roleList;
+
+}
diff --git a/pjcloud-app-server/pjcloud-app-server-api/src/main/resources/META-INF/spring/org.springframework.cloud.openfeign.FeignClient.imports b/pjcloud-app-server/pjcloud-app-server-api/src/main/resources/META-INF/spring/org.springframework.cloud.openfeign.FeignClient.imports
new file mode 100644
index 00000000..2c1b7d42
--- /dev/null
+++ b/pjcloud-app-server/pjcloud-app-server-api/src/main/resources/META-INF/spring/org.springframework.cloud.openfeign.FeignClient.imports
@@ -0,0 +1 @@
+com.bsd.pjcloud.app.api.feign.RemoteAppUserService
diff --git a/pjcloud-app-server/pjcloud-app-server-biz/Dockerfile b/pjcloud-app-server/pjcloud-app-server-biz/Dockerfile
new file mode 100644
index 00000000..151fd4a2
--- /dev/null
+++ b/pjcloud-app-server/pjcloud-app-server-biz/Dockerfile
@@ -0,0 +1,19 @@
+FROM registry.cn-hangzhou.aliyuncs.com/dockerhub_mirror/java:21-anolis
+
+MAINTAINER wangiegie@gmail.com
+
+ENV TZ=Asia/Shanghai
+ENV LANG C.UTF-8
+ENV JAVA_OPTS="-Xms512m -Xmx1024m -Djava.security.egd=file:/dev/./urandom"
+
+RUN ln -sf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
+
+RUN mkdir -p /pjcloud-app-server
+
+WORKDIR /pjcloud-app-server
+
+EXPOSE 7060
+
+ADD ./target/pjcloud-app-server-biz.jar ./
+
+CMD sleep 60;java $JAVA_OPTS -jar pjcloud-app-server-biz.jar
diff --git a/pjcloud-app-server/pjcloud-app-server-biz/pom.xml b/pjcloud-app-server/pjcloud-app-server-biz/pom.xml
new file mode 100644
index 00000000..e3f7e096
--- /dev/null
+++ b/pjcloud-app-server/pjcloud-app-server-biz/pom.xml
@@ -0,0 +1,130 @@
+
+
+ 4.0.0
+
+ com.bsd
+ pjcloud-app-server
+ 5.7.0
+
+
+ pjcloud-app-server-biz
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-undertow
+
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+
+ com.alibaba.cloud
+ spring-cloud-starter-alibaba-nacos-discovery
+
+
+
+ com.alibaba.cloud
+ spring-cloud-starter-alibaba-nacos-config
+
+
+
+ com.bsd
+ pjcloud-common-data
+
+
+
+ com.bsd
+ pjcloud-common-security
+
+
+
+ com.bsd
+ pjcloud-common-xss
+
+
+
+ com.bsd
+ pjcloud-common-sentinel
+
+
+
+ com.bsd
+ pjcloud-common-feign
+
+
+
+ com.bsd
+ pjcloud-app-server-api
+ 5.7.0
+
+
+
+ com.bsd
+ pjcloud-common-log
+
+
+
+ com.baomidou
+ mybatis-plus-spring-boot3-starter
+
+
+
+ com.alibaba
+ druid-spring-boot-3-starter
+
+
+
+ com.mysql
+ mysql-connector-j
+
+
+
+ com.bsd
+ pjcloud-common-swagger
+
+
+
+
+
+ cloud
+
+ true
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+ repackage
+
+
+ CLASSIC
+
+
+
+
+
+ io.fabric8
+ docker-maven-plugin
+
+ false
+
+
+
+
+
+
+ boot
+
+
+
diff --git a/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/PjcloudAppApplication.java b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/PjcloudAppApplication.java
new file mode 100644
index 00000000..70aa6b7b
--- /dev/null
+++ b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/PjcloudAppApplication.java
@@ -0,0 +1,26 @@
+package com.bsd.pjcloud.app;
+
+import com.bsd.pjcloud.common.feign.annotation.EnablePjcloudFeignClients;
+import com.bsd.pjcloud.common.security.annotation.EnablePjcloudResourceServer;
+import com.bsd.pjcloud.common.swagger.annotation.EnableOpenApi;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
+
+/**
+ * @author pjcloud archetype
+ *
+ * 项目启动类
+ */
+@EnableOpenApi("app")
+@EnablePjcloudFeignClients
+@EnableDiscoveryClient
+@EnablePjcloudResourceServer
+@SpringBootApplication
+public class PjcloudAppApplication {
+
+ public static void main(String[] args) {
+ SpringApplication.run(PjcloudAppApplication.class, args);
+ }
+
+}
diff --git a/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/controller/AppArticleCategoryController.java b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/controller/AppArticleCategoryController.java
new file mode 100644
index 00000000..a64cfddc
--- /dev/null
+++ b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/controller/AppArticleCategoryController.java
@@ -0,0 +1,131 @@
+package com.bsd.pjcloud.app.controller;
+
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.bsd.pjcloud.app.api.entity.AppArticleCategoryEntity;
+import com.bsd.pjcloud.app.service.AppArticleCategoryService;
+import com.bsd.pjcloud.common.core.util.R;
+import com.bsd.pjcloud.common.excel.annotation.ResponseExcel;
+import com.bsd.pjcloud.common.log.annotation.SysLog;
+import com.bsd.pjcloud.common.security.annotation.HasPermission;
+import com.bsd.pjcloud.common.security.annotation.Inner;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.security.SecurityRequirement;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.RequiredArgsConstructor;
+import org.springdoc.core.annotations.ParameterObject;
+import org.springframework.http.HttpHeaders;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * 文章分类表
+ *
+ * @author pig
+ * @date 2023-06-07 16:28:03
+ */
+@RestController
+@RequiredArgsConstructor
+@RequestMapping("/appArticleCategory")
+@Tag(description = "appArticleCategory", name = "文章分类表管理")
+@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
+public class AppArticleCategoryController {
+
+ private final AppArticleCategoryService appArticleCategoryService;
+
+ /**
+ * 分页查询
+ * @param page 分页对象
+ * @param appArticleCategory 文章分类表
+ * @return
+ */
+ @Operation(summary = "分页查询", description = "分页查询")
+ @GetMapping("/page")
+ @HasPermission("app_appArticleCategory_view")
+ public R getAppArticleCategoryPage(@ParameterObject Page page,
+ @ParameterObject AppArticleCategoryEntity appArticleCategory) {
+ LambdaQueryWrapper wrapper = Wrappers.lambdaQuery();
+ wrapper.like(StrUtil.isNotBlank(appArticleCategory.getName()), AppArticleCategoryEntity::getName,
+ appArticleCategory.getName());
+ return R.ok(appArticleCategoryService.page(page, wrapper));
+ }
+
+ /**
+ * 通过id查询文章分类表
+ * @param id id
+ * @return R
+ */
+ @Operation(summary = "通过id查询", description = "通过id查询")
+ @GetMapping("/{id}")
+ @HasPermission("app_appArticleCategory_view")
+ public R getById(@PathVariable("id") Long id) {
+ return R.ok(appArticleCategoryService.getById(id));
+ }
+
+ /**
+ * 通过查询文章分类
+ * @return R
+ */
+ @Operation(summary = "查询文章分类", description = "查询文章分类")
+ @Inner(value = false)
+ @GetMapping("/list")
+ public R list() {
+ return R.ok(appArticleCategoryService.list());
+ }
+
+ /**
+ * 新增文章分类表
+ * @param appArticleCategory 文章分类表
+ * @return R
+ */
+ @Operation(summary = "新增文章分类表", description = "新增文章分类表")
+ @SysLog("新增文章分类表")
+ @PostMapping
+ @HasPermission("app_appArticleCategory_add")
+ public R save(@RequestBody AppArticleCategoryEntity appArticleCategory) {
+ return R.ok(appArticleCategoryService.save(appArticleCategory));
+ }
+
+ /**
+ * 修改文章分类表
+ * @param appArticleCategory 文章分类表
+ * @return R
+ */
+ @Operation(summary = "修改文章分类表", description = "修改文章分类表")
+ @SysLog("修改文章分类表")
+ @PutMapping
+ @HasPermission("app_appArticleCategory_edit")
+ public R updateById(@RequestBody AppArticleCategoryEntity appArticleCategory) {
+ return R.ok(appArticleCategoryService.updateById(appArticleCategory));
+ }
+
+ /**
+ * 通过id删除文章分类表
+ * @param ids id列表
+ * @return R
+ */
+ @Operation(summary = "通过id删除文章分类表", description = "通过id删除文章分类表")
+ @SysLog("通过id删除文章分类表")
+ @DeleteMapping
+ @HasPermission("app_appArticleCategory_del")
+ public R removeById(@RequestBody Long[] ids) {
+ return R.ok(appArticleCategoryService.removeBatchByIds(CollUtil.toList(ids)));
+ }
+
+ /**
+ * 导出excel 表格
+ * @param appArticleCategory 查询条件
+ * @return excel 文件流
+ */
+ @ResponseExcel
+ @GetMapping("/export")
+ @HasPermission("app_appArticleCategory_export")
+ public List export(AppArticleCategoryEntity appArticleCategory) {
+ return appArticleCategoryService.list(Wrappers.query(appArticleCategory));
+ }
+
+}
diff --git a/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/controller/AppArticleCollectController.java b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/controller/AppArticleCollectController.java
new file mode 100644
index 00000000..91a97eb0
--- /dev/null
+++ b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/controller/AppArticleCollectController.java
@@ -0,0 +1,126 @@
+package com.bsd.pjcloud.app.controller;
+
+import cn.hutool.core.collection.CollUtil;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.github.yulichang.wrapper.MPJLambdaWrapper;
+import com.bsd.pjcloud.app.api.entity.AppArticleCollectEntity;
+import com.bsd.pjcloud.app.api.entity.AppArticleEntity;
+import com.bsd.pjcloud.app.service.AppArticleCollectService;
+import com.bsd.pjcloud.common.core.util.R;
+import com.bsd.pjcloud.common.excel.annotation.ResponseExcel;
+import com.bsd.pjcloud.common.log.annotation.SysLog;
+import com.bsd.pjcloud.common.security.annotation.HasPermission;
+import com.bsd.pjcloud.common.security.util.SecurityUtils;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.security.SecurityRequirement;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.RequiredArgsConstructor;
+import org.springdoc.core.annotations.ParameterObject;
+import org.springframework.http.HttpHeaders;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * 文章收藏表
+ *
+ * @author pig
+ * @date 2023-06-16 14:33:41
+ */
+@RestController
+@RequiredArgsConstructor
+@RequestMapping("/collect")
+@Tag(description = "collect", name = "文章收藏表管理")
+@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
+public class AppArticleCollectController {
+
+ private final AppArticleCollectService appArticleCollectService;
+
+ /**
+ * 分页查询
+ * @param page 分页对象
+ * @param appArticleCollect 文章收藏表
+ * @return
+ */
+ @Operation(summary = "分页查询", description = "分页查询")
+ @GetMapping("/page")
+ public R getAppArticleCollectPage(@ParameterObject Page page) {
+ MPJLambdaWrapper wrapper = new MPJLambdaWrapper()
+ .selectAll(AppArticleCollectEntity.class)
+ .select(AppArticleEntity::getTitle)
+ .leftJoin(AppArticleEntity.class, AppArticleEntity::getId, AppArticleCollectEntity::getArticleId)
+ .eq(AppArticleCollectEntity::getUserId, SecurityUtils.getUser().getId());
+ return R.ok(appArticleCollectService.selectJoinListPage(page, AppArticleCollectEntity.class, wrapper));
+ }
+
+ /**
+ * 通过id查询文章收藏表
+ * @param id id
+ * @return R
+ */
+ @Operation(summary = "通过id查询", description = "通过id查询")
+ @GetMapping("/{id}")
+ public R getById(@PathVariable("id") Long id) {
+ return R.ok(appArticleCollectService.getById(id));
+ }
+
+ /**
+ * 新增文章收藏表
+ * @param appArticleCollect 文章收藏表
+ * @return R
+ */
+ @Operation(summary = "新增文章收藏表", description = "新增文章收藏表")
+ @SysLog("新增文章收藏表")
+ @PostMapping
+ public R save(@RequestBody AppArticleCollectEntity appArticleCollect) {
+ return R.ok(appArticleCollectService.saveArticleCollect(appArticleCollect));
+ }
+
+ /**
+ * 修改文章收藏表
+ * @param appArticleCollect 文章收藏表
+ * @return R
+ */
+ @Operation(summary = "修改文章收藏表", description = "修改文章收藏表")
+ @SysLog("修改文章收藏表")
+ @PutMapping
+ public R updateById(@RequestBody AppArticleCollectEntity appArticleCollect) {
+ return R.ok(appArticleCollectService.updateById(appArticleCollect));
+ }
+
+ /**
+ * 通过id删除文章收藏表
+ * @param ids id列表
+ * @return R
+ */
+ @Operation(summary = "通过id删除文章收藏表", description = "通过id删除文章收藏表")
+ @SysLog("通过id删除文章收藏表")
+ @DeleteMapping
+ public R removeById(@RequestBody Long[] ids) {
+ return R.ok(appArticleCollectService.removeBatchByIds(CollUtil.toList(ids)));
+ }
+
+ @Operation(summary = "通过文章id删除文章收藏表", description = "通过文章id删除文章收藏表")
+ @SysLog("通过文章id删除文章收藏表")
+ @DeleteMapping("/{articleId}")
+ public R removeByArticleId(@PathVariable String articleId) {
+ Long id = SecurityUtils.getUser().getId();
+ return R.ok(appArticleCollectService.remove(Wrappers.lambdaQuery()
+ .eq(AppArticleCollectEntity::getUserId, id)
+ .eq(AppArticleCollectEntity::getArticleId, articleId)));
+ }
+
+ /**
+ * 导出excel 表格
+ * @param appArticleCollect 查询条件
+ * @return excel 文件流
+ */
+ @ResponseExcel
+ @GetMapping("/export")
+ @HasPermission("app_collect_export")
+ public List export(AppArticleCollectEntity appArticleCollect) {
+ return appArticleCollectService.list(Wrappers.query(appArticleCollect));
+ }
+
+}
diff --git a/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/controller/AppArticleController.java b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/controller/AppArticleController.java
new file mode 100644
index 00000000..0c1b1e1a
--- /dev/null
+++ b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/controller/AppArticleController.java
@@ -0,0 +1,114 @@
+package com.bsd.pjcloud.app.controller;
+
+import cn.hutool.core.collection.CollUtil;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.bsd.pjcloud.app.api.entity.AppArticleEntity;
+import com.bsd.pjcloud.app.service.AppArticleService;
+import com.bsd.pjcloud.common.core.util.R;
+import com.bsd.pjcloud.common.excel.annotation.ResponseExcel;
+import com.bsd.pjcloud.common.log.annotation.SysLog;
+import com.bsd.pjcloud.common.security.annotation.HasPermission;
+import com.bsd.pjcloud.common.security.annotation.Inner;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.security.SecurityRequirement;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.RequiredArgsConstructor;
+import org.springdoc.core.annotations.ParameterObject;
+import org.springframework.http.HttpHeaders;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * 文章资讯
+ *
+ * @author pig
+ * @date 2023-06-07 16:32:35
+ */
+@RestController
+@RequiredArgsConstructor
+@RequestMapping("/appArticle")
+@Tag(description = "appArticle", name = "文章资讯管理")
+@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
+public class AppArticleController {
+
+ private final AppArticleService appArticleService;
+
+ /**
+ * 分页查询
+ * @param page 分页对象
+ * @param appArticle 文章资讯
+ * @return
+ */
+ @Operation(summary = "分页查询", description = "分页查询")
+ @Inner(value = false)
+ @GetMapping("/page")
+ public R getAppArticlePage(@ParameterObject Page page, @ParameterObject AppArticleEntity appArticle) {
+ return R.ok(appArticleService.pageAndCname(page, appArticle));
+ }
+
+ /**
+ * 通过id查询文章资讯
+ * @param id id
+ * @return R
+ */
+ @Inner(value = false)
+ @Operation(summary = "通过id查询", description = "通过id查询")
+ @GetMapping("/details/{id}/{userId}")
+ public R getById(@PathVariable("id") Long id, @PathVariable(required = false) Long userId) {
+ return R.ok(appArticleService.getArticleAndIncrById(id, userId));
+ }
+
+ /**
+ * 新增文章资讯
+ * @param appArticle 文章资讯
+ * @return R
+ */
+ @Operation(summary = "新增文章资讯", description = "新增文章资讯")
+ @SysLog("新增文章资讯")
+ @PostMapping
+ @HasPermission("app_appArticle_add")
+ public R save(@RequestBody AppArticleEntity appArticle) {
+ return R.ok(appArticleService.save(appArticle));
+ }
+
+ /**
+ * 修改文章资讯
+ * @param appArticle 文章资讯
+ * @return R
+ */
+ @Operation(summary = "修改文章资讯", description = "修改文章资讯")
+ @SysLog("修改文章资讯")
+ @PutMapping
+ @HasPermission("app_appArticle_edit")
+ public R updateById(@RequestBody AppArticleEntity appArticle) {
+ return R.ok(appArticleService.updateById(appArticle));
+ }
+
+ /**
+ * 通过id删除文章资讯
+ * @param ids id列表
+ * @return R
+ */
+ @Operation(summary = "通过id删除文章资讯", description = "通过id删除文章资讯")
+ @SysLog("通过id删除文章资讯")
+ @DeleteMapping
+ @HasPermission("app_appArticle_del")
+ public R removeById(@RequestBody Long[] ids) {
+ return R.ok(appArticleService.removeBatchByIds(CollUtil.toList(ids)));
+ }
+
+ /**
+ * 导出excel 表格
+ * @param appArticle 查询条件
+ * @return excel 文件流
+ */
+ @ResponseExcel
+ @GetMapping("/export")
+ @HasPermission("app_appArticle_export")
+ public List export(AppArticleEntity appArticle) {
+ return appArticleService.list(Wrappers.query(appArticle));
+ }
+
+}
diff --git a/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/controller/AppIndexController.java b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/controller/AppIndexController.java
new file mode 100644
index 00000000..407b77c2
--- /dev/null
+++ b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/controller/AppIndexController.java
@@ -0,0 +1,59 @@
+package com.bsd.pjcloud.app.controller;
+
+import com.bsd.pjcloud.app.api.entity.AppPageEntity;
+import com.bsd.pjcloud.app.service.AppIndexService;
+import com.bsd.pjcloud.common.core.util.R;
+import com.bsd.pjcloud.common.security.annotation.Inner;
+import io.swagger.v3.oas.annotations.security.SecurityRequirement;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.RequiredArgsConstructor;
+import org.springframework.http.HttpHeaders;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.Map;
+
+/**
+ * app 首页控制
+ *
+ * @author pjcloud
+ * @date 2023/6/8
+ */
+@RestController
+@RequiredArgsConstructor
+@RequestMapping("/index")
+@Tag(description = "App 页面控制", name = "app index")
+@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
+public class AppIndexController {
+
+ private final AppIndexService indexService;
+
+ /**
+ * 首页
+ * @return Object
+ */
+ @Inner(value = false)
+ @GetMapping("/index")
+ public R index() {
+ Map detail = indexService.index();
+ return R.ok(detail);
+ }
+
+ @Inner(value = false)
+ @GetMapping("/config")
+ public R config() {
+ Map map = indexService.config();
+ return R.ok(map);
+ }
+
+ @Inner(value = false)
+ @GetMapping("/decorate")
+ public R decorate(@Validated @RequestParam("id") Integer id) {
+ AppPageEntity detail = indexService.decorate(id);
+ return R.ok(detail);
+ }
+
+}
diff --git a/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/controller/AppMobileController.java b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/controller/AppMobileController.java
new file mode 100644
index 00000000..c89f8759
--- /dev/null
+++ b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/controller/AppMobileController.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2018-2025, pjcloud All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the pig4cloud.com developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: pjcloud
+ */
+
+package com.bsd.pjcloud.app.controller;
+
+import com.bsd.pjcloud.app.service.AppMobileService;
+import com.bsd.pjcloud.common.core.util.R;
+import com.bsd.pjcloud.common.security.annotation.Inner;
+import io.swagger.v3.oas.annotations.security.SecurityRequirement;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.AllArgsConstructor;
+import org.springframework.http.HttpHeaders;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * @author pjcloud
+ * @date 2018/11/14
+ *
+ * 手机验证码
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("/appmobile")
+@Tag(description = "mobile", name = "手机管理模块")
+@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
+public class AppMobileController {
+
+ private final AppMobileService appMobileService;
+
+ @Inner(value = false)
+ @GetMapping("/{mobile}")
+ public R sendSmsCode(@PathVariable String mobile) {
+ return appMobileService.sendSmsCode(mobile);
+ }
+
+}
diff --git a/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/controller/AppPageController.java b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/controller/AppPageController.java
new file mode 100644
index 00000000..c39e9933
--- /dev/null
+++ b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/controller/AppPageController.java
@@ -0,0 +1,54 @@
+package com.bsd.pjcloud.app.controller;
+
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.bsd.pjcloud.app.api.entity.AppPageEntity;
+import com.bsd.pjcloud.app.service.AppPageService;
+import com.bsd.pjcloud.common.core.util.R;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.security.SecurityRequirement;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.RequiredArgsConstructor;
+import org.springframework.http.HttpHeaders;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * 页面管理
+ *
+ * @author pig
+ * @date 2023-06-07 16:32:35
+ */
+@RestController
+@RequiredArgsConstructor
+@RequestMapping("/appPage")
+@Tag(description = "appPage", name = "页面管理")
+@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
+public class AppPageController {
+
+ private final AppPageService pageService;
+
+ /**
+ * 查询文章资讯
+ *
+ * @param pageType pageType
+ * @return R
+ */
+ @Operation(summary = "通过页面类型查询", description = "通过页面类型查询")
+ @GetMapping("/{pageType}")
+ public R getByPageType(@PathVariable("pageType") Long pageType) {
+ AppPageEntity appPage = pageService.getOne(Wrappers.lambdaQuery().eq(AppPageEntity::getPageType, pageType));
+ return R.ok(appPage);
+ }
+
+ /**
+ * 更新
+ *
+ * @param page 页面
+ * @return {@link R }
+ */
+ @Operation(summary = "更新页面", description = "更新页面")
+ @PutMapping
+ public R update(@RequestBody AppPageEntity page) {
+ return R.ok(pageService.saveOrUpdate(page));
+ }
+
+}
diff --git a/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/controller/AppRoleController.java b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/controller/AppRoleController.java
new file mode 100644
index 00000000..85b22096
--- /dev/null
+++ b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/controller/AppRoleController.java
@@ -0,0 +1,175 @@
+/*
+ * Copyright (c) 2018-2025, pjcloud All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the pig4cloud.com developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: pjcloud
+ */
+
+package com.bsd.pjcloud.app.controller;
+
+import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.bsd.pjcloud.app.api.entity.AppRole;
+import com.bsd.pjcloud.app.api.vo.AppRoleExcelVO;
+import com.bsd.pjcloud.app.service.AppRoleService;
+import com.bsd.pjcloud.common.core.util.R;
+import com.bsd.pjcloud.common.excel.annotation.RequestExcel;
+import com.bsd.pjcloud.common.excel.annotation.ResponseExcel;
+import com.bsd.pjcloud.common.log.annotation.SysLog;
+import com.bsd.pjcloud.common.security.annotation.HasPermission;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.security.SecurityRequirement;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.RequiredArgsConstructor;
+import org.springframework.http.HttpHeaders;
+import org.springframework.validation.BindingResult;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * app角色表
+ *
+ * @author aeizzz
+ * @date 2022-12-07 09:52:03
+ */
+@RestController
+@RequiredArgsConstructor
+@RequestMapping("/approle")
+@Tag(description = "approle", name = "app角色表管理")
+@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
+public class AppRoleController {
+
+ private final AppRoleService appRoleService;
+
+ /**
+ * 分页查询
+ * @param page 分页对象
+ * @param appRole app角色表
+ * @return
+ */
+ @Operation(summary = "分页查询", description = "分页查询")
+ @GetMapping("/page")
+ public R getAppRolePage(Page page, AppRole appRole) {
+ return R.ok(appRoleService.page(page, Wrappers.lambdaQuery()
+ .like(StrUtil.isNotBlank(appRole.getRoleName()), AppRole::getRoleName, appRole.getRoleName())));
+ }
+
+ /**
+ * 查询全部角色
+ * @return
+ */
+ @Operation(summary = "查询全部", description = "查询全部")
+ @GetMapping("/list")
+ public R list() {
+ return R.ok(appRoleService.list(Wrappers.emptyWrapper()));
+ }
+
+ /**
+ * 通过id查询app角色表
+ * @param roleId id
+ * @return R
+ */
+ @Operation(summary = "通过id查询", description = "通过id查询")
+ @GetMapping("/{roleId}")
+ public R getById(@PathVariable("roleId") Long roleId) {
+ return R.ok(appRoleService.getById(roleId));
+ }
+
+ /**
+ * 通过roleName查询app角色表
+ * @param roleName roleName
+ * @return R
+ */
+ @Operation(summary = "通过id查询", description = "通过id查询")
+ @GetMapping("/details/{roleName}")
+ public R getByUserName(@PathVariable("roleName") String roleName) {
+ return R.ok(appRoleService.getOne(Wrappers.lambdaQuery().eq(AppRole::getRoleName, roleName)));
+ }
+
+ /**
+ * 通过roleCode查询app角色表
+ * @param roleCode roleCode
+ * @return R
+ */
+ @Operation(summary = "通过roleCode查询", description = "通过roleCode查询")
+ @GetMapping("/detailsByCode/{roleCode}")
+ public R getByPhone(@PathVariable("roleCode") String roleCode) {
+ return R.ok(appRoleService.getOne(Wrappers.lambdaQuery().eq(AppRole::getRoleCode, roleCode)));
+ }
+
+ /**
+ * 新增app角色表
+ * @param appRole app角色表
+ * @return R
+ */
+ @Operation(summary = "新增app角色表", description = "新增app角色表")
+ @SysLog("新增app角色表")
+ @PostMapping
+ @HasPermission("app_approle_add")
+ public R save(@RequestBody AppRole appRole) {
+ return R.ok(appRoleService.save(appRole));
+ }
+
+ /**
+ * 修改app角色表
+ * @param appRole app角色表
+ * @return R
+ */
+ @Operation(summary = "修改app角色表", description = "修改app角色表")
+ @SysLog("修改app角色表")
+ @PutMapping
+ @HasPermission("app_approle_edit")
+ public R updateById(@RequestBody AppRole appRole) {
+ return R.ok(appRoleService.updateById(appRole));
+ }
+
+ /**
+ * 通过ids批量删除app角色表
+ * @param ids roleIds
+ * @return R
+ */
+ @Operation(summary = "通过ids批量删除app角色表", description = "通过ids批量删除app角色表")
+ @SysLog("通过ids批量删除app角色表")
+ @DeleteMapping
+ @HasPermission("app_approle_del")
+ public R removeById(@RequestBody Long[] ids) {
+ return R.ok(appRoleService.deleteRoleByIds(ids));
+ }
+
+ /**
+ * 导出excel 表格
+ * @param appRole 查询条件
+ * @return excel 文件流
+ */
+ @ResponseExcel
+ @GetMapping("/export")
+ @HasPermission("app_approle_export")
+ public List export(AppRole appRole) {
+ return appRoleService.list(Wrappers.query(appRole));
+ }
+
+ /**
+ * 导入角色
+ * @param excelVOList 角色列表
+ * @param bindingResult 错误信息列表
+ * @return ok fail
+ */
+ @PostMapping("/import")
+ @HasPermission("app_approle_export")
+ public R importRole(@RequestExcel List excelVOList, BindingResult bindingResult) {
+ return appRoleService.importRole(excelVOList, bindingResult);
+ }
+
+}
diff --git a/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/controller/AppSocialDetailsController.java b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/controller/AppSocialDetailsController.java
new file mode 100644
index 00000000..7cdc7995
--- /dev/null
+++ b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/controller/AppSocialDetailsController.java
@@ -0,0 +1,139 @@
+/*
+ * Copyright (c) 2018-2025, pjcloud All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the pig4cloud.com developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: pjcloud
+ */
+
+package com.bsd.pjcloud.app.controller;
+
+import cn.hutool.core.collection.CollUtil;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.bsd.pjcloud.app.api.entity.AppSocialDetails;
+import com.bsd.pjcloud.app.service.AppSocialDetailsService;
+import com.bsd.pjcloud.common.core.util.R;
+import com.bsd.pjcloud.common.core.util.ValidGroup;
+import com.bsd.pjcloud.common.excel.annotation.ResponseExcel;
+import com.bsd.pjcloud.common.log.annotation.SysLog;
+import com.bsd.pjcloud.common.security.annotation.HasPermission;
+import com.bsd.pjcloud.common.security.annotation.Inner;
+import io.swagger.v3.oas.annotations.security.SecurityRequirement;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.validation.Valid;
+import lombok.AllArgsConstructor;
+import org.springframework.http.HttpHeaders;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+@RestController
+@RequestMapping("/appsocial")
+@AllArgsConstructor
+@Tag(description = "social", name = "三方账号管理模块")
+@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
+public class AppSocialDetailsController {
+
+ private final AppSocialDetailsService appSocialDetailsService;
+
+ /**
+ * 社交登录账户简单分页查询
+ * @param page 分页对象
+ * @param appSocialDetails 社交登录
+ * @return
+ */
+ @GetMapping("/page")
+ public R getSocialDetailsPage(Page page, AppSocialDetails appSocialDetails) {
+ return R.ok(appSocialDetailsService.page(page, Wrappers.query(appSocialDetails)));
+ }
+
+ /**
+ * 信息
+ * @param id id
+ * @return R
+ */
+ @GetMapping("/{id}")
+ public R getinfo(@PathVariable("id") Long id) {
+ return R.ok(appSocialDetailsService.getById(id));
+ }
+
+ /**
+ * 保存
+ * @param appSocialDetails
+ * @return R
+ */
+ @SysLog("保存三方信息")
+ @PostMapping
+ @HasPermission("app_social_details_add")
+ public R save(@Valid @RequestBody AppSocialDetails appSocialDetails) {
+ return R.ok(appSocialDetailsService.save(appSocialDetails));
+ }
+
+ /**
+ * 修改
+ * @param appSocialDetails
+ * @return R
+ */
+ @SysLog("修改三方信息")
+ @PutMapping
+ @HasPermission("app_social_details_edit")
+ public R updateById(@Validated({ ValidGroup.Update.class }) @RequestBody AppSocialDetails appSocialDetails) {
+ appSocialDetailsService.updateById(appSocialDetails);
+ return R.ok(Boolean.TRUE);
+ }
+
+ /**
+ * 删除
+ * @param ids
+ * @return R
+ */
+ @SysLog("删除三方信息")
+ @DeleteMapping
+ @HasPermission("app_social_details_del")
+ public R removeById(@RequestBody Long[] ids) {
+ return R.ok(appSocialDetailsService.removeBatchByIds(CollUtil.toList(ids)));
+ }
+
+ /**
+ * 通过社交账号、手机号查询用户、角色信息
+ * @param inStr appid@code
+ * @return
+ */
+ @Inner
+ @GetMapping("/info/{inStr}")
+ public R getUserInfo(@PathVariable String inStr) {
+ return R.ok(appSocialDetailsService.getUserInfo(inStr));
+ }
+
+ /**
+ * 绑定社交账号
+ * @param state 类型
+ * @param code code
+ * @return
+ */
+ @PostMapping("/bind")
+ public R bindSocial(String state, String code) {
+ return R.ok(appSocialDetailsService.bindSocial(state, code));
+ }
+
+ /**
+ * 导出
+ */
+ @GetMapping("/export")
+ @ResponseExcel
+ public List export(AppSocialDetails appSocialDetails) {
+ return appSocialDetailsService.list(Wrappers.query(appSocialDetails));
+ }
+
+}
diff --git a/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/controller/AppTabbarController.java b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/controller/AppTabbarController.java
new file mode 100644
index 00000000..7c4b6d39
--- /dev/null
+++ b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/controller/AppTabbarController.java
@@ -0,0 +1,61 @@
+package com.bsd.pjcloud.app.controller;
+
+import cn.hutool.core.collection.CollUtil;
+import com.bsd.pjcloud.app.api.entity.AppTabbarEntity;
+import com.bsd.pjcloud.app.service.AppTabbarService;
+import com.bsd.pjcloud.common.core.util.R;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.security.SecurityRequirement;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.RequiredArgsConstructor;
+import org.springframework.http.HttpHeaders;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * 底部导航
+ *
+ * @author pig
+ * @date 2023-06-07 16:32:35
+ */
+@RestController
+@RequiredArgsConstructor
+@RequestMapping("/appTabbar")
+@Tag(description = "appTabbar", name = "底部导航")
+@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
+public class AppTabbarController {
+
+ private final AppTabbarService tabbarService;
+
+ /**
+ * 查询导航列表
+ *
+ * @return R
+ */
+ @Operation(summary = "查询导航列表", description = "查询导航列表")
+ @GetMapping("/list")
+ public R list() {
+ return R.ok(tabbarService.list());
+ }
+
+ @Operation(summary = "更新导航", description = "更新导航")
+ @PutMapping
+ public R update(@RequestBody List tabbarEntityList) {
+ // 删除不在新增范围的导航菜单
+ List idList = tabbarService.list().stream().map(AppTabbarEntity::getId).collect(Collectors.toList());
+ List newIdList = tabbarEntityList.stream().map(AppTabbarEntity::getId).collect(Collectors.toList());
+
+ // 计算需要删除的 ID 列表
+ List idsToRemove = CollUtil.subtractToList(idList, newIdList);
+
+ // 如果有需要删除的菜单,则批量删除
+ if (CollUtil.isNotEmpty(idsToRemove)) {
+ tabbarService.removeBatchByIds(idsToRemove);
+ }
+
+ return R.ok(tabbarService.saveOrUpdateBatch(tabbarEntityList));
+ }
+
+}
diff --git a/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/controller/AppUserController.java b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/controller/AppUserController.java
new file mode 100644
index 00000000..265350f5
--- /dev/null
+++ b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/controller/AppUserController.java
@@ -0,0 +1,207 @@
+/*
+ * Copyright (c) 2018-2025, pjcloud All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the pig4cloud.com developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: pjcloud
+ */
+
+package com.bsd.pjcloud.app.controller;
+
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.bsd.pjcloud.app.api.dto.AppUserDTO;
+import com.bsd.pjcloud.app.api.entity.AppUser;
+import com.bsd.pjcloud.app.api.vo.AppUserExcelVO;
+import com.bsd.pjcloud.app.service.AppUserService;
+import com.bsd.pjcloud.common.core.constant.CommonConstants;
+import com.bsd.pjcloud.common.core.constant.enums.UserTypeEnum;
+import com.bsd.pjcloud.common.core.exception.ErrorCodes;
+import com.bsd.pjcloud.common.core.util.MsgUtils;
+import com.bsd.pjcloud.common.core.util.R;
+import com.bsd.pjcloud.common.excel.annotation.RequestExcel;
+import com.bsd.pjcloud.common.excel.annotation.ResponseExcel;
+import com.bsd.pjcloud.common.log.annotation.SysLog;
+import com.bsd.pjcloud.common.security.annotation.HasPermission;
+import com.bsd.pjcloud.common.security.annotation.Inner;
+import com.bsd.pjcloud.common.security.util.SecurityUtils;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.security.SecurityRequirement;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.validation.Valid;
+import lombok.RequiredArgsConstructor;
+import org.springframework.http.HttpHeaders;
+import org.springframework.validation.BindingResult;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * app用户表
+ *
+ * @author aeizzz
+ * @date 2022-12-07 09:52:03
+ */
+@RestController
+@RequiredArgsConstructor
+@RequestMapping("/appuser")
+@Tag(description = "appuser", name = "app用户表管理")
+@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
+public class AppUserController {
+
+ private final AppUserService appUserService;
+
+ @Inner
+ @GetMapping("/info/{username}")
+ public R info(@PathVariable String username) {
+ AppUser user = appUserService.getOne(Wrappers.query()
+ .lambda()
+ .eq(AppUser::getUsername, username)
+ .or()
+ .eq(AppUser::getPhone, username));
+ if (user == null) {
+ return R.failed(MsgUtils.getMessage(ErrorCodes.APP_USER_USERINFO_EMPTY, username));
+ }
+ return R.ok(appUserService.findUserInfo(user));
+ }
+
+ /**
+ * 获取当前用户全部信息
+ * @return 用户信息
+ */
+ @GetMapping(value = { "/info" })
+ public R info() {
+ String username = SecurityUtils.getUser().getUsername();
+ AppUser user = appUserService.getOne(Wrappers.query().lambda().eq(AppUser::getUsername, username));
+ if (user == null) {
+ return R.failed(MsgUtils.getMessage(ErrorCodes.SYS_USER_QUERY_ERROR));
+ }
+ return R.ok(appUserService.findUserInfo(user));
+ }
+
+ /**
+ * 分页查询
+ * @param page 分页对象
+ * @param appUserDTO app用户表
+ * @return
+ */
+ @Operation(summary = "分页查询", description = "分页查询")
+ @GetMapping("/page")
+ public R getAppUserPage(Page page, AppUserDTO appUserDTO) {
+ return R.ok(appUserService.getUsersWithRolePage(page, appUserDTO));
+ }
+
+ /**
+ * 通过id查询app用户表
+ * @param userId id
+ * @return R
+ */
+ @Operation(summary = "通过id查询", description = "通过id查询")
+ @GetMapping("/details/{userId}")
+ public R getById(@PathVariable("userId") Long userId) {
+ return R.ok(appUserService.selectUserVoById(userId));
+ }
+
+ /**
+ * @return R
+ */
+ @Operation(summary = "通过userName查询", description = "通过userName查询")
+ @GetMapping("/details")
+ public R getByUserName(AppUser user) {
+ AppUser one = appUserService.getOne(Wrappers.query(user), false);
+ return R.ok(one == null ? null : CommonConstants.SUCCESS);
+ }
+
+ /**
+ * 新增app用户表
+ * @param appUser app用户表
+ * @return R
+ */
+ @Operation(summary = "新增app用户表", description = "新增app用户表")
+ @SysLog("新增app用户表")
+ @PostMapping
+ @HasPermission("app_appuser_add")
+ public R save(@RequestBody AppUserDTO appUser) {
+ appUserService.saveUser(appUser);
+ return R.ok();
+ }
+
+ /**
+ * 修改app用户表
+ * @param appUser app用户表
+ * @return R
+ */
+ @Operation(summary = "修改app用户表", description = "修改app用户表")
+ @SysLog("修改app用户表")
+ @PutMapping
+ @HasPermission("app_appuser_edit")
+ public R updateById(@RequestBody AppUserDTO appUser) {
+ return R.ok(appUserService.updateUser(appUser));
+ }
+
+ /**
+ * 通过id删除app用户表
+ * @param ids userIds
+ * @return R
+ */
+ @Operation(summary = "通过ids删除app用户表", description = "通过ids删除app用户表")
+ @SysLog("通过id删除app用户表")
+ @DeleteMapping
+ @HasPermission("app_appuser_del")
+ public R removeById(@RequestBody Long[] ids) {
+ return R.ok(appUserService.deleteAppUserByIds(ids));
+ }
+
+ /**
+ * 导出excel 表格
+ * @param appUser 查询条件
+ * @return excel 文件流
+ */
+ @ResponseExcel
+ @GetMapping("/export")
+ @HasPermission("app_appuser_export")
+ public List export(AppUserDTO appUser) {
+ return appUserService.listUser(appUser);
+ }
+
+ @SysLog("修改个人信息")
+ @PutMapping("/edit")
+ public R updateUserInfo(@Valid @RequestBody AppUserDTO userDto) {
+ if (UserTypeEnum.TOC.getStatus().equals(SecurityUtils.getUser().getUserType())) {
+ userDto.setUserId(SecurityUtils.getUser().getId());
+ // TOC 以手机号为key
+ userDto.setUsername(SecurityUtils.getUser().getUsername());
+ }
+ return appUserService.updateUserInfo(userDto);
+ }
+
+ /**
+ * 导入用户
+ * @param excelVOList 用户列表
+ * @param bindingResult 错误信息列表
+ * @return R
+ */
+ @PostMapping("/import")
+ @HasPermission("app_appuser_export")
+ public R importUser(@RequestExcel List excelVOList, BindingResult bindingResult) {
+ return appUserService.importUser(excelVOList, bindingResult);
+ }
+
+ @Operation(summary = "注册app用户表", description = "注册app用户表")
+ @SysLog("注册app用户表")
+ @Inner(value = false)
+ @PostMapping("/register")
+ public R register(@RequestBody AppUserDTO appUser) {
+ return appUserService.registerAppUser(appUser);
+ }
+
+}
diff --git a/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/controller/AppUserRoleController.java b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/controller/AppUserRoleController.java
new file mode 100644
index 00000000..de2bcb61
--- /dev/null
+++ b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/controller/AppUserRoleController.java
@@ -0,0 +1,128 @@
+/*
+ * Copyright (c) 2018-2025, pjcloud All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the pig4cloud.com developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: pjcloud
+ */
+
+package com.bsd.pjcloud.app.controller;
+
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.bsd.pjcloud.app.api.entity.AppUserRole;
+import com.bsd.pjcloud.app.service.AppUserRoleService;
+import com.bsd.pjcloud.common.core.util.R;
+import com.bsd.pjcloud.common.excel.annotation.ResponseExcel;
+import com.bsd.pjcloud.common.log.annotation.SysLog;
+import com.bsd.pjcloud.common.security.annotation.HasPermission;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.security.SecurityRequirement;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.RequiredArgsConstructor;
+import org.springframework.http.HttpHeaders;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * 用户角色表
+ *
+ * @author aeizzz
+ * @date 2022-12-07 09:52:03
+ */
+@RestController
+@RequiredArgsConstructor
+@RequestMapping("/appuserrole")
+@Tag(description = "appuserrole", name = "用户角色表管理")
+@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
+public class AppUserRoleController {
+
+ private final AppUserRoleService appUserRoleService;
+
+ /**
+ * 分页查询
+ * @param page 分页对象
+ * @param appUserRole 用户角色表
+ * @return
+ */
+ @Operation(summary = "分页查询", description = "分页查询")
+ @GetMapping("/page")
+ @HasPermission("app_appuserrole_view")
+ public R getAppUserRolePage(Page page, AppUserRole appUserRole) {
+ return R.ok(appUserRoleService.page(page, Wrappers.query(appUserRole)));
+ }
+
+ /**
+ * 通过id查询用户角色表
+ * @param userId id
+ * @return R
+ */
+ @Operation(summary = "通过id查询", description = "通过id查询")
+ @GetMapping("/{userId}")
+ @HasPermission("app_appuserrole_view")
+ public R getById(@PathVariable("userId") Long userId) {
+ return R.ok(appUserRoleService.getById(userId));
+ }
+
+ /**
+ * 新增用户角色表
+ * @param appUserRole 用户角色表
+ * @return R
+ */
+ @Operation(summary = "新增用户角色表", description = "新增用户角色表")
+ @SysLog("新增用户角色表")
+ @PostMapping
+ @HasPermission("app_appuserrole_add")
+ public R save(@RequestBody AppUserRole appUserRole) {
+ return R.ok(appUserRoleService.save(appUserRole));
+ }
+
+ /**
+ * 修改用户角色表
+ * @param appUserRole 用户角色表
+ * @return R
+ */
+ @Operation(summary = "修改用户角色表", description = "修改用户角色表")
+ @SysLog("修改用户角色表")
+ @PutMapping
+ @HasPermission("app_appuserrole_edit")
+ public R updateById(@RequestBody AppUserRole appUserRole) {
+ return R.ok(appUserRoleService.updateById(appUserRole));
+ }
+
+ /**
+ * 通过id删除用户角色表
+ * @param userId id
+ * @return R
+ */
+ @Operation(summary = "通过id删除用户角色表", description = "通过id删除用户角色表")
+ @SysLog("通过id删除用户角色表")
+ @DeleteMapping("/{userId}")
+ @HasPermission("app_appuserrole_del")
+ public R removeById(@PathVariable Long userId) {
+ return R.ok(appUserRoleService.removeById(userId));
+ }
+
+ /**
+ * 导出excel 表格
+ * @param appUserRole 查询条件
+ * @return excel 文件流
+ */
+ @ResponseExcel
+ @GetMapping("/export")
+ @HasPermission("app_appuserrole_export")
+ public List export(AppUserRole appUserRole) {
+ return appUserRoleService.list(Wrappers.query(appUserRole));
+ }
+
+}
diff --git a/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/handler/AbstractLoginHandler.java b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/handler/AbstractLoginHandler.java
new file mode 100644
index 00000000..26c7dc3c
--- /dev/null
+++ b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/handler/AbstractLoginHandler.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2018-2025, pjcloud All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the pig4cloud.com developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: pjcloud
+ */
+
+package com.bsd.pjcloud.app.handler;
+
+import com.bsd.pjcloud.app.api.dto.AppUserInfo;
+
+/**
+ * @author pjcloud
+ * @date 2018/11/18
+ */
+public abstract class AbstractLoginHandler implements LoginHandler {
+
+ /***
+ * 数据合法性校验
+ * @param loginStr 通过用户传入获取唯一标识
+ * @return 默认不校验
+ */
+ @Override
+ public Boolean check(String loginStr) {
+ return true;
+ }
+
+ /**
+ * 处理方法
+ * @param loginStr 登录参数
+ * @return
+ */
+ @Override
+ public AppUserInfo handle(String loginStr) {
+ if (!check(loginStr)) {
+ return null;
+ }
+
+ String identify = identify(loginStr);
+ return info(identify);
+ }
+
+}
diff --git a/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/handler/LoginHandler.java b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/handler/LoginHandler.java
new file mode 100644
index 00000000..f46a9948
--- /dev/null
+++ b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/handler/LoginHandler.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2018-2025, pjcloud All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the pig4cloud.com developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: pjcloud
+ */
+
+package com.bsd.pjcloud.app.handler;
+
+import com.bsd.pjcloud.app.api.dto.AppUserInfo;
+import com.bsd.pjcloud.app.api.entity.AppUser;
+
+/**
+ * @author pjcloud
+ * @date 2018/11/18
+ *
+ * 登录处理器
+ */
+public interface LoginHandler {
+
+ /***
+ * 数据合法性校验
+ * @param loginStr 通过用户传入获取唯一标识
+ * @return
+ */
+ Boolean check(String loginStr);
+
+ /**
+ * 通过用户传入获取唯一标识
+ * @param loginStr
+ * @return
+ */
+ String identify(String loginStr);
+
+ /**
+ * 通过openId 获取用户信息
+ * @param identify
+ * @return
+ */
+ AppUserInfo info(String identify);
+
+ /**
+ * 处理方法
+ * @param loginStr 登录参数
+ * @return
+ */
+ AppUserInfo handle(String loginStr);
+
+ /**
+ * 绑定逻辑
+ * @param user 用户实体
+ * @param identify 渠道返回唯一标识
+ * @return
+ */
+ default Boolean bind(AppUser user, String identify) {
+ return false;
+ }
+
+}
diff --git a/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/handler/MiniAppLoginHandler.java b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/handler/MiniAppLoginHandler.java
new file mode 100644
index 00000000..e3e7c242
--- /dev/null
+++ b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/handler/MiniAppLoginHandler.java
@@ -0,0 +1,122 @@
+/*
+ * Copyright (c) 2018-2025, pjcloud All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the pig4cloud.com developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: pjcloud
+ */
+
+package com.bsd.pjcloud.app.handler;
+
+import cn.hutool.http.HttpUtil;
+import cn.hutool.json.JSONUtil;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.bsd.pjcloud.app.api.dto.AppUserInfo;
+import com.bsd.pjcloud.app.api.entity.AppSocialDetails;
+import com.bsd.pjcloud.app.api.entity.AppUser;
+import com.bsd.pjcloud.app.mapper.AppSocialDetailsMapper;
+import com.bsd.pjcloud.app.service.AppUserService;
+import com.bsd.pjcloud.common.core.constant.SecurityConstants;
+import com.bsd.pjcloud.common.core.constant.enums.LoginTypeEnum;
+import com.bsd.pjcloud.common.core.exception.CheckedException;
+import lombok.AllArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Component;
+
+import java.util.Objects;
+
+/**
+ * @author pjcloud
+ * @date 2019年11月02日
+ *
+ * 微信小程序
+ */
+@Slf4j
+@Component("APP-MINI")
+@AllArgsConstructor
+public class MiniAppLoginHandler extends AbstractLoginHandler {
+
+ private final AppUserService appUserService;
+
+ private final AppSocialDetailsMapper appSocialDetailsMapper;
+
+ /**
+ * 小程序登录传入code
+ *
+ * 通过code 调用qq 获取唯一标识
+ *
+ * @param code
+ * @return
+ */
+ @Override
+ public String identify(String code) {
+ AppSocialDetails condition = new AppSocialDetails();
+ condition.setType(LoginTypeEnum.MINI_APP.getType());
+ AppSocialDetails socialDetails = appSocialDetailsMapper.selectOne(new QueryWrapper<>(condition));
+
+ String url = String.format(SecurityConstants.MINI_APP_AUTHORIZATION_CODE_URL, socialDetails.getAppId(),
+ socialDetails.getAppSecret(), code);
+ String result = HttpUtil.get(url);
+ log.debug("微信小程序响应报文:{}", result);
+
+ if (JSONUtil.parseObj(result).containsKey("openid")) {
+ return JSONUtil.parseObj(result).get("openid").toString();
+ } else {
+ log.error("微信小程序登录失败:{}", result);
+ throw new CheckedException("微信小程序登录失败");
+ }
+ }
+
+ /**
+ * openId 获取用户信息
+ *
+ * @param openId
+ * @return
+ */
+ @Override
+ public AppUserInfo info(String openId) {
+ AppUser user = appUserService.getOne(Wrappers.query().lambda().eq(AppUser::getWxOpenid, openId));
+
+ // 未注册用户自动注册
+ if (Objects.isNull(user)) {
+ log.info("微信小程序未绑定:{},创建新的用户", openId);
+ AppUser appUser = new AppUser();
+ appUser.setWxOpenid(openId);
+ appUser.setUsername(openId);
+ appUser.setCreateBy(openId);
+ appUser.setUpdateBy(openId);
+ appUserService.saveOrUpdate(appUser);
+
+ AppUserInfo appUserDTO = new AppUserInfo();
+ appUserDTO.setAppUser(appUser);
+ return appUserDTO;
+ }
+
+ return appUserService.findUserInfo(user);
+ }
+
+ /**
+ * 绑定逻辑
+ *
+ * @param user 用户实体
+ * @param identify 渠道返回唯一标识
+ * @return
+ */
+ @Override
+ public Boolean bind(AppUser user, String identify) {
+ user.setWxOpenid(identify);
+ appUserService.updateById(user);
+ return true;
+ }
+
+}
diff --git a/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/handler/SmsLoginHandler.java b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/handler/SmsLoginHandler.java
new file mode 100644
index 00000000..edaa9d40
--- /dev/null
+++ b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/handler/SmsLoginHandler.java
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2018-2025, pjcloud All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the pig4cloud.com developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: pjcloud
+ */
+
+package com.bsd.pjcloud.app.handler;
+
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.bsd.pjcloud.app.api.dto.AppUserInfo;
+import com.bsd.pjcloud.app.api.entity.AppUser;
+import com.bsd.pjcloud.app.mapper.AppUserMapper;
+import com.bsd.pjcloud.app.service.AppUserService;
+import lombok.AllArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Component;
+
+import java.util.Objects;
+
+/**
+ * @author pjcloud
+ * @date 2018/11/18
+ */
+@Slf4j
+@Component("APP-SMS")
+@AllArgsConstructor
+public class SmsLoginHandler extends AbstractLoginHandler {
+
+ private final AppUserService appUserService;
+
+ /**
+ * 验证码登录传入为手机号 不用不处理
+ * @param mobile
+ * @return
+ */
+ @Override
+ public String identify(String mobile) {
+ return mobile;
+ }
+
+ /**
+ * 通过mobile 获取用户信息
+ * @param identify
+ * @return
+ */
+ @Override
+ public AppUserInfo info(String identify) {
+ AppUser user = appUserService.getOne(Wrappers.query().lambda().eq(AppUser::getPhone, identify));
+
+ // 未注册用户自动注册
+ if (Objects.isNull(user)) {
+ log.info("手机号未注册:{}", identify);
+ AppUser appUser = new AppUser();
+ appUser.setUsername(identify);
+ appUser.setPhone(identify);
+ appUser.setCreateBy(identify);
+ appUser.setUpdateBy(identify);
+ appUserService.save(appUser);
+ AppUserInfo appUserDTO = new AppUserInfo();
+ appUserDTO.setAppUser(appUser);
+ return appUserDTO;
+ }
+
+ // 返回用户信息
+ return appUserService.findUserInfo(user);
+ }
+
+
+ /**
+ * 绑定逻辑
+ * @param user 用户实体
+ * @param identify 渠道返回唯一标识
+ * @return
+ */
+ @Override
+ public Boolean bind(AppUser user, String identify) {
+ user.setPhone(identify);
+ appUserService.updateById(user);
+ return true;
+ }
+
+}
diff --git a/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/mapper/AppArticleCategoryMapper.java b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/mapper/AppArticleCategoryMapper.java
new file mode 100644
index 00000000..67259155
--- /dev/null
+++ b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/mapper/AppArticleCategoryMapper.java
@@ -0,0 +1,10 @@
+package com.bsd.pjcloud.app.mapper;
+
+import com.bsd.pjcloud.app.api.entity.AppArticleCategoryEntity;
+import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+@Mapper
+public interface AppArticleCategoryMapper extends PjcloudBaseMapper {
+
+}
diff --git a/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/mapper/AppArticleCollectMapper.java b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/mapper/AppArticleCollectMapper.java
new file mode 100644
index 00000000..d8887b6e
--- /dev/null
+++ b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/mapper/AppArticleCollectMapper.java
@@ -0,0 +1,10 @@
+package com.bsd.pjcloud.app.mapper;
+
+import com.bsd.pjcloud.app.api.entity.AppArticleCollectEntity;
+import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+@Mapper
+public interface AppArticleCollectMapper extends PjcloudBaseMapper {
+
+}
diff --git a/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/mapper/AppArticleMapper.java b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/mapper/AppArticleMapper.java
new file mode 100644
index 00000000..45b5fa1c
--- /dev/null
+++ b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/mapper/AppArticleMapper.java
@@ -0,0 +1,10 @@
+package com.bsd.pjcloud.app.mapper;
+
+import com.bsd.pjcloud.app.api.entity.AppArticleEntity;
+import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+@Mapper
+public interface AppArticleMapper extends PjcloudBaseMapper {
+
+}
diff --git a/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/mapper/AppPageMapper.java b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/mapper/AppPageMapper.java
new file mode 100644
index 00000000..ccf55a8b
--- /dev/null
+++ b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/mapper/AppPageMapper.java
@@ -0,0 +1,10 @@
+package com.bsd.pjcloud.app.mapper;
+
+import com.bsd.pjcloud.app.api.entity.AppPageEntity;
+import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+@Mapper
+public interface AppPageMapper extends PjcloudBaseMapper {
+
+}
diff --git a/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/mapper/AppRoleMapper.java b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/mapper/AppRoleMapper.java
new file mode 100644
index 00000000..c56a3282
--- /dev/null
+++ b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/mapper/AppRoleMapper.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2018-2025, pjcloud All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the pig4cloud.com developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: pjcloud
+ */
+
+package com.bsd.pjcloud.app.mapper;
+
+import com.bsd.pjcloud.app.api.entity.AppRole;
+import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+
+/**
+ * app角色表
+ *
+ * @author aeizzz
+ * @date 2022-12-07 09:52:03
+ */
+@Mapper
+public interface AppRoleMapper extends PjcloudBaseMapper {
+
+ List listRolesByUserId(Long userId);
+
+}
diff --git a/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/mapper/AppSocialDetailsMapper.java b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/mapper/AppSocialDetailsMapper.java
new file mode 100644
index 00000000..ba4cd894
--- /dev/null
+++ b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/mapper/AppSocialDetailsMapper.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2018-2025, pjcloud All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the pig4cloud.com developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: pjcloud
+ */
+
+package com.bsd.pjcloud.app.mapper;
+
+import com.bsd.pjcloud.app.api.entity.AppSocialDetails;
+import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * 系统社交登录账号表
+ *
+ * @author pjcloud
+ * @date 2018-08-16 21:30:41
+ */
+@Mapper
+public interface AppSocialDetailsMapper extends PjcloudBaseMapper {
+
+}
diff --git a/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/mapper/AppTabbarMapper.java b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/mapper/AppTabbarMapper.java
new file mode 100644
index 00000000..9350a7ba
--- /dev/null
+++ b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/mapper/AppTabbarMapper.java
@@ -0,0 +1,10 @@
+package com.bsd.pjcloud.app.mapper;
+
+import com.bsd.pjcloud.app.api.entity.AppTabbarEntity;
+import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+@Mapper
+public interface AppTabbarMapper extends PjcloudBaseMapper {
+
+}
diff --git a/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/mapper/AppUserMapper.java b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/mapper/AppUserMapper.java
new file mode 100644
index 00000000..da61e7d9
--- /dev/null
+++ b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/mapper/AppUserMapper.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2018-2025, pjcloud All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the pig4cloud.com developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: pjcloud
+ */
+
+package com.bsd.pjcloud.app.mapper;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.bsd.pjcloud.app.api.dto.AppUserDTO;
+import com.bsd.pjcloud.app.api.entity.AppUser;
+import com.bsd.pjcloud.app.api.vo.AppUserVO;
+import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * app用户表
+ *
+ * @author aeizzz
+ * @date 2022-12-07 09:52:03
+ */
+@Mapper
+public interface AppUserMapper extends PjcloudBaseMapper {
+
+ IPage getUserVosPage(Page page, @Param("query") AppUserDTO appUserDTO);
+
+ AppUserVO getUserVoById(Long userId);
+
+}
diff --git a/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/mapper/AppUserRoleMapper.java b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/mapper/AppUserRoleMapper.java
new file mode 100644
index 00000000..1f950b26
--- /dev/null
+++ b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/mapper/AppUserRoleMapper.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2018-2025, pjcloud All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the pig4cloud.com developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: pjcloud
+ */
+
+package com.bsd.pjcloud.app.mapper;
+
+import com.bsd.pjcloud.app.api.entity.AppUserRole;
+import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * 用户角色表
+ *
+ * @author aeizzz
+ * @date 2022-12-07 09:52:03
+ */
+@Mapper
+public interface AppUserRoleMapper extends PjcloudBaseMapper {
+
+}
diff --git a/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/service/AppArticleCategoryService.java b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/service/AppArticleCategoryService.java
new file mode 100644
index 00000000..f3cf35e2
--- /dev/null
+++ b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/service/AppArticleCategoryService.java
@@ -0,0 +1,8 @@
+package com.bsd.pjcloud.app.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.bsd.pjcloud.app.api.entity.AppArticleCategoryEntity;
+
+public interface AppArticleCategoryService extends IService {
+
+}
diff --git a/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/service/AppArticleCollectService.java b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/service/AppArticleCollectService.java
new file mode 100644
index 00000000..ea68a5d5
--- /dev/null
+++ b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/service/AppArticleCollectService.java
@@ -0,0 +1,10 @@
+package com.bsd.pjcloud.app.service;
+
+import com.github.yulichang.base.MPJBaseService;
+import com.bsd.pjcloud.app.api.entity.AppArticleCollectEntity;
+
+public interface AppArticleCollectService extends MPJBaseService {
+
+ Boolean saveArticleCollect(AppArticleCollectEntity appArticleCollect);
+
+}
diff --git a/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/service/AppArticleService.java b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/service/AppArticleService.java
new file mode 100644
index 00000000..2d436028
--- /dev/null
+++ b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/service/AppArticleService.java
@@ -0,0 +1,24 @@
+package com.bsd.pjcloud.app.service;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.bsd.pjcloud.app.api.entity.AppArticleEntity;
+
+public interface AppArticleService extends IService {
+
+ /**
+ * 获取文章并使阅读数+1
+ * @param id id
+ * @return
+ */
+ AppArticleEntity getArticleAndIncrById(Long id, Long userId);
+
+ /**
+ * 分页查询文章列表 包含分类名称
+ * @param page 分页参数
+ * @param appArticle 文章查询条件
+ * @return
+ */
+ Page pageAndCname(Page page, AppArticleEntity appArticle);
+
+}
diff --git a/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/service/AppIndexService.java b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/service/AppIndexService.java
new file mode 100644
index 00000000..64d4f6ef
--- /dev/null
+++ b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/service/AppIndexService.java
@@ -0,0 +1,33 @@
+package com.bsd.pjcloud.app.service;
+
+import com.bsd.pjcloud.app.api.entity.AppPageEntity;
+
+import java.util.Map;
+
+/**
+ * app 页面控制
+ *
+ * @author pjcloud
+ * @date 2023/6/8
+ */
+public interface AppIndexService {
+
+ /**
+ * 首页
+ */
+ Map index();
+
+ /**
+ * 配置
+ * @return Map
+ */
+ Map config();
+
+ /**
+ * 装修
+ * @param id 装修ID
+ * @return Map
+ */
+ AppPageEntity decorate(Integer id);
+
+}
diff --git a/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/service/AppMobileService.java b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/service/AppMobileService.java
new file mode 100644
index 00000000..f2ee8772
--- /dev/null
+++ b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/service/AppMobileService.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2018-2025, pjcloud All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the pig4cloud.com developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: pjcloud
+ */
+
+package com.bsd.pjcloud.app.service;
+
+import com.bsd.pjcloud.common.core.util.R;
+
+/**
+ * @author pjcloud
+ * @date 2018/11/14
+ */
+public interface AppMobileService {
+
+ /**
+ * 发送手机验证码
+ * @param mobile mobile
+ * @return code
+ */
+ R sendSmsCode(String mobile);
+
+}
diff --git a/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/service/AppPageService.java b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/service/AppPageService.java
new file mode 100644
index 00000000..2e3666a0
--- /dev/null
+++ b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/service/AppPageService.java
@@ -0,0 +1,8 @@
+package com.bsd.pjcloud.app.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.bsd.pjcloud.app.api.entity.AppPageEntity;
+
+public interface AppPageService extends IService {
+
+}
diff --git a/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/service/AppRoleService.java b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/service/AppRoleService.java
new file mode 100644
index 00000000..1aa80a76
--- /dev/null
+++ b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/service/AppRoleService.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2018-2025, pjcloud All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the pig4cloud.com developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: pjcloud
+ */
+
+package com.bsd.pjcloud.app.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.bsd.pjcloud.app.api.entity.AppRole;
+import com.bsd.pjcloud.app.api.vo.AppRoleExcelVO;
+import com.bsd.pjcloud.common.core.util.R;
+import org.springframework.validation.BindingResult;
+
+import java.util.List;
+
+/**
+ * app角色表
+ *
+ * @author aeizzz
+ * @date 2022-12-07 09:52:03
+ */
+public interface AppRoleService extends IService {
+
+ List findRolesByUserId(Long userId);
+
+ /**
+ * 删除用户的同时,把role_menu关系删除
+ * @param ids RoleIds
+ */
+ Boolean deleteRoleByIds(Long[] ids);
+
+ R importRole(List excelVOList, BindingResult bindingResult);
+
+}
diff --git a/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/service/AppSocialDetailsService.java b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/service/AppSocialDetailsService.java
new file mode 100644
index 00000000..390ae7a2
--- /dev/null
+++ b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/service/AppSocialDetailsService.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2018-2025, pjcloud All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the pig4cloud.com developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: pjcloud
+ */
+
+package com.bsd.pjcloud.app.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.bsd.pjcloud.app.api.dto.AppUserInfo;
+import com.bsd.pjcloud.app.api.entity.AppSocialDetails;
+
+/**
+ * 系统社交登录账号表
+ *
+ * @author pjcloud
+ * @date 2018-08-16 21:30:41
+ */
+public interface AppSocialDetailsService extends IService {
+
+ /**
+ * 绑定社交账号
+ * @param state 类型
+ * @param code code
+ * @return
+ */
+ Boolean bindSocial(String state, String code);
+
+ /**
+ * 根据入参查询用户信息
+ * @param inStr
+ * @return
+ */
+ AppUserInfo getUserInfo(String inStr);
+
+}
diff --git a/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/service/AppTabbarService.java b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/service/AppTabbarService.java
new file mode 100644
index 00000000..00fe313d
--- /dev/null
+++ b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/service/AppTabbarService.java
@@ -0,0 +1,8 @@
+package com.bsd.pjcloud.app.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.bsd.pjcloud.app.api.entity.AppTabbarEntity;
+
+public interface AppTabbarService extends IService {
+
+}
diff --git a/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/service/AppUserRoleService.java b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/service/AppUserRoleService.java
new file mode 100644
index 00000000..cdea8fb1
--- /dev/null
+++ b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/service/AppUserRoleService.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2018-2025, pjcloud All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the pig4cloud.com developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: pjcloud
+ */
+
+package com.bsd.pjcloud.app.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.bsd.pjcloud.app.api.entity.AppUserRole;
+
+/**
+ * 用户角色表
+ *
+ * @author aeizzz
+ * @date 2022-12-07 09:52:03
+ */
+public interface AppUserRoleService extends IService {
+
+}
diff --git a/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/service/AppUserService.java b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/service/AppUserService.java
new file mode 100644
index 00000000..9a287d3d
--- /dev/null
+++ b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/service/AppUserService.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2018-2025, pjcloud All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the pig4cloud.com developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: pjcloud
+ */
+
+package com.bsd.pjcloud.app.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.bsd.pjcloud.app.api.dto.AppUserDTO;
+import com.bsd.pjcloud.app.api.dto.AppUserInfo;
+import com.bsd.pjcloud.app.api.entity.AppUser;
+import com.bsd.pjcloud.app.api.vo.AppUserExcelVO;
+import com.bsd.pjcloud.app.api.vo.AppUserVO;
+import com.bsd.pjcloud.common.core.util.R;
+import org.springframework.validation.BindingResult;
+
+import java.util.List;
+
+/**
+ * app用户表
+ *
+ * @author aeizzz
+ * @date 2022-12-07 09:52:03
+ */
+public interface AppUserService extends IService {
+
+ Boolean updateUser(AppUserDTO appUser);
+
+ Boolean saveUser(AppUserDTO appUser);
+
+ List listUser(AppUserDTO appUser);
+
+ IPage getUsersWithRolePage(Page page, AppUserDTO appUserDTO);
+
+ AppUserInfo findUserInfo(AppUser user);
+
+ R updateUserInfo(AppUserDTO userDto);
+
+ AppUserVO selectUserVoById(Long userId);
+
+ Boolean deleteAppUserByIds(Long[] ids);
+
+ R importUser(List excelVOList, BindingResult bindingResult);
+
+ R registerAppUser(AppUserDTO appUser);
+
+}
diff --git a/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/service/impl/AppArticleCategoryServiceImpl.java b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/service/impl/AppArticleCategoryServiceImpl.java
new file mode 100644
index 00000000..d68b3564
--- /dev/null
+++ b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/service/impl/AppArticleCategoryServiceImpl.java
@@ -0,0 +1,19 @@
+package com.bsd.pjcloud.app.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.bsd.pjcloud.app.api.entity.AppArticleCategoryEntity;
+import com.bsd.pjcloud.app.mapper.AppArticleCategoryMapper;
+import com.bsd.pjcloud.app.service.AppArticleCategoryService;
+import org.springframework.stereotype.Service;
+
+/**
+ * 文章分类表
+ *
+ * @author pig
+ * @date 2023-06-07 16:28:03
+ */
+@Service
+public class AppArticleCategoryServiceImpl extends ServiceImpl
+ implements AppArticleCategoryService {
+
+}
diff --git a/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/service/impl/AppArticleCollectServiceImpl.java b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/service/impl/AppArticleCollectServiceImpl.java
new file mode 100644
index 00000000..584e7837
--- /dev/null
+++ b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/service/impl/AppArticleCollectServiceImpl.java
@@ -0,0 +1,36 @@
+package com.bsd.pjcloud.app.service.impl;
+
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.bsd.pjcloud.app.api.entity.AppArticleCollectEntity;
+import com.bsd.pjcloud.app.mapper.AppArticleCollectMapper;
+import com.bsd.pjcloud.app.service.AppArticleCollectService;
+import com.bsd.pjcloud.common.security.util.SecurityUtils;
+import org.springframework.stereotype.Service;
+
+/**
+ * 文章收藏表
+ *
+ * @author pig
+ * @date 2023-06-16 14:33:41
+ */
+@Service
+public class AppArticleCollectServiceImpl extends ServiceImpl
+ implements AppArticleCollectService {
+
+ @Override
+ public Boolean saveArticleCollect(AppArticleCollectEntity appArticleCollect) {
+ Long id = SecurityUtils.getUser().getId();
+ appArticleCollect.setUserId(id);
+
+ if (baseMapper.exists(Wrappers.lambdaQuery()
+ .eq(AppArticleCollectEntity::getUserId, id)
+ .eq(AppArticleCollectEntity::getArticleId, appArticleCollect.getArticleId()))) {
+ return Boolean.FALSE;
+ }
+
+ return this.save(appArticleCollect);
+
+ }
+
+}
diff --git a/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/service/impl/AppArticleServiceImpl.java b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/service/impl/AppArticleServiceImpl.java
new file mode 100644
index 00000000..187234f7
--- /dev/null
+++ b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/service/impl/AppArticleServiceImpl.java
@@ -0,0 +1,77 @@
+package com.bsd.pjcloud.app.service.impl;
+
+import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.github.yulichang.wrapper.MPJLambdaWrapper;
+import com.bsd.pjcloud.app.api.entity.AppArticleCategoryEntity;
+import com.bsd.pjcloud.app.api.entity.AppArticleCollectEntity;
+import com.bsd.pjcloud.app.api.entity.AppArticleEntity;
+import com.bsd.pjcloud.app.mapper.AppArticleCollectMapper;
+import com.bsd.pjcloud.app.mapper.AppArticleMapper;
+import com.bsd.pjcloud.app.service.AppArticleService;
+import lombok.RequiredArgsConstructor;
+import org.springframework.stereotype.Service;
+
+import java.util.Objects;
+
+/**
+ * 文章资讯
+ *
+ * @author pig
+ * @date 2023-06-07 16:32:35
+ */
+@Service
+@RequiredArgsConstructor
+public class AppArticleServiceImpl extends ServiceImpl
+ implements AppArticleService {
+
+ private final AppArticleCollectMapper collectMapper;
+
+ /**
+ * 获取文章并使阅读数+1
+ * @param id id
+ * @return
+ */
+ @Override
+ public AppArticleEntity getArticleAndIncrById(Long id, Long userId) {
+ AppArticleEntity appArticleEntity = baseMapper.selectById(id);
+ // 查询是否收藏了
+ if (Objects.nonNull(userId)) {
+ boolean exists = collectMapper.exists(Wrappers.lambdaQuery()//
+ .eq(AppArticleCollectEntity::getArticleId, appArticleEntity.getId())//
+ .eq(AppArticleCollectEntity::getUserId, userId));
+ appArticleEntity.setCollect(exists);
+ }
+
+ // TODO 更新条件需要根据其他指数限制
+ Integer nowVisit = appArticleEntity.getVisit();
+ appArticleEntity.setVisit(nowVisit + 1);
+ // 乐观锁
+ baseMapper.update(appArticleEntity,
+ Wrappers.lambdaQuery()
+ .eq(AppArticleEntity::getId, id)
+ .eq(AppArticleEntity::getVisit, nowVisit));
+ return appArticleEntity;
+ }
+
+ /**
+ * 分页查询文章列表 包含分类名称
+ * @param page 分页参数
+ * @param appArticle 文章查询条件
+ * @return
+ */
+ @Override
+ public Page pageAndCname(Page page, AppArticleEntity appArticle) {
+ MPJLambdaWrapper wrapper = new MPJLambdaWrapper<>();
+ wrapper.selectAll(AppArticleEntity.class)
+ .selectAs(AppArticleCategoryEntity::getName, AppArticleEntity.Fields.cname)
+ .leftJoin(AppArticleCategoryEntity.class, AppArticleCategoryEntity::getId, AppArticleEntity::getCid)
+ .like(StrUtil.isNotBlank(appArticle.getAuthor()), AppArticleEntity::getAuthor, appArticle.getAuthor())
+ .like(StrUtil.isNotBlank(appArticle.getTitle()), AppArticleEntity::getTitle, appArticle.getTitle())
+ .eq(Objects.nonNull(appArticle.getCid()), AppArticleEntity::getCid, appArticle.getCid());
+ return this.page(page, wrapper);
+ }
+
+}
diff --git a/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/service/impl/AppIndexServiceImpl.java b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/service/impl/AppIndexServiceImpl.java
new file mode 100644
index 00000000..168afb3b
--- /dev/null
+++ b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/service/impl/AppIndexServiceImpl.java
@@ -0,0 +1,73 @@
+package com.bsd.pjcloud.app.service.impl;
+
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.bsd.pjcloud.app.api.entity.AppArticleEntity;
+import com.bsd.pjcloud.app.api.entity.AppPageEntity;
+import com.bsd.pjcloud.app.api.entity.AppTabbarEntity;
+import com.bsd.pjcloud.app.mapper.AppArticleMapper;
+import com.bsd.pjcloud.app.mapper.AppPageMapper;
+import com.bsd.pjcloud.app.mapper.AppTabbarMapper;
+import com.bsd.pjcloud.app.service.AppIndexService;
+import lombok.RequiredArgsConstructor;
+import org.springframework.stereotype.Service;
+
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * app 页面控制
+ *
+ * @author pjcloud
+ * @date 2023/6/8
+ */
+
+@Service
+@RequiredArgsConstructor
+public class AppIndexServiceImpl implements AppIndexService {
+
+ private final AppArticleMapper appArticleMapper;
+
+ private final AppTabbarMapper appTabbarMapper;
+
+ private final AppPageMapper appPageMapper;
+
+ /**
+ * 商城首页 首页数据
+ */
+ @Override
+ public Map index() {
+ Map response = new LinkedHashMap<>();
+ AppPageEntity appPageEntity = appPageMapper.selectById(1);
+ List articleList = appArticleMapper
+ .selectList(Wrappers.lambdaQuery().orderByDesc(AppArticleEntity::getSort));
+ response.put("pages", appPageEntity);
+ response.put("article", articleList);
+ return response;
+ }
+
+ /**
+ * 配置
+ * @return Map
+ */
+ @Override
+ public Map config() {
+ Map response = new LinkedHashMap<>();
+ List tabbarEntityList = appTabbarMapper.selectList(Wrappers.emptyWrapper());
+ response.put("tabbar", tabbarEntityList);
+ return response;
+ }
+
+ /**
+ * 装修
+ *
+ * @author fzr
+ * @param id 主键
+ * @return Map
+ */
+ @Override
+ public AppPageEntity decorate(Integer id) {
+ return appPageMapper.selectById(id);
+ }
+
+}
diff --git a/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/service/impl/AppMobileServiceImpl.java b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/service/impl/AppMobileServiceImpl.java
new file mode 100644
index 00000000..2997a826
--- /dev/null
+++ b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/service/impl/AppMobileServiceImpl.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2018-2025, pjcloud All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the pig4cloud.com developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: pjcloud
+ */
+
+package com.bsd.pjcloud.app.service.impl;
+
+import cn.hutool.core.util.RandomUtil;
+import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.core.toolkit.StringPool;
+import com.bsd.pjcloud.app.service.AppMobileService;
+import com.bsd.pjcloud.common.core.constant.CacheConstants;
+import com.bsd.pjcloud.common.core.constant.SecurityConstants;
+import com.bsd.pjcloud.common.core.constant.enums.LoginTypeEnum;
+import com.bsd.pjcloud.common.core.exception.ErrorCodes;
+import com.bsd.pjcloud.common.core.util.MsgUtils;
+import com.bsd.pjcloud.common.core.util.R;
+import lombok.AllArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.data.redis.core.StringRedisTemplate;
+import org.springframework.stereotype.Service;
+
+import java.util.concurrent.TimeUnit;
+
+/**
+ * @author pjcloud
+ * @date 2018/11/14
+ *
+ * 手机登录相关业务实现
+ */
+@Slf4j
+@Service
+@AllArgsConstructor
+public class AppMobileServiceImpl implements AppMobileService {
+
+ private final StringRedisTemplate redisTemplate;
+
+ /**
+ * 发送手机验证码 TODO: 调用短信网关发送验证码,测试返回前端
+ * @param mobile mobile
+ * @return code
+ */
+ @Override
+ public R sendSmsCode(String mobile) {
+ String codeObj = redisTemplate.opsForValue()
+ .get(CacheConstants.DEFAULT_CODE_KEY + LoginTypeEnum.APPSMS.getType() + StringPool.AT + mobile);
+
+ if (StrUtil.isNotBlank(codeObj)) {
+ log.info("手机号验证码未过期:{},{}", mobile, codeObj);
+ return R.ok(Boolean.FALSE, MsgUtils.getMessage(ErrorCodes.SYS_APP_SMS_OFTEN));
+ }
+
+ String code = RandomUtil.randomNumbers(Integer.parseInt(SecurityConstants.CODE_SIZE));
+ log.debug("手机号生成验证码成功:{},{}", mobile, code);
+ redisTemplate.opsForValue()
+ .set(CacheConstants.DEFAULT_CODE_KEY + LoginTypeEnum.APPSMS.getType() + StringPool.AT + mobile, code,
+ SecurityConstants.CODE_TIME, TimeUnit.SECONDS);
+ return R.ok(Boolean.TRUE, code);
+ }
+
+}
diff --git a/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/service/impl/AppPageServiceImpl.java b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/service/impl/AppPageServiceImpl.java
new file mode 100644
index 00000000..e4acbd33
--- /dev/null
+++ b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/service/impl/AppPageServiceImpl.java
@@ -0,0 +1,18 @@
+package com.bsd.pjcloud.app.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.bsd.pjcloud.app.api.entity.AppPageEntity;
+import com.bsd.pjcloud.app.mapper.AppPageMapper;
+import com.bsd.pjcloud.app.service.AppPageService;
+import org.springframework.stereotype.Service;
+
+/**
+ * 页面
+ *
+ * @author pjcloud
+ * @date 2023-06-08 11:19:23
+ */
+@Service
+public class AppPageServiceImpl extends ServiceImpl implements AppPageService {
+
+}
diff --git a/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/service/impl/AppRoleServiceImpl.java b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/service/impl/AppRoleServiceImpl.java
new file mode 100644
index 00000000..1aa7aa66
--- /dev/null
+++ b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/service/impl/AppRoleServiceImpl.java
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2018-2025, pjcloud All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the pig4cloud.com developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: pjcloud
+ */
+package com.bsd.pjcloud.app.service.impl;
+
+import cn.hutool.core.collection.CollUtil;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.bsd.pjcloud.app.api.entity.AppRole;
+import com.bsd.pjcloud.app.api.vo.AppRoleExcelVO;
+import com.bsd.pjcloud.app.mapper.AppRoleMapper;
+import com.bsd.pjcloud.app.service.AppRoleService;
+import com.bsd.pjcloud.common.core.exception.ErrorCodes;
+import com.bsd.pjcloud.common.core.util.MsgUtils;
+import com.bsd.pjcloud.common.core.util.R;
+import com.bsd.pjcloud.common.excel.vo.ErrorMessage;
+import lombok.AllArgsConstructor;
+import org.springframework.stereotype.Service;
+import org.springframework.validation.BindingResult;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * app角色表
+ *
+ * @author aeizzz
+ * @date 2022-12-07 09:52:03
+ */
+@Service
+@AllArgsConstructor
+public class AppRoleServiceImpl extends ServiceImpl implements AppRoleService {
+
+ @Override
+ public List findRolesByUserId(Long userId) {
+ return baseMapper.listRolesByUserId(userId);
+ }
+
+ /**
+ * 删除用户的同时,把role_menu关系删除
+ * @param ids roleIds
+ */
+ @Override
+ public Boolean deleteRoleByIds(Long[] ids) {
+ this.removeBatchByIds(CollUtil.toList(ids));
+ return Boolean.TRUE;
+ }
+
+ /**
+ * 导入角色
+ * @param excelVOList
+ * @param bindingResult
+ * @return
+ */
+ @Override
+ public R importRole(List excelVOList, BindingResult bindingResult) {
+ // 通用校验获取失败的数据
+ List errorMessageList = (List) bindingResult.getTarget();
+
+ // 个性化校验逻辑
+ List roleList = this.list();
+
+ // 执行数据插入操作 组装 RoleDto
+ for (AppRoleExcelVO excel : excelVOList) {
+ Set errorMsg = new HashSet<>();
+ // 检验角色名称或者角色编码是否存在
+ boolean existRole = roleList.stream()
+ .anyMatch(appRole -> excel.getRoleName().equals(appRole.getRoleName())
+ || excel.getRoleCode().equals(appRole.getRoleCode()));
+
+ if (existRole) {
+ errorMsg.add(MsgUtils.getMessage(ErrorCodes.SYS_ROLE_NAMEORCODE_EXISTING, excel.getRoleName(),
+ excel.getRoleCode()));
+ }
+
+ // 数据合法情况
+ if (CollUtil.isEmpty(errorMsg)) {
+ insertExcelRole(excel);
+ }
+ else {
+ // 数据不合法情况
+ errorMessageList.add(new ErrorMessage(excel.getLineNum(), errorMsg));
+ }
+ }
+ if (CollUtil.isNotEmpty(errorMessageList)) {
+ return R.failed(errorMessageList);
+ }
+ return R.ok();
+
+ }
+
+ private void insertExcelRole(AppRoleExcelVO excel) {
+ AppRole appRole = new AppRole();
+ appRole.setRoleName(excel.getRoleName());
+ appRole.setRoleDesc(excel.getRoleDesc());
+ appRole.setRoleCode(excel.getRoleCode());
+ this.save(appRole);
+ }
+
+}
diff --git a/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/service/impl/AppSocialDetailsServiceImpl.java b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/service/impl/AppSocialDetailsServiceImpl.java
new file mode 100644
index 00000000..e8e53dc6
--- /dev/null
+++ b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/service/impl/AppSocialDetailsServiceImpl.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2018-2025, pjcloud All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the pig4cloud.com developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: pjcloud
+ */
+
+package com.bsd.pjcloud.app.service.impl;
+
+import com.baomidou.mybatisplus.core.toolkit.StringPool;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.bsd.pjcloud.app.api.dto.AppUserInfo;
+import com.bsd.pjcloud.app.api.entity.AppSocialDetails;
+import com.bsd.pjcloud.app.api.entity.AppUser;
+import com.bsd.pjcloud.app.handler.LoginHandler;
+import com.bsd.pjcloud.app.mapper.AppSocialDetailsMapper;
+import com.bsd.pjcloud.app.mapper.AppUserMapper;
+import com.bsd.pjcloud.app.service.AppSocialDetailsService;
+import com.bsd.pjcloud.common.core.constant.CacheConstants;
+import com.bsd.pjcloud.common.security.util.SecurityUtils;
+import lombok.AllArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.cache.CacheManager;
+import org.springframework.stereotype.Service;
+
+import java.util.Map;
+
+/**
+ * @author pjcloud
+ * @date 2018年08月16日
+ */
+@Slf4j
+@AllArgsConstructor
+@Service("appSocialDetailsService")
+public class AppSocialDetailsServiceImpl extends ServiceImpl
+ implements AppSocialDetailsService {
+
+ private final Map loginHandlerMap;
+
+ private final CacheManager cacheManager;
+
+ private final AppUserMapper appUserMapper;
+
+ /**
+ * 绑定社交账号
+ * @param type type
+ * @param code code
+ * @return
+ */
+ @Override
+ public Boolean bindSocial(String type, String code) {
+ LoginHandler loginHandler = loginHandlerMap.get(type);
+ // 绑定逻辑
+ String identify = loginHandler.identify(code);
+ AppUser user = appUserMapper.selectById(SecurityUtils.getUser().getId());
+ loginHandler.bind(user, identify);
+
+ // 更新緩存
+ cacheManager.getCache(CacheConstants.USER_DETAILS_MINI).evict(user.getUsername());
+ return Boolean.TRUE;
+ }
+
+ /**
+ * 根据入参查询用户信息
+ * @param inStr TYPE@code
+ * @return
+ */
+ @Override
+ public AppUserInfo getUserInfo(String inStr) {
+ String[] inStrs = inStr.split(StringPool.AT);
+ String type = inStrs[0];
+ String loginStr = inStr.substring(type.length() + 1);
+ return loginHandlerMap.get(type).handle(loginStr);
+ }
+
+}
diff --git a/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/service/impl/AppTabbarServiceImpl.java b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/service/impl/AppTabbarServiceImpl.java
new file mode 100644
index 00000000..04d0378f
--- /dev/null
+++ b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/service/impl/AppTabbarServiceImpl.java
@@ -0,0 +1,18 @@
+package com.bsd.pjcloud.app.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.bsd.pjcloud.app.api.entity.AppTabbarEntity;
+import com.bsd.pjcloud.app.mapper.AppTabbarMapper;
+import com.bsd.pjcloud.app.service.AppTabbarService;
+import org.springframework.stereotype.Service;
+
+/**
+ * 导航栏
+ *
+ * @author pjcloud
+ * @date 2023-06-08 11:18:46
+ */
+@Service
+public class AppTabbarServiceImpl extends ServiceImpl implements AppTabbarService {
+
+}
diff --git a/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/service/impl/AppUserRoleServiceImpl.java b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/service/impl/AppUserRoleServiceImpl.java
new file mode 100644
index 00000000..18953084
--- /dev/null
+++ b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/service/impl/AppUserRoleServiceImpl.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2018-2025, pjcloud All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the pig4cloud.com developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: pjcloud
+ */
+package com.bsd.pjcloud.app.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.bsd.pjcloud.app.api.entity.AppUserRole;
+import com.bsd.pjcloud.app.mapper.AppUserRoleMapper;
+import com.bsd.pjcloud.app.service.AppUserRoleService;
+import org.springframework.stereotype.Service;
+
+/**
+ * 用户角色表
+ *
+ * @author aeizzz
+ * @date 2022-12-07 09:52:03
+ */
+@Service
+public class AppUserRoleServiceImpl extends ServiceImpl implements AppUserRoleService {
+
+}
diff --git a/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/service/impl/AppUserServiceImpl.java b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/service/impl/AppUserServiceImpl.java
new file mode 100644
index 00000000..27933246
--- /dev/null
+++ b/pjcloud-app-server/pjcloud-app-server-biz/src/main/java/com/bsd/pjcloud/app/service/impl/AppUserServiceImpl.java
@@ -0,0 +1,318 @@
+/*
+ * Copyright (c) 2018-2025, pjcloud All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the pig4cloud.com developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: pjcloud
+ */
+package com.bsd.pjcloud.app.service.impl;
+
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.util.ArrayUtil;
+import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.StringPool;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.bsd.pjcloud.app.api.dto.AppUserDTO;
+import com.bsd.pjcloud.app.api.dto.AppUserInfo;
+import com.bsd.pjcloud.app.api.entity.AppRole;
+import com.bsd.pjcloud.app.api.entity.AppUser;
+import com.bsd.pjcloud.app.api.entity.AppUserRole;
+import com.bsd.pjcloud.app.api.vo.AppUserExcelVO;
+import com.bsd.pjcloud.app.api.vo.AppUserVO;
+import com.bsd.pjcloud.app.mapper.AppUserMapper;
+import com.bsd.pjcloud.app.service.AppRoleService;
+import com.bsd.pjcloud.app.service.AppUserRoleService;
+import com.bsd.pjcloud.app.service.AppUserService;
+import com.bsd.pjcloud.common.core.constant.CacheConstants;
+import com.bsd.pjcloud.common.core.constant.CommonConstants;
+import com.bsd.pjcloud.common.core.constant.enums.LoginTypeEnum;
+import com.bsd.pjcloud.common.core.constant.enums.UserTypeEnum;
+import com.bsd.pjcloud.common.core.exception.ErrorCodes;
+import com.bsd.pjcloud.common.core.util.MsgUtils;
+import com.bsd.pjcloud.common.core.util.R;
+import com.bsd.pjcloud.common.excel.vo.ErrorMessage;
+import com.bsd.pjcloud.common.security.service.PjcloudUser;
+import com.bsd.pjcloud.common.security.util.SecurityUtils;
+import lombok.AllArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.BeanUtils;
+import org.springframework.cache.Cache;
+import org.springframework.cache.CacheManager;
+import org.springframework.cache.annotation.CacheEvict;
+import org.springframework.data.redis.core.StringRedisTemplate;
+import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
+import org.springframework.security.crypto.password.PasswordEncoder;
+import org.springframework.stereotype.Service;
+import org.springframework.validation.BindingResult;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+/**
+ * app用户表
+ *
+ * @author aeizzz
+ * @date 2022-12-07 09:52:03
+ */
+@Service
+@AllArgsConstructor
+@Slf4j
+public class AppUserServiceImpl extends ServiceImpl implements AppUserService {
+
+ private static final PasswordEncoder ENCODER = new BCryptPasswordEncoder();
+
+ private final AppUserRoleService appUserRoleService;
+
+ private final StringRedisTemplate redisTemplate;
+
+ private final AppRoleService appRoleService;
+
+ private final CacheManager cacheManager;
+
+ /**
+ * 更新用户
+ * @param userDTO
+ * @return
+ */
+ @Override
+ @CacheEvict(value = CacheConstants.USER_DETAILS_MINI, key = "#userDTO.username")
+ public Boolean updateUser(AppUserDTO userDTO) {
+ AppUser appUser = new AppUser();
+ BeanUtils.copyProperties(userDTO, appUser);
+ if (StrUtil.isNotBlank(userDTO.getPassword())) {
+ appUser.setPassword(ENCODER.encode(userDTO.getPassword()));
+ }
+ this.updateById(appUser);
+
+ appUserRoleService.remove(Wrappers.lambdaQuery().eq(AppUserRole::getUserId, appUser.getUserId()));
+ userDTO.getRole().forEach(roleId -> {
+ AppUserRole appUserRole = new AppUserRole();
+ appUserRole.setRoleId(roleId);
+ appUserRole.setUserId(userDTO.getUserId());
+ appUserRole.insert();
+ });
+ return Boolean.TRUE;
+ }
+
+ /**
+ * 新增用户
+ * @param userDTO
+ * @return
+ */
+ @Override
+ public Boolean saveUser(AppUserDTO userDTO) {
+ AppUser appUser = new AppUser();
+ BeanUtils.copyProperties(userDTO, appUser);
+ appUser.setDelFlag(CommonConstants.STATUS_NORMAL);
+ appUser.setPassword(ENCODER.encode(userDTO.getPassword()));
+ baseMapper.insert(appUser);
+ // 如果角色为空,赋默认角色
+ if (CollUtil.isNotEmpty(userDTO.getRole())) {
+ List userRoleList = userDTO.getRole().stream().map(roleId -> {
+ AppUserRole userRole = new AppUserRole();
+ userRole.setUserId(appUser.getUserId());
+ userRole.setRoleId(roleId);
+ return userRole;
+ }).collect(Collectors.toList());
+ appUserRoleService.saveBatch(userRoleList);
+ }
+ return Boolean.TRUE;
+ }
+
+ /**
+ * 查询全部的用户
+ * @param appUser
+ * @return
+ */
+ @Override
+ public List listUser(AppUserDTO appUser) {
+ List appUsers = baseMapper.selectList(null);
+ List appUserExcelVOS = appUsers.stream().map(item -> {
+ AppUserExcelVO appUserExcelVO = new AppUserExcelVO();
+ BeanUtils.copyProperties(item, appUserExcelVO);
+ return appUserExcelVO;
+ }).collect(Collectors.toList());
+ return appUserExcelVOS;
+ }
+
+ @Override
+ public IPage getUsersWithRolePage(Page page, AppUserDTO appUserDTO) {
+ return baseMapper.getUserVosPage(page, appUserDTO);
+ }
+
+ @Override
+ public AppUserInfo findUserInfo(AppUser user) {
+ AppUserInfo info = new AppUserInfo();
+ info.setAppUser(user);
+ // 设置角色列表 (ID)
+ List roleIds = appRoleService.findRolesByUserId(user.getUserId())
+ .stream()
+ .map(AppRole::getRoleId)
+ .collect(Collectors.toList());
+ info.setRoles(ArrayUtil.toArray(roleIds, Long.class));
+
+ // 设置权限列表(menu.permission)
+ Set permissions = new HashSet<>();
+ info.setPermissions(ArrayUtil.toArray(permissions, String.class));
+ return info;
+ }
+
+ @Override
+ @CacheEvict(value = CacheConstants.USER_DETAILS_MINI, key = "#userDto.username")
+ public R updateUserInfo(AppUserDTO userDto) {
+ // C端客户修改手机号需要判断验证码是否正确
+ PjcloudUser user = SecurityUtils.getUser();
+ if (UserTypeEnum.TOC.getStatus().equals(user.getUserType()) && StrUtil.isNotBlank(userDto.getPhone())) {
+ String key = CacheConstants.DEFAULT_CODE_KEY + LoginTypeEnum.APPSMS.getType() + StringPool.AT
+ + userDto.getPhone();
+ String codeObj = redisTemplate.opsForValue().get(key);
+
+ if (!userDto.getMobileCode().equals(codeObj)) {
+ return R.failed("验证码错误");
+ }
+ }
+
+ // 更新密码
+ if (StrUtil.isNotBlank(userDto.getPassword())) {
+ userDto.setPassword(ENCODER.encode(userDto.getPassword()));
+ }
+
+ AppUser appUser = baseMapper.selectById(userDto.getUserId());
+ BeanUtils.copyProperties(userDto, appUser);
+ return R.ok(this.updateById(appUser));
+ }
+
+ @Override
+ public AppUserVO selectUserVoById(Long userId) {
+ return baseMapper.getUserVoById(userId);
+ }
+
+ /**
+ * 删除user用户同时删除user-role关系表
+ * @param ids userIds
+ */
+ @Override
+ public Boolean deleteAppUserByIds(Long[] ids) {
+ Cache cache = cacheManager.getCache(CacheConstants.USER_DETAILS_MINI);
+ for (AppUser appUser : baseMapper.selectBatchIds(CollUtil.toList(ids))) {
+ cache.evict(appUser.getUsername());
+ }
+ // 删除用户关联表
+ this.appUserRoleService
+ .remove(Wrappers.lambdaQuery().in(AppUserRole::getUserId, CollUtil.toList(ids)));
+
+ this.removeBatchByIds(CollUtil.toList(ids));
+
+ return Boolean.TRUE;
+
+ }
+
+ @Override
+ public R registerAppUser(AppUserDTO appUser) {
+ List appUserList = baseMapper
+ .selectList(Wrappers.lambdaQuery().eq(AppUser::getPhone, appUser.getPhone()));
+
+ if (CollUtil.isNotEmpty(appUserList)) {
+ return R.failed("手机号已注册,请使用验证码直接登录");
+ }
+
+ String key = CacheConstants.DEFAULT_CODE_KEY + LoginTypeEnum.APPSMS.getType() + StringPool.AT
+ + appUser.getPhone();
+ String codeObj = redisTemplate.opsForValue().get(key);
+
+ if (!appUser.getMobileCode().equals(codeObj)) {
+ return R.failed("验证码错误");
+ }
+
+ AppUser app = new AppUser();
+ BeanUtils.copyProperties(appUser, app);
+ appUser.setUsername(app.getPhone());
+ appUser.setDelFlag(CommonConstants.STATUS_NORMAL);
+ appUser.setPassword(ENCODER.encode(appUser.getPassword()));
+ baseMapper.insert(appUser);
+ return null;
+ }
+
+ /**
+ * @param excelVOList
+ * @param bindingResult
+ * @return
+ */
+ @Override
+ public R importUser(List excelVOList, BindingResult bindingResult) {
+ // 通用校验获取失败的数据
+ List errorMessageList = (List) bindingResult.getTarget();
+
+ // 执行数据插入操作 组装 UserDto
+ for (AppUserExcelVO excel : excelVOList) {
+ // 个性化校验逻辑
+ List userList = this.list();
+ List roleList = appRoleService.list();
+
+ Set errorMsg = new HashSet<>();
+ // 校验用户名是否存在
+ boolean exsitUserName = userList.stream()
+ .anyMatch(sysUser -> excel.getUsername().equals(sysUser.getUsername()));
+
+ if (exsitUserName) {
+ errorMsg.add(MsgUtils.getMessage(ErrorCodes.SYS_USER_USERNAME_EXISTING, excel.getUsername()));
+ }
+
+ // 判断输入的角色名称列表是否合法
+ List roleNameList = StrUtil.split(excel.getRoleNameList(), StrUtil.COMMA);
+ List roleCollList = roleList.stream()
+ .filter(role -> roleNameList.stream().anyMatch(name -> role.getRoleName().equals(name)))
+ .collect(Collectors.toList());
+
+ if (roleCollList.size() != roleNameList.size()) {
+ errorMsg.add(MsgUtils.getMessage(ErrorCodes.SYS_ROLE_ROLENAME_INEXISTENCE, excel.getRoleNameList()));
+ }
+ // 数据合法情况
+ if (CollUtil.isEmpty(errorMsg)) {
+ insertExcelUser(excel, roleCollList);
+ }
+ else {
+ // 数据不合法情况
+ errorMessageList.add(new ErrorMessage(excel.getLineNum(), errorMsg));
+ }
+
+ }
+
+ if (CollUtil.isNotEmpty(errorMessageList)) {
+ return R.failed(errorMessageList);
+ }
+ return R.ok(null, MsgUtils.getMessage(ErrorCodes.SYS_USER_IMPORT_SUCCEED));
+
+ }
+
+ private void insertExcelUser(AppUserExcelVO excel, List roleCollList) {
+ AppUserDTO userDTO = new AppUserDTO();
+ userDTO.setUsername(excel.getUsername());
+ userDTO.setPhone(excel.getPhone());
+ userDTO.setNickname(excel.getNickname());
+ userDTO.setName(excel.getName());
+ userDTO.setEmail(excel.getEmail());
+ // 批量导入初始密码为手机号
+ userDTO.setPassword(userDTO.getPhone());
+ // 根据角色名称查询角色ID
+ List roleIdList = roleCollList.stream().map(AppRole::getRoleId).collect(Collectors.toList());
+ userDTO.setRole(roleIdList);
+ // 插入用户
+ this.saveUser(userDTO);
+ }
+
+}
diff --git a/pjcloud-app-server/pjcloud-app-server-biz/src/main/resources/application.yml b/pjcloud-app-server/pjcloud-app-server-biz/src/main/resources/application.yml
new file mode 100644
index 00000000..db8f394a
--- /dev/null
+++ b/pjcloud-app-server/pjcloud-app-server-biz/src/main/resources/application.yml
@@ -0,0 +1,18 @@
+server:
+ port: 7060
+
+spring:
+ application:
+ name: @artifactId@
+ cloud:
+ nacos:
+ username: @nacos.username@
+ password: @nacos.password@
+ discovery:
+ server-addr: ${NACOS_HOST:pjcloud-register}:${NACOS_PORT:8848}
+ config:
+ server-addr: ${spring.cloud.nacos.discovery.server-addr}
+ config:
+ import:
+ - optional:nacos:application-@profiles.active@.yml
+ - optional:nacos:${spring.application.name}-@profiles.active@.yml
diff --git a/pjcloud-app-server/pjcloud-app-server-biz/src/main/resources/logback-spring.xml b/pjcloud-app-server/pjcloud-app-server-biz/src/main/resources/logback-spring.xml
new file mode 100644
index 00000000..294dd57f
--- /dev/null
+++ b/pjcloud-app-server/pjcloud-app-server-biz/src/main/resources/logback-spring.xml
@@ -0,0 +1,70 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ${CONSOLE_LOG_PATTERN}
+
+
+
+
+
+ ${log.path}/debug.log
+
+ ${log.path}/%d{yyyy-MM, aux}/debug.%d{yyyy-MM-dd}.%i.log.gz
+ 50MB
+ 30
+
+
+ %date [%thread] %-5level [%logger{50}] %file:%line - %msg%n
+
+
+
+
+
+ ${log.path}/error.log
+
+ ${log.path}/%d{yyyy-MM}/error.%d{yyyy-MM-dd}.%i.log.gz
+ 50MB
+ 30
+
+
+ %date [%thread] %-5level [%logger{50}] %file:%line - %msg%n
+
+
+ ERROR
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pjcloud-app-server/pjcloud-app-server-biz/src/main/resources/mapper/AppArticleCategoryMapper.xml b/pjcloud-app-server/pjcloud-app-server-biz/src/main/resources/mapper/AppArticleCategoryMapper.xml
new file mode 100644
index 00000000..cf791584
--- /dev/null
+++ b/pjcloud-app-server/pjcloud-app-server-biz/src/main/resources/mapper/AppArticleCategoryMapper.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pjcloud-app-server/pjcloud-app-server-biz/src/main/resources/mapper/AppArticleCollectMapper.xml b/pjcloud-app-server/pjcloud-app-server-biz/src/main/resources/mapper/AppArticleCollectMapper.xml
new file mode 100644
index 00000000..132c3c85
--- /dev/null
+++ b/pjcloud-app-server/pjcloud-app-server-biz/src/main/resources/mapper/AppArticleCollectMapper.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pjcloud-app-server/pjcloud-app-server-biz/src/main/resources/mapper/AppArticleMapper.xml b/pjcloud-app-server/pjcloud-app-server-biz/src/main/resources/mapper/AppArticleMapper.xml
new file mode 100644
index 00000000..291f505f
--- /dev/null
+++ b/pjcloud-app-server/pjcloud-app-server-biz/src/main/resources/mapper/AppArticleMapper.xml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pjcloud-app-server/pjcloud-app-server-biz/src/main/resources/mapper/AppPageMapper.xml b/pjcloud-app-server/pjcloud-app-server-biz/src/main/resources/mapper/AppPageMapper.xml
new file mode 100644
index 00000000..cacd7292
--- /dev/null
+++ b/pjcloud-app-server/pjcloud-app-server-biz/src/main/resources/mapper/AppPageMapper.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pjcloud-app-server/pjcloud-app-server-biz/src/main/resources/mapper/AppRoleMapper.xml b/pjcloud-app-server/pjcloud-app-server-biz/src/main/resources/mapper/AppRoleMapper.xml
new file mode 100644
index 00000000..a284a865
--- /dev/null
+++ b/pjcloud-app-server/pjcloud-app-server-biz/src/main/resources/mapper/AppRoleMapper.xml
@@ -0,0 +1,52 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ SELECT app_role.role_id,
+ app_role.role_name,
+ app_role.role_code,
+ app_role.role_desc,
+ app_role.create_time,
+ app_role.update_time,
+ app_role.del_flag
+ FROM app_role,
+ app_user_role
+ WHERE app_role.role_id = app_user_role.role_id
+ AND app_role.del_flag = '0'
+ and app_user_role.user_id = #{userId}
+
+
diff --git a/pjcloud-app-server/pjcloud-app-server-biz/src/main/resources/mapper/AppTabbarMapper.xml b/pjcloud-app-server/pjcloud-app-server-biz/src/main/resources/mapper/AppTabbarMapper.xml
new file mode 100644
index 00000000..76f6e0a4
--- /dev/null
+++ b/pjcloud-app-server/pjcloud-app-server-biz/src/main/resources/mapper/AppTabbarMapper.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pjcloud-app-server/pjcloud-app-server-biz/src/main/resources/mapper/AppUserMapper.xml b/pjcloud-app-server/pjcloud-app-server-biz/src/main/resources/mapper/AppUserMapper.xml
new file mode 100644
index 00000000..962e4011
--- /dev/null
+++ b/pjcloud-app-server/pjcloud-app-server-biz/src/main/resources/mapper/AppUserMapper.xml
@@ -0,0 +1,97 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ select
+ u.user_id,
+ u.username,
+ u.password,
+ u.phone,
+ u.avatar,
+ u.create_time,
+ u.del_flag,
+ u.lock_flag,
+ u.tenant_id,
+ u.nickname,
+ u.name,
+ u.email
+ from app_user u
+
+ u.del_flag = '0'
+
+
+ AND u.username LIKE #{usernameLike}
+
+
+
+
+
+ u.user_id,
+ u.username,
+ u.password,
+ u.salt,
+ u.phone,
+ u.avatar,
+ u.wx_openid,
+ u.del_flag,
+ u.lock_flag,
+ u.tenant_id,
+ u.nickname,
+ u.name,
+ u.email,
+ u.create_by,
+ u.create_time ucreate_time,
+ u.update_time uupdate_time,
+ r.role_id
+
+
+
+ SELECT
+
+ FROM
+ app_user u
+ LEFT JOIN app_user_role urole ON urole.user_id = u.user_id
+ LEFT JOIN app_role r ON r.role_id = urole.role_id
+ WHERE
+ u.user_id = #{id}
+
+
diff --git a/pjcloud-app-server/pjcloud-app-server-biz/src/main/resources/mapper/AppUserRoleMapper.xml b/pjcloud-app-server/pjcloud-app-server-biz/src/main/resources/mapper/AppUserRoleMapper.xml
new file mode 100644
index 00000000..7f895097
--- /dev/null
+++ b/pjcloud-app-server/pjcloud-app-server-biz/src/main/resources/mapper/AppUserRoleMapper.xml
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pjcloud-app-server/pom.xml b/pjcloud-app-server/pom.xml
new file mode 100644
index 00000000..6aeca4bc
--- /dev/null
+++ b/pjcloud-app-server/pom.xml
@@ -0,0 +1,21 @@
+
+
+
+ 4.0.0
+
+
+ com.bsd
+ pjcloud
+ 5.7.0
+
+
+ pjcloud-app-server
+ pom
+
+
+
+ pjcloud-app-server-api
+ pjcloud-app-server-biz
+
+
diff --git a/pjcloud-auth/Dockerfile b/pjcloud-auth/Dockerfile
new file mode 100644
index 00000000..6ed515e5
--- /dev/null
+++ b/pjcloud-auth/Dockerfile
@@ -0,0 +1,19 @@
+FROM registry.cn-hangzhou.aliyuncs.com/dockerhub_mirror/java:21-anolis
+
+MAINTAINER wangiegie@gmail.com
+
+ENV TZ=Asia/Shanghai
+ENV LANG C.UTF-8
+ENV JAVA_OPTS="-Xms128m -Xmx256m -Djava.security.egd=file:/dev/./urandom"
+
+RUN ln -sf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
+
+RUN mkdir -p /pjcloud-auth
+
+WORKDIR /pjcloud-auth
+
+EXPOSE 3000
+
+ADD ./target/pjcloud-auth.jar ./
+
+CMD sleep 120;java $JAVA_OPTS -jar pjcloud-auth.jar
diff --git a/pjcloud-auth/pom.xml b/pjcloud-auth/pom.xml
new file mode 100644
index 00000000..6b2546f0
--- /dev/null
+++ b/pjcloud-auth/pom.xml
@@ -0,0 +1,147 @@
+
+
+
+
+ 4.0.0
+
+ com.bsd
+ pjcloud
+ 5.7.0
+
+
+ pjcloud-auth
+ jar
+
+ pjcloud 认证授权中心,基于 spring security oAuth2
+
+
+
+
+ com.alibaba.cloud
+ spring-cloud-starter-alibaba-nacos-discovery
+
+
+
+ com.alibaba.cloud
+ spring-cloud-starter-alibaba-nacos-config
+
+
+
+ com.bsd
+ pjcloud-common-log
+
+
+
+ com.bsd
+ pjcloud-common-security
+
+
+
+ com.bsd
+ pjcloud-common-feign
+
+
+
+ com.bsd
+ pjcloud-common-data
+
+
+
+ com.bsd
+ pjcloud-common-sentinel
+
+
+
+ com.bsd
+ pjcloud-common-gray
+
+
+
+ org.springframework.boot
+ spring-boot-starter-freemarker
+
+
+
+ cn.hutool
+ hutool-crypto
+
+
+
+ io.springboot.plugin
+ captcha-core
+ ${captcha.image.version}
+
+
+
+ io.springboot.plugin
+ spring-boot-starter-captcha
+ ${captcha.version}
+
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+
+ org.springframework.boot
+ spring-boot-starter-undertow
+
+
+
+
+
+ cloud
+
+ true
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+ repackage
+
+
+ CLASSIC
+
+
+
+
+
+ io.fabric8
+ docker-maven-plugin
+
+ false
+
+
+
+
+
+
+ boot
+
+
+
+
diff --git a/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/PjcloudAuthApplication.java b/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/PjcloudAuthApplication.java
new file mode 100644
index 00000000..d05a8a7b
--- /dev/null
+++ b/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/PjcloudAuthApplication.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.bsd.pjcloud.auth;
+
+import com.bsd.pjcloud.common.feign.annotation.EnablePjcloudFeignClients;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
+
+/**
+ * @author pjcloud
+ * @date 2018年06月21日 认证授权中心
+ */
+@EnablePjcloudFeignClients
+@EnableDiscoveryClient
+@SpringBootApplication
+public class PjcloudAuthApplication {
+
+ public static void main(String[] args) {
+ SpringApplication.run(PjcloudAuthApplication.class, args);
+ }
+
+}
diff --git a/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/config/AuthorizationServerConfiguration.java b/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/config/AuthorizationServerConfiguration.java
new file mode 100644
index 00000000..aeda7749
--- /dev/null
+++ b/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/config/AuthorizationServerConfiguration.java
@@ -0,0 +1,186 @@
+/*
+ * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.bsd.pjcloud.auth.config;
+
+import com.bsd.pjcloud.auth.support.CustomeOAuth2AccessTokenGenerator;
+import com.bsd.pjcloud.auth.support.core.CustomeOAuth2TokenCustomizer;
+import com.bsd.pjcloud.auth.support.core.FormIdentityLoginConfigurer;
+import com.bsd.pjcloud.auth.support.core.PjcloudDaoAuthenticationProvider;
+import com.bsd.pjcloud.auth.support.core.PjcloudOAuth2RefreshTokenAuthenticationConverter;
+import com.bsd.pjcloud.auth.support.filter.PasswordDecoderFilter;
+import com.bsd.pjcloud.auth.support.filter.ValidateCodeFilter;
+import com.bsd.pjcloud.auth.support.handler.PjcloudAuthenticationFailureEventHandler;
+import com.bsd.pjcloud.auth.support.handler.PjcloudAuthenticationSuccessEventHandler;
+import com.bsd.pjcloud.auth.support.password.OAuth2ResourceOwnerPasswordAuthenticationConverter;
+import com.bsd.pjcloud.auth.support.password.OAuth2ResourceOwnerPasswordAuthenticationProvider;
+import com.bsd.pjcloud.auth.support.sms.OAuth2ResourceOwnerSmsAuthenticationConverter;
+import com.bsd.pjcloud.auth.support.sms.OAuth2ResourceOwnerSmsAuthenticationProvider;
+import com.bsd.pjcloud.common.core.constant.SecurityConstants;
+import com.bsd.pjcloud.common.security.handler.FormAuthenticationFailureHandler;
+import com.bsd.pjcloud.common.security.handler.SsoLogoutSuccessHandler;
+import lombok.RequiredArgsConstructor;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.core.Ordered;
+import org.springframework.core.annotation.Order;
+import org.springframework.security.authentication.AuthenticationManager;
+import org.springframework.security.config.Customizer;
+import org.springframework.security.config.annotation.web.builders.HttpSecurity;
+import org.springframework.security.oauth2.server.authorization.OAuth2AuthorizationService;
+import org.springframework.security.oauth2.server.authorization.config.annotation.web.configurers.OAuth2AuthorizationServerConfigurer;
+import org.springframework.security.oauth2.server.authorization.settings.AuthorizationServerSettings;
+import org.springframework.security.oauth2.server.authorization.token.DelegatingOAuth2TokenGenerator;
+import org.springframework.security.oauth2.server.authorization.token.OAuth2RefreshTokenGenerator;
+import org.springframework.security.oauth2.server.authorization.token.OAuth2TokenGenerator;
+import org.springframework.security.oauth2.server.authorization.web.authentication.DelegatingAuthenticationConverter;
+import org.springframework.security.oauth2.server.authorization.web.authentication.OAuth2AuthorizationCodeAuthenticationConverter;
+import org.springframework.security.oauth2.server.authorization.web.authentication.OAuth2AuthorizationCodeRequestAuthenticationConverter;
+import org.springframework.security.oauth2.server.authorization.web.authentication.OAuth2ClientCredentialsAuthenticationConverter;
+import org.springframework.security.web.DefaultSecurityFilterChain;
+import org.springframework.security.web.SecurityFilterChain;
+import org.springframework.security.web.authentication.AuthenticationConverter;
+import org.springframework.security.web.authentication.AuthenticationFailureHandler;
+import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
+import org.springframework.security.web.authentication.logout.LogoutSuccessHandler;
+import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
+
+import java.util.Arrays;
+
+/**
+ * @author pjcloud
+ * @date 2022/5/27
+ *
+ * 认证服务器配置
+ */
+@Configuration
+@RequiredArgsConstructor
+public class AuthorizationServerConfiguration {
+
+ private final OAuth2AuthorizationService authorizationService;
+
+ private final PasswordDecoderFilter passwordDecoderFilter;
+
+ private final ValidateCodeFilter validateCodeFilter;
+
+ @Bean
+ @Order(Ordered.HIGHEST_PRECEDENCE)
+ @ConditionalOnProperty(value = "security.micro", matchIfMissing = true)
+ public SecurityFilterChain authorizationServerSecurityFilterChain(HttpSecurity http,
+ PjcloudAuthenticationSuccessEventHandler successEventHandler,
+ PjcloudAuthenticationFailureEventHandler failureEventHandler) throws Exception {
+ // 增加验证码过滤器
+ http.addFilterBefore(validateCodeFilter, UsernamePasswordAuthenticationFilter.class);
+ // 增加密码解密过滤器
+ http.addFilterBefore(passwordDecoderFilter, UsernamePasswordAuthenticationFilter.class);
+
+ OAuth2AuthorizationServerConfigurer authorizationServerConfigurer = new OAuth2AuthorizationServerConfigurer();
+ http.with(authorizationServerConfigurer.tokenEndpoint((tokenEndpoint) -> {// 个性化认证授权端点
+ tokenEndpoint.accessTokenRequestConverter(accessTokenRequestConverter()) // 注入自定义的授权认证Converter
+ .accessTokenResponseHandler(successEventHandler) // 登录成功处理器
+ .errorResponseHandler(failureEventHandler);// 登录失败处理器
+ }).clientAuthentication(oAuth2ClientAuthenticationConfigurer -> // 个性化客户端认证
+ oAuth2ClientAuthenticationConfigurer.errorResponseHandler(failureEventHandler))// 处理客户端认证异常
+ .authorizationEndpoint(authorizationEndpoint -> authorizationEndpoint// 授权码端点个性化confirm页面
+ .consentPage(SecurityConstants.CUSTOM_CONSENT_PAGE_URI)), Customizer.withDefaults());
+
+ AntPathRequestMatcher[] requestMatchers = new AntPathRequestMatcher[]{
+ AntPathRequestMatcher.antMatcher("/token/**"), AntPathRequestMatcher.antMatcher("/actuator/**"),
+ AntPathRequestMatcher.antMatcher("/code/**"), AntPathRequestMatcher.antMatcher("/css/**"),
+ AntPathRequestMatcher.antMatcher("/error")};
+
+ http.authorizeHttpRequests(authorizeRequests -> {
+ // 自定义接口、端点暴露
+ authorizeRequests.requestMatchers(requestMatchers).permitAll();
+ authorizeRequests.anyRequest().authenticated();
+ })
+ .with(authorizationServerConfigurer.authorizationService(authorizationService)// redis存储token的实现
+ .authorizationServerSettings(
+ AuthorizationServerSettings.builder().issuer(SecurityConstants.PIGX_LICENSE).build()), Customizer.withDefaults());
+ http.with(new FormIdentityLoginConfigurer(), Customizer.withDefaults());
+ DefaultSecurityFilterChain securityFilterChain = http.build();
+
+ // 注入自定义授权模式实现
+ addCustomOAuth2GrantAuthenticationProvider(http);
+ return securityFilterChain;
+ }
+
+ /**
+ * 令牌生成规则实现
+ * client:username:uuid
+ *
+ * @return OAuth2TokenGenerator
+ */
+ @Bean
+ public OAuth2TokenGenerator oAuth2TokenGenerator() {
+ CustomeOAuth2AccessTokenGenerator accessTokenGenerator = new CustomeOAuth2AccessTokenGenerator();
+ // 注入Token 增加关联用户信息
+ accessTokenGenerator.setAccessTokenCustomizer(new CustomeOAuth2TokenCustomizer());
+ return new DelegatingOAuth2TokenGenerator(accessTokenGenerator, new OAuth2RefreshTokenGenerator());
+ }
+
+ @Bean
+ public AuthenticationFailureHandler authenticationFailureHandler() {
+ return new FormAuthenticationFailureHandler();
+ }
+
+ @Bean
+ public LogoutSuccessHandler logoutSuccessHandler() {
+ return new SsoLogoutSuccessHandler();
+ }
+
+ /**
+ * request -> xToken 注入请求转换器
+ *
+ * @return DelegatingAuthenticationConverter
+ */
+ @Bean
+ public AuthenticationConverter accessTokenRequestConverter() {
+ return new DelegatingAuthenticationConverter(Arrays.asList(
+ new OAuth2ResourceOwnerPasswordAuthenticationConverter(),
+ new OAuth2ResourceOwnerSmsAuthenticationConverter(), new PjcloudOAuth2RefreshTokenAuthenticationConverter(),
+ new OAuth2ClientCredentialsAuthenticationConverter(),
+ new OAuth2AuthorizationCodeAuthenticationConverter(),
+ new OAuth2AuthorizationCodeRequestAuthenticationConverter()));
+ }
+
+ /**
+ * 注入授权模式实现提供方
+ *
+ * 1. 密码模式
+ * 2. 短信登录
+ */
+ @SuppressWarnings("unchecked")
+ private void addCustomOAuth2GrantAuthenticationProvider(HttpSecurity http) {
+ AuthenticationManager authenticationManager = http.getSharedObject(AuthenticationManager.class);
+ OAuth2AuthorizationService authorizationService = http.getSharedObject(OAuth2AuthorizationService.class);
+
+ OAuth2ResourceOwnerPasswordAuthenticationProvider resourceOwnerPasswordAuthenticationProvider = new OAuth2ResourceOwnerPasswordAuthenticationProvider(
+ authenticationManager, authorizationService, oAuth2TokenGenerator());
+
+ OAuth2ResourceOwnerSmsAuthenticationProvider resourceOwnerSmsAuthenticationProvider = new OAuth2ResourceOwnerSmsAuthenticationProvider(
+ authenticationManager, authorizationService, oAuth2TokenGenerator());
+
+ // 处理 UsernamePasswordAuthenticationToken
+ http.authenticationProvider(new PjcloudDaoAuthenticationProvider());
+ // 处理 OAuth2ResourceOwnerPasswordAuthenticationToken
+ http.authenticationProvider(resourceOwnerPasswordAuthenticationProvider);
+ // 处理 OAuth2ResourceOwnerSmsAuthenticationToken
+ http.authenticationProvider(resourceOwnerSmsAuthenticationProvider);
+ }
+
+}
diff --git a/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/endpoint/CaptchaCacheServiceProvider.java b/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/endpoint/CaptchaCacheServiceProvider.java
new file mode 100644
index 00000000..a15da84b
--- /dev/null
+++ b/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/endpoint/CaptchaCacheServiceProvider.java
@@ -0,0 +1,52 @@
+package com.bsd.pjcloud.auth.endpoint;
+
+import com.anji.captcha.service.CaptchaCacheService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.redis.core.StringRedisTemplate;
+
+import java.util.concurrent.TimeUnit;
+
+/**
+ * @author pjcloud
+ * @date 2020/8/27
+ *
+ * 验证码 缓存提供支持集群,需要通过SPI
+ */
+public class CaptchaCacheServiceProvider implements CaptchaCacheService {
+
+ private static final String REDIS = "redis";
+
+ @Autowired
+ private StringRedisTemplate stringRedisTemplate;
+
+ @Override
+ public void set(String key, String value, long expiresInSeconds) {
+ stringRedisTemplate.opsForValue().set(key, value, expiresInSeconds, TimeUnit.SECONDS);
+ }
+
+ @Override
+ public boolean exists(String key) {
+ return stringRedisTemplate.hasKey(key);
+ }
+
+ @Override
+ public void delete(String key) {
+ stringRedisTemplate.delete(key);
+ }
+
+ @Override
+ public String get(String key) {
+ return stringRedisTemplate.opsForValue().get(key);
+ }
+
+ @Override
+ public String type() {
+ return REDIS;
+ }
+
+ @Override
+ public Long increment(String key, long val) {
+ return stringRedisTemplate.opsForValue().increment(key, val);
+ }
+
+}
diff --git a/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/endpoint/ImageCodeEndpoint.java b/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/endpoint/ImageCodeEndpoint.java
new file mode 100644
index 00000000..3aad570e
--- /dev/null
+++ b/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/endpoint/ImageCodeEndpoint.java
@@ -0,0 +1,89 @@
+package com.bsd.pjcloud.auth.endpoint;
+
+import cn.hutool.core.lang.Validator;
+import com.anji.captcha.model.vo.CaptchaVO;
+import com.anji.captcha.service.CaptchaService;
+import com.bsd.pjcloud.common.core.constant.CacheConstants;
+import com.bsd.pjcloud.common.core.constant.CommonConstants;
+import com.bsd.pjcloud.common.core.constant.SecurityConstants;
+import com.bsd.pjcloud.common.core.util.R;
+import com.bsd.pjcloud.common.core.util.SpringContextHolder;
+import io.springboot.captcha.ArithmeticCaptcha;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
+import lombok.RequiredArgsConstructor;
+import lombok.SneakyThrows;
+import org.springframework.data.redis.core.StringRedisTemplate;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.concurrent.TimeUnit;
+
+/**
+ * 验证码相关的接口
+ *
+ * @author pjcloud
+ * @date 2022/6/27
+ */
+@RestController
+@RequestMapping("/code")
+@RequiredArgsConstructor
+public class ImageCodeEndpoint {
+
+ private static final Integer DEFAULT_IMAGE_WIDTH = 100;
+
+ private static final Integer DEFAULT_IMAGE_HEIGHT = 40;
+
+ private final StringRedisTemplate redisTemplate;
+
+ /**
+ * 创建图形验证码
+ */
+ @SneakyThrows
+ @GetMapping("/image")
+ public void image(String randomStr, HttpServletResponse response) {
+ ArithmeticCaptcha captcha = new ArithmeticCaptcha(DEFAULT_IMAGE_WIDTH, DEFAULT_IMAGE_HEIGHT);
+
+ String result = captcha.text();
+
+ // 如果是手机号码,不存储下发验证码
+ if (Validator.isMobile(randomStr)) {
+ return;
+ }
+
+ redisTemplate.opsForValue()
+ .set(CacheConstants.DEFAULT_CODE_KEY + randomStr, result, SecurityConstants.CODE_TIME, TimeUnit.SECONDS);
+ // 转换流信息写出
+ captcha.out(response.getOutputStream());
+ }
+
+ /**
+ * 行为 创建滑块图形验证码
+ */
+ @SneakyThrows
+ @GetMapping("/create")
+ public R behavior() {
+ CaptchaVO vo = new CaptchaVO();
+ vo.setCaptchaType(CommonConstants.IMAGE_CODE_TYPE);
+ CaptchaService captchaService = SpringContextHolder.getBean(CaptchaService.class);
+ return R.ok(captchaService.get(vo));
+ }
+
+ /**
+ * 行为 创建滑块图形验证码
+ */
+ @SneakyThrows
+ @PostMapping("/check")
+ public R check(HttpServletRequest request) {
+ CaptchaVO vo = new CaptchaVO();
+ vo.setPointJson(request.getParameter("pointJson"));
+ vo.setToken(request.getParameter("token"));
+ vo.setCaptchaType(CommonConstants.IMAGE_CODE_TYPE);
+
+ CaptchaService captchaService = SpringContextHolder.getBean(CaptchaService.class);
+ return R.ok(captchaService.check(vo));
+ }
+
+}
diff --git a/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/endpoint/PjcloudTokenEndpoint.java b/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/endpoint/PjcloudTokenEndpoint.java
new file mode 100644
index 00000000..be9275e7
--- /dev/null
+++ b/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/endpoint/PjcloudTokenEndpoint.java
@@ -0,0 +1,255 @@
+/*
+ * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.bsd.pjcloud.auth.endpoint;
+
+import cn.hutool.core.date.DatePattern;
+import cn.hutool.core.date.TemporalAccessorUtil;
+import cn.hutool.core.map.MapUtil;
+import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.bsd.pjcloud.admin.api.entity.SysOauthClientDetails;
+import com.bsd.pjcloud.admin.api.entity.SysTenant;
+import com.bsd.pjcloud.admin.api.feign.RemoteClientDetailsService;
+import com.bsd.pjcloud.admin.api.feign.RemoteTenantService;
+import com.bsd.pjcloud.admin.api.vo.TokenVO;
+import com.bsd.pjcloud.common.core.constant.CacheConstants;
+import com.bsd.pjcloud.common.core.constant.CommonConstants;
+import com.bsd.pjcloud.common.core.constant.SecurityConstants;
+import com.bsd.pjcloud.common.core.util.KeyStrResolver;
+import com.bsd.pjcloud.common.core.util.R;
+import com.bsd.pjcloud.common.core.util.RetOps;
+import com.bsd.pjcloud.common.core.util.SpringContextHolder;
+import com.bsd.pjcloud.common.security.annotation.Inner;
+import com.bsd.pjcloud.common.security.service.PjcloudUser;
+import com.bsd.pjcloud.common.security.util.OAuth2ErrorCodesExpand;
+import com.bsd.pjcloud.common.security.util.OAuthClientException;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
+import lombok.RequiredArgsConstructor;
+import lombok.SneakyThrows;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.cache.CacheManager;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.server.ServletServerHttpResponse;
+import org.springframework.security.authentication.event.LogoutSuccessEvent;
+import org.springframework.security.core.Authentication;
+import org.springframework.security.oauth2.core.OAuth2AccessToken;
+import org.springframework.security.oauth2.core.endpoint.OAuth2ParameterNames;
+import org.springframework.security.oauth2.server.authorization.OAuth2Authorization;
+import org.springframework.security.oauth2.server.authorization.OAuth2AuthorizationService;
+import org.springframework.security.oauth2.server.authorization.OAuth2TokenType;
+import org.springframework.security.web.authentication.preauth.PreAuthenticatedAuthenticationToken;
+import org.springframework.util.StringUtils;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.servlet.ModelAndView;
+
+import java.security.Principal;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+/**
+ * @author pjcloud
+ * @date 2019/2/1 删除token端点
+ */
+@Slf4j
+@RestController
+@RequiredArgsConstructor
+@RequestMapping("/token")
+public class PjcloudTokenEndpoint {
+
+ private final OAuth2AuthorizationService authorizationService;
+
+ private final RemoteClientDetailsService clientDetailsService;
+
+ private final RedisTemplate redisTemplate;
+
+ private final RemoteTenantService tenantService;
+
+ private final KeyStrResolver tenantKeyStrResolver;
+
+ private final CacheManager cacheManager;
+
+ /**
+ * 认证页面
+ * @param modelAndView
+ * @param error 表单登录失败处理回调的错误信息
+ * @return ModelAndView
+ */
+ @GetMapping("/login")
+ public ModelAndView require(ModelAndView modelAndView, @RequestParam(required = false) String error) {
+ modelAndView.setViewName("ftl/login");
+ modelAndView.addObject("error", error);
+
+ R> tenantList = tenantService.list();
+ modelAndView.addObject("tenantList", tenantList.getData());
+ return modelAndView;
+ }
+
+ @GetMapping("/confirm_access")
+ public ModelAndView confirm(Principal principal, ModelAndView modelAndView,
+ @RequestParam(OAuth2ParameterNames.CLIENT_ID) String clientId,
+ @RequestParam(OAuth2ParameterNames.SCOPE) String scope,
+ @RequestParam(OAuth2ParameterNames.STATE) String state) {
+ SysOauthClientDetails clientDetails = RetOps
+ .of(clientDetailsService.getClientDetailsById(clientId))
+ .getData()
+ .orElseThrow(() -> new OAuthClientException("clientId 不合法"));
+
+ Set authorizedScopes = StringUtils.commaDelimitedListToSet(clientDetails.getScope());
+ modelAndView.addObject("clientId", clientId);
+ modelAndView.addObject("state", state);
+ modelAndView.addObject("scopeList", authorizedScopes);
+ modelAndView.addObject("principalName", principal.getName());
+ modelAndView.setViewName("ftl/confirm");
+ return modelAndView;
+ }
+
+ /**
+ * 退出并删除token
+ * @param authHeader Authorization
+ */
+ @DeleteMapping("/logout")
+ public R logout(@RequestHeader(value = HttpHeaders.AUTHORIZATION, required = false) String authHeader) {
+ if (StrUtil.isBlank(authHeader)) {
+ return R.ok();
+ }
+
+ String tokenValue = authHeader.replace(OAuth2AccessToken.TokenType.BEARER.getValue(), StrUtil.EMPTY).trim();
+ return removeToken(tokenValue);
+ }
+
+ /**
+ * 校验token
+ * @param token 令牌
+ * @return
+ */
+ @SneakyThrows
+ @GetMapping("/check_token")
+ public R checkToken(String token, HttpServletResponse response, HttpServletRequest request) {
+ ServletServerHttpResponse httpResponse = new ServletServerHttpResponse(response);
+
+ if (StrUtil.isBlank(token)) {
+ httpResponse.setStatusCode(HttpStatus.UNAUTHORIZED);
+ return R.failed(OAuth2ErrorCodesExpand.TOKEN_MISSING);
+ }
+ OAuth2Authorization authorization = authorizationService.findByToken(token, OAuth2TokenType.ACCESS_TOKEN);
+
+ // 如果令牌不存在 返回401
+ if (authorization == null || authorization.getAccessToken() == null) {
+ httpResponse.setStatusCode(HttpStatus.UNAUTHORIZED);
+ return R.failed(OAuth2ErrorCodesExpand.INVALID_BEARER_TOKEN);
+ }
+
+ // 获取令牌
+ return R.ok(Objects.requireNonNull(authorization).getAccessToken().getToken());
+ }
+
+ /**
+ * 令牌管理调用
+ * @param token token
+ */
+ @Inner
+ @DeleteMapping("/{token}")
+ public R removeToken(@PathVariable("token") String token) {
+ OAuth2Authorization authorization = authorizationService.findByToken(token, OAuth2TokenType.ACCESS_TOKEN);
+ if (authorization == null) {
+ return R.ok();
+ }
+
+ OAuth2Authorization.Token accessToken = authorization.getAccessToken();
+ if (accessToken == null || StrUtil.isBlank(accessToken.getToken().getTokenValue())) {
+ return R.ok();
+ }
+ // 清空用户信息
+ cacheManager.getCache(CacheConstants.USER_DETAILS).evict(authorization.getPrincipalName());
+ // 清空access token
+ authorizationService.remove(authorization);
+ // 处理自定义退出事件,保存相关日志
+ SpringContextHolder.publishEvent(new LogoutSuccessEvent(new PreAuthenticatedAuthenticationToken(
+ authorization.getPrincipalName(), authorization.getRegisteredClientId())));
+ return R.ok();
+ }
+
+ /**
+ * 查询token
+ * @param params 分页参数
+ * @return
+ */
+ @Inner
+ @PostMapping("/page")
+ public R> tokenList(@RequestBody Map params) {
+ // 根据分页参数获取对应数据
+ String key = String.format("%s::%s::*", tenantKeyStrResolver.key(), CacheConstants.PROJECT_OAUTH_ACCESS);
+ int current = MapUtil.getInt(params, CommonConstants.CURRENT);
+ int size = MapUtil.getInt(params, CommonConstants.SIZE);
+ Set keys = redisTemplate.keys(key);
+ List pages = keys.stream().skip((current - 1) * size).limit(size).collect(Collectors.toList());
+ Page result = new Page(current, size);
+
+ List tokenVoList = redisTemplate.opsForValue().multiGet(pages).stream().map(obj -> {
+ OAuth2Authorization authorization = (OAuth2Authorization) obj;
+ TokenVO tokenVo = new TokenVO();
+ tokenVo.setClientId(authorization.getRegisteredClientId());
+ tokenVo.setId(authorization.getId());
+ tokenVo.setUsername(authorization.getPrincipalName());
+ OAuth2Authorization.Token accessToken = authorization.getAccessToken();
+ tokenVo.setAccessToken(accessToken.getToken().getTokenValue());
+
+ String expiresAt = TemporalAccessorUtil.format(accessToken.getToken().getExpiresAt(),
+ DatePattern.NORM_DATETIME_PATTERN);
+ tokenVo.setExpiresAt(expiresAt);
+
+ String issuedAt = TemporalAccessorUtil.format(accessToken.getToken().getIssuedAt(),
+ DatePattern.NORM_DATETIME_PATTERN);
+ tokenVo.setIssuedAt(issuedAt);
+
+ Map attributes = authorization.getAttributes();
+ Authentication authentication = (Authentication) attributes.get(Principal.class.getName());
+
+ if (Objects.isNull(authentication)) {
+ return tokenVo;
+ }
+
+ PjcloudUser pjcloudUser = (PjcloudUser) authentication.getPrincipal();
+ tokenVo.setUserId(pjcloudUser.getId());
+ return tokenVo;
+ }).filter(tokenVo -> {
+ // 根据用户名过滤
+ String username = MapUtil.getStr(params, SecurityConstants.DETAILS_USERNAME);
+ if (StrUtil.isBlank(username)) {
+ return true;
+ }
+ return tokenVo.getUsername().contains(username);
+ }).collect(Collectors.toList());
+ result.setRecords(tokenVoList);
+ result.setTotal(keys.size());
+ return R.ok(result);
+ }
+
+ @Inner
+ @GetMapping("/query-token")
+ public R queryToken(String token) {
+ OAuth2Authorization authorization = authorizationService.findByToken(token, OAuth2TokenType.ACCESS_TOKEN);
+ return R.ok(authorization);
+ }
+
+}
diff --git a/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/support/CustomeOAuth2AccessTokenGenerator.java b/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/support/CustomeOAuth2AccessTokenGenerator.java
new file mode 100644
index 00000000..d3528aff
--- /dev/null
+++ b/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/support/CustomeOAuth2AccessTokenGenerator.java
@@ -0,0 +1,119 @@
+package com.bsd.pjcloud.auth.support;
+
+import org.springframework.lang.Nullable;
+import org.springframework.security.oauth2.core.ClaimAccessor;
+import org.springframework.security.oauth2.core.OAuth2AccessToken;
+import org.springframework.security.oauth2.core.endpoint.OAuth2ParameterNames;
+import org.springframework.security.oauth2.server.authorization.OAuth2TokenType;
+import org.springframework.security.oauth2.server.authorization.client.RegisteredClient;
+import org.springframework.security.oauth2.server.authorization.settings.OAuth2TokenFormat;
+import org.springframework.security.oauth2.server.authorization.token.*;
+import org.springframework.util.Assert;
+import org.springframework.util.CollectionUtils;
+import org.springframework.util.StringUtils;
+
+import java.time.Instant;
+import java.util.Collections;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
+
+/**
+ * @author pjcloud
+ * @date 2022/5/29
+ */
+public class CustomeOAuth2AccessTokenGenerator implements OAuth2TokenGenerator {
+
+ private OAuth2TokenCustomizer accessTokenCustomizer;
+
+ @Nullable
+ @Override
+ public OAuth2AccessToken generate(OAuth2TokenContext context) {
+ if (!OAuth2TokenType.ACCESS_TOKEN.equals(context.getTokenType()) || !OAuth2TokenFormat.REFERENCE
+ .equals(context.getRegisteredClient().getTokenSettings().getAccessTokenFormat())) {
+ return null;
+ }
+
+ String issuer = null;
+ if (context.getAuthorizationServerContext() != null) {
+ issuer = context.getAuthorizationServerContext().getIssuer();
+ }
+ RegisteredClient registeredClient = context.getRegisteredClient();
+
+ Instant issuedAt = Instant.now();
+ Instant expiresAt = issuedAt.plus(registeredClient.getTokenSettings().getAccessTokenTimeToLive());
+
+ // @formatter:off
+ OAuth2TokenClaimsSet.Builder claimsBuilder = OAuth2TokenClaimsSet.builder();
+ if (StringUtils.hasText(issuer)) {
+ claimsBuilder.issuer(issuer);
+ }
+ claimsBuilder
+ .subject(context.getPrincipal().getName())
+ .audience(Collections.singletonList(registeredClient.getClientId()))
+ .issuedAt(issuedAt)
+ .expiresAt(expiresAt)
+ .notBefore(issuedAt)
+ .id(UUID.randomUUID().toString());
+ if (!CollectionUtils.isEmpty(context.getAuthorizedScopes())) {
+ claimsBuilder.claim(OAuth2ParameterNames.SCOPE, context.getAuthorizedScopes());
+ }
+ // @formatter:on
+
+ if (this.accessTokenCustomizer != null) {
+ // @formatter:off
+ OAuth2TokenClaimsContext.Builder accessTokenContextBuilder = OAuth2TokenClaimsContext.with(claimsBuilder)
+ .registeredClient(context.getRegisteredClient())
+ .principal(context.getPrincipal())
+ .authorizationServerContext(context.getAuthorizationServerContext())
+ .authorizedScopes(context.getAuthorizedScopes())
+ .tokenType(context.getTokenType())
+ .authorizationGrantType(context.getAuthorizationGrantType());
+ if (context.getAuthorization() != null) {
+ accessTokenContextBuilder.authorization(context.getAuthorization());
+ }
+ if (context.getAuthorizationGrant() != null) {
+ accessTokenContextBuilder.authorizationGrant(context.getAuthorizationGrant());
+ }
+ // @formatter:on
+
+ OAuth2TokenClaimsContext accessTokenContext = accessTokenContextBuilder.build();
+ this.accessTokenCustomizer.customize(accessTokenContext);
+ }
+
+ OAuth2TokenClaimsSet accessTokenClaimsSet = claimsBuilder.build();
+ return new OAuth2AccessTokenClaims(OAuth2AccessToken.TokenType.BEARER, UUID.randomUUID().toString(),
+ accessTokenClaimsSet.getIssuedAt(), accessTokenClaimsSet.getExpiresAt(), context.getAuthorizedScopes(),
+ accessTokenClaimsSet.getClaims());
+ }
+
+ /**
+ * Sets the {@link OAuth2TokenCustomizer} that customizes the
+ * {@link OAuth2TokenClaimsContext#getClaims() claims} for the
+ * {@link OAuth2AccessToken}.
+ * @param accessTokenCustomizer the {@link OAuth2TokenCustomizer} that customizes the
+ * claims for the {@code OAuth2AccessToken}
+ */
+ public void setAccessTokenCustomizer(OAuth2TokenCustomizer accessTokenCustomizer) {
+ Assert.notNull(accessTokenCustomizer, "accessTokenCustomizer cannot be null");
+ this.accessTokenCustomizer = accessTokenCustomizer;
+ }
+
+ private static final class OAuth2AccessTokenClaims extends OAuth2AccessToken implements ClaimAccessor {
+
+ private final Map claims;
+
+ private OAuth2AccessTokenClaims(TokenType tokenType, String tokenValue, Instant issuedAt, Instant expiresAt,
+ Set scopes, Map claims) {
+ super(tokenType, tokenValue, issuedAt, expiresAt, scopes);
+ this.claims = claims;
+ }
+
+ @Override
+ public Map getClaims() {
+ return this.claims;
+ }
+
+ }
+
+}
diff --git a/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/support/base/OAuth2ResourceOwnerBaseAuthenticationConverter.java b/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/support/base/OAuth2ResourceOwnerBaseAuthenticationConverter.java
new file mode 100644
index 00000000..c57d92b4
--- /dev/null
+++ b/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/support/base/OAuth2ResourceOwnerBaseAuthenticationConverter.java
@@ -0,0 +1,97 @@
+package com.bsd.pjcloud.auth.support.base;
+
+import com.bsd.pjcloud.common.security.util.OAuth2EndpointUtils;
+import jakarta.servlet.http.HttpServletRequest;
+import org.springframework.security.core.Authentication;
+import org.springframework.security.core.context.SecurityContextHolder;
+import org.springframework.security.oauth2.core.OAuth2ErrorCodes;
+import org.springframework.security.oauth2.core.endpoint.OAuth2ParameterNames;
+import org.springframework.security.web.authentication.AuthenticationConverter;
+import org.springframework.util.MultiValueMap;
+import org.springframework.util.StringUtils;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+/**
+ * @author jumuning
+ * @date 2022-06-02
+ *
+ * 自定义模式认证转换器
+ */
+public abstract class OAuth2ResourceOwnerBaseAuthenticationConverter
+ implements AuthenticationConverter {
+
+ /**
+ * 是否支持此convert
+ * @param grantType 授权类型
+ * @return
+ */
+ public abstract boolean support(String grantType);
+
+ /**
+ * 校验参数
+ * @param request 请求
+ */
+ public void checkParams(HttpServletRequest request) {
+
+ }
+
+ /**
+ * 构建具体类型的token
+ * @param clientPrincipal
+ * @param requestedScopes
+ * @param additionalParameters
+ * @return
+ */
+ public abstract T buildToken(Authentication clientPrincipal, Set requestedScopes,
+ Map additionalParameters);
+
+ @Override
+ public Authentication convert(HttpServletRequest request) {
+
+ // grant_type (REQUIRED)
+ String grantType = request.getParameter(OAuth2ParameterNames.GRANT_TYPE);
+ if (!support(grantType)) {
+ return null;
+ }
+
+ MultiValueMap parameters = OAuth2EndpointUtils.getParameters(request);
+ // scope (OPTIONAL)
+ String scope = parameters.getFirst(OAuth2ParameterNames.SCOPE);
+ if (StringUtils.hasText(scope) && parameters.get(OAuth2ParameterNames.SCOPE).size() != 1) {
+ OAuth2EndpointUtils.throwError(OAuth2ErrorCodes.INVALID_REQUEST, OAuth2ParameterNames.SCOPE,
+ OAuth2EndpointUtils.ACCESS_TOKEN_REQUEST_ERROR_URI);
+ }
+
+ Set requestedScopes = null;
+ if (StringUtils.hasText(scope)) {
+ requestedScopes = new HashSet<>(Arrays.asList(StringUtils.delimitedListToStringArray(scope, " ")));
+ }
+
+ // 校验个性化参数
+ checkParams(request);
+
+ // 获取当前已经认证的客户端信息
+ Authentication clientPrincipal = SecurityContextHolder.getContext().getAuthentication();
+ if (clientPrincipal == null) {
+ OAuth2EndpointUtils.throwError(OAuth2ErrorCodes.INVALID_REQUEST, OAuth2ErrorCodes.INVALID_CLIENT,
+ OAuth2EndpointUtils.ACCESS_TOKEN_REQUEST_ERROR_URI);
+ }
+
+ // 扩展信息
+ Map additionalParameters = parameters.entrySet()
+ .stream()
+ .filter(e -> !e.getKey().equals(OAuth2ParameterNames.GRANT_TYPE)
+ && !e.getKey().equals(OAuth2ParameterNames.SCOPE))
+ .collect(Collectors.toMap(Map.Entry::getKey, e -> e.getValue().get(0)));
+
+ // 创建token
+ return buildToken(clientPrincipal, requestedScopes, additionalParameters);
+
+ }
+
+}
diff --git a/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/support/base/OAuth2ResourceOwnerBaseAuthenticationProvider.java b/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/support/base/OAuth2ResourceOwnerBaseAuthenticationProvider.java
new file mode 100644
index 00000000..359ac085
--- /dev/null
+++ b/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/support/base/OAuth2ResourceOwnerBaseAuthenticationProvider.java
@@ -0,0 +1,332 @@
+package com.bsd.pjcloud.auth.support.base;
+
+import cn.hutool.core.util.BooleanUtil;
+import cn.hutool.extra.spring.SpringUtil;
+import com.bsd.pjcloud.common.core.constant.CommonConstants;
+import com.bsd.pjcloud.common.security.service.PjcloudRedisOAuth2AuthorizationService;
+import com.bsd.pjcloud.common.security.util.OAuth2ErrorCodesExpand;
+import com.bsd.pjcloud.common.security.util.ScopeException;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.jetbrains.annotations.NotNull;
+import org.springframework.context.support.MessageSourceAccessor;
+import org.springframework.security.authentication.*;
+import org.springframework.security.core.Authentication;
+import org.springframework.security.core.AuthenticationException;
+import org.springframework.security.core.userdetails.UsernameNotFoundException;
+import org.springframework.security.oauth2.core.*;
+import org.springframework.security.oauth2.server.authorization.OAuth2Authorization;
+import org.springframework.security.oauth2.server.authorization.OAuth2AuthorizationService;
+import org.springframework.security.oauth2.server.authorization.OAuth2TokenType;
+import org.springframework.security.oauth2.server.authorization.authentication.OAuth2AccessTokenAuthenticationToken;
+import org.springframework.security.oauth2.server.authorization.authentication.OAuth2ClientAuthenticationToken;
+import org.springframework.security.oauth2.server.authorization.client.RegisteredClient;
+import org.springframework.security.oauth2.server.authorization.context.AuthorizationServerContextHolder;
+import org.springframework.security.oauth2.server.authorization.token.DefaultOAuth2TokenContext;
+import org.springframework.security.oauth2.server.authorization.token.OAuth2TokenContext;
+import org.springframework.security.oauth2.server.authorization.token.OAuth2TokenGenerator;
+import org.springframework.util.Assert;
+import org.springframework.util.CollectionUtils;
+
+import java.security.Principal;
+import java.time.Instant;
+import java.util.*;
+import java.util.function.Supplier;
+
+/**
+ * @author jumuning
+ * @description 处理自定义授权
+ */
+@Slf4j
+public abstract class OAuth2ResourceOwnerBaseAuthenticationProvider
+ implements AuthenticationProvider {
+
+ private static final Logger LOGGER = LogManager.getLogger(OAuth2ResourceOwnerBaseAuthenticationProvider.class);
+
+ private static final String ERROR_URI = "https://datatracker.ietf.org/doc/html/rfc6749#section-4.1.2.1";
+
+ private final OAuth2AuthorizationService authorizationService;
+
+ private final OAuth2TokenGenerator extends OAuth2Token> tokenGenerator;
+
+ private final AuthenticationManager authenticationManager;
+
+ private final MessageSourceAccessor messages;
+
+ @Deprecated
+ private Supplier refreshTokenGenerator;
+
+ /**
+ * Constructs an {@code OAuth2AuthorizationCodeAuthenticationProvider} using the
+ * provided parameters.
+ *
+ * @param authorizationService the authorization service
+ * @param tokenGenerator the token generator
+ * @since 0.2.3
+ */
+ public OAuth2ResourceOwnerBaseAuthenticationProvider(AuthenticationManager authenticationManager,
+ OAuth2AuthorizationService authorizationService,
+ OAuth2TokenGenerator extends OAuth2Token> tokenGenerator) {
+ Assert.notNull(authorizationService, "authorizationService cannot be null");
+ Assert.notNull(tokenGenerator, "tokenGenerator cannot be null");
+ this.authenticationManager = authenticationManager;
+ this.authorizationService = authorizationService;
+ this.tokenGenerator = tokenGenerator;
+
+ // 国际化配置
+ this.messages = new MessageSourceAccessor(SpringUtil.getBean("securityMessageSource"), Locale.CHINA);
+ }
+
+ @Deprecated
+ public void setRefreshTokenGenerator(Supplier refreshTokenGenerator) {
+ Assert.notNull(refreshTokenGenerator, "refreshTokenGenerator cannot be null");
+ this.refreshTokenGenerator = refreshTokenGenerator;
+ }
+
+ public abstract UsernamePasswordAuthenticationToken buildToken(Map reqParameters);
+
+ /**
+ * 当前provider是否支持此令牌类型
+ *
+ * @param authentication
+ * @return
+ */
+ @Override
+ public abstract boolean supports(Class> authentication);
+
+ /**
+ * 当前的请求客户端是否支持此模式
+ *
+ * @param registeredClient
+ */
+ public abstract void checkClient(RegisteredClient registeredClient);
+
+ /**
+ * Performs authentication with the same contract as
+ * {@link AuthenticationManager#authenticate(Authentication)} .
+ *
+ * @param authentication the authentication request object.
+ * @return a fully authenticated object including credentials. May return
+ * null if the AuthenticationProvider is unable to support
+ * authentication of the passed Authentication object. In such a case,
+ * the next AuthenticationProvider that supports the presented
+ * Authentication class will be tried.
+ * @throws AuthenticationException if authentication fails.
+ */
+ @Override
+ public Authentication authenticate(Authentication authentication) throws AuthenticationException {
+
+ T resouceOwnerBaseAuthentication = (T) authentication;
+
+ OAuth2ClientAuthenticationToken clientPrincipal = getAuthenticatedClientElseThrowInvalidClient(
+ resouceOwnerBaseAuthentication);
+
+ RegisteredClient registeredClient = clientPrincipal.getRegisteredClient();
+ checkClient(registeredClient);
+
+ Set authorizedScopes;
+ // Default to configured scopes
+ if (!CollectionUtils.isEmpty(resouceOwnerBaseAuthentication.getScopes())) {
+ for (String requestedScope : resouceOwnerBaseAuthentication.getScopes()) {
+ if (!registeredClient.getScopes().contains(requestedScope)) {
+ throw new OAuth2AuthenticationException(OAuth2ErrorCodes.INVALID_SCOPE);
+ }
+ }
+ authorizedScopes = new LinkedHashSet<>(resouceOwnerBaseAuthentication.getScopes());
+ } else {
+ authorizedScopes = new LinkedHashSet<>();
+ }
+
+ Map reqParameters = resouceOwnerBaseAuthentication.getAdditionalParameters();
+ try {
+
+ UsernamePasswordAuthenticationToken usernamePasswordAuthenticationToken = buildToken(reqParameters);
+
+ LOGGER.debug("got usernamePasswordAuthenticationToken=" + usernamePasswordAuthenticationToken);
+
+ Authentication usernamePasswordAuthentication = authenticationManager
+ .authenticate(usernamePasswordAuthenticationToken);
+
+ Object onlineQuantity = registeredClient.getClientSettings()
+ .getSettings()
+ .get(CommonConstants.ONLINE_QUANTITY);
+ // 没有设置并发控制走原有逻辑生成 || 设置同时在线为 true
+ if (Objects.isNull(onlineQuantity) || BooleanUtil.toBooleanObject((String) onlineQuantity)) {
+ return generatAuthenticationToken(resouceOwnerBaseAuthentication, clientPrincipal, registeredClient,
+ authorizedScopes, usernamePasswordAuthentication);
+ }
+
+ // 不允许同时在线,删除原有username 关联的所有token
+ PjcloudRedisOAuth2AuthorizationService redisOAuth2AuthorizationService = (PjcloudRedisOAuth2AuthorizationService) this.authorizationService;
+ redisOAuth2AuthorizationService.removeByUsername(usernamePasswordAuthentication);
+
+ return generatAuthenticationToken(resouceOwnerBaseAuthentication, clientPrincipal, registeredClient,
+ authorizedScopes, usernamePasswordAuthentication);
+
+ } catch (AuthenticationException ex) {
+ throw oAuth2AuthenticationException(authentication, ex);
+ } catch (Exception e) {
+ log.error("登录异常:", e);
+ throw new OAuth2AuthenticationException(new OAuth2Error(OAuth2ErrorCodes.SERVER_ERROR));
+ }
+ }
+
+ /**
+ * 生成新的令牌
+ *
+ * @param resouceOwnerBaseAuthentication
+ * @param clientPrincipal
+ * @param registeredClient
+ * @param authorizedScopes
+ * @param usernamePasswordAuthentication
+ * @return OAuth2AccessTokenAuthenticationToken
+ */
+ @NotNull
+ private OAuth2AccessTokenAuthenticationToken generatAuthenticationToken(T resouceOwnerBaseAuthentication,
+ OAuth2ClientAuthenticationToken clientPrincipal, RegisteredClient registeredClient,
+ Set authorizedScopes, Authentication usernamePasswordAuthentication) {
+ // @formatter:off
+ DefaultOAuth2TokenContext.Builder tokenContextBuilder = DefaultOAuth2TokenContext.builder()
+ .registeredClient(registeredClient)
+ .principal(usernamePasswordAuthentication)
+ .authorizationServerContext(AuthorizationServerContextHolder.getContext())
+ .authorizedScopes(authorizedScopes)
+ .authorizationGrantType(resouceOwnerBaseAuthentication.getAuthorizationGrantType())
+ .authorizationGrant(resouceOwnerBaseAuthentication);
+ // @formatter:on
+
+ OAuth2Authorization.Builder authorizationBuilder = OAuth2Authorization.withRegisteredClient(registeredClient)
+ .principalName(usernamePasswordAuthentication.getName())
+ .authorizationGrantType(resouceOwnerBaseAuthentication.getAuthorizationGrantType())
+ // 0.4.0 新增的方法
+ .authorizedScopes(authorizedScopes);
+
+ // ----- Access token -----
+ OAuth2TokenContext tokenContext = tokenContextBuilder.tokenType(OAuth2TokenType.ACCESS_TOKEN).build();
+ OAuth2Token generatedAccessToken = this.tokenGenerator.generate(tokenContext);
+ if (generatedAccessToken == null) {
+ OAuth2Error error = new OAuth2Error(OAuth2ErrorCodes.SERVER_ERROR,
+ "The token generator failed to generate the access token.", ERROR_URI);
+ throw new OAuth2AuthenticationException(error);
+ }
+ OAuth2AccessToken accessToken = new OAuth2AccessToken(OAuth2AccessToken.TokenType.BEARER,
+ generatedAccessToken.getTokenValue(), generatedAccessToken.getIssuedAt(),
+ generatedAccessToken.getExpiresAt(), tokenContext.getAuthorizedScopes());
+ if (generatedAccessToken instanceof ClaimAccessor) {
+ authorizationBuilder.id(accessToken.getTokenValue())
+ .token(accessToken,
+ (metadata) -> metadata.put(OAuth2Authorization.Token.CLAIMS_METADATA_NAME,
+ ((ClaimAccessor) generatedAccessToken).getClaims()))
+ // 0.4.0 新增的方法
+ .authorizedScopes(authorizedScopes)
+ .attribute(Principal.class.getName(), usernamePasswordAuthentication);
+ } else {
+ authorizationBuilder.id(accessToken.getTokenValue()).accessToken(accessToken);
+ }
+
+ // ----- Refresh token -----
+ OAuth2RefreshToken refreshToken = null;
+ if (registeredClient.getAuthorizationGrantTypes().contains(AuthorizationGrantType.REFRESH_TOKEN) &&
+ // Do not issue refresh token to public client
+ !clientPrincipal.getClientAuthenticationMethod().equals(ClientAuthenticationMethod.NONE)) {
+
+ if (this.refreshTokenGenerator != null) {
+ Instant issuedAt = Instant.now();
+ Instant expiresAt = issuedAt.plus(registeredClient.getTokenSettings().getRefreshTokenTimeToLive());
+ refreshToken = new OAuth2RefreshToken(this.refreshTokenGenerator.get(), issuedAt, expiresAt);
+ } else {
+ tokenContext = tokenContextBuilder.tokenType(OAuth2TokenType.REFRESH_TOKEN).build();
+ OAuth2Token generatedRefreshToken = this.tokenGenerator.generate(tokenContext);
+ if (!(generatedRefreshToken instanceof OAuth2RefreshToken)) {
+ OAuth2Error error = new OAuth2Error(OAuth2ErrorCodes.SERVER_ERROR,
+ "The token generator failed to generate the refresh token.", ERROR_URI);
+ throw new OAuth2AuthenticationException(error);
+ }
+ refreshToken = (OAuth2RefreshToken) generatedRefreshToken;
+ }
+ authorizationBuilder.refreshToken(refreshToken);
+ }
+
+ OAuth2Authorization authorization = authorizationBuilder.build();
+
+ this.authorizationService.save(authorization);
+
+ LOGGER.debug("returning OAuth2AccessTokenAuthenticationToken");
+
+ return new OAuth2AccessTokenAuthenticationToken(registeredClient, clientPrincipal, accessToken, refreshToken,
+ Objects.requireNonNull(authorization.getAccessToken().getClaims()));
+ }
+
+ /**
+ * 登录异常转换为oauth2异常
+ *
+ * @param authentication 身份验证
+ * @param authenticationException 身份验证异常
+ * @return {@link OAuth2AuthenticationException}
+ */
+ private OAuth2AuthenticationException oAuth2AuthenticationException(Authentication authentication,
+ AuthenticationException authenticationException) {
+
+ // OAuth2AuthenticationException 直接返回
+ if (authenticationException instanceof OAuth2AuthenticationException) {
+ return (OAuth2AuthenticationException) authenticationException;
+ }
+
+ if (authenticationException instanceof UsernameNotFoundException) {
+ return new OAuth2AuthenticationException(new OAuth2Error(OAuth2ErrorCodesExpand.USERNAME_NOT_FOUND,
+ this.messages.getMessage("JdbcDaoImpl.notFound", new Object[]{authentication.getName()},
+ "Username {0} not found"),
+ ""));
+ }
+ if (authenticationException instanceof BadCredentialsException) {
+ return new OAuth2AuthenticationException(
+ new OAuth2Error(OAuth2ErrorCodesExpand.BAD_CREDENTIALS, this.messages.getMessage(
+ "AbstractUserDetailsAuthenticationProvider.badCredentials", "Bad credentials"), ""));
+ }
+ if (authenticationException instanceof LockedException) {
+ return new OAuth2AuthenticationException(new OAuth2Error(OAuth2ErrorCodesExpand.USER_LOCKED, this.messages
+ .getMessage("AbstractUserDetailsAuthenticationProvider.locked", "User account is locked"), ""));
+ }
+ if (authenticationException instanceof DisabledException) {
+ return new OAuth2AuthenticationException(new OAuth2Error(OAuth2ErrorCodesExpand.USER_DISABLE,
+ this.messages.getMessage("AbstractUserDetailsAuthenticationProvider.disabled", "User is disabled"),
+ ""));
+ }
+ if (authenticationException instanceof AccountExpiredException) {
+ return new OAuth2AuthenticationException(new OAuth2Error(OAuth2ErrorCodesExpand.USER_EXPIRED, this.messages
+ .getMessage("AbstractUserDetailsAuthenticationProvider.expired", "User account has expired"), ""));
+ }
+ if (authenticationException instanceof CredentialsExpiredException) {
+ return new OAuth2AuthenticationException(new OAuth2Error(OAuth2ErrorCodesExpand.CREDENTIALS_EXPIRED,
+ this.messages.getMessage("AbstractUserDetailsAuthenticationProvider.credentialsExpired",
+ "User credentials have expired"),
+ ""));
+ }
+ if (authenticationException instanceof ScopeException) {
+ return new OAuth2AuthenticationException(new OAuth2Error(OAuth2ErrorCodes.INVALID_SCOPE,
+ this.messages.getMessage("AbstractAccessDecisionManager.accessDenied", "invalid_scope"), ""));
+ }
+
+ log.error(authenticationException.getLocalizedMessage());
+ return new OAuth2AuthenticationException(new OAuth2Error(OAuth2ErrorCodes.SERVER_ERROR),
+ authenticationException.getLocalizedMessage(), authenticationException);
+ }
+
+ private OAuth2ClientAuthenticationToken getAuthenticatedClientElseThrowInvalidClient(
+ Authentication authentication) {
+
+ OAuth2ClientAuthenticationToken clientPrincipal = null;
+
+ if (OAuth2ClientAuthenticationToken.class.isAssignableFrom(authentication.getPrincipal().getClass())) {
+ clientPrincipal = (OAuth2ClientAuthenticationToken) authentication.getPrincipal();
+ }
+
+ if (clientPrincipal != null && clientPrincipal.isAuthenticated()) {
+ return clientPrincipal;
+ }
+
+ throw new OAuth2AuthenticationException(OAuth2ErrorCodes.INVALID_CLIENT);
+ }
+
+}
diff --git a/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/support/base/OAuth2ResourceOwnerBaseAuthenticationToken.java b/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/support/base/OAuth2ResourceOwnerBaseAuthenticationToken.java
new file mode 100644
index 00000000..624384af
--- /dev/null
+++ b/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/support/base/OAuth2ResourceOwnerBaseAuthenticationToken.java
@@ -0,0 +1,61 @@
+package com.bsd.pjcloud.auth.support.base;
+
+import lombok.Getter;
+import org.springframework.lang.Nullable;
+import org.springframework.security.authentication.AbstractAuthenticationToken;
+import org.springframework.security.core.Authentication;
+import org.springframework.security.oauth2.core.AuthorizationGrantType;
+import org.springframework.util.Assert;
+
+import java.util.*;
+
+/**
+ * @author pjcloud
+ * @date 2022/6/2
+ *
+ * 自定义授权模式抽象
+ */
+public abstract class OAuth2ResourceOwnerBaseAuthenticationToken extends AbstractAuthenticationToken {
+
+ @Getter
+ private final AuthorizationGrantType authorizationGrantType;
+
+ @Getter
+ private final Authentication clientPrincipal;
+
+ @Getter
+ private final Set scopes;
+
+ @Getter
+ private final Map additionalParameters;
+
+ public OAuth2ResourceOwnerBaseAuthenticationToken(AuthorizationGrantType authorizationGrantType,
+ Authentication clientPrincipal, @Nullable Set scopes,
+ @Nullable Map additionalParameters) {
+ super(Collections.emptyList());
+ Assert.notNull(authorizationGrantType, "authorizationGrantType cannot be null");
+ Assert.notNull(clientPrincipal, "clientPrincipal cannot be null");
+ this.authorizationGrantType = authorizationGrantType;
+ this.clientPrincipal = clientPrincipal;
+ this.scopes = Collections.unmodifiableSet(scopes != null ? new HashSet<>(scopes) : Collections.emptySet());
+ this.additionalParameters = Collections.unmodifiableMap(
+ additionalParameters != null ? new HashMap<>(additionalParameters) : Collections.emptyMap());
+ }
+
+ /**
+ * 扩展模式一般不需要密码
+ */
+ @Override
+ public Object getCredentials() {
+ return "";
+ }
+
+ /**
+ * 获取用户名
+ */
+ @Override
+ public Object getPrincipal() {
+ return this.clientPrincipal;
+ }
+
+}
diff --git a/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/support/base/package-info.java b/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/support/base/package-info.java
new file mode 100644
index 00000000..18c6d4d0
--- /dev/null
+++ b/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/support/base/package-info.java
@@ -0,0 +1,4 @@
+/**
+ * 自定义认证模式接入的抽象实现
+ */
+package com.bsd.pjcloud.auth.support.base;
diff --git a/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/support/core/CustomeOAuth2TokenCustomizer.java b/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/support/core/CustomeOAuth2TokenCustomizer.java
new file mode 100644
index 00000000..36c0bff9
--- /dev/null
+++ b/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/support/core/CustomeOAuth2TokenCustomizer.java
@@ -0,0 +1,39 @@
+package com.bsd.pjcloud.auth.support.core;
+
+import com.bsd.pjcloud.common.core.constant.SecurityConstants;
+import com.bsd.pjcloud.common.security.service.PjcloudUser;
+import org.springframework.security.oauth2.server.authorization.token.OAuth2TokenClaimsContext;
+import org.springframework.security.oauth2.server.authorization.token.OAuth2TokenClaimsSet;
+import org.springframework.security.oauth2.server.authorization.token.OAuth2TokenCustomizer;
+
+/**
+ * token 输出增强
+ *
+ * @author pjcloud
+ * @date 2022/6/3
+ */
+public class CustomeOAuth2TokenCustomizer implements OAuth2TokenCustomizer {
+
+ /**
+ * Customize the OAuth 2.0 Token attributes.
+ * @param context the context containing the OAuth 2.0 Token attributes
+ */
+ @Override
+ public void customize(OAuth2TokenClaimsContext context) {
+ OAuth2TokenClaimsSet.Builder claims = context.getClaims();
+ claims.claim(SecurityConstants.DETAILS_LICENSE, SecurityConstants.PIGX_LICENSE);
+ String clientId = context.getAuthorizationGrant().getName();
+ claims.claim(SecurityConstants.CLIENT_ID, clientId);
+ claims.claim(SecurityConstants.ACTIVE, Boolean.TRUE);
+
+ // 客户端模式不返回具体用户信息
+ if (SecurityConstants.CLIENT_CREDENTIALS.equals(context.getAuthorizationGrantType().getValue())) {
+ return;
+ }
+
+ PjcloudUser pjcloudUser = (PjcloudUser) context.getPrincipal().getPrincipal();
+ claims.claim(SecurityConstants.DETAILS_USER_ID, pjcloudUser.getId());
+ claims.claim(SecurityConstants.DETAILS_USERNAME, pjcloudUser.getUsername());
+ }
+
+}
diff --git a/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/support/core/FormIdentityLoginConfigurer.java b/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/support/core/FormIdentityLoginConfigurer.java
new file mode 100644
index 00000000..a7a135cb
--- /dev/null
+++ b/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/support/core/FormIdentityLoginConfigurer.java
@@ -0,0 +1,36 @@
+package com.bsd.pjcloud.auth.support.core;
+
+import com.bsd.pjcloud.auth.support.handler.FormAuthenticationFailureHandler;
+import com.bsd.pjcloud.auth.support.handler.SsoLogoutSuccessHandler;
+import com.bsd.pjcloud.auth.support.handler.TenantSavedRequestAwareAuthenticationSuccessHandler;
+import org.springframework.security.config.annotation.web.builders.HttpSecurity;
+import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer;
+
+/**
+ * @author pjcloud
+ * @data 2022-06-04
+ *
+ * 基于授权码模式 统一认证登录 spring security & sas 都可以使用 所以抽取成 HttpConfigurer
+ */
+public final class FormIdentityLoginConfigurer
+ extends AbstractHttpConfigurer {
+
+ @Override
+ public void init(HttpSecurity http) throws Exception {
+ http.formLogin(formLogin -> {
+ formLogin.loginPage("/token/login");
+ formLogin.loginProcessingUrl("/token/form");
+ formLogin.failureHandler(new FormAuthenticationFailureHandler());
+ formLogin.successHandler(new TenantSavedRequestAwareAuthenticationSuccessHandler());
+
+ })
+ .logout() // SSO登出成功处理
+ .logoutSuccessHandler(new SsoLogoutSuccessHandler())
+ .deleteCookies("JSESSIONID")
+ .invalidateHttpSession(true)
+ .and()
+ .csrf()
+ .disable();
+ }
+
+}
diff --git a/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/support/core/PjcloudDaoAuthenticationProvider.java b/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/support/core/PjcloudDaoAuthenticationProvider.java
new file mode 100644
index 00000000..c2cb22c1
--- /dev/null
+++ b/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/support/core/PjcloudDaoAuthenticationProvider.java
@@ -0,0 +1,182 @@
+package com.bsd.pjcloud.auth.support.core;
+
+import cn.hutool.core.util.StrUtil;
+import cn.hutool.extra.spring.SpringUtil;
+import com.bsd.pjcloud.common.core.constant.SecurityConstants;
+import com.bsd.pjcloud.common.core.util.WebUtils;
+import com.bsd.pjcloud.common.security.service.PjcloudUserDetailsService;
+import lombok.SneakyThrows;
+import org.springframework.core.Ordered;
+import org.springframework.security.authentication.BadCredentialsException;
+import org.springframework.security.authentication.InternalAuthenticationServiceException;
+import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
+import org.springframework.security.authentication.dao.AbstractUserDetailsAuthenticationProvider;
+import org.springframework.security.core.Authentication;
+import org.springframework.security.core.AuthenticationException;
+import org.springframework.security.core.userdetails.UserDetails;
+import org.springframework.security.core.userdetails.UserDetailsPasswordService;
+import org.springframework.security.core.userdetails.UserDetailsService;
+import org.springframework.security.core.userdetails.UsernameNotFoundException;
+import org.springframework.security.crypto.factory.PasswordEncoderFactories;
+import org.springframework.security.crypto.password.PasswordEncoder;
+import org.springframework.security.oauth2.core.endpoint.OAuth2ParameterNames;
+import org.springframework.security.web.authentication.www.BasicAuthenticationConverter;
+import org.springframework.util.Assert;
+
+import java.util.Comparator;
+import java.util.Map;
+import java.util.Optional;
+
+/**
+ * @author pjcloud
+ * @date 2022-06-04
+ */
+public class PjcloudDaoAuthenticationProvider extends AbstractUserDetailsAuthenticationProvider {
+
+ /**
+ * The plaintext password used to perform PasswordEncoder#matches(CharSequence,
+ * String)} on when the user is not found to avoid SEC-2056.
+ */
+ private static final String USER_NOT_FOUND_PASSWORD = "userNotFoundPassword";
+
+ private final static BasicAuthenticationConverter basicConvert = new BasicAuthenticationConverter();
+
+ private PasswordEncoder passwordEncoder;
+
+ /**
+ * The password used to perform {@link PasswordEncoder#matches(CharSequence, String)}
+ * on when the user is not found to avoid SEC-2056. This is necessary, because some
+ * {@link PasswordEncoder} implementations will short circuit if the password is not
+ * in a valid format.
+ */
+ private volatile String userNotFoundEncodedPassword;
+
+ private UserDetailsService userDetailsService;
+
+ private UserDetailsPasswordService userDetailsPasswordService;
+
+ public PjcloudDaoAuthenticationProvider() {
+ setMessageSource(SpringUtil.getBean("securityMessageSource"));
+ setPasswordEncoder(PasswordEncoderFactories.createDelegatingPasswordEncoder());
+ }
+
+ @Override
+ protected void additionalAuthenticationChecks(UserDetails userDetails,
+ UsernamePasswordAuthenticationToken authentication) throws AuthenticationException {
+
+ // app 模式不用校验密码
+ String grantType = WebUtils.getRequest().getParameter(OAuth2ParameterNames.GRANT_TYPE);
+ if (StrUtil.equals(SecurityConstants.APP, grantType)) {
+ return;
+ }
+
+ if (authentication.getCredentials() == null) {
+ this.logger.debug("Failed to authenticate since no credentials provided");
+ throw new BadCredentialsException(this.messages
+ .getMessage("AbstractUserDetailsAuthenticationProvider.badCredentials", "Bad credentials"));
+ }
+ String presentedPassword = authentication.getCredentials().toString();
+ if (!this.passwordEncoder.matches(presentedPassword, userDetails.getPassword())) {
+ this.logger.debug("Failed to authenticate since password does not match stored value");
+ throw new BadCredentialsException(this.messages
+ .getMessage("AbstractUserDetailsAuthenticationProvider.badCredentials", "Bad credentials"));
+ }
+ }
+
+ @SneakyThrows
+ @Override
+ protected final UserDetails retrieveUser(String username, UsernamePasswordAuthenticationToken authentication) {
+ prepareTimingAttackProtection();
+ String grantType = WebUtils.getRequest().getParameter(OAuth2ParameterNames.GRANT_TYPE);
+ String clientId = WebUtils.getRequest().getParameter(OAuth2ParameterNames.CLIENT_ID);
+
+ if (StrUtil.isBlank(clientId)) {
+ clientId = basicConvert.convert(WebUtils.getRequest()).getName();
+ }
+
+ Map userDetailsServiceMap = SpringUtil
+ .getBeansOfType(PjcloudUserDetailsService.class);
+
+ String finalClientId = clientId;
+ Optional optional = userDetailsServiceMap.values()
+ .stream()
+ .filter(service -> service.support(finalClientId, grantType))
+ .max(Comparator.comparingInt(Ordered::getOrder));
+
+ if (optional.isEmpty()) {
+ throw new InternalAuthenticationServiceException("UserDetailsService error , not register");
+ }
+
+ try {
+ UserDetails loadedUser = optional.get().loadUserByUsername(username);
+ if (loadedUser == null) {
+ throw new InternalAuthenticationServiceException(
+ "UserDetailsService returned null, which is an interface contract violation");
+ }
+ return loadedUser;
+ }
+ catch (UsernameNotFoundException ex) {
+ mitigateAgainstTimingAttack(authentication);
+ throw ex;
+ }
+ catch (Exception ex) {
+ throw ex;
+ }
+ }
+
+ @Override
+ protected Authentication createSuccessAuthentication(Object principal, Authentication authentication,
+ UserDetails user) {
+ boolean upgradeEncoding = this.userDetailsPasswordService != null
+ && this.passwordEncoder.upgradeEncoding(user.getPassword());
+ if (upgradeEncoding) {
+ String presentedPassword = authentication.getCredentials().toString();
+ String newPassword = this.passwordEncoder.encode(presentedPassword);
+ user = this.userDetailsPasswordService.updatePassword(user, newPassword);
+ }
+ return super.createSuccessAuthentication(principal, authentication, user);
+ }
+
+ private void prepareTimingAttackProtection() {
+ if (this.userNotFoundEncodedPassword == null) {
+ this.userNotFoundEncodedPassword = this.passwordEncoder.encode(USER_NOT_FOUND_PASSWORD);
+ }
+ }
+
+ private void mitigateAgainstTimingAttack(UsernamePasswordAuthenticationToken authentication) {
+ if (authentication.getCredentials() != null) {
+ String presentedPassword = authentication.getCredentials().toString();
+ this.passwordEncoder.matches(presentedPassword, this.userNotFoundEncodedPassword);
+ }
+ }
+
+ /**
+ * Sets the PasswordEncoder instance to be used to encode and validate passwords. If
+ * not set, the password will be compared using
+ * {@link PasswordEncoderFactories#createDelegatingPasswordEncoder()}
+ * @param passwordEncoder must be an instance of one of the {@code PasswordEncoder}
+ * types.
+ */
+ public void setPasswordEncoder(PasswordEncoder passwordEncoder) {
+ Assert.notNull(passwordEncoder, "passwordEncoder cannot be null");
+ this.passwordEncoder = passwordEncoder;
+ this.userNotFoundEncodedPassword = null;
+ }
+
+ protected PasswordEncoder getPasswordEncoder() {
+ return this.passwordEncoder;
+ }
+
+ public void setUserDetailsService(UserDetailsService userDetailsService) {
+ this.userDetailsService = userDetailsService;
+ }
+
+ protected UserDetailsService getUserDetailsService() {
+ return this.userDetailsService;
+ }
+
+ public void setUserDetailsPasswordService(UserDetailsPasswordService userDetailsPasswordService) {
+ this.userDetailsPasswordService = userDetailsPasswordService;
+ }
+
+}
diff --git a/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/support/core/PjcloudOAuth2RefreshTokenAuthenticationConverter.java b/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/support/core/PjcloudOAuth2RefreshTokenAuthenticationConverter.java
new file mode 100644
index 00000000..e3356e4c
--- /dev/null
+++ b/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/support/core/PjcloudOAuth2RefreshTokenAuthenticationConverter.java
@@ -0,0 +1,77 @@
+package com.bsd.pjcloud.auth.support.core;
+
+import com.bsd.pjcloud.common.security.util.OAuth2EndpointUtils;
+import jakarta.servlet.http.HttpServletRequest;
+import org.springframework.lang.Nullable;
+import org.springframework.security.core.Authentication;
+import org.springframework.security.core.context.SecurityContextHolder;
+import org.springframework.security.oauth2.core.AuthorizationGrantType;
+import org.springframework.security.oauth2.core.OAuth2ErrorCodes;
+import org.springframework.security.oauth2.core.endpoint.OAuth2ParameterNames;
+import org.springframework.security.oauth2.server.authorization.authentication.OAuth2RefreshTokenAuthenticationToken;
+import org.springframework.security.web.authentication.AuthenticationConverter;
+import org.springframework.util.MultiValueMap;
+import org.springframework.util.StringUtils;
+
+import java.util.*;
+
+/**
+ * @author pjcloud
+ * @date 2024/3/5
+ *
+ * 覆盖原生的 OAuth2RefreshTokenAuthenticationConverter ,避免无法获取 query params
+ */
+public class PjcloudOAuth2RefreshTokenAuthenticationConverter implements AuthenticationConverter {
+
+ @Nullable
+ @Override
+ public Authentication convert(HttpServletRequest request) {
+ MultiValueMap parameters = OAuth2EndpointUtils.getParameters(request);
+
+ // grant_type (REQUIRED)
+ String grantType = parameters.getFirst(OAuth2ParameterNames.GRANT_TYPE);
+ if (!AuthorizationGrantType.REFRESH_TOKEN.getValue().equals(grantType)) {
+ return null;
+ }
+
+ Authentication clientPrincipal = SecurityContextHolder.getContext().getAuthentication();
+
+ // refresh_token (REQUIRED)
+ String refreshToken = parameters.getFirst(OAuth2ParameterNames.REFRESH_TOKEN);
+ if (!StringUtils.hasText(refreshToken) ||
+ parameters.get(OAuth2ParameterNames.REFRESH_TOKEN).size() != 1) {
+ OAuth2EndpointUtils.throwError(
+ OAuth2ErrorCodes.INVALID_REQUEST,
+ OAuth2ParameterNames.REFRESH_TOKEN,
+ OAuth2EndpointUtils.ACCESS_TOKEN_REQUEST_ERROR_URI);
+ }
+
+ // scope (OPTIONAL)
+ String scope = parameters.getFirst(OAuth2ParameterNames.SCOPE);
+ if (StringUtils.hasText(scope) &&
+ parameters.get(OAuth2ParameterNames.SCOPE).size() != 1) {
+ OAuth2EndpointUtils.throwError(
+ OAuth2ErrorCodes.INVALID_REQUEST,
+ OAuth2ParameterNames.SCOPE,
+ OAuth2EndpointUtils.ACCESS_TOKEN_REQUEST_ERROR_URI);
+ }
+ Set requestedScopes = null;
+ if (StringUtils.hasText(scope)) {
+ requestedScopes = new HashSet<>(
+ Arrays.asList(StringUtils.delimitedListToStringArray(scope, " ")));
+ }
+
+ Map additionalParameters = new HashMap<>();
+ parameters.forEach((key, value) -> {
+ if (!key.equals(OAuth2ParameterNames.GRANT_TYPE) &&
+ !key.equals(OAuth2ParameterNames.REFRESH_TOKEN) &&
+ !key.equals(OAuth2ParameterNames.SCOPE)) {
+ additionalParameters.put(key, (value.size() == 1) ? value.get(0) : value.toArray(new String[0]));
+ }
+ });
+
+ return new OAuth2RefreshTokenAuthenticationToken(
+ refreshToken, clientPrincipal, requestedScopes, additionalParameters);
+ }
+}
+
diff --git a/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/support/filter/AuthSecurityConfigProperties.java b/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/support/filter/AuthSecurityConfigProperties.java
new file mode 100644
index 00000000..318909c8
--- /dev/null
+++ b/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/support/filter/AuthSecurityConfigProperties.java
@@ -0,0 +1,30 @@
+package com.bsd.pjcloud.auth.support.filter;
+
+import lombok.Data;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.cloud.context.config.annotation.RefreshScope;
+import org.springframework.stereotype.Component;
+
+/**
+ * @author pjcloud
+ * @date 2020/10/4
+ *
+ * 网关配置文件
+ */
+@Data
+@Component
+@RefreshScope
+@ConfigurationProperties("security")
+public class AuthSecurityConfigProperties {
+
+ /**
+ * 是否是微服务架构
+ */
+ private boolean isMicro;
+
+ /**
+ * 网关解密登录前端密码 秘钥
+ */
+ private String encodeKey;
+
+}
diff --git a/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/support/filter/PasswordDecoderFilter.java b/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/support/filter/PasswordDecoderFilter.java
new file mode 100644
index 00000000..aa19847f
--- /dev/null
+++ b/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/support/filter/PasswordDecoderFilter.java
@@ -0,0 +1,139 @@
+/*
+ * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.bsd.pjcloud.auth.support.filter;
+
+import cn.hutool.core.util.ArrayUtil;
+import cn.hutool.core.util.StrUtil;
+import cn.hutool.crypto.Mode;
+import cn.hutool.crypto.Padding;
+import cn.hutool.crypto.SecureUtil;
+import cn.hutool.crypto.symmetric.AES;
+import cn.hutool.json.JSONObject;
+import cn.hutool.json.JSONUtil;
+import com.bsd.pjcloud.common.core.constant.CacheConstants;
+import com.bsd.pjcloud.common.core.constant.CommonConstants;
+import com.bsd.pjcloud.common.core.constant.SecurityConstants;
+import com.bsd.pjcloud.common.core.constant.enums.EncFlagTypeEnum;
+import com.bsd.pjcloud.common.core.util.RepeatBodyRequestWrapper;
+import com.bsd.pjcloud.common.core.util.WebUtils;
+import jakarta.servlet.FilterChain;
+import jakarta.servlet.ServletException;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.data.redis.core.StringRedisTemplate;
+import org.springframework.http.HttpHeaders;
+import org.springframework.stereotype.Component;
+import org.springframework.web.filter.OncePerRequestFilter;
+
+import javax.crypto.spec.IvParameterSpec;
+import javax.crypto.spec.SecretKeySpec;
+import java.io.IOException;
+import java.util.Map;
+
+/**
+ * @author pjcloud
+ * @date 2019 /2/1 密码解密工具类
+ */
+@Slf4j
+@Component
+@RequiredArgsConstructor
+public class PasswordDecoderFilter extends OncePerRequestFilter {
+
+ private final AuthSecurityConfigProperties authSecurityConfigProperties;
+
+ private final StringRedisTemplate redisTemplate;
+
+ private static final String PASSWORD = "password";
+
+ private static final String KEY_ALGORITHM = "AES";
+
+ static {
+ // 关闭hutool 强制关闭Bouncy Castle库的依赖
+ SecureUtil.disableBouncyCastle();
+ }
+
+ @Override
+ protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain)
+ throws ServletException, IOException {
+ // 不是登录请求,直接向下执行
+ if (!StrUtil.containsAnyIgnoreCase(request.getRequestURI(), SecurityConstants.OAUTH_TOKEN_URL)) {
+ chain.doFilter(request, response);
+ return;
+ }
+
+ // 2. 刷新token类型,直接向下执行
+ String grantType = request.getParameter("grant_type");
+ if (StrUtil.equals(SecurityConstants.REFRESH_TOKEN, grantType)) {
+ chain.doFilter(request, response);
+ return;
+ }
+
+ // 3. 判断客户端是否需要解密,明文传输直接向下执行
+ if (!isEncClient(request)) {
+ chain.doFilter(request, response);
+ return; }
+
+ // 将请求流转换为可多次读取的请求流
+ RepeatBodyRequestWrapper requestWrapper = new RepeatBodyRequestWrapper(request);
+ Map parameterMap = requestWrapper.getParameterMap();
+
+ // 构建前端对应解密AES 因子
+ AES aes = new AES(Mode.CFB, Padding.NoPadding,
+ new SecretKeySpec(authSecurityConfigProperties.getEncodeKey().getBytes(), KEY_ALGORITHM),
+ new IvParameterSpec(authSecurityConfigProperties.getEncodeKey().getBytes()));
+
+ parameterMap.forEach((k, v) -> {
+ String[] values = parameterMap.get(k);
+ if (!PASSWORD.equals(k) || ArrayUtil.isEmpty(values)) {
+ return;
+ }
+
+ // 解密密码
+ String decryptPassword = aes.decryptStr(values[0]);
+ parameterMap.put(k, new String[]{decryptPassword});
+ });
+ chain.doFilter(requestWrapper, response);
+ }
+
+ /**
+ * 根据请求的clientId 查询客户端配置是否是加密传输
+ *
+ * @param request 请求上下文
+ * @return true 加密传输 、 false 原文传输
+ */
+ private boolean isEncClient(HttpServletRequest request) {
+ String header = request.getHeader(HttpHeaders.AUTHORIZATION);
+ String clientId = WebUtils.extractClientId(header).orElse(null);
+ // 获取租户拼接区分租户的key
+ String tenantId = request.getHeader(CommonConstants.TENANT_ID);
+ String key = String.format("%s:%s:%s", StrUtil.isBlank(tenantId) ? CommonConstants.TENANT_ID_1 : tenantId,
+ CacheConstants.CLIENT_FLAG, clientId);
+
+ String val = redisTemplate.opsForValue().get(key);
+
+ // 当配置不存在时,默认需要解密
+ if (val == null) {
+ return true;
+ }
+
+ JSONObject information = JSONUtil.parseObj(val);
+ return !StrUtil.equals(EncFlagTypeEnum.NO.getType(), information.getStr(CommonConstants.ENC_FLAG));
+ }
+
+}
diff --git a/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/support/filter/ValidateCodeFilter.java b/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/support/filter/ValidateCodeFilter.java
new file mode 100644
index 00000000..6a75a244
--- /dev/null
+++ b/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/support/filter/ValidateCodeFilter.java
@@ -0,0 +1,179 @@
+package com.bsd.pjcloud.auth.support.filter;
+
+/**
+ * 登录前处理器
+ *
+ * @author pjcloud
+ * @date 2024/4/3
+ */
+
+import cn.hutool.core.util.StrUtil;
+import cn.hutool.json.JSONObject;
+import cn.hutool.json.JSONUtil;
+import com.anji.captcha.model.vo.CaptchaVO;
+import com.anji.captcha.service.CaptchaService;
+import com.bsd.pjcloud.common.core.constant.CacheConstants;
+import com.bsd.pjcloud.common.core.constant.CommonConstants;
+import com.bsd.pjcloud.common.core.constant.SecurityConstants;
+import com.bsd.pjcloud.common.core.constant.enums.CaptchaFlagTypeEnum;
+import com.bsd.pjcloud.common.core.exception.ValidateCodeException;
+import com.bsd.pjcloud.common.core.util.SpringContextHolder;
+import com.bsd.pjcloud.common.core.util.WebUtils;
+import jakarta.servlet.FilterChain;
+import jakarta.servlet.ServletException;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.data.redis.core.StringRedisTemplate;
+import org.springframework.http.HttpHeaders;
+import org.springframework.security.oauth2.core.OAuth2AuthenticationException;
+import org.springframework.security.oauth2.core.endpoint.OAuth2ParameterNames;
+import org.springframework.stereotype.Component;
+import org.springframework.web.filter.OncePerRequestFilter;
+
+import java.io.IOException;
+
+/**
+ * @author lbw
+ * @date 2024-01-06
+ *
+ * 登录前置处理器: 前端密码传输密文解密,验证码处理
+ */
+@Slf4j
+@Component
+@RequiredArgsConstructor
+public class ValidateCodeFilter extends OncePerRequestFilter {
+
+
+ private final StringRedisTemplate redisTemplate;
+
+
+ @Override
+ protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain)
+ throws ServletException, IOException {
+
+ String requestUrl = request.getServletPath();
+
+ // 不是登录URL 请求直接跳过
+ if (!SecurityConstants.OAUTH_TOKEN_URL.equals(requestUrl)) {
+ filterChain.doFilter(request, response);
+ return;
+ }
+
+ // 如果登录URL 但是刷新token的请求,直接向下执行
+ String grantType = request.getParameter(OAuth2ParameterNames.GRANT_TYPE);
+ if (StrUtil.containsAny(grantType, SecurityConstants.REFRESH_TOKEN)) {
+ filterChain.doFilter(request, response);
+ return;
+ }
+
+ // mobile模式, 如果请求不包含mobile 参数直接
+ String mobile = request.getParameter(SecurityConstants.GRANT_MOBILE);
+ if (StrUtil.equals(SecurityConstants.GRANT_MOBILE, grantType) && StrUtil.isBlank(mobile)) {
+ throw new OAuth2AuthenticationException(SecurityConstants.GRANT_MOBILE);
+ }
+
+ // mobile模式, 社交登录模式不校验验证码直接跳过
+ if (StrUtil.equals(SecurityConstants.GRANT_MOBILE, grantType) && !StrUtil.contains(mobile, "SMS")) {
+ filterChain.doFilter(request, response);
+ return;
+ }
+
+ // 判断客户端是否跳过检验
+ if (!isCheckCaptchaClient(request)) {
+ filterChain.doFilter(request, response);
+ return;
+ }
+
+ // 校验验证码 1. 客户端开启验证码 2. 短信模式
+ try {
+ checkCode();
+ filterChain.doFilter(request, response);
+ } catch (ValidateCodeException validateCodeException) {
+ throw new OAuth2AuthenticationException(validateCodeException.getMessage());
+ }
+ }
+
+ /**
+ * 校验验证码
+ */
+ private void checkCode() throws ValidateCodeException {
+ HttpServletRequest request = WebUtils.getRequest();
+ String code = request.getParameter("code");
+
+ if (StrUtil.isBlank(code)) {
+ throw new ValidateCodeException("验证码不能为空");
+ }
+
+ String randomStr = request.getParameter("randomStr");
+
+ // https://gitee.com/log4j/pig/issues/IWA0D
+ String mobile = request.getParameter("mobile");
+ if (StrUtil.isNotBlank(mobile)) {
+ randomStr = mobile;
+ }
+
+ // 若是滑块登录
+ if (CommonConstants.IMAGE_CODE_TYPE.equalsIgnoreCase(randomStr)) {
+ CaptchaService captchaService = SpringContextHolder.getBean(CaptchaService.class);
+ CaptchaVO vo = new CaptchaVO();
+ vo.setCaptchaVerification(code);
+ vo.setCaptchaType(CommonConstants.IMAGE_CODE_TYPE);
+ if (!captchaService.verification(vo).isSuccess()) {
+ throw new ValidateCodeException("验证码不能为空");
+ }
+ return;
+ }
+
+
+ String key = CacheConstants.DEFAULT_CODE_KEY + randomStr;
+ if (Boolean.FALSE.equals(redisTemplate.hasKey(key))) {
+ throw new ValidateCodeException("验证码不合法");
+ }
+
+ Object codeObj = redisTemplate.opsForValue().get(key);
+
+ if (codeObj == null) {
+ throw new ValidateCodeException("验证码不合法");
+ }
+
+ String saveCode = codeObj.toString();
+ if (StrUtil.isBlank(saveCode)) {
+ redisTemplate.delete(key);
+ throw new ValidateCodeException("验证码不合法");
+ }
+
+ if (!StrUtil.equals(saveCode, code)) {
+ redisTemplate.delete(key);
+ throw new ValidateCodeException("验证码不合法");
+ }
+
+ redisTemplate.delete(key);
+ }
+
+ /**
+ * 是否需要校验客户端,根据client 查询客户端配置
+ *
+ * @param request 请求
+ * @return true 需要校验, false 不需要校验
+ */
+ private boolean isCheckCaptchaClient(HttpServletRequest request) {
+ String header = request.getHeader(HttpHeaders.AUTHORIZATION);
+ String clientId = WebUtils.extractClientId(header).orElse(null);
+ // 获取租户拼接区分租户的key
+ String tenantId = request.getHeader(CommonConstants.TENANT_ID);
+ String key = String.format("%s:%s:%s", StrUtil.isBlank(tenantId) ? CommonConstants.TENANT_ID_1 : tenantId,
+ CacheConstants.CLIENT_FLAG, clientId);
+
+ String val = redisTemplate.opsForValue().get(key);
+
+ // 当配置不存在时,不用校验
+ if (val == null) {
+ return false;
+ }
+
+ JSONObject information = JSONUtil.parseObj(val);
+ return !StrUtil.equals(CaptchaFlagTypeEnum.OFF.getType(), information.getStr(CommonConstants.CAPTCHA_FLAG));
+ }
+}
diff --git a/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/support/handler/FormAuthenticationFailureHandler.java b/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/support/handler/FormAuthenticationFailureHandler.java
new file mode 100644
index 00000000..c5e6ac75
--- /dev/null
+++ b/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/support/handler/FormAuthenticationFailureHandler.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.bsd.pjcloud.auth.support.handler;
+
+import cn.hutool.core.util.CharsetUtil;
+import cn.hutool.http.HttpUtil;
+import com.bsd.pjcloud.common.core.util.WebUtils;
+import lombok.SneakyThrows;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.security.core.AuthenticationException;
+import org.springframework.security.web.authentication.AuthenticationFailureHandler;
+
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
+
+/**
+ * @author pjcloud
+ * @date 2022-06-02
+ *
+ * 表单登录失败处理逻辑
+ */
+@Slf4j
+public class FormAuthenticationFailureHandler implements AuthenticationFailureHandler {
+
+ /**
+ * Called when an authentication attempt fails.
+ * @param request the request during which the authentication attempt occurred.
+ * @param response the response.
+ * @param exception the exception which was thrown to reject the authentication
+ */
+ @Override
+ @SneakyThrows
+ public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response,
+ AuthenticationException exception) {
+ log.debug("表单登录失败:{}", exception.getLocalizedMessage());
+ String url = HttpUtil.encodeParams(String.format("/token/login?error=%s", exception.getMessage()),
+ CharsetUtil.CHARSET_UTF_8);
+ WebUtils.getResponse().sendRedirect(url);
+ }
+
+}
diff --git a/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/support/handler/PjcloudAuthenticationFailureEventHandler.java b/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/support/handler/PjcloudAuthenticationFailureEventHandler.java
new file mode 100644
index 00000000..042741a8
--- /dev/null
+++ b/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/support/handler/PjcloudAuthenticationFailureEventHandler.java
@@ -0,0 +1,172 @@
+/*
+ * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.bsd.pjcloud.auth.support.handler;
+
+import cn.hutool.core.util.StrUtil;
+import com.bsd.pjcloud.admin.api.dto.SysLogDTO;
+import com.bsd.pjcloud.admin.api.feign.RemoteUserService;
+import com.bsd.pjcloud.common.core.constant.CacheConstants;
+import com.bsd.pjcloud.common.core.constant.CommonConstants;
+import com.bsd.pjcloud.common.core.constant.SecurityConstants;
+import com.bsd.pjcloud.common.core.util.KeyStrResolver;
+import com.bsd.pjcloud.common.core.util.R;
+import com.bsd.pjcloud.common.core.util.WebUtils;
+import com.bsd.pjcloud.common.data.resolver.ParamResolver;
+import com.bsd.pjcloud.common.log.event.SysLogEvent;
+import com.bsd.pjcloud.common.log.util.LogTypeEnum;
+import com.bsd.pjcloud.common.log.util.SysLogUtils;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
+import lombok.RequiredArgsConstructor;
+import lombok.SneakyThrows;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.context.ApplicationEventPublisher;
+import org.springframework.data.redis.core.StringRedisTemplate;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.MediaType;
+import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
+import org.springframework.http.server.ServletServerHttpResponse;
+import org.springframework.security.core.AuthenticationException;
+import org.springframework.security.oauth2.core.OAuth2AuthenticationException;
+import org.springframework.security.oauth2.core.endpoint.OAuth2ParameterNames;
+import org.springframework.security.web.authentication.AuthenticationFailureHandler;
+import org.springframework.stereotype.Component;
+
+import java.io.IOException;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * @author pjcloud
+ * @date 2022-06-02
+ */
+@Slf4j
+@Component
+@RequiredArgsConstructor
+public class PjcloudAuthenticationFailureEventHandler implements AuthenticationFailureHandler {
+
+ private static final MappingJackson2HttpMessageConverter errorHttpResponseConverter = new MappingJackson2HttpMessageConverter();
+
+ private final StringRedisTemplate redisTemplate;
+
+ private final ApplicationEventPublisher publisher;
+
+ private final KeyStrResolver tenantKeyStrResolver;
+
+ private final RemoteUserService userService;
+
+ /**
+ * Called when an authentication attempt fails.
+ * @param request the request during which the authentication attempt occurred.
+ * @param response the response.
+ * @param exception the exception which was thrown to reject the authentication
+ * request.
+ */
+ @Override
+ @SneakyThrows
+ public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response,
+ AuthenticationException exception) {
+ String grantType = request.getParameter(OAuth2ParameterNames.GRANT_TYPE);
+ log.info("登录失败,异常:{}", exception.getLocalizedMessage());
+
+ // 密码模式记录错误信息
+ if (OAuth2ParameterNames.PASSWORD.equals(grantType)) {
+ String username = request.getParameter(OAuth2ParameterNames.USERNAME);
+
+ // 密码错误记录错误次数 (TOC用户不记录)
+ String header = WebUtils.getRequest().getHeader(SecurityConstants.HEADER_TOC);
+ if (exception instanceof OAuth2AuthenticationException
+ && !SecurityConstants.HEADER_TOC_YES.equals(header)) {
+ recordLoginFailureTimes(username);
+ }
+
+ // 记录登录失败错误信息
+ sendFailureEventLog(request, exception, username);
+ }
+
+ // 写出错误信息
+ sendErrorResponse(request, response, exception);
+ }
+
+ /**
+ * 记录失败日志
+ * @param request HttpServletRequest
+ * @param exception 错误日志
+ * @param username 用户名
+ */
+ private void sendFailureEventLog(HttpServletRequest request, AuthenticationException exception, String username) {
+ SysLogDTO logVo = SysLogUtils.getSysLog();
+ logVo.setTitle("登录失败");
+ logVo.setLogType(LogTypeEnum.ERROR.getType());
+ logVo.setException(exception.getLocalizedMessage());
+ // 发送异步日志事件
+ String startTimeStr = request.getHeader(CommonConstants.REQUEST_START_TIME);
+ if (StrUtil.isNotBlank(startTimeStr)) {
+ Long startTime = Long.parseLong(startTimeStr);
+ Long endTime = System.currentTimeMillis();
+ logVo.setTime(endTime - startTime);
+ }
+ String header = request.getHeader(HttpHeaders.AUTHORIZATION);
+ String clientId = WebUtils.extractClientId(header).orElse(null);
+ logVo.setServiceId(clientId);
+ logVo.setCreateBy(username);
+ logVo.setTenantId(Long.parseLong(tenantKeyStrResolver.key()));
+ publisher.publishEvent(new SysLogEvent(logVo));
+ }
+
+ /**
+ * 记录登录失败此处,如果操作阈值 调用接口锁定用户
+ * @param username username
+ */
+ private void recordLoginFailureTimes(String username) {
+ String key = String.format("%s:%s:%s", tenantKeyStrResolver.key(), CacheConstants.LOGIN_ERROR_TIMES, username);
+ Long deltaTimes = ParamResolver.getLong("LOGIN_ERROR_TIMES", 5L);
+ Long times = redisTemplate.opsForValue().increment(key);
+
+ // 自动过期时间
+ Long deltaTime = ParamResolver.getLong("DELTA_TIME", 1L);
+ redisTemplate.expire(key, deltaTime, TimeUnit.HOURS);
+
+ if (deltaTimes <= times) {
+ userService.lockUser(username);
+ }
+ }
+
+ private void sendErrorResponse(HttpServletRequest request, HttpServletResponse response,
+ AuthenticationException exception) throws IOException {
+ ServletServerHttpResponse httpResponse = new ServletServerHttpResponse(response);
+ httpResponse.setStatusCode(HttpStatus.UNAUTHORIZED);
+ String errorMessage;
+
+ if (exception instanceof OAuth2AuthenticationException) {
+ OAuth2AuthenticationException authorizationException = (OAuth2AuthenticationException) exception;
+ errorMessage = StrUtil.isBlank(authorizationException.getError().getDescription())
+ ? authorizationException.getError().getErrorCode()
+ : authorizationException.getError().getDescription();
+
+ this.errorHttpResponseConverter.write(
+ R.failed(authorizationException.getError().getErrorCode(), errorMessage),
+ MediaType.APPLICATION_JSON, httpResponse);
+
+ }
+ else {
+ errorMessage = exception.getLocalizedMessage();
+ this.errorHttpResponseConverter.write(R.failed(errorMessage), MediaType.APPLICATION_JSON, httpResponse);
+ }
+ }
+
+}
diff --git a/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/support/handler/PjcloudAuthenticationSuccessEventHandler.java b/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/support/handler/PjcloudAuthenticationSuccessEventHandler.java
new file mode 100644
index 00000000..b1889012
--- /dev/null
+++ b/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/support/handler/PjcloudAuthenticationSuccessEventHandler.java
@@ -0,0 +1,167 @@
+/*
+ * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.bsd.pjcloud.auth.support.handler;
+
+import cn.hutool.core.map.MapUtil;
+import cn.hutool.core.util.StrUtil;
+import com.bsd.pjcloud.admin.api.dto.SysLogDTO;
+import com.bsd.pjcloud.common.core.constant.CacheConstants;
+import com.bsd.pjcloud.common.core.constant.CommonConstants;
+import com.bsd.pjcloud.common.core.constant.SecurityConstants;
+import com.bsd.pjcloud.common.core.util.KeyStrResolver;
+import com.bsd.pjcloud.common.log.event.SysLogEvent;
+import com.bsd.pjcloud.common.log.util.LogTypeEnum;
+import com.bsd.pjcloud.common.log.util.SysLogUtils;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
+import lombok.RequiredArgsConstructor;
+import lombok.SneakyThrows;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.context.ApplicationEventPublisher;
+import org.springframework.data.redis.core.StringRedisTemplate;
+import org.springframework.http.converter.HttpMessageConverter;
+import org.springframework.http.server.ServletServerHttpResponse;
+import org.springframework.security.core.Authentication;
+import org.springframework.security.core.context.SecurityContext;
+import org.springframework.security.core.context.SecurityContextHolder;
+import org.springframework.security.oauth2.core.OAuth2AccessToken;
+import org.springframework.security.oauth2.core.OAuth2RefreshToken;
+import org.springframework.security.oauth2.core.endpoint.OAuth2AccessTokenResponse;
+import org.springframework.security.oauth2.core.http.converter.OAuth2AccessTokenResponseHttpMessageConverter;
+import org.springframework.security.oauth2.server.authorization.authentication.OAuth2AccessTokenAuthenticationToken;
+import org.springframework.security.web.authentication.AuthenticationSuccessHandler;
+import org.springframework.stereotype.Component;
+import org.springframework.util.CollectionUtils;
+
+import java.io.IOException;
+import java.time.temporal.ChronoUnit;
+import java.util.Map;
+
+/**
+ * @author pjcloud
+ * @date 2022-06-02
+ */
+@Slf4j
+@Component
+@RequiredArgsConstructor
+public class PjcloudAuthenticationSuccessEventHandler implements AuthenticationSuccessHandler {
+
+ private static final HttpMessageConverter accessTokenHttpResponseConverter = new OAuth2AccessTokenResponseHttpMessageConverter();
+
+ private final StringRedisTemplate redisTemplate;
+
+ private final ApplicationEventPublisher publisher;
+
+ private final KeyStrResolver tenantKeyStrResolver;
+
+ /**
+ * Called when a user has been successfully authenticated.
+ * @param request the request which caused the successful authentication
+ * @param response the response
+ * @param authentication the Authentication object which was created during
+ * the authentication process.
+ */
+ @SneakyThrows
+ @Override
+ public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response,
+ Authentication authentication) {
+
+ // 写入登录成功的日志
+ OAuth2AccessTokenAuthenticationToken accessTokenAuthentication = (OAuth2AccessTokenAuthenticationToken) authentication;
+ Map map = accessTokenAuthentication.getAdditionalParameters();
+ if (MapUtil.isNotEmpty(map)) {
+ sendSuccessEventLog(request, accessTokenAuthentication, map);
+ }
+
+ // 清除账号历史锁定次数
+ clearLoginFailureTimes(map);
+
+ // 输出token
+ sendAccessTokenResponse(response, authentication);
+ }
+
+ /**
+ * 记录登录成功事件
+ * @param request HttpServletRequest
+ * @param accessTokenAuthentication Authentication
+ * @param map 请求参数
+ */
+ private void sendSuccessEventLog(HttpServletRequest request,
+ OAuth2AccessTokenAuthenticationToken accessTokenAuthentication, Map map) {
+ // 发送异步日志事件
+
+ SecurityContext context = SecurityContextHolder.createEmptyContext();
+ context.setAuthentication(accessTokenAuthentication);
+ SecurityContextHolder.setContext(context);
+
+ SysLogDTO logVo = SysLogUtils.getSysLog();
+ logVo.setTitle("登录成功");
+ logVo.setLogType(LogTypeEnum.NORMAL.getType());
+ String startTimeStr = request.getHeader(CommonConstants.REQUEST_START_TIME);
+ if (StrUtil.isNotBlank(startTimeStr)) {
+ Long startTime = Long.parseLong(startTimeStr);
+ Long endTime = System.currentTimeMillis();
+ logVo.setTime(endTime - startTime);
+ }
+
+ logVo.setServiceId(accessTokenAuthentication.getRegisteredClient().getClientId());
+ logVo.setCreateBy(MapUtil.getStr(map, SecurityConstants.DETAILS_USERNAME));
+ logVo.setTenantId(Long.parseLong(tenantKeyStrResolver.key()));
+
+ publisher.publishEvent(new SysLogEvent(logVo));
+ }
+
+ /**
+ * 清空登录失败的记录
+ * @param map
+ */
+ private void clearLoginFailureTimes(Map map) {
+ String key = String.format("%s:%s:%s", tenantKeyStrResolver.key(), CacheConstants.LOGIN_ERROR_TIMES,
+ MapUtil.getStr(map, SecurityConstants.DETAILS_USERNAME));
+ redisTemplate.delete(key);
+ }
+
+ private void sendAccessTokenResponse(HttpServletResponse response, Authentication authentication)
+ throws IOException {
+
+ OAuth2AccessTokenAuthenticationToken accessTokenAuthentication = (OAuth2AccessTokenAuthenticationToken) authentication;
+
+ OAuth2AccessToken accessToken = accessTokenAuthentication.getAccessToken();
+ OAuth2RefreshToken refreshToken = accessTokenAuthentication.getRefreshToken();
+ Map additionalParameters = accessTokenAuthentication.getAdditionalParameters();
+
+ OAuth2AccessTokenResponse.Builder builder = OAuth2AccessTokenResponse.withToken(accessToken.getTokenValue())
+ .tokenType(accessToken.getTokenType())
+ .scopes(accessToken.getScopes());
+ if (accessToken.getIssuedAt() != null && accessToken.getExpiresAt() != null) {
+ builder.expiresIn(ChronoUnit.SECONDS.between(accessToken.getIssuedAt(), accessToken.getExpiresAt()));
+ }
+ if (refreshToken != null) {
+ builder.refreshToken(refreshToken.getTokenValue());
+ }
+ if (!CollectionUtils.isEmpty(additionalParameters)) {
+ builder.additionalParameters(additionalParameters);
+ }
+ OAuth2AccessTokenResponse accessTokenResponse = builder.build();
+ ServletServerHttpResponse httpResponse = new ServletServerHttpResponse(response);
+
+ // 无状态 注意删除 context 上下文的信息
+ SecurityContextHolder.clearContext();
+ this.accessTokenHttpResponseConverter.write(accessTokenResponse, null, httpResponse);
+ }
+
+}
diff --git a/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/support/handler/PjcloudLogoutSuccessEventHandler.java b/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/support/handler/PjcloudLogoutSuccessEventHandler.java
new file mode 100644
index 00000000..8ce0d9d2
--- /dev/null
+++ b/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/support/handler/PjcloudLogoutSuccessEventHandler.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.bsd.pjcloud.auth.support.handler;
+
+import com.bsd.pjcloud.admin.api.dto.SysLogDTO;
+import com.bsd.pjcloud.common.core.util.WebUtils;
+import com.bsd.pjcloud.common.log.util.SysLogUtils;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.context.ApplicationListener;
+import org.springframework.http.HttpHeaders;
+import org.springframework.security.authentication.event.LogoutSuccessEvent;
+import org.springframework.security.core.Authentication;
+import org.springframework.security.web.authentication.preauth.PreAuthenticatedAuthenticationToken;
+import org.springframework.stereotype.Component;
+
+/**
+ * @author zhangran
+ * @date 2022-06-02
+ *
+ * 事件机制处理退出相关
+ */
+@Slf4j
+@Component
+public class PjcloudLogoutSuccessEventHandler implements ApplicationListener {
+
+ @Override
+ public void onApplicationEvent(LogoutSuccessEvent event) {
+ Authentication authentication = (Authentication) event.getSource();
+ if (authentication instanceof PreAuthenticatedAuthenticationToken) {
+ handle(authentication);
+ }
+ }
+
+ /**
+ * 处理退出成功方法
+ *
+ * 获取到登录的authentication 对象
+ * @param authentication 登录对象
+ */
+ public void handle(Authentication authentication) {
+ log.info("用户:{} 退出成功", authentication.getPrincipal());
+ SysLogDTO logVo = SysLogUtils.getSysLog();
+ logVo.setTitle("退出成功");
+ // 发送异步日志事件
+ Long startTime = System.currentTimeMillis();
+ Long endTime = System.currentTimeMillis();
+ logVo.setTime(endTime - startTime);
+
+ // 设置对应的token
+ logVo.setParams(WebUtils.getRequest().getHeader(HttpHeaders.AUTHORIZATION));
+
+ // 这边设置ServiceId
+ if (authentication instanceof PreAuthenticatedAuthenticationToken) {
+ logVo.setServiceId(authentication.getCredentials().toString());
+ }
+ logVo.setCreateBy(authentication.getName());
+ }
+
+}
diff --git a/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/support/handler/SsoLogoutSuccessHandler.java b/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/support/handler/SsoLogoutSuccessHandler.java
new file mode 100644
index 00000000..a4a27b63
--- /dev/null
+++ b/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/support/handler/SsoLogoutSuccessHandler.java
@@ -0,0 +1,41 @@
+package com.bsd.pjcloud.auth.support.handler;
+
+import cn.hutool.core.util.StrUtil;
+import org.springframework.http.HttpHeaders;
+import org.springframework.security.core.Authentication;
+import org.springframework.security.web.authentication.logout.LogoutSuccessHandler;
+
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
+import java.io.IOException;
+
+/**
+ * @author pjcloud
+ * @date 2022-06-02
+ *
+ * sso 退出功能 ,根据客户端传入跳转
+ */
+public class SsoLogoutSuccessHandler implements LogoutSuccessHandler {
+
+ private static final String REDIRECT_URL = "redirect_url";
+
+ @Override
+ public void onLogoutSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication)
+ throws IOException {
+ if (response == null) {
+ return;
+ }
+
+ // 获取请求参数中是否包含 回调地址
+ String redirectUrl = request.getParameter(REDIRECT_URL);
+ if (StrUtil.isNotBlank(redirectUrl)) {
+ response.sendRedirect(redirectUrl);
+ }
+ else if (StrUtil.isNotBlank(request.getHeader(HttpHeaders.REFERER))) {
+ // 默认跳转referer 地址
+ String referer = request.getHeader(HttpHeaders.REFERER);
+ response.sendRedirect(referer);
+ }
+ }
+
+}
diff --git a/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/support/handler/TenantSavedRequestAwareAuthenticationSuccessHandler.java b/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/support/handler/TenantSavedRequestAwareAuthenticationSuccessHandler.java
new file mode 100644
index 00000000..27ebd6c2
--- /dev/null
+++ b/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/support/handler/TenantSavedRequestAwareAuthenticationSuccessHandler.java
@@ -0,0 +1,60 @@
+package com.bsd.pjcloud.auth.support.handler;
+
+import com.bsd.pjcloud.common.core.util.KeyStrResolver;
+import com.bsd.pjcloud.common.core.util.SpringContextHolder;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.springframework.security.core.Authentication;
+import org.springframework.security.web.authentication.SavedRequestAwareAuthenticationSuccessHandler;
+import org.springframework.security.web.authentication.SimpleUrlAuthenticationSuccessHandler;
+import org.springframework.security.web.savedrequest.HttpSessionRequestCache;
+import org.springframework.security.web.savedrequest.RequestCache;
+import org.springframework.security.web.savedrequest.SavedRequest;
+
+import jakarta.servlet.ServletException;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
+import java.io.IOException;
+
+/**
+ * @author pjcloud
+ * @date 2021/2/7
+ *
+ * 增强成功回调增加租户上下文避免极端情况下丢失问题
+ * @see SavedRequestAwareAuthenticationSuccessHandler
+ */
+@Slf4j
+public class TenantSavedRequestAwareAuthenticationSuccessHandler extends SimpleUrlAuthenticationSuccessHandler {
+
+ protected final Log logger = LogFactory.getLog(this.getClass());
+
+ private RequestCache requestCache = new HttpSessionRequestCache();
+
+ public TenantSavedRequestAwareAuthenticationSuccessHandler() {
+ }
+
+ @Override
+ public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response,
+ Authentication authentication) throws ServletException, IOException {
+ SavedRequest savedRequest = this.requestCache.getRequest(request, response);
+ if (savedRequest == null) {
+ super.onAuthenticationSuccess(request, response, authentication);
+ }
+
+ if (isAlwaysUseDefaultTargetUrl()) {
+ this.requestCache.removeRequest(request, response);
+ super.onAuthenticationSuccess(request, response, authentication);
+ }
+ else {
+ this.clearAuthenticationAttributes(request);
+ // 增加租户信息
+ assert savedRequest != null;
+ String targetUrl = savedRequest.getRedirectUrl() + "&TENANT-ID="
+ + SpringContextHolder.getBean(KeyStrResolver.class).key();
+
+ this.getRedirectStrategy().sendRedirect(request, response, targetUrl);
+ }
+ }
+
+}
diff --git a/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/support/password/OAuth2ResourceOwnerPasswordAuthenticationConverter.java b/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/support/password/OAuth2ResourceOwnerPasswordAuthenticationConverter.java
new file mode 100644
index 00000000..5e94f956
--- /dev/null
+++ b/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/support/password/OAuth2ResourceOwnerPasswordAuthenticationConverter.java
@@ -0,0 +1,63 @@
+package com.bsd.pjcloud.auth.support.password;
+
+import com.bsd.pjcloud.auth.support.base.OAuth2ResourceOwnerBaseAuthenticationConverter;
+import com.bsd.pjcloud.common.security.util.OAuth2EndpointUtils;
+import org.springframework.security.core.Authentication;
+import org.springframework.security.oauth2.core.AuthorizationGrantType;
+import org.springframework.security.oauth2.core.OAuth2ErrorCodes;
+import org.springframework.security.oauth2.core.endpoint.OAuth2ParameterNames;
+import org.springframework.util.MultiValueMap;
+import org.springframework.util.StringUtils;
+
+import jakarta.servlet.http.HttpServletRequest;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * @author jumuning
+ * @date 2022-06-02
+ *
+ * 密码认证转换器
+ */
+public class OAuth2ResourceOwnerPasswordAuthenticationConverter
+ extends OAuth2ResourceOwnerBaseAuthenticationConverter {
+
+ /**
+ * 支持密码模式
+ * @param grantType 授权类型
+ */
+ @Override
+ public boolean support(String grantType) {
+ return AuthorizationGrantType.PASSWORD.getValue().equals(grantType);
+ }
+
+ @Override
+ public OAuth2ResourceOwnerPasswordAuthenticationToken buildToken(Authentication clientPrincipal,
+ Set requestedScopes, Map additionalParameters) {
+ return new OAuth2ResourceOwnerPasswordAuthenticationToken(AuthorizationGrantType.PASSWORD, clientPrincipal,
+ requestedScopes, additionalParameters);
+ }
+
+ /**
+ * 校验扩展参数 密码模式密码必须不为空
+ * @param request 参数列表
+ */
+ @Override
+ public void checkParams(HttpServletRequest request) {
+ MultiValueMap parameters = OAuth2EndpointUtils.getParameters(request);
+ // username (REQUIRED)
+ String username = parameters.getFirst(OAuth2ParameterNames.USERNAME);
+ if (!StringUtils.hasText(username) || parameters.get(OAuth2ParameterNames.USERNAME).size() != 1) {
+ OAuth2EndpointUtils.throwError(OAuth2ErrorCodes.INVALID_REQUEST, OAuth2ParameterNames.USERNAME,
+ OAuth2EndpointUtils.ACCESS_TOKEN_REQUEST_ERROR_URI);
+ }
+
+ // password (REQUIRED)
+ String password = parameters.getFirst(OAuth2ParameterNames.PASSWORD);
+ if (!StringUtils.hasText(password) || parameters.get(OAuth2ParameterNames.PASSWORD).size() != 1) {
+ OAuth2EndpointUtils.throwError(OAuth2ErrorCodes.INVALID_REQUEST, OAuth2ParameterNames.PASSWORD,
+ OAuth2EndpointUtils.ACCESS_TOKEN_REQUEST_ERROR_URI);
+ }
+ }
+
+}
diff --git a/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/support/password/OAuth2ResourceOwnerPasswordAuthenticationProvider.java b/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/support/password/OAuth2ResourceOwnerPasswordAuthenticationProvider.java
new file mode 100644
index 00000000..0bf3d95d
--- /dev/null
+++ b/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/support/password/OAuth2ResourceOwnerPasswordAuthenticationProvider.java
@@ -0,0 +1,64 @@
+package com.bsd.pjcloud.auth.support.password;
+
+import com.bsd.pjcloud.auth.support.base.OAuth2ResourceOwnerBaseAuthenticationProvider;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.springframework.security.authentication.AuthenticationManager;
+import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
+import org.springframework.security.oauth2.core.AuthorizationGrantType;
+import org.springframework.security.oauth2.core.OAuth2AuthenticationException;
+import org.springframework.security.oauth2.core.OAuth2ErrorCodes;
+import org.springframework.security.oauth2.core.OAuth2Token;
+import org.springframework.security.oauth2.core.endpoint.OAuth2ParameterNames;
+import org.springframework.security.oauth2.server.authorization.OAuth2AuthorizationService;
+import org.springframework.security.oauth2.server.authorization.client.RegisteredClient;
+import org.springframework.security.oauth2.server.authorization.token.OAuth2TokenGenerator;
+
+import java.util.Map;
+
+/**
+ * @author jumuning
+ * @description 处理用户名密码授权
+ */
+public class OAuth2ResourceOwnerPasswordAuthenticationProvider
+ extends OAuth2ResourceOwnerBaseAuthenticationProvider {
+
+ private static final Logger LOGGER = LogManager.getLogger(OAuth2ResourceOwnerPasswordAuthenticationProvider.class);
+
+ /**
+ * Constructs an {@code OAuth2AuthorizationCodeAuthenticationProvider} using the
+ * provided parameters.
+ * @param authenticationManager
+ * @param authorizationService the authorization service
+ * @param tokenGenerator the token generator
+ * @since 0.2.3
+ */
+ public OAuth2ResourceOwnerPasswordAuthenticationProvider(AuthenticationManager authenticationManager,
+ OAuth2AuthorizationService authorizationService,
+ OAuth2TokenGenerator extends OAuth2Token> tokenGenerator) {
+ super(authenticationManager, authorizationService, tokenGenerator);
+ }
+
+ @Override
+ public UsernamePasswordAuthenticationToken buildToken(Map reqParameters) {
+ String username = (String) reqParameters.get(OAuth2ParameterNames.USERNAME);
+ String password = (String) reqParameters.get(OAuth2ParameterNames.PASSWORD);
+ return new UsernamePasswordAuthenticationToken(username, password);
+ }
+
+ @Override
+ public boolean supports(Class> authentication) {
+ boolean supports = OAuth2ResourceOwnerPasswordAuthenticationToken.class.isAssignableFrom(authentication);
+ LOGGER.debug("supports authentication=" + authentication + " returning " + supports);
+ return supports;
+ }
+
+ @Override
+ public void checkClient(RegisteredClient registeredClient) {
+ assert registeredClient != null;
+ if (!registeredClient.getAuthorizationGrantTypes().contains(AuthorizationGrantType.PASSWORD)) {
+ throw new OAuth2AuthenticationException(OAuth2ErrorCodes.UNAUTHORIZED_CLIENT);
+ }
+ }
+
+}
diff --git a/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/support/password/OAuth2ResourceOwnerPasswordAuthenticationToken.java b/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/support/password/OAuth2ResourceOwnerPasswordAuthenticationToken.java
new file mode 100644
index 00000000..5c889b74
--- /dev/null
+++ b/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/support/password/OAuth2ResourceOwnerPasswordAuthenticationToken.java
@@ -0,0 +1,21 @@
+package com.bsd.pjcloud.auth.support.password;
+
+import com.bsd.pjcloud.auth.support.base.OAuth2ResourceOwnerBaseAuthenticationToken;
+import org.springframework.security.core.Authentication;
+import org.springframework.security.oauth2.core.AuthorizationGrantType;
+
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * @author jumuning
+ * @description 密码授权token信息
+ */
+public class OAuth2ResourceOwnerPasswordAuthenticationToken extends OAuth2ResourceOwnerBaseAuthenticationToken {
+
+ public OAuth2ResourceOwnerPasswordAuthenticationToken(AuthorizationGrantType authorizationGrantType,
+ Authentication clientPrincipal, Set scopes, Map additionalParameters) {
+ super(authorizationGrantType, clientPrincipal, scopes, additionalParameters);
+ }
+
+}
diff --git a/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/support/password/package-info.java b/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/support/password/package-info.java
new file mode 100644
index 00000000..1d6d1521
--- /dev/null
+++ b/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/support/password/package-info.java
@@ -0,0 +1,4 @@
+/**
+ * 密码模式
+ */
+package com.bsd.pjcloud.auth.support.password;
diff --git a/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/support/sms/OAuth2ResourceOwnerSmsAuthenticationConverter.java b/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/support/sms/OAuth2ResourceOwnerSmsAuthenticationConverter.java
new file mode 100644
index 00000000..8749b283
--- /dev/null
+++ b/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/support/sms/OAuth2ResourceOwnerSmsAuthenticationConverter.java
@@ -0,0 +1,57 @@
+package com.bsd.pjcloud.auth.support.sms;
+
+import com.bsd.pjcloud.auth.support.base.OAuth2ResourceOwnerBaseAuthenticationConverter;
+import com.bsd.pjcloud.common.core.constant.SecurityConstants;
+import com.bsd.pjcloud.common.security.util.OAuth2EndpointUtils;
+import org.springframework.security.core.Authentication;
+import org.springframework.security.oauth2.core.AuthorizationGrantType;
+import org.springframework.security.oauth2.core.OAuth2ErrorCodes;
+import org.springframework.util.MultiValueMap;
+import org.springframework.util.StringUtils;
+
+import jakarta.servlet.http.HttpServletRequest;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * @author pjcloud
+ * @date 2022-05-31
+ *
+ * 短信登录转换器
+ */
+public class OAuth2ResourceOwnerSmsAuthenticationConverter
+ extends OAuth2ResourceOwnerBaseAuthenticationConverter {
+
+ /**
+ * 是否支持此convert
+ * @param grantType 授权类型
+ * @return
+ */
+ @Override
+ public boolean support(String grantType) {
+ return SecurityConstants.APP.equals(grantType);
+ }
+
+ @Override
+ public OAuth2ResourceOwnerSmsAuthenticationToken buildToken(Authentication clientPrincipal, Set requestedScopes,
+ Map additionalParameters) {
+ return new OAuth2ResourceOwnerSmsAuthenticationToken(new AuthorizationGrantType(SecurityConstants.APP),
+ clientPrincipal, requestedScopes, additionalParameters);
+ }
+
+ /**
+ * 校验扩展参数 密码模式密码必须不为空
+ * @param request 参数列表
+ */
+ @Override
+ public void checkParams(HttpServletRequest request) {
+ MultiValueMap parameters = OAuth2EndpointUtils.getParameters(request);
+ // PHONE (REQUIRED)
+ String phone = parameters.getFirst(SecurityConstants.SMS_PARAMETER_NAME);
+ if (!StringUtils.hasText(phone) || parameters.get(SecurityConstants.SMS_PARAMETER_NAME).size() != 1) {
+ OAuth2EndpointUtils.throwError(OAuth2ErrorCodes.INVALID_REQUEST, SecurityConstants.SMS_PARAMETER_NAME,
+ OAuth2EndpointUtils.ACCESS_TOKEN_REQUEST_ERROR_URI);
+ }
+ }
+
+}
diff --git a/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/support/sms/OAuth2ResourceOwnerSmsAuthenticationProvider.java b/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/support/sms/OAuth2ResourceOwnerSmsAuthenticationProvider.java
new file mode 100644
index 00000000..f4551b82
--- /dev/null
+++ b/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/support/sms/OAuth2ResourceOwnerSmsAuthenticationProvider.java
@@ -0,0 +1,66 @@
+package com.bsd.pjcloud.auth.support.sms;
+
+import com.bsd.pjcloud.auth.support.base.OAuth2ResourceOwnerBaseAuthenticationProvider;
+import com.bsd.pjcloud.common.core.constant.SecurityConstants;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.springframework.security.authentication.AuthenticationManager;
+import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
+import org.springframework.security.oauth2.core.AuthorizationGrantType;
+import org.springframework.security.oauth2.core.OAuth2AuthenticationException;
+import org.springframework.security.oauth2.core.OAuth2ErrorCodes;
+import org.springframework.security.oauth2.core.OAuth2Token;
+import org.springframework.security.oauth2.server.authorization.OAuth2AuthorizationService;
+import org.springframework.security.oauth2.server.authorization.client.RegisteredClient;
+import org.springframework.security.oauth2.server.authorization.token.OAuth2TokenGenerator;
+
+import java.util.Map;
+
+/**
+ * @author pjcloud
+ * @date date
+ *
+ * 短信登录的核心处理
+ */
+public class OAuth2ResourceOwnerSmsAuthenticationProvider
+ extends OAuth2ResourceOwnerBaseAuthenticationProvider {
+
+ private static final Logger LOGGER = LogManager.getLogger(OAuth2ResourceOwnerSmsAuthenticationProvider.class);
+
+ /**
+ * Constructs an {@code OAuth2AuthorizationCodeAuthenticationProvider} using the
+ * provided parameters.
+ * @param authenticationManager
+ * @param authorizationService the authorization service
+ * @param tokenGenerator the token generator
+ * @since 0.2.3
+ */
+ public OAuth2ResourceOwnerSmsAuthenticationProvider(AuthenticationManager authenticationManager,
+ OAuth2AuthorizationService authorizationService,
+ OAuth2TokenGenerator extends OAuth2Token> tokenGenerator) {
+ super(authenticationManager, authorizationService, tokenGenerator);
+ }
+
+ @Override
+ public boolean supports(Class> authentication) {
+ boolean supports = OAuth2ResourceOwnerSmsAuthenticationToken.class.isAssignableFrom(authentication);
+ LOGGER.debug("supports authentication=" + authentication + " returning " + supports);
+ return supports;
+ }
+
+ @Override
+ public void checkClient(RegisteredClient registeredClient) {
+ assert registeredClient != null;
+ if (!registeredClient.getAuthorizationGrantTypes()
+ .contains(new AuthorizationGrantType(SecurityConstants.APP))) {
+ throw new OAuth2AuthenticationException(OAuth2ErrorCodes.UNAUTHORIZED_CLIENT);
+ }
+ }
+
+ @Override
+ public UsernamePasswordAuthenticationToken buildToken(Map reqParameters) {
+ String phone = (String) reqParameters.get(SecurityConstants.SMS_PARAMETER_NAME);
+ return new UsernamePasswordAuthenticationToken(phone, null);
+ }
+
+}
diff --git a/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/support/sms/OAuth2ResourceOwnerSmsAuthenticationToken.java b/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/support/sms/OAuth2ResourceOwnerSmsAuthenticationToken.java
new file mode 100644
index 00000000..6ab0af6d
--- /dev/null
+++ b/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/support/sms/OAuth2ResourceOwnerSmsAuthenticationToken.java
@@ -0,0 +1,21 @@
+package com.bsd.pjcloud.auth.support.sms;
+
+import com.bsd.pjcloud.auth.support.base.OAuth2ResourceOwnerBaseAuthenticationToken;
+import org.springframework.security.core.Authentication;
+import org.springframework.security.oauth2.core.AuthorizationGrantType;
+
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * @author pjcloud
+ * @description 短信登录token信息
+ */
+public class OAuth2ResourceOwnerSmsAuthenticationToken extends OAuth2ResourceOwnerBaseAuthenticationToken {
+
+ public OAuth2ResourceOwnerSmsAuthenticationToken(AuthorizationGrantType authorizationGrantType,
+ Authentication clientPrincipal, Set scopes, Map additionalParameters) {
+ super(authorizationGrantType, clientPrincipal, scopes, additionalParameters);
+ }
+
+}
diff --git a/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/support/sms/package-info.java b/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/support/sms/package-info.java
new file mode 100644
index 00000000..e4572b78
--- /dev/null
+++ b/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/support/sms/package-info.java
@@ -0,0 +1,4 @@
+/**
+ * 短信模式
+ */
+package com.bsd.pjcloud.auth.support.sms;
diff --git a/pjcloud-auth/src/main/resources/META-INF/services/com.anji.captcha.service.CaptchaCacheService b/pjcloud-auth/src/main/resources/META-INF/services/com.anji.captcha.service.CaptchaCacheService
new file mode 100644
index 00000000..b22b9731
--- /dev/null
+++ b/pjcloud-auth/src/main/resources/META-INF/services/com.anji.captcha.service.CaptchaCacheService
@@ -0,0 +1 @@
+com.bsd.pjcloud.auth.endpoint.CaptchaCacheServiceProvider
diff --git a/pjcloud-auth/src/main/resources/application.yml b/pjcloud-auth/src/main/resources/application.yml
new file mode 100644
index 00000000..c6a576cc
--- /dev/null
+++ b/pjcloud-auth/src/main/resources/application.yml
@@ -0,0 +1,18 @@
+server:
+ port: 3000
+
+spring:
+ application:
+ name: @artifactId@
+ cloud:
+ nacos:
+ username: @nacos.username@
+ password: @nacos.password@
+ discovery:
+ server-addr: ${NACOS_HOST:pjcloud-register}:${NACOS_PORT:8848}
+ config:
+ server-addr: ${spring.cloud.nacos.discovery.server-addr}
+ config:
+ import:
+ - optional:nacos:application-@profiles.active@.yml
+ - optional:nacos:${spring.application.name}-@profiles.active@.yml
diff --git a/pjcloud-auth/src/main/resources/logback-spring.xml b/pjcloud-auth/src/main/resources/logback-spring.xml
new file mode 100644
index 00000000..58904d49
--- /dev/null
+++ b/pjcloud-auth/src/main/resources/logback-spring.xml
@@ -0,0 +1,94 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ${CONSOLE_LOG_PATTERN}
+
+
+
+
+
+ ${log.path}/debug.log
+
+ ${log.path}/%d{yyyy-MM, aux}/debug.%d{yyyy-MM-dd}.%i.log.gz
+ 50MB
+ 30
+
+
+ %date [%thread] %-5level [%logger{50}] %file:%line - %msg%n
+
+
+
+
+
+ ${log.path}/error.log
+
+ ${log.path}/%d{yyyy-MM}/error.%d{yyyy-MM-dd}.%i.log.gz
+ 50MB
+ 30
+
+
+ %date [%thread] %-5level [%logger{50}] %file:%line - %msg%n
+
+
+ ERROR
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pjcloud-auth/src/main/resources/static/css/bootstrap.min.css b/pjcloud-auth/src/main/resources/static/css/bootstrap.min.css
new file mode 100644
index 00000000..82113bd8
--- /dev/null
+++ b/pjcloud-auth/src/main/resources/static/css/bootstrap.min.css
@@ -0,0 +1,6 @@
+/*!
+ * Bootstrap v3.3.7 (http://getbootstrap.com)
+ * Copyright 2011-2016 Twitter, Inc.
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
+ *//*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */html{font-family:sans-serif;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,hgroup,main,menu,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background-color:transparent}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:700}dfn{font-style:italic}h1{margin:.67em 0;font-size:2em}mark{color:#000;background:#ff0}small{font-size:80%}sub,sup{position:relative;font-size:75%;line-height:0;vertical-align:baseline}sup{top:-.5em}sub{bottom:-.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:1em 40px}hr{height:0;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box}pre{overflow:auto}code,kbd,pre,samp{font-family:monospace,monospace;font-size:1em}button,input,optgroup,select,textarea{margin:0;font:inherit;color:inherit}button{overflow:visible}button,select{text-transform:none}button,html input[type=button],input[type=reset],input[type=submit]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}button::-moz-focus-inner,input::-moz-focus-inner{padding:0;border:0}input{line-height:normal}input[type=checkbox],input[type=radio]{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;padding:0}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{height:auto}input[type=search]{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;-webkit-appearance:textfield}input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration{-webkit-appearance:none}fieldset{padding:.35em .625em .75em;margin:0 2px;border:1px solid silver}legend{padding:0;border:0}textarea{overflow:auto}optgroup{font-weight:700}table{border-spacing:0;border-collapse:collapse}td,th{padding:0}/*! Source: https://github.com/h5bp/html5-boilerplate/blob/master/src/css/main.css */@media print{*,:after,:before{color:#000!important;text-shadow:none!important;background:0 0!important;-webkit-box-shadow:none!important;box-shadow:none!important}a,a:visited{text-decoration:underline}a[href]:after{content:" (" attr(href) ")"}abbr[title]:after{content:" (" attr(title) ")"}a[href^="javascript:"]:after,a[href^="#"]:after{content:""}blockquote,pre{border:1px solid #999;page-break-inside:avoid}thead{display:table-header-group}img,tr{page-break-inside:avoid}img{max-width:100%!important}h2,h3,p{orphans:3;widows:3}h2,h3{page-break-after:avoid}.navbar{display:none}.btn>.caret,.dropup>.btn>.caret{border-top-color:#000!important}.label{border:1px solid #000}.table{border-collapse:collapse!important}.table td,.table th{background-color:#fff!important}.table-bordered td,.table-bordered th{border:1px solid #ddd!important}}@font-face{font-family:'Glyphicons Halflings';src:url(../fonts/glyphicons-halflings-regular.eot);src:url(../fonts/glyphicons-halflings-regular.eot?#iefix) format('embedded-opentype'),url(../fonts/glyphicons-halflings-regular.woff2) format('woff2'),url(../fonts/glyphicons-halflings-regular.woff) format('woff'),url(../fonts/glyphicons-halflings-regular.ttf) format('truetype'),url(../fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular) format('svg')}.glyphicon{position:relative;top:1px;display:inline-block;font-family:'Glyphicons Halflings';font-style:normal;font-weight:400;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.glyphicon-asterisk:before{content:"\002a"}.glyphicon-plus:before{content:"\002b"}.glyphicon-eur:before,.glyphicon-euro:before{content:"\20ac"}.glyphicon-minus:before{content:"\2212"}.glyphicon-cloud:before{content:"\2601"}.glyphicon-envelope:before{content:"\2709"}.glyphicon-pencil:before{content:"\270f"}.glyphicon-glass:before{content:"\e001"}.glyphicon-music:before{content:"\e002"}.glyphicon-search:before{content:"\e003"}.glyphicon-heart:before{content:"\e005"}.glyphicon-star:before{content:"\e006"}.glyphicon-star-empty:before{content:"\e007"}.glyphicon-user:before{content:"\e008"}.glyphicon-film:before{content:"\e009"}.glyphicon-th-large:before{content:"\e010"}.glyphicon-th:before{content:"\e011"}.glyphicon-th-list:before{content:"\e012"}.glyphicon-ok:before{content:"\e013"}.glyphicon-remove:before{content:"\e014"}.glyphicon-zoom-in:before{content:"\e015"}.glyphicon-zoom-out:before{content:"\e016"}.glyphicon-off:before{content:"\e017"}.glyphicon-signal:before{content:"\e018"}.glyphicon-cog:before{content:"\e019"}.glyphicon-trash:before{content:"\e020"}.glyphicon-home:before{content:"\e021"}.glyphicon-file:before{content:"\e022"}.glyphicon-time:before{content:"\e023"}.glyphicon-road:before{content:"\e024"}.glyphicon-download-alt:before{content:"\e025"}.glyphicon-download:before{content:"\e026"}.glyphicon-upload:before{content:"\e027"}.glyphicon-inbox:before{content:"\e028"}.glyphicon-play-circle:before{content:"\e029"}.glyphicon-repeat:before{content:"\e030"}.glyphicon-refresh:before{content:"\e031"}.glyphicon-list-alt:before{content:"\e032"}.glyphicon-lock:before{content:"\e033"}.glyphicon-flag:before{content:"\e034"}.glyphicon-headphones:before{content:"\e035"}.glyphicon-volume-off:before{content:"\e036"}.glyphicon-volume-down:before{content:"\e037"}.glyphicon-volume-up:before{content:"\e038"}.glyphicon-qrcode:before{content:"\e039"}.glyphicon-barcode:before{content:"\e040"}.glyphicon-tag:before{content:"\e041"}.glyphicon-tags:before{content:"\e042"}.glyphicon-book:before{content:"\e043"}.glyphicon-bookmark:before{content:"\e044"}.glyphicon-print:before{content:"\e045"}.glyphicon-camera:before{content:"\e046"}.glyphicon-font:before{content:"\e047"}.glyphicon-bold:before{content:"\e048"}.glyphicon-italic:before{content:"\e049"}.glyphicon-text-height:before{content:"\e050"}.glyphicon-text-width:before{content:"\e051"}.glyphicon-align-left:before{content:"\e052"}.glyphicon-align-center:before{content:"\e053"}.glyphicon-align-right:before{content:"\e054"}.glyphicon-align-justify:before{content:"\e055"}.glyphicon-list:before{content:"\e056"}.glyphicon-indent-left:before{content:"\e057"}.glyphicon-indent-right:before{content:"\e058"}.glyphicon-facetime-video:before{content:"\e059"}.glyphicon-picture:before{content:"\e060"}.glyphicon-map-marker:before{content:"\e062"}.glyphicon-adjust:before{content:"\e063"}.glyphicon-tint:before{content:"\e064"}.glyphicon-edit:before{content:"\e065"}.glyphicon-share:before{content:"\e066"}.glyphicon-check:before{content:"\e067"}.glyphicon-move:before{content:"\e068"}.glyphicon-step-backward:before{content:"\e069"}.glyphicon-fast-backward:before{content:"\e070"}.glyphicon-backward:before{content:"\e071"}.glyphicon-play:before{content:"\e072"}.glyphicon-pause:before{content:"\e073"}.glyphicon-stop:before{content:"\e074"}.glyphicon-forward:before{content:"\e075"}.glyphicon-fast-forward:before{content:"\e076"}.glyphicon-step-forward:before{content:"\e077"}.glyphicon-eject:before{content:"\e078"}.glyphicon-chevron-left:before{content:"\e079"}.glyphicon-chevron-right:before{content:"\e080"}.glyphicon-plus-sign:before{content:"\e081"}.glyphicon-minus-sign:before{content:"\e082"}.glyphicon-remove-sign:before{content:"\e083"}.glyphicon-ok-sign:before{content:"\e084"}.glyphicon-question-sign:before{content:"\e085"}.glyphicon-info-sign:before{content:"\e086"}.glyphicon-screenshot:before{content:"\e087"}.glyphicon-remove-circle:before{content:"\e088"}.glyphicon-ok-circle:before{content:"\e089"}.glyphicon-ban-circle:before{content:"\e090"}.glyphicon-arrow-left:before{content:"\e091"}.glyphicon-arrow-right:before{content:"\e092"}.glyphicon-arrow-up:before{content:"\e093"}.glyphicon-arrow-down:before{content:"\e094"}.glyphicon-share-alt:before{content:"\e095"}.glyphicon-resize-full:before{content:"\e096"}.glyphicon-resize-small:before{content:"\e097"}.glyphicon-exclamation-sign:before{content:"\e101"}.glyphicon-gift:before{content:"\e102"}.glyphicon-leaf:before{content:"\e103"}.glyphicon-fire:before{content:"\e104"}.glyphicon-eye-open:before{content:"\e105"}.glyphicon-eye-close:before{content:"\e106"}.glyphicon-warning-sign:before{content:"\e107"}.glyphicon-plane:before{content:"\e108"}.glyphicon-calendar:before{content:"\e109"}.glyphicon-random:before{content:"\e110"}.glyphicon-comment:before{content:"\e111"}.glyphicon-magnet:before{content:"\e112"}.glyphicon-chevron-up:before{content:"\e113"}.glyphicon-chevron-down:before{content:"\e114"}.glyphicon-retweet:before{content:"\e115"}.glyphicon-shopping-cart:before{content:"\e116"}.glyphicon-folder-close:before{content:"\e117"}.glyphicon-folder-open:before{content:"\e118"}.glyphicon-resize-vertical:before{content:"\e119"}.glyphicon-resize-horizontal:before{content:"\e120"}.glyphicon-hdd:before{content:"\e121"}.glyphicon-bullhorn:before{content:"\e122"}.glyphicon-bell:before{content:"\e123"}.glyphicon-certificate:before{content:"\e124"}.glyphicon-thumbs-up:before{content:"\e125"}.glyphicon-thumbs-down:before{content:"\e126"}.glyphicon-hand-right:before{content:"\e127"}.glyphicon-hand-left:before{content:"\e128"}.glyphicon-hand-up:before{content:"\e129"}.glyphicon-hand-down:before{content:"\e130"}.glyphicon-circle-arrow-right:before{content:"\e131"}.glyphicon-circle-arrow-left:before{content:"\e132"}.glyphicon-circle-arrow-up:before{content:"\e133"}.glyphicon-circle-arrow-down:before{content:"\e134"}.glyphicon-globe:before{content:"\e135"}.glyphicon-wrench:before{content:"\e136"}.glyphicon-tasks:before{content:"\e137"}.glyphicon-filter:before{content:"\e138"}.glyphicon-briefcase:before{content:"\e139"}.glyphicon-fullscreen:before{content:"\e140"}.glyphicon-dashboard:before{content:"\e141"}.glyphicon-paperclip:before{content:"\e142"}.glyphicon-heart-empty:before{content:"\e143"}.glyphicon-link:before{content:"\e144"}.glyphicon-phone:before{content:"\e145"}.glyphicon-pushpin:before{content:"\e146"}.glyphicon-usd:before{content:"\e148"}.glyphicon-gbp:before{content:"\e149"}.glyphicon-sort:before{content:"\e150"}.glyphicon-sort-by-alphabet:before{content:"\e151"}.glyphicon-sort-by-alphabet-alt:before{content:"\e152"}.glyphicon-sort-by-order:before{content:"\e153"}.glyphicon-sort-by-order-alt:before{content:"\e154"}.glyphicon-sort-by-attributes:before{content:"\e155"}.glyphicon-sort-by-attributes-alt:before{content:"\e156"}.glyphicon-unchecked:before{content:"\e157"}.glyphicon-expand:before{content:"\e158"}.glyphicon-collapse-down:before{content:"\e159"}.glyphicon-collapse-up:before{content:"\e160"}.glyphicon-log-in:before{content:"\e161"}.glyphicon-flash:before{content:"\e162"}.glyphicon-log-out:before{content:"\e163"}.glyphicon-new-window:before{content:"\e164"}.glyphicon-record:before{content:"\e165"}.glyphicon-save:before{content:"\e166"}.glyphicon-open:before{content:"\e167"}.glyphicon-saved:before{content:"\e168"}.glyphicon-import:before{content:"\e169"}.glyphicon-export:before{content:"\e170"}.glyphicon-send:before{content:"\e171"}.glyphicon-floppy-disk:before{content:"\e172"}.glyphicon-floppy-saved:before{content:"\e173"}.glyphicon-floppy-remove:before{content:"\e174"}.glyphicon-floppy-save:before{content:"\e175"}.glyphicon-floppy-open:before{content:"\e176"}.glyphicon-credit-card:before{content:"\e177"}.glyphicon-transfer:before{content:"\e178"}.glyphicon-cutlery:before{content:"\e179"}.glyphicon-header:before{content:"\e180"}.glyphicon-compressed:before{content:"\e181"}.glyphicon-earphone:before{content:"\e182"}.glyphicon-phone-alt:before{content:"\e183"}.glyphicon-tower:before{content:"\e184"}.glyphicon-stats:before{content:"\e185"}.glyphicon-sd-video:before{content:"\e186"}.glyphicon-hd-video:before{content:"\e187"}.glyphicon-subtitles:before{content:"\e188"}.glyphicon-sound-stereo:before{content:"\e189"}.glyphicon-sound-dolby:before{content:"\e190"}.glyphicon-sound-5-1:before{content:"\e191"}.glyphicon-sound-6-1:before{content:"\e192"}.glyphicon-sound-7-1:before{content:"\e193"}.glyphicon-copyright-mark:before{content:"\e194"}.glyphicon-registration-mark:before{content:"\e195"}.glyphicon-cloud-download:before{content:"\e197"}.glyphicon-cloud-upload:before{content:"\e198"}.glyphicon-tree-conifer:before{content:"\e199"}.glyphicon-tree-deciduous:before{content:"\e200"}.glyphicon-cd:before{content:"\e201"}.glyphicon-save-file:before{content:"\e202"}.glyphicon-open-file:before{content:"\e203"}.glyphicon-level-up:before{content:"\e204"}.glyphicon-copy:before{content:"\e205"}.glyphicon-paste:before{content:"\e206"}.glyphicon-alert:before{content:"\e209"}.glyphicon-equalizer:before{content:"\e210"}.glyphicon-king:before{content:"\e211"}.glyphicon-queen:before{content:"\e212"}.glyphicon-pawn:before{content:"\e213"}.glyphicon-bishop:before{content:"\e214"}.glyphicon-knight:before{content:"\e215"}.glyphicon-baby-formula:before{content:"\e216"}.glyphicon-tent:before{content:"\26fa"}.glyphicon-blackboard:before{content:"\e218"}.glyphicon-bed:before{content:"\e219"}.glyphicon-apple:before{content:"\f8ff"}.glyphicon-erase:before{content:"\e221"}.glyphicon-hourglass:before{content:"\231b"}.glyphicon-lamp:before{content:"\e223"}.glyphicon-duplicate:before{content:"\e224"}.glyphicon-piggy-bank:before{content:"\e225"}.glyphicon-scissors:before{content:"\e226"}.glyphicon-bitcoin:before{content:"\e227"}.glyphicon-btc:before{content:"\e227"}.glyphicon-xbt:before{content:"\e227"}.glyphicon-yen:before{content:"\00a5"}.glyphicon-jpy:before{content:"\00a5"}.glyphicon-ruble:before{content:"\20bd"}.glyphicon-rub:before{content:"\20bd"}.glyphicon-scale:before{content:"\e230"}.glyphicon-ice-lolly:before{content:"\e231"}.glyphicon-ice-lolly-tasted:before{content:"\e232"}.glyphicon-education:before{content:"\e233"}.glyphicon-option-horizontal:before{content:"\e234"}.glyphicon-option-vertical:before{content:"\e235"}.glyphicon-menu-hamburger:before{content:"\e236"}.glyphicon-modal-window:before{content:"\e237"}.glyphicon-oil:before{content:"\e238"}.glyphicon-grain:before{content:"\e239"}.glyphicon-sunglasses:before{content:"\e240"}.glyphicon-text-size:before{content:"\e241"}.glyphicon-text-color:before{content:"\e242"}.glyphicon-text-background:before{content:"\e243"}.glyphicon-object-align-top:before{content:"\e244"}.glyphicon-object-align-bottom:before{content:"\e245"}.glyphicon-object-align-horizontal:before{content:"\e246"}.glyphicon-object-align-left:before{content:"\e247"}.glyphicon-object-align-vertical:before{content:"\e248"}.glyphicon-object-align-right:before{content:"\e249"}.glyphicon-triangle-right:before{content:"\e250"}.glyphicon-triangle-left:before{content:"\e251"}.glyphicon-triangle-bottom:before{content:"\e252"}.glyphicon-triangle-top:before{content:"\e253"}.glyphicon-console:before{content:"\e254"}.glyphicon-superscript:before{content:"\e255"}.glyphicon-subscript:before{content:"\e256"}.glyphicon-menu-left:before{content:"\e257"}.glyphicon-menu-right:before{content:"\e258"}.glyphicon-menu-down:before{content:"\e259"}.glyphicon-menu-up:before{content:"\e260"}*{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}:after,:before{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}html{font-size:10px;-webkit-tap-highlight-color:rgba(0,0,0,0)}body{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:14px;line-height:1.42857143;color:#333;background-color:#fff}button,input,select,textarea{font-family:inherit;font-size:inherit;line-height:inherit}a{color:#337ab7;text-decoration:none}a:focus,a:hover{color:#23527c;text-decoration:underline}a:focus{outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}figure{margin:0}img{vertical-align:middle}.carousel-inner>.item>a>img,.carousel-inner>.item>img,.img-responsive,.thumbnail a>img,.thumbnail>img{display:block;max-width:100%;height:auto}.img-rounded{border-radius:6px}.img-thumbnail{display:inline-block;max-width:100%;height:auto;padding:4px;line-height:1.42857143;background-color:#fff;border:1px solid #ddd;border-radius:4px;-webkit-transition:all .2s ease-in-out;-o-transition:all .2s ease-in-out;transition:all .2s ease-in-out}.img-circle{border-radius:50%}hr{margin-top:20px;margin-bottom:20px;border:0;border-top:1px solid #eee}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}.sr-only-focusable:active,.sr-only-focusable:focus{position:static;width:auto;height:auto;margin:0;overflow:visible;clip:auto}[role=button]{cursor:pointer}.h1,.h2,.h3,.h4,.h5,.h6,h1,h2,h3,h4,h5,h6{font-family:inherit;font-weight:500;line-height:1.1;color:inherit}.h1 .small,.h1 small,.h2 .small,.h2 small,.h3 .small,.h3 small,.h4 .small,.h4 small,.h5 .small,.h5 small,.h6 .small,.h6 small,h1 .small,h1 small,h2 .small,h2 small,h3 .small,h3 small,h4 .small,h4 small,h5 .small,h5 small,h6 .small,h6 small{font-weight:400;line-height:1;color:#777}.h1,.h2,.h3,h1,h2,h3{margin-top:20px;margin-bottom:10px}.h1 .small,.h1 small,.h2 .small,.h2 small,.h3 .small,.h3 small,h1 .small,h1 small,h2 .small,h2 small,h3 .small,h3 small{font-size:65%}.h4,.h5,.h6,h4,h5,h6{margin-top:10px;margin-bottom:10px}.h4 .small,.h4 small,.h5 .small,.h5 small,.h6 .small,.h6 small,h4 .small,h4 small,h5 .small,h5 small,h6 .small,h6 small{font-size:75%}.h1,h1{font-size:36px}.h2,h2{font-size:30px}.h3,h3{font-size:24px}.h4,h4{font-size:18px}.h5,h5{font-size:14px}.h6,h6{font-size:12px}p{margin:0 0 10px}.lead{margin-bottom:20px;font-size:16px;font-weight:300;line-height:1.4}@media (min-width:768px){.lead{font-size:21px}}.small,small{font-size:85%}.mark,mark{padding:.2em;background-color:#fcf8e3}.text-left{text-align:left}.text-right{text-align:right}.text-center{text-align:center}.text-justify{text-align:justify}.text-nowrap{white-space:nowrap}.text-lowercase{text-transform:lowercase}.text-uppercase{text-transform:uppercase}.text-capitalize{text-transform:capitalize}.text-muted{color:#777}.text-primary{color:#337ab7}a.text-primary:focus,a.text-primary:hover{color:#286090}.text-success{color:#3c763d}a.text-success:focus,a.text-success:hover{color:#2b542c}.text-info{color:#31708f}a.text-info:focus,a.text-info:hover{color:#245269}.text-warning{color:#8a6d3b}a.text-warning:focus,a.text-warning:hover{color:#66512c}.text-danger{color:#a94442}a.text-danger:focus,a.text-danger:hover{color:#843534}.bg-primary{color:#fff;background-color:#337ab7}a.bg-primary:focus,a.bg-primary:hover{background-color:#286090}.bg-success{background-color:#dff0d8}a.bg-success:focus,a.bg-success:hover{background-color:#c1e2b3}.bg-info{background-color:#d9edf7}a.bg-info:focus,a.bg-info:hover{background-color:#afd9ee}.bg-warning{background-color:#fcf8e3}a.bg-warning:focus,a.bg-warning:hover{background-color:#f7ecb5}.bg-danger{background-color:#f2dede}a.bg-danger:focus,a.bg-danger:hover{background-color:#e4b9b9}.page-header{padding-bottom:9px;margin:40px 0 20px;border-bottom:1px solid #eee}ol,ul{margin-top:0;margin-bottom:10px}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}.list-unstyled{padding-left:0;list-style:none}.list-inline{padding-left:0;margin-left:-5px;list-style:none}.list-inline>li{display:inline-block;padding-right:5px;padding-left:5px}dl{margin-top:0;margin-bottom:20px}dd,dt{line-height:1.42857143}dt{font-weight:700}dd{margin-left:0}@media (min-width:768px){.dl-horizontal dt{float:left;width:160px;overflow:hidden;clear:left;text-align:right;text-overflow:ellipsis;white-space:nowrap}.dl-horizontal dd{margin-left:180px}}abbr[data-original-title],abbr[title]{cursor:help;border-bottom:1px dotted #777}.initialism{font-size:90%;text-transform:uppercase}blockquote{padding:10px 20px;margin:0 0 20px;font-size:17.5px;border-left:5px solid #eee}blockquote ol:last-child,blockquote p:last-child,blockquote ul:last-child{margin-bottom:0}blockquote .small,blockquote footer,blockquote small{display:block;font-size:80%;line-height:1.42857143;color:#777}blockquote .small:before,blockquote footer:before,blockquote small:before{content:'\2014 \00A0'}.blockquote-reverse,blockquote.pull-right{padding-right:15px;padding-left:0;text-align:right;border-right:5px solid #eee;border-left:0}.blockquote-reverse .small:before,.blockquote-reverse footer:before,.blockquote-reverse small:before,blockquote.pull-right .small:before,blockquote.pull-right footer:before,blockquote.pull-right small:before{content:''}.blockquote-reverse .small:after,.blockquote-reverse footer:after,.blockquote-reverse small:after,blockquote.pull-right .small:after,blockquote.pull-right footer:after,blockquote.pull-right small:after{content:'\00A0 \2014'}address{margin-bottom:20px;font-style:normal;line-height:1.42857143}code,kbd,pre,samp{font-family:Menlo,Monaco,Consolas,"Courier New",monospace}code{padding:2px 4px;font-size:90%;color:#c7254e;background-color:#f9f2f4;border-radius:4px}kbd{padding:2px 4px;font-size:90%;color:#fff;background-color:#333;border-radius:3px;-webkit-box-shadow:inset 0 -1px 0 rgba(0,0,0,.25);box-shadow:inset 0 -1px 0 rgba(0,0,0,.25)}kbd kbd{padding:0;font-size:100%;font-weight:700;-webkit-box-shadow:none;box-shadow:none}pre{display:block;padding:9.5px;margin:0 0 10px;font-size:13px;line-height:1.42857143;color:#333;word-break:break-all;word-wrap:break-word;background-color:#f5f5f5;border:1px solid #ccc;border-radius:4px}pre code{padding:0;font-size:inherit;color:inherit;white-space:pre-wrap;background-color:transparent;border-radius:0}.pre-scrollable{max-height:340px;overflow-y:scroll}.container{padding-right:15px;padding-left:15px;margin-right:auto;margin-left:auto}@media (min-width:768px){.container{width:750px}}@media (min-width:992px){.container{width:970px}}@media (min-width:1200px){.container{width:1170px}}.container-fluid{padding-right:15px;padding-left:15px;margin-right:auto;margin-left:auto}.row{margin-right:-15px;margin-left:-15px}.col-lg-1,.col-lg-10,.col-lg-11,.col-lg-12,.col-lg-2,.col-lg-3,.col-lg-4,.col-lg-5,.col-lg-6,.col-lg-7,.col-lg-8,.col-lg-9,.col-md-1,.col-md-10,.col-md-11,.col-md-12,.col-md-2,.col-md-3,.col-md-4,.col-md-5,.col-md-6,.col-md-7,.col-md-8,.col-md-9,.col-sm-1,.col-sm-10,.col-sm-11,.col-sm-12,.col-sm-2,.col-sm-3,.col-sm-4,.col-sm-5,.col-sm-6,.col-sm-7,.col-sm-8,.col-sm-9,.col-xs-1,.col-xs-10,.col-xs-11,.col-xs-12,.col-xs-2,.col-xs-3,.col-xs-4,.col-xs-5,.col-xs-6,.col-xs-7,.col-xs-8,.col-xs-9{position:relative;min-height:1px;padding-right:15px;padding-left:15px}.col-xs-1,.col-xs-10,.col-xs-11,.col-xs-12,.col-xs-2,.col-xs-3,.col-xs-4,.col-xs-5,.col-xs-6,.col-xs-7,.col-xs-8,.col-xs-9{float:left}.col-xs-12{width:100%}.col-xs-11{width:91.66666667%}.col-xs-10{width:83.33333333%}.col-xs-9{width:75%}.col-xs-8{width:66.66666667%}.col-xs-7{width:58.33333333%}.col-xs-6{width:50%}.col-xs-5{width:41.66666667%}.col-xs-4{width:33.33333333%}.col-xs-3{width:25%}.col-xs-2{width:16.66666667%}.col-xs-1{width:8.33333333%}.col-xs-pull-12{right:100%}.col-xs-pull-11{right:91.66666667%}.col-xs-pull-10{right:83.33333333%}.col-xs-pull-9{right:75%}.col-xs-pull-8{right:66.66666667%}.col-xs-pull-7{right:58.33333333%}.col-xs-pull-6{right:50%}.col-xs-pull-5{right:41.66666667%}.col-xs-pull-4{right:33.33333333%}.col-xs-pull-3{right:25%}.col-xs-pull-2{right:16.66666667%}.col-xs-pull-1{right:8.33333333%}.col-xs-pull-0{right:auto}.col-xs-push-12{left:100%}.col-xs-push-11{left:91.66666667%}.col-xs-push-10{left:83.33333333%}.col-xs-push-9{left:75%}.col-xs-push-8{left:66.66666667%}.col-xs-push-7{left:58.33333333%}.col-xs-push-6{left:50%}.col-xs-push-5{left:41.66666667%}.col-xs-push-4{left:33.33333333%}.col-xs-push-3{left:25%}.col-xs-push-2{left:16.66666667%}.col-xs-push-1{left:8.33333333%}.col-xs-push-0{left:auto}.col-xs-offset-12{margin-left:100%}.col-xs-offset-11{margin-left:91.66666667%}.col-xs-offset-10{margin-left:83.33333333%}.col-xs-offset-9{margin-left:75%}.col-xs-offset-8{margin-left:66.66666667%}.col-xs-offset-7{margin-left:58.33333333%}.col-xs-offset-6{margin-left:50%}.col-xs-offset-5{margin-left:41.66666667%}.col-xs-offset-4{margin-left:33.33333333%}.col-xs-offset-3{margin-left:25%}.col-xs-offset-2{margin-left:16.66666667%}.col-xs-offset-1{margin-left:8.33333333%}.col-xs-offset-0{margin-left:0}@media (min-width:768px){.col-sm-1,.col-sm-10,.col-sm-11,.col-sm-12,.col-sm-2,.col-sm-3,.col-sm-4,.col-sm-5,.col-sm-6,.col-sm-7,.col-sm-8,.col-sm-9{float:left}.col-sm-12{width:100%}.col-sm-11{width:91.66666667%}.col-sm-10{width:83.33333333%}.col-sm-9{width:75%}.col-sm-8{width:66.66666667%}.col-sm-7{width:58.33333333%}.col-sm-6{width:50%}.col-sm-5{width:41.66666667%}.col-sm-4{width:33.33333333%}.col-sm-3{width:25%}.col-sm-2{width:16.66666667%}.col-sm-1{width:8.33333333%}.col-sm-pull-12{right:100%}.col-sm-pull-11{right:91.66666667%}.col-sm-pull-10{right:83.33333333%}.col-sm-pull-9{right:75%}.col-sm-pull-8{right:66.66666667%}.col-sm-pull-7{right:58.33333333%}.col-sm-pull-6{right:50%}.col-sm-pull-5{right:41.66666667%}.col-sm-pull-4{right:33.33333333%}.col-sm-pull-3{right:25%}.col-sm-pull-2{right:16.66666667%}.col-sm-pull-1{right:8.33333333%}.col-sm-pull-0{right:auto}.col-sm-push-12{left:100%}.col-sm-push-11{left:91.66666667%}.col-sm-push-10{left:83.33333333%}.col-sm-push-9{left:75%}.col-sm-push-8{left:66.66666667%}.col-sm-push-7{left:58.33333333%}.col-sm-push-6{left:50%}.col-sm-push-5{left:41.66666667%}.col-sm-push-4{left:33.33333333%}.col-sm-push-3{left:25%}.col-sm-push-2{left:16.66666667%}.col-sm-push-1{left:8.33333333%}.col-sm-push-0{left:auto}.col-sm-offset-12{margin-left:100%}.col-sm-offset-11{margin-left:91.66666667%}.col-sm-offset-10{margin-left:83.33333333%}.col-sm-offset-9{margin-left:75%}.col-sm-offset-8{margin-left:66.66666667%}.col-sm-offset-7{margin-left:58.33333333%}.col-sm-offset-6{margin-left:50%}.col-sm-offset-5{margin-left:41.66666667%}.col-sm-offset-4{margin-left:33.33333333%}.col-sm-offset-3{margin-left:25%}.col-sm-offset-2{margin-left:16.66666667%}.col-sm-offset-1{margin-left:8.33333333%}.col-sm-offset-0{margin-left:0}}@media (min-width:992px){.col-md-1,.col-md-10,.col-md-11,.col-md-12,.col-md-2,.col-md-3,.col-md-4,.col-md-5,.col-md-6,.col-md-7,.col-md-8,.col-md-9{float:left}.col-md-12{width:100%}.col-md-11{width:91.66666667%}.col-md-10{width:83.33333333%}.col-md-9{width:75%}.col-md-8{width:66.66666667%}.col-md-7{width:58.33333333%}.col-md-6{width:50%}.col-md-5{width:41.66666667%}.col-md-4{width:33.33333333%}.col-md-3{width:25%}.col-md-2{width:16.66666667%}.col-md-1{width:8.33333333%}.col-md-pull-12{right:100%}.col-md-pull-11{right:91.66666667%}.col-md-pull-10{right:83.33333333%}.col-md-pull-9{right:75%}.col-md-pull-8{right:66.66666667%}.col-md-pull-7{right:58.33333333%}.col-md-pull-6{right:50%}.col-md-pull-5{right:41.66666667%}.col-md-pull-4{right:33.33333333%}.col-md-pull-3{right:25%}.col-md-pull-2{right:16.66666667%}.col-md-pull-1{right:8.33333333%}.col-md-pull-0{right:auto}.col-md-push-12{left:100%}.col-md-push-11{left:91.66666667%}.col-md-push-10{left:83.33333333%}.col-md-push-9{left:75%}.col-md-push-8{left:66.66666667%}.col-md-push-7{left:58.33333333%}.col-md-push-6{left:50%}.col-md-push-5{left:41.66666667%}.col-md-push-4{left:33.33333333%}.col-md-push-3{left:25%}.col-md-push-2{left:16.66666667%}.col-md-push-1{left:8.33333333%}.col-md-push-0{left:auto}.col-md-offset-12{margin-left:100%}.col-md-offset-11{margin-left:91.66666667%}.col-md-offset-10{margin-left:83.33333333%}.col-md-offset-9{margin-left:75%}.col-md-offset-8{margin-left:66.66666667%}.col-md-offset-7{margin-left:58.33333333%}.col-md-offset-6{margin-left:50%}.col-md-offset-5{margin-left:41.66666667%}.col-md-offset-4{margin-left:33.33333333%}.col-md-offset-3{margin-left:25%}.col-md-offset-2{margin-left:16.66666667%}.col-md-offset-1{margin-left:8.33333333%}.col-md-offset-0{margin-left:0}}@media (min-width:1200px){.col-lg-1,.col-lg-10,.col-lg-11,.col-lg-12,.col-lg-2,.col-lg-3,.col-lg-4,.col-lg-5,.col-lg-6,.col-lg-7,.col-lg-8,.col-lg-9{float:left}.col-lg-12{width:100%}.col-lg-11{width:91.66666667%}.col-lg-10{width:83.33333333%}.col-lg-9{width:75%}.col-lg-8{width:66.66666667%}.col-lg-7{width:58.33333333%}.col-lg-6{width:50%}.col-lg-5{width:41.66666667%}.col-lg-4{width:33.33333333%}.col-lg-3{width:25%}.col-lg-2{width:16.66666667%}.col-lg-1{width:8.33333333%}.col-lg-pull-12{right:100%}.col-lg-pull-11{right:91.66666667%}.col-lg-pull-10{right:83.33333333%}.col-lg-pull-9{right:75%}.col-lg-pull-8{right:66.66666667%}.col-lg-pull-7{right:58.33333333%}.col-lg-pull-6{right:50%}.col-lg-pull-5{right:41.66666667%}.col-lg-pull-4{right:33.33333333%}.col-lg-pull-3{right:25%}.col-lg-pull-2{right:16.66666667%}.col-lg-pull-1{right:8.33333333%}.col-lg-pull-0{right:auto}.col-lg-push-12{left:100%}.col-lg-push-11{left:91.66666667%}.col-lg-push-10{left:83.33333333%}.col-lg-push-9{left:75%}.col-lg-push-8{left:66.66666667%}.col-lg-push-7{left:58.33333333%}.col-lg-push-6{left:50%}.col-lg-push-5{left:41.66666667%}.col-lg-push-4{left:33.33333333%}.col-lg-push-3{left:25%}.col-lg-push-2{left:16.66666667%}.col-lg-push-1{left:8.33333333%}.col-lg-push-0{left:auto}.col-lg-offset-12{margin-left:100%}.col-lg-offset-11{margin-left:91.66666667%}.col-lg-offset-10{margin-left:83.33333333%}.col-lg-offset-9{margin-left:75%}.col-lg-offset-8{margin-left:66.66666667%}.col-lg-offset-7{margin-left:58.33333333%}.col-lg-offset-6{margin-left:50%}.col-lg-offset-5{margin-left:41.66666667%}.col-lg-offset-4{margin-left:33.33333333%}.col-lg-offset-3{margin-left:25%}.col-lg-offset-2{margin-left:16.66666667%}.col-lg-offset-1{margin-left:8.33333333%}.col-lg-offset-0{margin-left:0}}table{background-color:transparent}caption{padding-top:8px;padding-bottom:8px;color:#777;text-align:left}th{text-align:left}.table{width:100%;max-width:100%;margin-bottom:20px}.table>tbody>tr>td,.table>tbody>tr>th,.table>tfoot>tr>td,.table>tfoot>tr>th,.table>thead>tr>td,.table>thead>tr>th{padding:8px;line-height:1.42857143;vertical-align:top;border-top:1px solid #ddd}.table>thead>tr>th{vertical-align:bottom;border-bottom:2px solid #ddd}.table>caption+thead>tr:first-child>td,.table>caption+thead>tr:first-child>th,.table>colgroup+thead>tr:first-child>td,.table>colgroup+thead>tr:first-child>th,.table>thead:first-child>tr:first-child>td,.table>thead:first-child>tr:first-child>th{border-top:0}.table>tbody+tbody{border-top:2px solid #ddd}.table .table{background-color:#fff}.table-condensed>tbody>tr>td,.table-condensed>tbody>tr>th,.table-condensed>tfoot>tr>td,.table-condensed>tfoot>tr>th,.table-condensed>thead>tr>td,.table-condensed>thead>tr>th{padding:5px}.table-bordered{border:1px solid #ddd}.table-bordered>tbody>tr>td,.table-bordered>tbody>tr>th,.table-bordered>tfoot>tr>td,.table-bordered>tfoot>tr>th,.table-bordered>thead>tr>td,.table-bordered>thead>tr>th{border:1px solid #ddd}.table-bordered>thead>tr>td,.table-bordered>thead>tr>th{border-bottom-width:2px}.table-striped>tbody>tr:nth-of-type(odd){background-color:#f9f9f9}.table-hover>tbody>tr:hover{background-color:#f5f5f5}table col[class*=col-]{position:static;display:table-column;float:none}table td[class*=col-],table th[class*=col-]{position:static;display:table-cell;float:none}.table>tbody>tr.active>td,.table>tbody>tr.active>th,.table>tbody>tr>td.active,.table>tbody>tr>th.active,.table>tfoot>tr.active>td,.table>tfoot>tr.active>th,.table>tfoot>tr>td.active,.table>tfoot>tr>th.active,.table>thead>tr.active>td,.table>thead>tr.active>th,.table>thead>tr>td.active,.table>thead>tr>th.active{background-color:#f5f5f5}.table-hover>tbody>tr.active:hover>td,.table-hover>tbody>tr.active:hover>th,.table-hover>tbody>tr:hover>.active,.table-hover>tbody>tr>td.active:hover,.table-hover>tbody>tr>th.active:hover{background-color:#e8e8e8}.table>tbody>tr.success>td,.table>tbody>tr.success>th,.table>tbody>tr>td.success,.table>tbody>tr>th.success,.table>tfoot>tr.success>td,.table>tfoot>tr.success>th,.table>tfoot>tr>td.success,.table>tfoot>tr>th.success,.table>thead>tr.success>td,.table>thead>tr.success>th,.table>thead>tr>td.success,.table>thead>tr>th.success{background-color:#dff0d8}.table-hover>tbody>tr.success:hover>td,.table-hover>tbody>tr.success:hover>th,.table-hover>tbody>tr:hover>.success,.table-hover>tbody>tr>td.success:hover,.table-hover>tbody>tr>th.success:hover{background-color:#d0e9c6}.table>tbody>tr.info>td,.table>tbody>tr.info>th,.table>tbody>tr>td.info,.table>tbody>tr>th.info,.table>tfoot>tr.info>td,.table>tfoot>tr.info>th,.table>tfoot>tr>td.info,.table>tfoot>tr>th.info,.table>thead>tr.info>td,.table>thead>tr.info>th,.table>thead>tr>td.info,.table>thead>tr>th.info{background-color:#d9edf7}.table-hover>tbody>tr.info:hover>td,.table-hover>tbody>tr.info:hover>th,.table-hover>tbody>tr:hover>.info,.table-hover>tbody>tr>td.info:hover,.table-hover>tbody>tr>th.info:hover{background-color:#c4e3f3}.table>tbody>tr.warning>td,.table>tbody>tr.warning>th,.table>tbody>tr>td.warning,.table>tbody>tr>th.warning,.table>tfoot>tr.warning>td,.table>tfoot>tr.warning>th,.table>tfoot>tr>td.warning,.table>tfoot>tr>th.warning,.table>thead>tr.warning>td,.table>thead>tr.warning>th,.table>thead>tr>td.warning,.table>thead>tr>th.warning{background-color:#fcf8e3}.table-hover>tbody>tr.warning:hover>td,.table-hover>tbody>tr.warning:hover>th,.table-hover>tbody>tr:hover>.warning,.table-hover>tbody>tr>td.warning:hover,.table-hover>tbody>tr>th.warning:hover{background-color:#faf2cc}.table>tbody>tr.danger>td,.table>tbody>tr.danger>th,.table>tbody>tr>td.danger,.table>tbody>tr>th.danger,.table>tfoot>tr.danger>td,.table>tfoot>tr.danger>th,.table>tfoot>tr>td.danger,.table>tfoot>tr>th.danger,.table>thead>tr.danger>td,.table>thead>tr.danger>th,.table>thead>tr>td.danger,.table>thead>tr>th.danger{background-color:#f2dede}.table-hover>tbody>tr.danger:hover>td,.table-hover>tbody>tr.danger:hover>th,.table-hover>tbody>tr:hover>.danger,.table-hover>tbody>tr>td.danger:hover,.table-hover>tbody>tr>th.danger:hover{background-color:#ebcccc}.table-responsive{min-height:.01%;overflow-x:auto}@media screen and (max-width:767px){.table-responsive{width:100%;margin-bottom:15px;overflow-y:hidden;-ms-overflow-style:-ms-autohiding-scrollbar;border:1px solid #ddd}.table-responsive>.table{margin-bottom:0}.table-responsive>.table>tbody>tr>td,.table-responsive>.table>tbody>tr>th,.table-responsive>.table>tfoot>tr>td,.table-responsive>.table>tfoot>tr>th,.table-responsive>.table>thead>tr>td,.table-responsive>.table>thead>tr>th{white-space:nowrap}.table-responsive>.table-bordered{border:0}.table-responsive>.table-bordered>tbody>tr>td:first-child,.table-responsive>.table-bordered>tbody>tr>th:first-child,.table-responsive>.table-bordered>tfoot>tr>td:first-child,.table-responsive>.table-bordered>tfoot>tr>th:first-child,.table-responsive>.table-bordered>thead>tr>td:first-child,.table-responsive>.table-bordered>thead>tr>th:first-child{border-left:0}.table-responsive>.table-bordered>tbody>tr>td:last-child,.table-responsive>.table-bordered>tbody>tr>th:last-child,.table-responsive>.table-bordered>tfoot>tr>td:last-child,.table-responsive>.table-bordered>tfoot>tr>th:last-child,.table-responsive>.table-bordered>thead>tr>td:last-child,.table-responsive>.table-bordered>thead>tr>th:last-child{border-right:0}.table-responsive>.table-bordered>tbody>tr:last-child>td,.table-responsive>.table-bordered>tbody>tr:last-child>th,.table-responsive>.table-bordered>tfoot>tr:last-child>td,.table-responsive>.table-bordered>tfoot>tr:last-child>th{border-bottom:0}}fieldset{min-width:0;padding:0;margin:0;border:0}legend{display:block;width:100%;padding:0;margin-bottom:20px;font-size:21px;line-height:inherit;color:#333;border:0;border-bottom:1px solid #e5e5e5}label{display:inline-block;max-width:100%;margin-bottom:5px;font-weight:700}input[type=search]{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}input[type=checkbox],input[type=radio]{margin:4px 0 0;margin-top:1px\9;line-height:normal}input[type=file]{display:block}input[type=range]{display:block;width:100%}select[multiple],select[size]{height:auto}input[type=file]:focus,input[type=checkbox]:focus,input[type=radio]:focus{outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}output{display:block;padding-top:7px;font-size:14px;line-height:1.42857143;color:#555}.form-control{display:block;width:100%;height:34px;padding:6px 12px;font-size:14px;line-height:1.42857143;color:#555;background-color:#fff;background-image:none;border:1px solid #ccc;border-radius:4px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075);-webkit-transition:border-color ease-in-out .15s,-webkit-box-shadow ease-in-out .15s;-o-transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s;transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s}.form-control:focus{border-color:#66afe9;outline:0;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6);box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6)}.form-control::-moz-placeholder{color:#999;opacity:1}.form-control:-ms-input-placeholder{color:#999}.form-control::-webkit-input-placeholder{color:#999}.form-control::-ms-expand{background-color:transparent;border:0}.form-control[disabled],.form-control[readonly],fieldset[disabled] .form-control{background-color:#eee;opacity:1}.form-control[disabled],fieldset[disabled] .form-control{cursor:not-allowed}textarea.form-control{height:auto}input[type=search]{-webkit-appearance:none}@media screen and (-webkit-min-device-pixel-ratio:0){input[type=date].form-control,input[type=time].form-control,input[type=datetime-local].form-control,input[type=month].form-control{line-height:34px}.input-group-sm input[type=date],.input-group-sm input[type=time],.input-group-sm input[type=datetime-local],.input-group-sm input[type=month],input[type=date].input-sm,input[type=time].input-sm,input[type=datetime-local].input-sm,input[type=month].input-sm{line-height:30px}.input-group-lg input[type=date],.input-group-lg input[type=time],.input-group-lg input[type=datetime-local],.input-group-lg input[type=month],input[type=date].input-lg,input[type=time].input-lg,input[type=datetime-local].input-lg,input[type=month].input-lg{line-height:46px}}.form-group{margin-bottom:15px}.checkbox,.radio{position:relative;display:block;margin-top:10px;margin-bottom:10px}.checkbox label,.radio label{min-height:20px;padding-left:20px;margin-bottom:0;font-weight:400;cursor:pointer}.checkbox input[type=checkbox],.checkbox-inline input[type=checkbox],.radio input[type=radio],.radio-inline input[type=radio]{position:absolute;margin-top:4px\9;margin-left:-20px}.checkbox+.checkbox,.radio+.radio{margin-top:-5px}.checkbox-inline,.radio-inline{position:relative;display:inline-block;padding-left:20px;margin-bottom:0;font-weight:400;vertical-align:middle;cursor:pointer}.checkbox-inline+.checkbox-inline,.radio-inline+.radio-inline{margin-top:0;margin-left:10px}fieldset[disabled] input[type=checkbox],fieldset[disabled] input[type=radio],input[type=checkbox].disabled,input[type=checkbox][disabled],input[type=radio].disabled,input[type=radio][disabled]{cursor:not-allowed}.checkbox-inline.disabled,.radio-inline.disabled,fieldset[disabled] .checkbox-inline,fieldset[disabled] .radio-inline{cursor:not-allowed}.checkbox.disabled label,.radio.disabled label,fieldset[disabled] .checkbox label,fieldset[disabled] .radio label{cursor:not-allowed}.form-control-static{min-height:34px;padding-top:7px;padding-bottom:7px;margin-bottom:0}.form-control-static.input-lg,.form-control-static.input-sm{padding-right:0;padding-left:0}.input-sm{height:30px;padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}select.input-sm{height:30px;line-height:30px}select[multiple].input-sm,textarea.input-sm{height:auto}.form-group-sm .form-control{height:30px;padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}.form-group-sm select.form-control{height:30px;line-height:30px}.form-group-sm select[multiple].form-control,.form-group-sm textarea.form-control{height:auto}.form-group-sm .form-control-static{height:30px;min-height:32px;padding:6px 10px;font-size:12px;line-height:1.5}.input-lg{height:46px;padding:10px 16px;font-size:18px;line-height:1.3333333;border-radius:6px}select.input-lg{height:46px;line-height:46px}select[multiple].input-lg,textarea.input-lg{height:auto}.form-group-lg .form-control{height:46px;padding:10px 16px;font-size:18px;line-height:1.3333333;border-radius:6px}.form-group-lg select.form-control{height:46px;line-height:46px}.form-group-lg select[multiple].form-control,.form-group-lg textarea.form-control{height:auto}.form-group-lg .form-control-static{height:46px;min-height:38px;padding:11px 16px;font-size:18px;line-height:1.3333333}.has-feedback{position:relative}.has-feedback .form-control{padding-right:42.5px}.form-control-feedback{position:absolute;top:0;right:0;z-index:2;display:block;width:34px;height:34px;line-height:34px;text-align:center;pointer-events:none}.form-group-lg .form-control+.form-control-feedback,.input-group-lg+.form-control-feedback,.input-lg+.form-control-feedback{width:46px;height:46px;line-height:46px}.form-group-sm .form-control+.form-control-feedback,.input-group-sm+.form-control-feedback,.input-sm+.form-control-feedback{width:30px;height:30px;line-height:30px}.has-success .checkbox,.has-success .checkbox-inline,.has-success .control-label,.has-success .help-block,.has-success .radio,.has-success .radio-inline,.has-success.checkbox label,.has-success.checkbox-inline label,.has-success.radio label,.has-success.radio-inline label{color:#3c763d}.has-success .form-control{border-color:#3c763d;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075)}.has-success .form-control:focus{border-color:#2b542c;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #67b168;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #67b168}.has-success .input-group-addon{color:#3c763d;background-color:#dff0d8;border-color:#3c763d}.has-success .form-control-feedback{color:#3c763d}.has-warning .checkbox,.has-warning .checkbox-inline,.has-warning .control-label,.has-warning .help-block,.has-warning .radio,.has-warning .radio-inline,.has-warning.checkbox label,.has-warning.checkbox-inline label,.has-warning.radio label,.has-warning.radio-inline label{color:#8a6d3b}.has-warning .form-control{border-color:#8a6d3b;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075)}.has-warning .form-control:focus{border-color:#66512c;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #c0a16b;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #c0a16b}.has-warning .input-group-addon{color:#8a6d3b;background-color:#fcf8e3;border-color:#8a6d3b}.has-warning .form-control-feedback{color:#8a6d3b}.has-error .checkbox,.has-error .checkbox-inline,.has-error .control-label,.has-error .help-block,.has-error .radio,.has-error .radio-inline,.has-error.checkbox label,.has-error.checkbox-inline label,.has-error.radio label,.has-error.radio-inline label{color:#a94442}.has-error .form-control{border-color:#a94442;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075)}.has-error .form-control:focus{border-color:#843534;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #ce8483;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #ce8483}.has-error .input-group-addon{color:#a94442;background-color:#f2dede;border-color:#a94442}.has-error .form-control-feedback{color:#a94442}.has-feedback label~.form-control-feedback{top:25px}.has-feedback label.sr-only~.form-control-feedback{top:0}.help-block{display:block;margin-top:5px;margin-bottom:10px;color:#737373}@media (min-width:768px){.form-inline .form-group{display:inline-block;margin-bottom:0;vertical-align:middle}.form-inline .form-control{display:inline-block;width:auto;vertical-align:middle}.form-inline .form-control-static{display:inline-block}.form-inline .input-group{display:inline-table;vertical-align:middle}.form-inline .input-group .form-control,.form-inline .input-group .input-group-addon,.form-inline .input-group .input-group-btn{width:auto}.form-inline .input-group>.form-control{width:100%}.form-inline .control-label{margin-bottom:0;vertical-align:middle}.form-inline .checkbox,.form-inline .radio{display:inline-block;margin-top:0;margin-bottom:0;vertical-align:middle}.form-inline .checkbox label,.form-inline .radio label{padding-left:0}.form-inline .checkbox input[type=checkbox],.form-inline .radio input[type=radio]{position:relative;margin-left:0}.form-inline .has-feedback .form-control-feedback{top:0}}.form-horizontal .checkbox,.form-horizontal .checkbox-inline,.form-horizontal .radio,.form-horizontal .radio-inline{padding-top:7px;margin-top:0;margin-bottom:0}.form-horizontal .checkbox,.form-horizontal .radio{min-height:27px}.form-horizontal .form-group{margin-right:-15px;margin-left:-15px}@media (min-width:768px){.form-horizontal .control-label{padding-top:7px;margin-bottom:0;text-align:right}}.form-horizontal .has-feedback .form-control-feedback{right:15px}@media (min-width:768px){.form-horizontal .form-group-lg .control-label{padding-top:11px;font-size:18px}}@media (min-width:768px){.form-horizontal .form-group-sm .control-label{padding-top:6px;font-size:12px}}.btn{display:inline-block;padding:6px 12px;margin-bottom:0;font-size:14px;font-weight:400;line-height:1.42857143;text-align:center;white-space:nowrap;vertical-align:middle;-ms-touch-action:manipulation;touch-action:manipulation;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background-image:none;border:1px solid transparent;border-radius:4px}.btn.active.focus,.btn.active:focus,.btn.focus,.btn:active.focus,.btn:active:focus,.btn:focus{outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}.btn.focus,.btn:focus,.btn:hover{color:#333;text-decoration:none}.btn.active,.btn:active{background-image:none;outline:0;-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,.125);box-shadow:inset 0 3px 5px rgba(0,0,0,.125)}.btn.disabled,.btn[disabled],fieldset[disabled] .btn{cursor:not-allowed;filter:alpha(opacity=65);-webkit-box-shadow:none;box-shadow:none;opacity:.65}a.btn.disabled,fieldset[disabled] a.btn{pointer-events:none}.btn-default{color:#333;background-color:#fff;border-color:#ccc}.btn-default.focus,.btn-default:focus{color:#333;background-color:#e6e6e6;border-color:#8c8c8c}.btn-default:hover{color:#333;background-color:#e6e6e6;border-color:#adadad}.btn-default.active,.btn-default:active,.open>.dropdown-toggle.btn-default{color:#333;background-color:#e6e6e6;border-color:#adadad}.btn-default.active.focus,.btn-default.active:focus,.btn-default.active:hover,.btn-default:active.focus,.btn-default:active:focus,.btn-default:active:hover,.open>.dropdown-toggle.btn-default.focus,.open>.dropdown-toggle.btn-default:focus,.open>.dropdown-toggle.btn-default:hover{color:#333;background-color:#d4d4d4;border-color:#8c8c8c}.btn-default.active,.btn-default:active,.open>.dropdown-toggle.btn-default{background-image:none}.btn-default.disabled.focus,.btn-default.disabled:focus,.btn-default.disabled:hover,.btn-default[disabled].focus,.btn-default[disabled]:focus,.btn-default[disabled]:hover,fieldset[disabled] .btn-default.focus,fieldset[disabled] .btn-default:focus,fieldset[disabled] .btn-default:hover{background-color:#fff;border-color:#ccc}.btn-default .badge{color:#fff;background-color:#333}.btn-primary{color:#fff;background-color:#337ab7;border-color:#2e6da4}.btn-primary.focus,.btn-primary:focus{color:#fff;background-color:#286090;border-color:#122b40}.btn-primary:hover{color:#fff;background-color:#286090;border-color:#204d74}.btn-primary.active,.btn-primary:active,.open>.dropdown-toggle.btn-primary{color:#fff;background-color:#286090;border-color:#204d74}.btn-primary.active.focus,.btn-primary.active:focus,.btn-primary.active:hover,.btn-primary:active.focus,.btn-primary:active:focus,.btn-primary:active:hover,.open>.dropdown-toggle.btn-primary.focus,.open>.dropdown-toggle.btn-primary:focus,.open>.dropdown-toggle.btn-primary:hover{color:#fff;background-color:#204d74;border-color:#122b40}.btn-primary.active,.btn-primary:active,.open>.dropdown-toggle.btn-primary{background-image:none}.btn-primary.disabled.focus,.btn-primary.disabled:focus,.btn-primary.disabled:hover,.btn-primary[disabled].focus,.btn-primary[disabled]:focus,.btn-primary[disabled]:hover,fieldset[disabled] .btn-primary.focus,fieldset[disabled] .btn-primary:focus,fieldset[disabled] .btn-primary:hover{background-color:#337ab7;border-color:#2e6da4}.btn-primary .badge{color:#337ab7;background-color:#fff}.btn-success{color:#fff;background-color:#5cb85c;border-color:#4cae4c}.btn-success.focus,.btn-success:focus{color:#fff;background-color:#449d44;border-color:#255625}.btn-success:hover{color:#fff;background-color:#449d44;border-color:#398439}.btn-success.active,.btn-success:active,.open>.dropdown-toggle.btn-success{color:#fff;background-color:#449d44;border-color:#398439}.btn-success.active.focus,.btn-success.active:focus,.btn-success.active:hover,.btn-success:active.focus,.btn-success:active:focus,.btn-success:active:hover,.open>.dropdown-toggle.btn-success.focus,.open>.dropdown-toggle.btn-success:focus,.open>.dropdown-toggle.btn-success:hover{color:#fff;background-color:#398439;border-color:#255625}.btn-success.active,.btn-success:active,.open>.dropdown-toggle.btn-success{background-image:none}.btn-success.disabled.focus,.btn-success.disabled:focus,.btn-success.disabled:hover,.btn-success[disabled].focus,.btn-success[disabled]:focus,.btn-success[disabled]:hover,fieldset[disabled] .btn-success.focus,fieldset[disabled] .btn-success:focus,fieldset[disabled] .btn-success:hover{background-color:#5cb85c;border-color:#4cae4c}.btn-success .badge{color:#5cb85c;background-color:#fff}.btn-info{color:#fff;background-color:#5bc0de;border-color:#46b8da}.btn-info.focus,.btn-info:focus{color:#fff;background-color:#31b0d5;border-color:#1b6d85}.btn-info:hover{color:#fff;background-color:#31b0d5;border-color:#269abc}.btn-info.active,.btn-info:active,.open>.dropdown-toggle.btn-info{color:#fff;background-color:#31b0d5;border-color:#269abc}.btn-info.active.focus,.btn-info.active:focus,.btn-info.active:hover,.btn-info:active.focus,.btn-info:active:focus,.btn-info:active:hover,.open>.dropdown-toggle.btn-info.focus,.open>.dropdown-toggle.btn-info:focus,.open>.dropdown-toggle.btn-info:hover{color:#fff;background-color:#269abc;border-color:#1b6d85}.btn-info.active,.btn-info:active,.open>.dropdown-toggle.btn-info{background-image:none}.btn-info.disabled.focus,.btn-info.disabled:focus,.btn-info.disabled:hover,.btn-info[disabled].focus,.btn-info[disabled]:focus,.btn-info[disabled]:hover,fieldset[disabled] .btn-info.focus,fieldset[disabled] .btn-info:focus,fieldset[disabled] .btn-info:hover{background-color:#5bc0de;border-color:#46b8da}.btn-info .badge{color:#5bc0de;background-color:#fff}.btn-warning{color:#fff;background-color:#f0ad4e;border-color:#eea236}.btn-warning.focus,.btn-warning:focus{color:#fff;background-color:#ec971f;border-color:#985f0d}.btn-warning:hover{color:#fff;background-color:#ec971f;border-color:#d58512}.btn-warning.active,.btn-warning:active,.open>.dropdown-toggle.btn-warning{color:#fff;background-color:#ec971f;border-color:#d58512}.btn-warning.active.focus,.btn-warning.active:focus,.btn-warning.active:hover,.btn-warning:active.focus,.btn-warning:active:focus,.btn-warning:active:hover,.open>.dropdown-toggle.btn-warning.focus,.open>.dropdown-toggle.btn-warning:focus,.open>.dropdown-toggle.btn-warning:hover{color:#fff;background-color:#d58512;border-color:#985f0d}.btn-warning.active,.btn-warning:active,.open>.dropdown-toggle.btn-warning{background-image:none}.btn-warning.disabled.focus,.btn-warning.disabled:focus,.btn-warning.disabled:hover,.btn-warning[disabled].focus,.btn-warning[disabled]:focus,.btn-warning[disabled]:hover,fieldset[disabled] .btn-warning.focus,fieldset[disabled] .btn-warning:focus,fieldset[disabled] .btn-warning:hover{background-color:#f0ad4e;border-color:#eea236}.btn-warning .badge{color:#f0ad4e;background-color:#fff}.btn-danger{color:#fff;background-color:#d9534f;border-color:#d43f3a}.btn-danger.focus,.btn-danger:focus{color:#fff;background-color:#c9302c;border-color:#761c19}.btn-danger:hover{color:#fff;background-color:#c9302c;border-color:#ac2925}.btn-danger.active,.btn-danger:active,.open>.dropdown-toggle.btn-danger{color:#fff;background-color:#c9302c;border-color:#ac2925}.btn-danger.active.focus,.btn-danger.active:focus,.btn-danger.active:hover,.btn-danger:active.focus,.btn-danger:active:focus,.btn-danger:active:hover,.open>.dropdown-toggle.btn-danger.focus,.open>.dropdown-toggle.btn-danger:focus,.open>.dropdown-toggle.btn-danger:hover{color:#fff;background-color:#ac2925;border-color:#761c19}.btn-danger.active,.btn-danger:active,.open>.dropdown-toggle.btn-danger{background-image:none}.btn-danger.disabled.focus,.btn-danger.disabled:focus,.btn-danger.disabled:hover,.btn-danger[disabled].focus,.btn-danger[disabled]:focus,.btn-danger[disabled]:hover,fieldset[disabled] .btn-danger.focus,fieldset[disabled] .btn-danger:focus,fieldset[disabled] .btn-danger:hover{background-color:#d9534f;border-color:#d43f3a}.btn-danger .badge{color:#d9534f;background-color:#fff}.btn-link{font-weight:400;color:#337ab7;border-radius:0}.btn-link,.btn-link.active,.btn-link:active,.btn-link[disabled],fieldset[disabled] .btn-link{background-color:transparent;-webkit-box-shadow:none;box-shadow:none}.btn-link,.btn-link:active,.btn-link:focus,.btn-link:hover{border-color:transparent}.btn-link:focus,.btn-link:hover{color:#23527c;text-decoration:underline;background-color:transparent}.btn-link[disabled]:focus,.btn-link[disabled]:hover,fieldset[disabled] .btn-link:focus,fieldset[disabled] .btn-link:hover{color:#777;text-decoration:none}.btn-group-lg>.btn,.btn-lg{padding:10px 16px;font-size:18px;line-height:1.3333333;border-radius:6px}.btn-group-sm>.btn,.btn-sm{padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}.btn-group-xs>.btn,.btn-xs{padding:1px 5px;font-size:12px;line-height:1.5;border-radius:3px}.btn-block{display:block;width:100%}.btn-block+.btn-block{margin-top:5px}input[type=button].btn-block,input[type=reset].btn-block,input[type=submit].btn-block{width:100%}.fade{opacity:0;-webkit-transition:opacity .15s linear;-o-transition:opacity .15s linear;transition:opacity .15s linear}.fade.in{opacity:1}.collapse{display:none}.collapse.in{display:block}tr.collapse.in{display:table-row}tbody.collapse.in{display:table-row-group}.collapsing{position:relative;height:0;overflow:hidden;-webkit-transition-timing-function:ease;-o-transition-timing-function:ease;transition-timing-function:ease;-webkit-transition-duration:.35s;-o-transition-duration:.35s;transition-duration:.35s;-webkit-transition-property:height,visibility;-o-transition-property:height,visibility;transition-property:height,visibility}.caret{display:inline-block;width:0;height:0;margin-left:2px;vertical-align:middle;border-top:4px dashed;border-top:4px solid\9;border-right:4px solid transparent;border-left:4px solid transparent}.dropdown,.dropup{position:relative}.dropdown-toggle:focus{outline:0}.dropdown-menu{position:absolute;top:100%;left:0;z-index:1000;display:none;float:left;min-width:160px;padding:5px 0;margin:2px 0 0;font-size:14px;text-align:left;list-style:none;background-color:#fff;-webkit-background-clip:padding-box;background-clip:padding-box;border:1px solid #ccc;border:1px solid rgba(0,0,0,.15);border-radius:4px;-webkit-box-shadow:0 6px 12px rgba(0,0,0,.175);box-shadow:0 6px 12px rgba(0,0,0,.175)}.dropdown-menu.pull-right{right:0;left:auto}.dropdown-menu .divider{height:1px;margin:9px 0;overflow:hidden;background-color:#e5e5e5}.dropdown-menu>li>a{display:block;padding:3px 20px;clear:both;font-weight:400;line-height:1.42857143;color:#333;white-space:nowrap}.dropdown-menu>li>a:focus,.dropdown-menu>li>a:hover{color:#262626;text-decoration:none;background-color:#f5f5f5}.dropdown-menu>.active>a,.dropdown-menu>.active>a:focus,.dropdown-menu>.active>a:hover{color:#fff;text-decoration:none;background-color:#337ab7;outline:0}.dropdown-menu>.disabled>a,.dropdown-menu>.disabled>a:focus,.dropdown-menu>.disabled>a:hover{color:#777}.dropdown-menu>.disabled>a:focus,.dropdown-menu>.disabled>a:hover{text-decoration:none;cursor:not-allowed;background-color:transparent;background-image:none;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.open>.dropdown-menu{display:block}.open>a{outline:0}.dropdown-menu-right{right:0;left:auto}.dropdown-menu-left{right:auto;left:0}.dropdown-header{display:block;padding:3px 20px;font-size:12px;line-height:1.42857143;color:#777;white-space:nowrap}.dropdown-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:990}.pull-right>.dropdown-menu{right:0;left:auto}.dropup .caret,.navbar-fixed-bottom .dropdown .caret{content:"";border-top:0;border-bottom:4px dashed;border-bottom:4px solid\9}.dropup .dropdown-menu,.navbar-fixed-bottom .dropdown .dropdown-menu{top:auto;bottom:100%;margin-bottom:2px}@media (min-width:768px){.navbar-right .dropdown-menu{right:0;left:auto}.navbar-right .dropdown-menu-left{right:auto;left:0}}.btn-group,.btn-group-vertical{position:relative;display:inline-block;vertical-align:middle}.btn-group-vertical>.btn,.btn-group>.btn{position:relative;float:left}.btn-group-vertical>.btn.active,.btn-group-vertical>.btn:active,.btn-group-vertical>.btn:focus,.btn-group-vertical>.btn:hover,.btn-group>.btn.active,.btn-group>.btn:active,.btn-group>.btn:focus,.btn-group>.btn:hover{z-index:2}.btn-group .btn+.btn,.btn-group .btn+.btn-group,.btn-group .btn-group+.btn,.btn-group .btn-group+.btn-group{margin-left:-1px}.btn-toolbar{margin-left:-5px}.btn-toolbar .btn,.btn-toolbar .btn-group,.btn-toolbar .input-group{float:left}.btn-toolbar>.btn,.btn-toolbar>.btn-group,.btn-toolbar>.input-group{margin-left:5px}.btn-group>.btn:not(:first-child):not(:last-child):not(.dropdown-toggle){border-radius:0}.btn-group>.btn:first-child{margin-left:0}.btn-group>.btn:first-child:not(:last-child):not(.dropdown-toggle){border-top-right-radius:0;border-bottom-right-radius:0}.btn-group>.btn:last-child:not(:first-child),.btn-group>.dropdown-toggle:not(:first-child){border-top-left-radius:0;border-bottom-left-radius:0}.btn-group>.btn-group{float:left}.btn-group>.btn-group:not(:first-child):not(:last-child)>.btn{border-radius:0}.btn-group>.btn-group:first-child:not(:last-child)>.btn:last-child,.btn-group>.btn-group:first-child:not(:last-child)>.dropdown-toggle{border-top-right-radius:0;border-bottom-right-radius:0}.btn-group>.btn-group:last-child:not(:first-child)>.btn:first-child{border-top-left-radius:0;border-bottom-left-radius:0}.btn-group .dropdown-toggle:active,.btn-group.open .dropdown-toggle{outline:0}.btn-group>.btn+.dropdown-toggle{padding-right:8px;padding-left:8px}.btn-group>.btn-lg+.dropdown-toggle{padding-right:12px;padding-left:12px}.btn-group.open .dropdown-toggle{-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,.125);box-shadow:inset 0 3px 5px rgba(0,0,0,.125)}.btn-group.open .dropdown-toggle.btn-link{-webkit-box-shadow:none;box-shadow:none}.btn .caret{margin-left:0}.btn-lg .caret{border-width:5px 5px 0;border-bottom-width:0}.dropup .btn-lg .caret{border-width:0 5px 5px}.btn-group-vertical>.btn,.btn-group-vertical>.btn-group,.btn-group-vertical>.btn-group>.btn{display:block;float:none;width:100%;max-width:100%}.btn-group-vertical>.btn-group>.btn{float:none}.btn-group-vertical>.btn+.btn,.btn-group-vertical>.btn+.btn-group,.btn-group-vertical>.btn-group+.btn,.btn-group-vertical>.btn-group+.btn-group{margin-top:-1px;margin-left:0}.btn-group-vertical>.btn:not(:first-child):not(:last-child){border-radius:0}.btn-group-vertical>.btn:first-child:not(:last-child){border-top-left-radius:4px;border-top-right-radius:4px;border-bottom-right-radius:0;border-bottom-left-radius:0}.btn-group-vertical>.btn:last-child:not(:first-child){border-top-left-radius:0;border-top-right-radius:0;border-bottom-right-radius:4px;border-bottom-left-radius:4px}.btn-group-vertical>.btn-group:not(:first-child):not(:last-child)>.btn{border-radius:0}.btn-group-vertical>.btn-group:first-child:not(:last-child)>.btn:last-child,.btn-group-vertical>.btn-group:first-child:not(:last-child)>.dropdown-toggle{border-bottom-right-radius:0;border-bottom-left-radius:0}.btn-group-vertical>.btn-group:last-child:not(:first-child)>.btn:first-child{border-top-left-radius:0;border-top-right-radius:0}.btn-group-justified{display:table;width:100%;table-layout:fixed;border-collapse:separate}.btn-group-justified>.btn,.btn-group-justified>.btn-group{display:table-cell;float:none;width:1%}.btn-group-justified>.btn-group .btn{width:100%}.btn-group-justified>.btn-group .dropdown-menu{left:auto}[data-toggle=buttons]>.btn input[type=checkbox],[data-toggle=buttons]>.btn input[type=radio],[data-toggle=buttons]>.btn-group>.btn input[type=checkbox],[data-toggle=buttons]>.btn-group>.btn input[type=radio]{position:absolute;clip:rect(0,0,0,0);pointer-events:none}.input-group{position:relative;display:table;border-collapse:separate}.input-group[class*=col-]{float:none;padding-right:0;padding-left:0}.input-group .form-control{position:relative;z-index:2;float:left;width:100%;margin-bottom:0}.input-group .form-control:focus{z-index:3}.input-group-lg>.form-control,.input-group-lg>.input-group-addon,.input-group-lg>.input-group-btn>.btn{height:46px;padding:10px 16px;font-size:18px;line-height:1.3333333;border-radius:6px}select.input-group-lg>.form-control,select.input-group-lg>.input-group-addon,select.input-group-lg>.input-group-btn>.btn{height:46px;line-height:46px}select[multiple].input-group-lg>.form-control,select[multiple].input-group-lg>.input-group-addon,select[multiple].input-group-lg>.input-group-btn>.btn,textarea.input-group-lg>.form-control,textarea.input-group-lg>.input-group-addon,textarea.input-group-lg>.input-group-btn>.btn{height:auto}.input-group-sm>.form-control,.input-group-sm>.input-group-addon,.input-group-sm>.input-group-btn>.btn{height:30px;padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}select.input-group-sm>.form-control,select.input-group-sm>.input-group-addon,select.input-group-sm>.input-group-btn>.btn{height:30px;line-height:30px}select[multiple].input-group-sm>.form-control,select[multiple].input-group-sm>.input-group-addon,select[multiple].input-group-sm>.input-group-btn>.btn,textarea.input-group-sm>.form-control,textarea.input-group-sm>.input-group-addon,textarea.input-group-sm>.input-group-btn>.btn{height:auto}.input-group .form-control,.input-group-addon,.input-group-btn{display:table-cell}.input-group .form-control:not(:first-child):not(:last-child),.input-group-addon:not(:first-child):not(:last-child),.input-group-btn:not(:first-child):not(:last-child){border-radius:0}.input-group-addon,.input-group-btn{width:1%;white-space:nowrap;vertical-align:middle}.input-group-addon{padding:6px 12px;font-size:14px;font-weight:400;line-height:1;color:#555;text-align:center;background-color:#eee;border:1px solid #ccc;border-radius:4px}.input-group-addon.input-sm{padding:5px 10px;font-size:12px;border-radius:3px}.input-group-addon.input-lg{padding:10px 16px;font-size:18px;border-radius:6px}.input-group-addon input[type=checkbox],.input-group-addon input[type=radio]{margin-top:0}.input-group .form-control:first-child,.input-group-addon:first-child,.input-group-btn:first-child>.btn,.input-group-btn:first-child>.btn-group>.btn,.input-group-btn:first-child>.dropdown-toggle,.input-group-btn:last-child>.btn-group:not(:last-child)>.btn,.input-group-btn:last-child>.btn:not(:last-child):not(.dropdown-toggle){border-top-right-radius:0;border-bottom-right-radius:0}.input-group-addon:first-child{border-right:0}.input-group .form-control:last-child,.input-group-addon:last-child,.input-group-btn:first-child>.btn-group:not(:first-child)>.btn,.input-group-btn:first-child>.btn:not(:first-child),.input-group-btn:last-child>.btn,.input-group-btn:last-child>.btn-group>.btn,.input-group-btn:last-child>.dropdown-toggle{border-top-left-radius:0;border-bottom-left-radius:0}.input-group-addon:last-child{border-left:0}.input-group-btn{position:relative;font-size:0;white-space:nowrap}.input-group-btn>.btn{position:relative}.input-group-btn>.btn+.btn{margin-left:-1px}.input-group-btn>.btn:active,.input-group-btn>.btn:focus,.input-group-btn>.btn:hover{z-index:2}.input-group-btn:first-child>.btn,.input-group-btn:first-child>.btn-group{margin-right:-1px}.input-group-btn:last-child>.btn,.input-group-btn:last-child>.btn-group{z-index:2;margin-left:-1px}.nav{padding-left:0;margin-bottom:0;list-style:none}.nav>li{position:relative;display:block}.nav>li>a{position:relative;display:block;padding:10px 15px}.nav>li>a:focus,.nav>li>a:hover{text-decoration:none;background-color:#eee}.nav>li.disabled>a{color:#777}.nav>li.disabled>a:focus,.nav>li.disabled>a:hover{color:#777;text-decoration:none;cursor:not-allowed;background-color:transparent}.nav .open>a,.nav .open>a:focus,.nav .open>a:hover{background-color:#eee;border-color:#337ab7}.nav .nav-divider{height:1px;margin:9px 0;overflow:hidden;background-color:#e5e5e5}.nav>li>a>img{max-width:none}.nav-tabs{border-bottom:1px solid #ddd}.nav-tabs>li{float:left;margin-bottom:-1px}.nav-tabs>li>a{margin-right:2px;line-height:1.42857143;border:1px solid transparent;border-radius:4px 4px 0 0}.nav-tabs>li>a:hover{border-color:#eee #eee #ddd}.nav-tabs>li.active>a,.nav-tabs>li.active>a:focus,.nav-tabs>li.active>a:hover{color:#555;cursor:default;background-color:#fff;border:1px solid #ddd;border-bottom-color:transparent}.nav-tabs.nav-justified{width:100%;border-bottom:0}.nav-tabs.nav-justified>li{float:none}.nav-tabs.nav-justified>li>a{margin-bottom:5px;text-align:center}.nav-tabs.nav-justified>.dropdown .dropdown-menu{top:auto;left:auto}@media (min-width:768px){.nav-tabs.nav-justified>li{display:table-cell;width:1%}.nav-tabs.nav-justified>li>a{margin-bottom:0}}.nav-tabs.nav-justified>li>a{margin-right:0;border-radius:4px}.nav-tabs.nav-justified>.active>a,.nav-tabs.nav-justified>.active>a:focus,.nav-tabs.nav-justified>.active>a:hover{border:1px solid #ddd}@media (min-width:768px){.nav-tabs.nav-justified>li>a{border-bottom:1px solid #ddd;border-radius:4px 4px 0 0}.nav-tabs.nav-justified>.active>a,.nav-tabs.nav-justified>.active>a:focus,.nav-tabs.nav-justified>.active>a:hover{border-bottom-color:#fff}}.nav-pills>li{float:left}.nav-pills>li>a{border-radius:4px}.nav-pills>li+li{margin-left:2px}.nav-pills>li.active>a,.nav-pills>li.active>a:focus,.nav-pills>li.active>a:hover{color:#fff;background-color:#337ab7}.nav-stacked>li{float:none}.nav-stacked>li+li{margin-top:2px;margin-left:0}.nav-justified{width:100%}.nav-justified>li{float:none}.nav-justified>li>a{margin-bottom:5px;text-align:center}.nav-justified>.dropdown .dropdown-menu{top:auto;left:auto}@media (min-width:768px){.nav-justified>li{display:table-cell;width:1%}.nav-justified>li>a{margin-bottom:0}}.nav-tabs-justified{border-bottom:0}.nav-tabs-justified>li>a{margin-right:0;border-radius:4px}.nav-tabs-justified>.active>a,.nav-tabs-justified>.active>a:focus,.nav-tabs-justified>.active>a:hover{border:1px solid #ddd}@media (min-width:768px){.nav-tabs-justified>li>a{border-bottom:1px solid #ddd;border-radius:4px 4px 0 0}.nav-tabs-justified>.active>a,.nav-tabs-justified>.active>a:focus,.nav-tabs-justified>.active>a:hover{border-bottom-color:#fff}}.tab-content>.tab-pane{display:none}.tab-content>.active{display:block}.nav-tabs .dropdown-menu{margin-top:-1px;border-top-left-radius:0;border-top-right-radius:0}.navbar{position:relative;min-height:50px;margin-bottom:20px;border:1px solid transparent}@media (min-width:768px){.navbar{border-radius:4px}}@media (min-width:768px){.navbar-header{float:left}}.navbar-collapse{padding-right:15px;padding-left:15px;overflow-x:visible;-webkit-overflow-scrolling:touch;border-top:1px solid transparent;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.1);box-shadow:inset 0 1px 0 rgba(255,255,255,.1)}.navbar-collapse.in{overflow-y:auto}@media (min-width:768px){.navbar-collapse{width:auto;border-top:0;-webkit-box-shadow:none;box-shadow:none}.navbar-collapse.collapse{display:block!important;height:auto!important;padding-bottom:0;overflow:visible!important}.navbar-collapse.in{overflow-y:visible}.navbar-fixed-bottom .navbar-collapse,.navbar-fixed-top .navbar-collapse,.navbar-static-top .navbar-collapse{padding-right:0;padding-left:0}}.navbar-fixed-bottom .navbar-collapse,.navbar-fixed-top .navbar-collapse{max-height:340px}@media (max-device-width:480px) and (orientation:landscape){.navbar-fixed-bottom .navbar-collapse,.navbar-fixed-top .navbar-collapse{max-height:200px}}.container-fluid>.navbar-collapse,.container-fluid>.navbar-header,.container>.navbar-collapse,.container>.navbar-header{margin-right:-15px;margin-left:-15px}@media (min-width:768px){.container-fluid>.navbar-collapse,.container-fluid>.navbar-header,.container>.navbar-collapse,.container>.navbar-header{margin-right:0;margin-left:0}}.navbar-static-top{z-index:1000;border-width:0 0 1px}@media (min-width:768px){.navbar-static-top{border-radius:0}}.navbar-fixed-bottom,.navbar-fixed-top{position:fixed;right:0;left:0;z-index:1030}@media (min-width:768px){.navbar-fixed-bottom,.navbar-fixed-top{border-radius:0}}.navbar-fixed-top{top:0;border-width:0 0 1px}.navbar-fixed-bottom{bottom:0;margin-bottom:0;border-width:1px 0 0}.navbar-brand{float:left;height:50px;padding:15px 15px;font-size:18px;line-height:20px}.navbar-brand:focus,.navbar-brand:hover{text-decoration:none}.navbar-brand>img{display:block}@media (min-width:768px){.navbar>.container .navbar-brand,.navbar>.container-fluid .navbar-brand{margin-left:-15px}}.navbar-toggle{position:relative;float:right;padding:9px 10px;margin-top:8px;margin-right:15px;margin-bottom:8px;background-color:transparent;background-image:none;border:1px solid transparent;border-radius:4px}.navbar-toggle:focus{outline:0}.navbar-toggle .icon-bar{display:block;width:22px;height:2px;border-radius:1px}.navbar-toggle .icon-bar+.icon-bar{margin-top:4px}@media (min-width:768px){.navbar-toggle{display:none}}.navbar-nav{margin:7.5px -15px}.navbar-nav>li>a{padding-top:10px;padding-bottom:10px;line-height:20px}@media (max-width:767px){.navbar-nav .open .dropdown-menu{position:static;float:none;width:auto;margin-top:0;background-color:transparent;border:0;-webkit-box-shadow:none;box-shadow:none}.navbar-nav .open .dropdown-menu .dropdown-header,.navbar-nav .open .dropdown-menu>li>a{padding:5px 15px 5px 25px}.navbar-nav .open .dropdown-menu>li>a{line-height:20px}.navbar-nav .open .dropdown-menu>li>a:focus,.navbar-nav .open .dropdown-menu>li>a:hover{background-image:none}}@media (min-width:768px){.navbar-nav{float:left;margin:0}.navbar-nav>li{float:left}.navbar-nav>li>a{padding-top:15px;padding-bottom:15px}}.navbar-form{padding:10px 15px;margin-top:8px;margin-right:-15px;margin-bottom:8px;margin-left:-15px;border-top:1px solid transparent;border-bottom:1px solid transparent;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.1),0 1px 0 rgba(255,255,255,.1);box-shadow:inset 0 1px 0 rgba(255,255,255,.1),0 1px 0 rgba(255,255,255,.1)}@media (min-width:768px){.navbar-form .form-group{display:inline-block;margin-bottom:0;vertical-align:middle}.navbar-form .form-control{display:inline-block;width:auto;vertical-align:middle}.navbar-form .form-control-static{display:inline-block}.navbar-form .input-group{display:inline-table;vertical-align:middle}.navbar-form .input-group .form-control,.navbar-form .input-group .input-group-addon,.navbar-form .input-group .input-group-btn{width:auto}.navbar-form .input-group>.form-control{width:100%}.navbar-form .control-label{margin-bottom:0;vertical-align:middle}.navbar-form .checkbox,.navbar-form .radio{display:inline-block;margin-top:0;margin-bottom:0;vertical-align:middle}.navbar-form .checkbox label,.navbar-form .radio label{padding-left:0}.navbar-form .checkbox input[type=checkbox],.navbar-form .radio input[type=radio]{position:relative;margin-left:0}.navbar-form .has-feedback .form-control-feedback{top:0}}@media (max-width:767px){.navbar-form .form-group{margin-bottom:5px}.navbar-form .form-group:last-child{margin-bottom:0}}@media (min-width:768px){.navbar-form{width:auto;padding-top:0;padding-bottom:0;margin-right:0;margin-left:0;border:0;-webkit-box-shadow:none;box-shadow:none}}.navbar-nav>li>.dropdown-menu{margin-top:0;border-top-left-radius:0;border-top-right-radius:0}.navbar-fixed-bottom .navbar-nav>li>.dropdown-menu{margin-bottom:0;border-top-left-radius:4px;border-top-right-radius:4px;border-bottom-right-radius:0;border-bottom-left-radius:0}.navbar-btn{margin-top:8px;margin-bottom:8px}.navbar-btn.btn-sm{margin-top:10px;margin-bottom:10px}.navbar-btn.btn-xs{margin-top:14px;margin-bottom:14px}.navbar-text{margin-top:15px;margin-bottom:15px}@media (min-width:768px){.navbar-text{float:left;margin-right:15px;margin-left:15px}}@media (min-width:768px){.navbar-left{float:left!important}.navbar-right{float:right!important;margin-right:-15px}.navbar-right~.navbar-right{margin-right:0}}.navbar-default{background-color:#f8f8f8;border-color:#e7e7e7}.navbar-default .navbar-brand{color:#777}.navbar-default .navbar-brand:focus,.navbar-default .navbar-brand:hover{color:#5e5e5e;background-color:transparent}.navbar-default .navbar-text{color:#777}.navbar-default .navbar-nav>li>a{color:#777}.navbar-default .navbar-nav>li>a:focus,.navbar-default .navbar-nav>li>a:hover{color:#333;background-color:transparent}.navbar-default .navbar-nav>.active>a,.navbar-default .navbar-nav>.active>a:focus,.navbar-default .navbar-nav>.active>a:hover{color:#555;background-color:#e7e7e7}.navbar-default .navbar-nav>.disabled>a,.navbar-default .navbar-nav>.disabled>a:focus,.navbar-default .navbar-nav>.disabled>a:hover{color:#ccc;background-color:transparent}.navbar-default .navbar-toggle{border-color:#ddd}.navbar-default .navbar-toggle:focus,.navbar-default .navbar-toggle:hover{background-color:#ddd}.navbar-default .navbar-toggle .icon-bar{background-color:#888}.navbar-default .navbar-collapse,.navbar-default .navbar-form{border-color:#e7e7e7}.navbar-default .navbar-nav>.open>a,.navbar-default .navbar-nav>.open>a:focus,.navbar-default .navbar-nav>.open>a:hover{color:#555;background-color:#e7e7e7}@media (max-width:767px){.navbar-default .navbar-nav .open .dropdown-menu>li>a{color:#777}.navbar-default .navbar-nav .open .dropdown-menu>li>a:focus,.navbar-default .navbar-nav .open .dropdown-menu>li>a:hover{color:#333;background-color:transparent}.navbar-default .navbar-nav .open .dropdown-menu>.active>a,.navbar-default .navbar-nav .open .dropdown-menu>.active>a:focus,.navbar-default .navbar-nav .open .dropdown-menu>.active>a:hover{color:#555;background-color:#e7e7e7}.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a,.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a:focus,.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a:hover{color:#ccc;background-color:transparent}}.navbar-default .navbar-link{color:#777}.navbar-default .navbar-link:hover{color:#333}.navbar-default .btn-link{color:#777}.navbar-default .btn-link:focus,.navbar-default .btn-link:hover{color:#333}.navbar-default .btn-link[disabled]:focus,.navbar-default .btn-link[disabled]:hover,fieldset[disabled] .navbar-default .btn-link:focus,fieldset[disabled] .navbar-default .btn-link:hover{color:#ccc}.navbar-inverse{background-color:#222;border-color:#080808}.navbar-inverse .navbar-brand{color:#9d9d9d}.navbar-inverse .navbar-brand:focus,.navbar-inverse .navbar-brand:hover{color:#fff;background-color:transparent}.navbar-inverse .navbar-text{color:#9d9d9d}.navbar-inverse .navbar-nav>li>a{color:#9d9d9d}.navbar-inverse .navbar-nav>li>a:focus,.navbar-inverse .navbar-nav>li>a:hover{color:#fff;background-color:transparent}.navbar-inverse .navbar-nav>.active>a,.navbar-inverse .navbar-nav>.active>a:focus,.navbar-inverse .navbar-nav>.active>a:hover{color:#fff;background-color:#080808}.navbar-inverse .navbar-nav>.disabled>a,.navbar-inverse .navbar-nav>.disabled>a:focus,.navbar-inverse .navbar-nav>.disabled>a:hover{color:#444;background-color:transparent}.navbar-inverse .navbar-toggle{border-color:#333}.navbar-inverse .navbar-toggle:focus,.navbar-inverse .navbar-toggle:hover{background-color:#333}.navbar-inverse .navbar-toggle .icon-bar{background-color:#fff}.navbar-inverse .navbar-collapse,.navbar-inverse .navbar-form{border-color:#101010}.navbar-inverse .navbar-nav>.open>a,.navbar-inverse .navbar-nav>.open>a:focus,.navbar-inverse .navbar-nav>.open>a:hover{color:#fff;background-color:#080808}@media (max-width:767px){.navbar-inverse .navbar-nav .open .dropdown-menu>.dropdown-header{border-color:#080808}.navbar-inverse .navbar-nav .open .dropdown-menu .divider{background-color:#080808}.navbar-inverse .navbar-nav .open .dropdown-menu>li>a{color:#9d9d9d}.navbar-inverse .navbar-nav .open .dropdown-menu>li>a:focus,.navbar-inverse .navbar-nav .open .dropdown-menu>li>a:hover{color:#fff;background-color:transparent}.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a,.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a:focus,.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a:hover{color:#fff;background-color:#080808}.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a,.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a:focus,.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a:hover{color:#444;background-color:transparent}}.navbar-inverse .navbar-link{color:#9d9d9d}.navbar-inverse .navbar-link:hover{color:#fff}.navbar-inverse .btn-link{color:#9d9d9d}.navbar-inverse .btn-link:focus,.navbar-inverse .btn-link:hover{color:#fff}.navbar-inverse .btn-link[disabled]:focus,.navbar-inverse .btn-link[disabled]:hover,fieldset[disabled] .navbar-inverse .btn-link:focus,fieldset[disabled] .navbar-inverse .btn-link:hover{color:#444}.breadcrumb{padding:8px 15px;margin-bottom:20px;list-style:none;background-color:#f5f5f5;border-radius:4px}.breadcrumb>li{display:inline-block}.breadcrumb>li+li:before{padding:0 5px;color:#ccc;content:"/\00a0"}.breadcrumb>.active{color:#777}.pagination{display:inline-block;padding-left:0;margin:20px 0;border-radius:4px}.pagination>li{display:inline}.pagination>li>a,.pagination>li>span{position:relative;float:left;padding:6px 12px;margin-left:-1px;line-height:1.42857143;color:#337ab7;text-decoration:none;background-color:#fff;border:1px solid #ddd}.pagination>li:first-child>a,.pagination>li:first-child>span{margin-left:0;border-top-left-radius:4px;border-bottom-left-radius:4px}.pagination>li:last-child>a,.pagination>li:last-child>span{border-top-right-radius:4px;border-bottom-right-radius:4px}.pagination>li>a:focus,.pagination>li>a:hover,.pagination>li>span:focus,.pagination>li>span:hover{z-index:2;color:#23527c;background-color:#eee;border-color:#ddd}.pagination>.active>a,.pagination>.active>a:focus,.pagination>.active>a:hover,.pagination>.active>span,.pagination>.active>span:focus,.pagination>.active>span:hover{z-index:3;color:#fff;cursor:default;background-color:#337ab7;border-color:#337ab7}.pagination>.disabled>a,.pagination>.disabled>a:focus,.pagination>.disabled>a:hover,.pagination>.disabled>span,.pagination>.disabled>span:focus,.pagination>.disabled>span:hover{color:#777;cursor:not-allowed;background-color:#fff;border-color:#ddd}.pagination-lg>li>a,.pagination-lg>li>span{padding:10px 16px;font-size:18px;line-height:1.3333333}.pagination-lg>li:first-child>a,.pagination-lg>li:first-child>span{border-top-left-radius:6px;border-bottom-left-radius:6px}.pagination-lg>li:last-child>a,.pagination-lg>li:last-child>span{border-top-right-radius:6px;border-bottom-right-radius:6px}.pagination-sm>li>a,.pagination-sm>li>span{padding:5px 10px;font-size:12px;line-height:1.5}.pagination-sm>li:first-child>a,.pagination-sm>li:first-child>span{border-top-left-radius:3px;border-bottom-left-radius:3px}.pagination-sm>li:last-child>a,.pagination-sm>li:last-child>span{border-top-right-radius:3px;border-bottom-right-radius:3px}.pager{padding-left:0;margin:20px 0;text-align:center;list-style:none}.pager li{display:inline}.pager li>a,.pager li>span{display:inline-block;padding:5px 14px;background-color:#fff;border:1px solid #ddd;border-radius:15px}.pager li>a:focus,.pager li>a:hover{text-decoration:none;background-color:#eee}.pager .next>a,.pager .next>span{float:right}.pager .previous>a,.pager .previous>span{float:left}.pager .disabled>a,.pager .disabled>a:focus,.pager .disabled>a:hover,.pager .disabled>span{color:#777;cursor:not-allowed;background-color:#fff}.label{display:inline;padding:.2em .6em .3em;font-size:75%;font-weight:700;line-height:1;color:#fff;text-align:center;white-space:nowrap;vertical-align:baseline;border-radius:.25em}a.label:focus,a.label:hover{color:#fff;text-decoration:none;cursor:pointer}.label:empty{display:none}.btn .label{position:relative;top:-1px}.label-default{background-color:#777}.label-default[href]:focus,.label-default[href]:hover{background-color:#5e5e5e}.label-primary{background-color:#337ab7}.label-primary[href]:focus,.label-primary[href]:hover{background-color:#286090}.label-success{background-color:#5cb85c}.label-success[href]:focus,.label-success[href]:hover{background-color:#449d44}.label-info{background-color:#5bc0de}.label-info[href]:focus,.label-info[href]:hover{background-color:#31b0d5}.label-warning{background-color:#f0ad4e}.label-warning[href]:focus,.label-warning[href]:hover{background-color:#ec971f}.label-danger{background-color:#d9534f}.label-danger[href]:focus,.label-danger[href]:hover{background-color:#c9302c}.badge{display:inline-block;min-width:10px;padding:3px 7px;font-size:12px;font-weight:700;line-height:1;color:#fff;text-align:center;white-space:nowrap;vertical-align:middle;background-color:#777;border-radius:10px}.badge:empty{display:none}.btn .badge{position:relative;top:-1px}.btn-group-xs>.btn .badge,.btn-xs .badge{top:0;padding:1px 5px}a.badge:focus,a.badge:hover{color:#fff;text-decoration:none;cursor:pointer}.list-group-item.active>.badge,.nav-pills>.active>a>.badge{color:#337ab7;background-color:#fff}.list-group-item>.badge{float:right}.list-group-item>.badge+.badge{margin-right:5px}.nav-pills>li>a>.badge{margin-left:3px}.jumbotron{padding-top:30px;padding-bottom:30px;margin-bottom:30px;color:inherit;background-color:#eee}.jumbotron .h1,.jumbotron h1{color:inherit}.jumbotron p{margin-bottom:15px;font-size:21px;font-weight:200}.jumbotron>hr{border-top-color:#d5d5d5}.container .jumbotron,.container-fluid .jumbotron{padding-right:15px;padding-left:15px;border-radius:6px}.jumbotron .container{max-width:100%}@media screen and (min-width:768px){.jumbotron{padding-top:48px;padding-bottom:48px}.container .jumbotron,.container-fluid .jumbotron{padding-right:60px;padding-left:60px}.jumbotron .h1,.jumbotron h1{font-size:63px}}.thumbnail{display:block;padding:4px;margin-bottom:20px;line-height:1.42857143;background-color:#fff;border:1px solid #ddd;border-radius:4px;-webkit-transition:border .2s ease-in-out;-o-transition:border .2s ease-in-out;transition:border .2s ease-in-out}.thumbnail a>img,.thumbnail>img{margin-right:auto;margin-left:auto}a.thumbnail.active,a.thumbnail:focus,a.thumbnail:hover{border-color:#337ab7}.thumbnail .caption{padding:9px;color:#333}.alert{padding:15px;margin-bottom:20px;border:1px solid transparent;border-radius:4px}.alert h4{margin-top:0;color:inherit}.alert .alert-link{font-weight:700}.alert>p,.alert>ul{margin-bottom:0}.alert>p+p{margin-top:5px}.alert-dismissable,.alert-dismissible{padding-right:35px}.alert-dismissable .close,.alert-dismissible .close{position:relative;top:-2px;right:-21px;color:inherit}.alert-success{color:#3c763d;background-color:#dff0d8;border-color:#d6e9c6}.alert-success hr{border-top-color:#c9e2b3}.alert-success .alert-link{color:#2b542c}.alert-info{color:#31708f;background-color:#d9edf7;border-color:#bce8f1}.alert-info hr{border-top-color:#a6e1ec}.alert-info .alert-link{color:#245269}.alert-warning{color:#8a6d3b;background-color:#fcf8e3;border-color:#faebcc}.alert-warning hr{border-top-color:#f7e1b5}.alert-warning .alert-link{color:#66512c}.alert-danger{color:#a94442;background-color:#f2dede;border-color:#ebccd1}.alert-danger hr{border-top-color:#e4b9c0}.alert-danger .alert-link{color:#843534}@-webkit-keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}@-o-keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}@keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}.progress{height:20px;margin-bottom:20px;overflow:hidden;background-color:#f5f5f5;border-radius:4px;-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,.1);box-shadow:inset 0 1px 2px rgba(0,0,0,.1)}.progress-bar{float:left;width:0;height:100%;font-size:12px;line-height:20px;color:#fff;text-align:center;background-color:#337ab7;-webkit-box-shadow:inset 0 -1px 0 rgba(0,0,0,.15);box-shadow:inset 0 -1px 0 rgba(0,0,0,.15);-webkit-transition:width .6s ease;-o-transition:width .6s ease;transition:width .6s ease}.progress-bar-striped,.progress-striped .progress-bar{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);-webkit-background-size:40px 40px;background-size:40px 40px}.progress-bar.active,.progress.active .progress-bar{-webkit-animation:progress-bar-stripes 2s linear infinite;-o-animation:progress-bar-stripes 2s linear infinite;animation:progress-bar-stripes 2s linear infinite}.progress-bar-success{background-color:#5cb85c}.progress-striped .progress-bar-success{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.progress-bar-info{background-color:#5bc0de}.progress-striped .progress-bar-info{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.progress-bar-warning{background-color:#f0ad4e}.progress-striped .progress-bar-warning{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.progress-bar-danger{background-color:#d9534f}.progress-striped .progress-bar-danger{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.media{margin-top:15px}.media:first-child{margin-top:0}.media,.media-body{overflow:hidden;zoom:1}.media-body{width:10000px}.media-object{display:block}.media-object.img-thumbnail{max-width:none}.media-right,.media>.pull-right{padding-left:10px}.media-left,.media>.pull-left{padding-right:10px}.media-body,.media-left,.media-right{display:table-cell;vertical-align:top}.media-middle{vertical-align:middle}.media-bottom{vertical-align:bottom}.media-heading{margin-top:0;margin-bottom:5px}.media-list{padding-left:0;list-style:none}.list-group{padding-left:0;margin-bottom:20px}.list-group-item{position:relative;display:block;padding:10px 15px;margin-bottom:-1px;background-color:#fff;border:1px solid #ddd}.list-group-item:first-child{border-top-left-radius:4px;border-top-right-radius:4px}.list-group-item:last-child{margin-bottom:0;border-bottom-right-radius:4px;border-bottom-left-radius:4px}a.list-group-item,button.list-group-item{color:#555}a.list-group-item .list-group-item-heading,button.list-group-item .list-group-item-heading{color:#333}a.list-group-item:focus,a.list-group-item:hover,button.list-group-item:focus,button.list-group-item:hover{color:#555;text-decoration:none;background-color:#f5f5f5}button.list-group-item{width:100%;text-align:left}.list-group-item.disabled,.list-group-item.disabled:focus,.list-group-item.disabled:hover{color:#777;cursor:not-allowed;background-color:#eee}.list-group-item.disabled .list-group-item-heading,.list-group-item.disabled:focus .list-group-item-heading,.list-group-item.disabled:hover .list-group-item-heading{color:inherit}.list-group-item.disabled .list-group-item-text,.list-group-item.disabled:focus .list-group-item-text,.list-group-item.disabled:hover .list-group-item-text{color:#777}.list-group-item.active,.list-group-item.active:focus,.list-group-item.active:hover{z-index:2;color:#fff;background-color:#337ab7;border-color:#337ab7}.list-group-item.active .list-group-item-heading,.list-group-item.active .list-group-item-heading>.small,.list-group-item.active .list-group-item-heading>small,.list-group-item.active:focus .list-group-item-heading,.list-group-item.active:focus .list-group-item-heading>.small,.list-group-item.active:focus .list-group-item-heading>small,.list-group-item.active:hover .list-group-item-heading,.list-group-item.active:hover .list-group-item-heading>.small,.list-group-item.active:hover .list-group-item-heading>small{color:inherit}.list-group-item.active .list-group-item-text,.list-group-item.active:focus .list-group-item-text,.list-group-item.active:hover .list-group-item-text{color:#c7ddef}.list-group-item-success{color:#3c763d;background-color:#dff0d8}a.list-group-item-success,button.list-group-item-success{color:#3c763d}a.list-group-item-success .list-group-item-heading,button.list-group-item-success .list-group-item-heading{color:inherit}a.list-group-item-success:focus,a.list-group-item-success:hover,button.list-group-item-success:focus,button.list-group-item-success:hover{color:#3c763d;background-color:#d0e9c6}a.list-group-item-success.active,a.list-group-item-success.active:focus,a.list-group-item-success.active:hover,button.list-group-item-success.active,button.list-group-item-success.active:focus,button.list-group-item-success.active:hover{color:#fff;background-color:#3c763d;border-color:#3c763d}.list-group-item-info{color:#31708f;background-color:#d9edf7}a.list-group-item-info,button.list-group-item-info{color:#31708f}a.list-group-item-info .list-group-item-heading,button.list-group-item-info .list-group-item-heading{color:inherit}a.list-group-item-info:focus,a.list-group-item-info:hover,button.list-group-item-info:focus,button.list-group-item-info:hover{color:#31708f;background-color:#c4e3f3}a.list-group-item-info.active,a.list-group-item-info.active:focus,a.list-group-item-info.active:hover,button.list-group-item-info.active,button.list-group-item-info.active:focus,button.list-group-item-info.active:hover{color:#fff;background-color:#31708f;border-color:#31708f}.list-group-item-warning{color:#8a6d3b;background-color:#fcf8e3}a.list-group-item-warning,button.list-group-item-warning{color:#8a6d3b}a.list-group-item-warning .list-group-item-heading,button.list-group-item-warning .list-group-item-heading{color:inherit}a.list-group-item-warning:focus,a.list-group-item-warning:hover,button.list-group-item-warning:focus,button.list-group-item-warning:hover{color:#8a6d3b;background-color:#faf2cc}a.list-group-item-warning.active,a.list-group-item-warning.active:focus,a.list-group-item-warning.active:hover,button.list-group-item-warning.active,button.list-group-item-warning.active:focus,button.list-group-item-warning.active:hover{color:#fff;background-color:#8a6d3b;border-color:#8a6d3b}.list-group-item-danger{color:#a94442;background-color:#f2dede}a.list-group-item-danger,button.list-group-item-danger{color:#a94442}a.list-group-item-danger .list-group-item-heading,button.list-group-item-danger .list-group-item-heading{color:inherit}a.list-group-item-danger:focus,a.list-group-item-danger:hover,button.list-group-item-danger:focus,button.list-group-item-danger:hover{color:#a94442;background-color:#ebcccc}a.list-group-item-danger.active,a.list-group-item-danger.active:focus,a.list-group-item-danger.active:hover,button.list-group-item-danger.active,button.list-group-item-danger.active:focus,button.list-group-item-danger.active:hover{color:#fff;background-color:#a94442;border-color:#a94442}.list-group-item-heading{margin-top:0;margin-bottom:5px}.list-group-item-text{margin-bottom:0;line-height:1.3}.panel{margin-bottom:20px;background-color:#fff;border:1px solid transparent;border-radius:4px;-webkit-box-shadow:0 1px 1px rgba(0,0,0,.05);box-shadow:0 1px 1px rgba(0,0,0,.05)}.panel-body{padding:15px}.panel-heading{padding:10px 15px;border-bottom:1px solid transparent;border-top-left-radius:3px;border-top-right-radius:3px}.panel-heading>.dropdown .dropdown-toggle{color:inherit}.panel-title{margin-top:0;margin-bottom:0;font-size:16px;color:inherit}.panel-title>.small,.panel-title>.small>a,.panel-title>a,.panel-title>small,.panel-title>small>a{color:inherit}.panel-footer{padding:10px 15px;background-color:#f5f5f5;border-top:1px solid #ddd;border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel>.list-group,.panel>.panel-collapse>.list-group{margin-bottom:0}.panel>.list-group .list-group-item,.panel>.panel-collapse>.list-group .list-group-item{border-width:1px 0;border-radius:0}.panel>.list-group:first-child .list-group-item:first-child,.panel>.panel-collapse>.list-group:first-child .list-group-item:first-child{border-top:0;border-top-left-radius:3px;border-top-right-radius:3px}.panel>.list-group:last-child .list-group-item:last-child,.panel>.panel-collapse>.list-group:last-child .list-group-item:last-child{border-bottom:0;border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel>.panel-heading+.panel-collapse>.list-group .list-group-item:first-child{border-top-left-radius:0;border-top-right-radius:0}.panel-heading+.list-group .list-group-item:first-child{border-top-width:0}.list-group+.panel-footer{border-top-width:0}.panel>.panel-collapse>.table,.panel>.table,.panel>.table-responsive>.table{margin-bottom:0}.panel>.panel-collapse>.table caption,.panel>.table caption,.panel>.table-responsive>.table caption{padding-right:15px;padding-left:15px}.panel>.table-responsive:first-child>.table:first-child,.panel>.table:first-child{border-top-left-radius:3px;border-top-right-radius:3px}.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child,.panel>.table:first-child>tbody:first-child>tr:first-child,.panel>.table:first-child>thead:first-child>tr:first-child{border-top-left-radius:3px;border-top-right-radius:3px}.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child td:first-child,.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child th:first-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child td:first-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child th:first-child,.panel>.table:first-child>tbody:first-child>tr:first-child td:first-child,.panel>.table:first-child>tbody:first-child>tr:first-child th:first-child,.panel>.table:first-child>thead:first-child>tr:first-child td:first-child,.panel>.table:first-child>thead:first-child>tr:first-child th:first-child{border-top-left-radius:3px}.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child td:last-child,.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child th:last-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child td:last-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child th:last-child,.panel>.table:first-child>tbody:first-child>tr:first-child td:last-child,.panel>.table:first-child>tbody:first-child>tr:first-child th:last-child,.panel>.table:first-child>thead:first-child>tr:first-child td:last-child,.panel>.table:first-child>thead:first-child>tr:first-child th:last-child{border-top-right-radius:3px}.panel>.table-responsive:last-child>.table:last-child,.panel>.table:last-child{border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child,.panel>.table:last-child>tbody:last-child>tr:last-child,.panel>.table:last-child>tfoot:last-child>tr:last-child{border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child td:first-child,.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child th:first-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child td:first-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child th:first-child,.panel>.table:last-child>tbody:last-child>tr:last-child td:first-child,.panel>.table:last-child>tbody:last-child>tr:last-child th:first-child,.panel>.table:last-child>tfoot:last-child>tr:last-child td:first-child,.panel>.table:last-child>tfoot:last-child>tr:last-child th:first-child{border-bottom-left-radius:3px}.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child td:last-child,.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child th:last-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child td:last-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child th:last-child,.panel>.table:last-child>tbody:last-child>tr:last-child td:last-child,.panel>.table:last-child>tbody:last-child>tr:last-child th:last-child,.panel>.table:last-child>tfoot:last-child>tr:last-child td:last-child,.panel>.table:last-child>tfoot:last-child>tr:last-child th:last-child{border-bottom-right-radius:3px}.panel>.panel-body+.table,.panel>.panel-body+.table-responsive,.panel>.table+.panel-body,.panel>.table-responsive+.panel-body{border-top:1px solid #ddd}.panel>.table>tbody:first-child>tr:first-child td,.panel>.table>tbody:first-child>tr:first-child th{border-top:0}.panel>.table-bordered,.panel>.table-responsive>.table-bordered{border:0}.panel>.table-bordered>tbody>tr>td:first-child,.panel>.table-bordered>tbody>tr>th:first-child,.panel>.table-bordered>tfoot>tr>td:first-child,.panel>.table-bordered>tfoot>tr>th:first-child,.panel>.table-bordered>thead>tr>td:first-child,.panel>.table-bordered>thead>tr>th:first-child,.panel>.table-responsive>.table-bordered>tbody>tr>td:first-child,.panel>.table-responsive>.table-bordered>tbody>tr>th:first-child,.panel>.table-responsive>.table-bordered>tfoot>tr>td:first-child,.panel>.table-responsive>.table-bordered>tfoot>tr>th:first-child,.panel>.table-responsive>.table-bordered>thead>tr>td:first-child,.panel>.table-responsive>.table-bordered>thead>tr>th:first-child{border-left:0}.panel>.table-bordered>tbody>tr>td:last-child,.panel>.table-bordered>tbody>tr>th:last-child,.panel>.table-bordered>tfoot>tr>td:last-child,.panel>.table-bordered>tfoot>tr>th:last-child,.panel>.table-bordered>thead>tr>td:last-child,.panel>.table-bordered>thead>tr>th:last-child,.panel>.table-responsive>.table-bordered>tbody>tr>td:last-child,.panel>.table-responsive>.table-bordered>tbody>tr>th:last-child,.panel>.table-responsive>.table-bordered>tfoot>tr>td:last-child,.panel>.table-responsive>.table-bordered>tfoot>tr>th:last-child,.panel>.table-responsive>.table-bordered>thead>tr>td:last-child,.panel>.table-responsive>.table-bordered>thead>tr>th:last-child{border-right:0}.panel>.table-bordered>tbody>tr:first-child>td,.panel>.table-bordered>tbody>tr:first-child>th,.panel>.table-bordered>thead>tr:first-child>td,.panel>.table-bordered>thead>tr:first-child>th,.panel>.table-responsive>.table-bordered>tbody>tr:first-child>td,.panel>.table-responsive>.table-bordered>tbody>tr:first-child>th,.panel>.table-responsive>.table-bordered>thead>tr:first-child>td,.panel>.table-responsive>.table-bordered>thead>tr:first-child>th{border-bottom:0}.panel>.table-bordered>tbody>tr:last-child>td,.panel>.table-bordered>tbody>tr:last-child>th,.panel>.table-bordered>tfoot>tr:last-child>td,.panel>.table-bordered>tfoot>tr:last-child>th,.panel>.table-responsive>.table-bordered>tbody>tr:last-child>td,.panel>.table-responsive>.table-bordered>tbody>tr:last-child>th,.panel>.table-responsive>.table-bordered>tfoot>tr:last-child>td,.panel>.table-responsive>.table-bordered>tfoot>tr:last-child>th{border-bottom:0}.panel>.table-responsive{margin-bottom:0;border:0}.panel-group{margin-bottom:20px}.panel-group .panel{margin-bottom:0;border-radius:4px}.panel-group .panel+.panel{margin-top:5px}.panel-group .panel-heading{border-bottom:0}.panel-group .panel-heading+.panel-collapse>.list-group,.panel-group .panel-heading+.panel-collapse>.panel-body{border-top:1px solid #ddd}.panel-group .panel-footer{border-top:0}.panel-group .panel-footer+.panel-collapse .panel-body{border-bottom:1px solid #ddd}.panel-default{border-color:#ddd}.panel-default>.panel-heading{color:#333;background-color:#f5f5f5;border-color:#ddd}.panel-default>.panel-heading+.panel-collapse>.panel-body{border-top-color:#ddd}.panel-default>.panel-heading .badge{color:#f5f5f5;background-color:#333}.panel-default>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#ddd}.panel-primary{border-color:#337ab7}.panel-primary>.panel-heading{color:#fff;background-color:#337ab7;border-color:#337ab7}.panel-primary>.panel-heading+.panel-collapse>.panel-body{border-top-color:#337ab7}.panel-primary>.panel-heading .badge{color:#337ab7;background-color:#fff}.panel-primary>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#337ab7}.panel-success{border-color:#d6e9c6}.panel-success>.panel-heading{color:#3c763d;background-color:#dff0d8;border-color:#d6e9c6}.panel-success>.panel-heading+.panel-collapse>.panel-body{border-top-color:#d6e9c6}.panel-success>.panel-heading .badge{color:#dff0d8;background-color:#3c763d}.panel-success>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#d6e9c6}.panel-info{border-color:#bce8f1}.panel-info>.panel-heading{color:#31708f;background-color:#d9edf7;border-color:#bce8f1}.panel-info>.panel-heading+.panel-collapse>.panel-body{border-top-color:#bce8f1}.panel-info>.panel-heading .badge{color:#d9edf7;background-color:#31708f}.panel-info>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#bce8f1}.panel-warning{border-color:#faebcc}.panel-warning>.panel-heading{color:#8a6d3b;background-color:#fcf8e3;border-color:#faebcc}.panel-warning>.panel-heading+.panel-collapse>.panel-body{border-top-color:#faebcc}.panel-warning>.panel-heading .badge{color:#fcf8e3;background-color:#8a6d3b}.panel-warning>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#faebcc}.panel-danger{border-color:#ebccd1}.panel-danger>.panel-heading{color:#a94442;background-color:#f2dede;border-color:#ebccd1}.panel-danger>.panel-heading+.panel-collapse>.panel-body{border-top-color:#ebccd1}.panel-danger>.panel-heading .badge{color:#f2dede;background-color:#a94442}.panel-danger>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#ebccd1}.embed-responsive{position:relative;display:block;height:0;padding:0;overflow:hidden}.embed-responsive .embed-responsive-item,.embed-responsive embed,.embed-responsive iframe,.embed-responsive object,.embed-responsive video{position:absolute;top:0;bottom:0;left:0;width:100%;height:100%;border:0}.embed-responsive-16by9{padding-bottom:56.25%}.embed-responsive-4by3{padding-bottom:75%}.well{min-height:20px;padding:19px;margin-bottom:20px;background-color:#f5f5f5;border:1px solid #e3e3e3;border-radius:4px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.05);box-shadow:inset 0 1px 1px rgba(0,0,0,.05)}.well blockquote{border-color:#ddd;border-color:rgba(0,0,0,.15)}.well-lg{padding:24px;border-radius:6px}.well-sm{padding:9px;border-radius:3px}.close{float:right;font-size:21px;font-weight:700;line-height:1;color:#000;text-shadow:0 1px 0 #fff;filter:alpha(opacity=20);opacity:.2}.close:focus,.close:hover{color:#000;text-decoration:none;cursor:pointer;filter:alpha(opacity=50);opacity:.5}button.close{-webkit-appearance:none;padding:0;cursor:pointer;background:0 0;border:0}.modal-open{overflow:hidden}.modal{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1050;display:none;overflow:hidden;-webkit-overflow-scrolling:touch;outline:0}.modal.fade .modal-dialog{-webkit-transition:-webkit-transform .3s ease-out;-o-transition:-o-transform .3s ease-out;transition:transform .3s ease-out;-webkit-transform:translate(0,-25%);-ms-transform:translate(0,-25%);-o-transform:translate(0,-25%);transform:translate(0,-25%)}.modal.in .modal-dialog{-webkit-transform:translate(0,0);-ms-transform:translate(0,0);-o-transform:translate(0,0);transform:translate(0,0)}.modal-open .modal{overflow-x:hidden;overflow-y:auto}.modal-dialog{position:relative;width:auto;margin:10px}.modal-content{position:relative;background-color:#fff;-webkit-background-clip:padding-box;background-clip:padding-box;border:1px solid #999;border:1px solid rgba(0,0,0,.2);border-radius:6px;outline:0;-webkit-box-shadow:0 3px 9px rgba(0,0,0,.5);box-shadow:0 3px 9px rgba(0,0,0,.5)}.modal-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1040;background-color:#000}.modal-backdrop.fade{filter:alpha(opacity=0);opacity:0}.modal-backdrop.in{filter:alpha(opacity=50);opacity:.5}.modal-header{padding:15px;border-bottom:1px solid #e5e5e5}.modal-header .close{margin-top:-2px}.modal-title{margin:0;line-height:1.42857143}.modal-body{position:relative;padding:15px}.modal-footer{padding:15px;text-align:right;border-top:1px solid #e5e5e5}.modal-footer .btn+.btn{margin-bottom:0;margin-left:5px}.modal-footer .btn-group .btn+.btn{margin-left:-1px}.modal-footer .btn-block+.btn-block{margin-left:0}.modal-scrollbar-measure{position:absolute;top:-9999px;width:50px;height:50px;overflow:scroll}@media (min-width:768px){.modal-dialog{width:600px;margin:30px auto}.modal-content{-webkit-box-shadow:0 5px 15px rgba(0,0,0,.5);box-shadow:0 5px 15px rgba(0,0,0,.5)}.modal-sm{width:300px}}@media (min-width:992px){.modal-lg{width:900px}}.tooltip{position:absolute;z-index:1070;display:block;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:12px;font-style:normal;font-weight:400;line-height:1.42857143;text-align:left;text-align:start;text-decoration:none;text-shadow:none;text-transform:none;letter-spacing:normal;word-break:normal;word-spacing:normal;word-wrap:normal;white-space:normal;filter:alpha(opacity=0);opacity:0;line-break:auto}.tooltip.in{filter:alpha(opacity=90);opacity:.9}.tooltip.top{padding:5px 0;margin-top:-3px}.tooltip.right{padding:0 5px;margin-left:3px}.tooltip.bottom{padding:5px 0;margin-top:3px}.tooltip.left{padding:0 5px;margin-left:-3px}.tooltip-inner{max-width:200px;padding:3px 8px;color:#fff;text-align:center;background-color:#000;border-radius:4px}.tooltip-arrow{position:absolute;width:0;height:0;border-color:transparent;border-style:solid}.tooltip.top .tooltip-arrow{bottom:0;left:50%;margin-left:-5px;border-width:5px 5px 0;border-top-color:#000}.tooltip.top-left .tooltip-arrow{right:5px;bottom:0;margin-bottom:-5px;border-width:5px 5px 0;border-top-color:#000}.tooltip.top-right .tooltip-arrow{bottom:0;left:5px;margin-bottom:-5px;border-width:5px 5px 0;border-top-color:#000}.tooltip.right .tooltip-arrow{top:50%;left:0;margin-top:-5px;border-width:5px 5px 5px 0;border-right-color:#000}.tooltip.left .tooltip-arrow{top:50%;right:0;margin-top:-5px;border-width:5px 0 5px 5px;border-left-color:#000}.tooltip.bottom .tooltip-arrow{top:0;left:50%;margin-left:-5px;border-width:0 5px 5px;border-bottom-color:#000}.tooltip.bottom-left .tooltip-arrow{top:0;right:5px;margin-top:-5px;border-width:0 5px 5px;border-bottom-color:#000}.tooltip.bottom-right .tooltip-arrow{top:0;left:5px;margin-top:-5px;border-width:0 5px 5px;border-bottom-color:#000}.popover{position:absolute;top:0;left:0;z-index:1060;display:none;max-width:276px;padding:1px;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:14px;font-style:normal;font-weight:400;line-height:1.42857143;text-align:left;text-align:start;text-decoration:none;text-shadow:none;text-transform:none;letter-spacing:normal;word-break:normal;word-spacing:normal;word-wrap:normal;white-space:normal;background-color:#fff;-webkit-background-clip:padding-box;background-clip:padding-box;border:1px solid #ccc;border:1px solid rgba(0,0,0,.2);border-radius:6px;-webkit-box-shadow:0 5px 10px rgba(0,0,0,.2);box-shadow:0 5px 10px rgba(0,0,0,.2);line-break:auto}.popover.top{margin-top:-10px}.popover.right{margin-left:10px}.popover.bottom{margin-top:10px}.popover.left{margin-left:-10px}.popover-title{padding:8px 14px;margin:0;font-size:14px;background-color:#f7f7f7;border-bottom:1px solid #ebebeb;border-radius:5px 5px 0 0}.popover-content{padding:9px 14px}.popover>.arrow,.popover>.arrow:after{position:absolute;display:block;width:0;height:0;border-color:transparent;border-style:solid}.popover>.arrow{border-width:11px}.popover>.arrow:after{content:"";border-width:10px}.popover.top>.arrow{bottom:-11px;left:50%;margin-left:-11px;border-top-color:#999;border-top-color:rgba(0,0,0,.25);border-bottom-width:0}.popover.top>.arrow:after{bottom:1px;margin-left:-10px;content:" ";border-top-color:#fff;border-bottom-width:0}.popover.right>.arrow{top:50%;left:-11px;margin-top:-11px;border-right-color:#999;border-right-color:rgba(0,0,0,.25);border-left-width:0}.popover.right>.arrow:after{bottom:-10px;left:1px;content:" ";border-right-color:#fff;border-left-width:0}.popover.bottom>.arrow{top:-11px;left:50%;margin-left:-11px;border-top-width:0;border-bottom-color:#999;border-bottom-color:rgba(0,0,0,.25)}.popover.bottom>.arrow:after{top:1px;margin-left:-10px;content:" ";border-top-width:0;border-bottom-color:#fff}.popover.left>.arrow{top:50%;right:-11px;margin-top:-11px;border-right-width:0;border-left-color:#999;border-left-color:rgba(0,0,0,.25)}.popover.left>.arrow:after{right:1px;bottom:-10px;content:" ";border-right-width:0;border-left-color:#fff}.carousel{position:relative}.carousel-inner{position:relative;width:100%;overflow:hidden}.carousel-inner>.item{position:relative;display:none;-webkit-transition:.6s ease-in-out left;-o-transition:.6s ease-in-out left;transition:.6s ease-in-out left}.carousel-inner>.item>a>img,.carousel-inner>.item>img{line-height:1}@media all and (transform-3d),(-webkit-transform-3d){.carousel-inner>.item{-webkit-transition:-webkit-transform .6s ease-in-out;-o-transition:-o-transform .6s ease-in-out;transition:transform .6s ease-in-out;-webkit-backface-visibility:hidden;backface-visibility:hidden;-webkit-perspective:1000px;perspective:1000px}.carousel-inner>.item.active.right,.carousel-inner>.item.next{left:0;-webkit-transform:translate3d(100%,0,0);transform:translate3d(100%,0,0)}.carousel-inner>.item.active.left,.carousel-inner>.item.prev{left:0;-webkit-transform:translate3d(-100%,0,0);transform:translate3d(-100%,0,0)}.carousel-inner>.item.active,.carousel-inner>.item.next.left,.carousel-inner>.item.prev.right{left:0;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}}.carousel-inner>.active,.carousel-inner>.next,.carousel-inner>.prev{display:block}.carousel-inner>.active{left:0}.carousel-inner>.next,.carousel-inner>.prev{position:absolute;top:0;width:100%}.carousel-inner>.next{left:100%}.carousel-inner>.prev{left:-100%}.carousel-inner>.next.left,.carousel-inner>.prev.right{left:0}.carousel-inner>.active.left{left:-100%}.carousel-inner>.active.right{left:100%}.carousel-control{position:absolute;top:0;bottom:0;left:0;width:15%;font-size:20px;color:#fff;text-align:center;text-shadow:0 1px 2px rgba(0,0,0,.6);background-color:rgba(0,0,0,0);filter:alpha(opacity=50);opacity:.5}.carousel-control.left{background-image:-webkit-linear-gradient(left,rgba(0,0,0,.5) 0,rgba(0,0,0,.0001) 100%);background-image:-o-linear-gradient(left,rgba(0,0,0,.5) 0,rgba(0,0,0,.0001) 100%);background-image:-webkit-gradient(linear,left top,right top,from(rgba(0,0,0,.5)),to(rgba(0,0,0,.0001)));background-image:linear-gradient(to right,rgba(0,0,0,.5) 0,rgba(0,0,0,.0001) 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#80000000', endColorstr='#00000000', GradientType=1);background-repeat:repeat-x}.carousel-control.right{right:0;left:auto;background-image:-webkit-linear-gradient(left,rgba(0,0,0,.0001) 0,rgba(0,0,0,.5) 100%);background-image:-o-linear-gradient(left,rgba(0,0,0,.0001) 0,rgba(0,0,0,.5) 100%);background-image:-webkit-gradient(linear,left top,right top,from(rgba(0,0,0,.0001)),to(rgba(0,0,0,.5)));background-image:linear-gradient(to right,rgba(0,0,0,.0001) 0,rgba(0,0,0,.5) 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#00000000', endColorstr='#80000000', GradientType=1);background-repeat:repeat-x}.carousel-control:focus,.carousel-control:hover{color:#fff;text-decoration:none;filter:alpha(opacity=90);outline:0;opacity:.9}.carousel-control .glyphicon-chevron-left,.carousel-control .glyphicon-chevron-right,.carousel-control .icon-next,.carousel-control .icon-prev{position:absolute;top:50%;z-index:5;display:inline-block;margin-top:-10px}.carousel-control .glyphicon-chevron-left,.carousel-control .icon-prev{left:50%;margin-left:-10px}.carousel-control .glyphicon-chevron-right,.carousel-control .icon-next{right:50%;margin-right:-10px}.carousel-control .icon-next,.carousel-control .icon-prev{width:20px;height:20px;font-family:serif;line-height:1}.carousel-control .icon-prev:before{content:'\2039'}.carousel-control .icon-next:before{content:'\203a'}.carousel-indicators{position:absolute;bottom:10px;left:50%;z-index:15;width:60%;padding-left:0;margin-left:-30%;text-align:center;list-style:none}.carousel-indicators li{display:inline-block;width:10px;height:10px;margin:1px;text-indent:-999px;cursor:pointer;background-color:#000\9;background-color:rgba(0,0,0,0);border:1px solid #fff;border-radius:10px}.carousel-indicators .active{width:12px;height:12px;margin:0;background-color:#fff}.carousel-caption{position:absolute;right:15%;bottom:20px;left:15%;z-index:10;padding-top:20px;padding-bottom:20px;color:#fff;text-align:center;text-shadow:0 1px 2px rgba(0,0,0,.6)}.carousel-caption .btn{text-shadow:none}@media screen and (min-width:768px){.carousel-control .glyphicon-chevron-left,.carousel-control .glyphicon-chevron-right,.carousel-control .icon-next,.carousel-control .icon-prev{width:30px;height:30px;margin-top:-10px;font-size:30px}.carousel-control .glyphicon-chevron-left,.carousel-control .icon-prev{margin-left:-10px}.carousel-control .glyphicon-chevron-right,.carousel-control .icon-next{margin-right:-10px}.carousel-caption{right:20%;left:20%;padding-bottom:30px}.carousel-indicators{bottom:20px}}.btn-group-vertical>.btn-group:after,.btn-group-vertical>.btn-group:before,.btn-toolbar:after,.btn-toolbar:before,.clearfix:after,.clearfix:before,.container-fluid:after,.container-fluid:before,.container:after,.container:before,.dl-horizontal dd:after,.dl-horizontal dd:before,.form-horizontal .form-group:after,.form-horizontal .form-group:before,.modal-footer:after,.modal-footer:before,.modal-header:after,.modal-header:before,.nav:after,.nav:before,.navbar-collapse:after,.navbar-collapse:before,.navbar-header:after,.navbar-header:before,.navbar:after,.navbar:before,.pager:after,.pager:before,.panel-body:after,.panel-body:before,.row:after,.row:before{display:table;content:" "}.btn-group-vertical>.btn-group:after,.btn-toolbar:after,.clearfix:after,.container-fluid:after,.container:after,.dl-horizontal dd:after,.form-horizontal .form-group:after,.modal-footer:after,.modal-header:after,.nav:after,.navbar-collapse:after,.navbar-header:after,.navbar:after,.pager:after,.panel-body:after,.row:after{clear:both}.center-block{display:block;margin-right:auto;margin-left:auto}.pull-right{float:right!important}.pull-left{float:left!important}.hide{display:none!important}.show{display:block!important}.invisible{visibility:hidden}.text-hide{font:0/0 a;color:transparent;text-shadow:none;background-color:transparent;border:0}.hidden{display:none!important}.affix{position:fixed}@-ms-viewport{width:device-width}.visible-lg,.visible-md,.visible-sm,.visible-xs{display:none!important}.visible-lg-block,.visible-lg-inline,.visible-lg-inline-block,.visible-md-block,.visible-md-inline,.visible-md-inline-block,.visible-sm-block,.visible-sm-inline,.visible-sm-inline-block,.visible-xs-block,.visible-xs-inline,.visible-xs-inline-block{display:none!important}@media (max-width:767px){.visible-xs{display:block!important}table.visible-xs{display:table!important}tr.visible-xs{display:table-row!important}td.visible-xs,th.visible-xs{display:table-cell!important}}@media (max-width:767px){.visible-xs-block{display:block!important}}@media (max-width:767px){.visible-xs-inline{display:inline!important}}@media (max-width:767px){.visible-xs-inline-block{display:inline-block!important}}@media (min-width:768px) and (max-width:991px){.visible-sm{display:block!important}table.visible-sm{display:table!important}tr.visible-sm{display:table-row!important}td.visible-sm,th.visible-sm{display:table-cell!important}}@media (min-width:768px) and (max-width:991px){.visible-sm-block{display:block!important}}@media (min-width:768px) and (max-width:991px){.visible-sm-inline{display:inline!important}}@media (min-width:768px) and (max-width:991px){.visible-sm-inline-block{display:inline-block!important}}@media (min-width:992px) and (max-width:1199px){.visible-md{display:block!important}table.visible-md{display:table!important}tr.visible-md{display:table-row!important}td.visible-md,th.visible-md{display:table-cell!important}}@media (min-width:992px) and (max-width:1199px){.visible-md-block{display:block!important}}@media (min-width:992px) and (max-width:1199px){.visible-md-inline{display:inline!important}}@media (min-width:992px) and (max-width:1199px){.visible-md-inline-block{display:inline-block!important}}@media (min-width:1200px){.visible-lg{display:block!important}table.visible-lg{display:table!important}tr.visible-lg{display:table-row!important}td.visible-lg,th.visible-lg{display:table-cell!important}}@media (min-width:1200px){.visible-lg-block{display:block!important}}@media (min-width:1200px){.visible-lg-inline{display:inline!important}}@media (min-width:1200px){.visible-lg-inline-block{display:inline-block!important}}@media (max-width:767px){.hidden-xs{display:none!important}}@media (min-width:768px) and (max-width:991px){.hidden-sm{display:none!important}}@media (min-width:992px) and (max-width:1199px){.hidden-md{display:none!important}}@media (min-width:1200px){.hidden-lg{display:none!important}}.visible-print{display:none!important}@media print{.visible-print{display:block!important}table.visible-print{display:table!important}tr.visible-print{display:table-row!important}td.visible-print,th.visible-print{display:table-cell!important}}.visible-print-block{display:none!important}@media print{.visible-print-block{display:block!important}}.visible-print-inline{display:none!important}@media print{.visible-print-inline{display:inline!important}}.visible-print-inline-block{display:none!important}@media print{.visible-print-inline-block{display:inline-block!important}}@media print{.hidden-print{display:none!important}}
+/*# sourceMappingURL=bootstrap.min.css.map */
diff --git a/pjcloud-auth/src/main/resources/static/css/signin.css b/pjcloud-auth/src/main/resources/static/css/signin.css
new file mode 100644
index 00000000..5a0f6ec6
--- /dev/null
+++ b/pjcloud-auth/src/main/resources/static/css/signin.css
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2018-2025, lengleng All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the pig4cloud.com developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: lengleng (wangiegie@gmail.com)
+ */
+
+.sign_body {
+ padding-top: 40px;
+ padding-bottom: 40px;
+ background-color: #eee;
+}
+
+.form-signin {
+ max-width: 330px;
+ padding: 15px;
+ margin: 0 auto;
+}
+.form-margin-top {
+ margin-top: 50px;
+}
+.form-signin .form-signin-heading,
+.form-signin .checkbox {
+ margin-bottom: 10px;
+}
+.form-signin .checkbox {
+ font-weight: normal;
+}
+.form-signin .form-control {
+ position: relative;
+ height: auto;
+ -webkit-box-sizing: border-box;
+ -moz-box-sizing: border-box;
+ box-sizing: border-box;
+ padding: 10px;
+ font-size: 16px;
+}
+.form-signin .form-control:focus {
+ z-index: 2;
+}
+.form-signin input[type="email"] {
+ margin-bottom: -1px;
+ border-bottom-right-radius: 0;
+ border-bottom-left-radius: 0;
+}
+.form-signin input[type="password"] {
+ margin-bottom: 10px;
+ border-top-left-radius: 0;
+ border-top-right-radius: 0;
+}
+footer{
+ text-align: center;
+ position:absolute;
+ bottom:0;
+ width:100%;
+ height:100px;
+}
+* {
+ margin: 0;
+ padding: 0;
+}
+
+.input {
+ transition: border 0.2s ease-in-out;
+ min-width: 280px
+}
+
+.input:focus + .label,
+.input:active + .label,
+.input.filled + .label {
+ font-size: .75rem;
+ transition: all 0.2s ease-out;
+ top: -0.3rem;
+ color: #6b7280;
+}
+
+.label {
+ transition: all 0.2s ease-out;
+ top: 0.4rem;
+ left: 0;
+}
diff --git a/pjcloud-auth/src/main/resources/templates/ftl/confirm.ftl b/pjcloud-auth/src/main/resources/templates/ftl/confirm.ftl
new file mode 100644
index 00000000..d10eb741
--- /dev/null
+++ b/pjcloud-auth/src/main/resources/templates/ftl/confirm.ftl
@@ -0,0 +1,56 @@
+
+
+
+
+
+
+ pjcloud 第三方授权
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pjcloud-auth/src/main/resources/templates/ftl/login.ftl b/pjcloud-auth/src/main/resources/templates/ftl/login.ftl
new file mode 100644
index 00000000..cd91c949
--- /dev/null
+++ b/pjcloud-auth/src/main/resources/templates/ftl/login.ftl
@@ -0,0 +1,50 @@
+
+
+
+
+
+ <#-- 内网部署下载相对应放文件放在 resource目录离线加载-->
+
+
+
+
+
+
+
统一身份平台
+
+ <#if error??>
+
${error?html}
+ #if>
+
+
+
+
diff --git a/pjcloud-boot/Dockerfile b/pjcloud-boot/Dockerfile
new file mode 100644
index 00000000..9b8d8260
--- /dev/null
+++ b/pjcloud-boot/Dockerfile
@@ -0,0 +1,13 @@
+FROM registry.cn-hangzhou.aliyuncs.com/dockerhub_mirror/java:21-anolis
+
+WORKDIR /pjcloud-boot
+
+ARG JAR_FILE=target/pjcloud-boot.jar
+
+COPY ${JAR_FILE} app.jar
+
+EXPOSE 9999
+
+ENV TZ=Asia/Shanghai JAVA_OPTS="-Xms512m -Xmx1024m -Djava.security.egd=file:/dev/./urandom"
+
+CMD sleep 60; java $JAVA_OPTS -jar app.jar
diff --git a/pjcloud-boot/pom.xml b/pjcloud-boot/pom.xml
new file mode 100644
index 00000000..3f1c9ee1
--- /dev/null
+++ b/pjcloud-boot/pom.xml
@@ -0,0 +1,124 @@
+
+
+
+
+ 4.0.0
+
+ com.bsd
+ pjcloud
+ 5.7.0
+
+
+ pjcloud-boot
+ jar
+
+ pjcloud 单体版本启动
+
+
+
+
+ com.bsd
+ pjcloud-auth
+ ${project.version}
+
+
+
+ com.bsd
+ pjcloud-upms-biz
+ ${project.version}
+
+
+
+ com.bsd
+ pjcloud-codegen
+ ${project.version}
+
+
+ com.bsd
+ pjcloud-app-server-biz
+ ${project.version}
+
+
+ com.bsd
+ pjcloud-daemon-quartz
+ ${project.version}
+
+
+ com.bsd
+ pjcloud-flow-engine-biz
+ ${project.version}
+
+
+ com.bsd
+ pjcloud-flow-task-biz
+ ${project.version}
+
+
+ com.bsd
+ pjcloud-mp-platform
+ ${project.version}
+
+
+ com.bsd
+ pjcloud-pay-platform
+ ${project.version}
+
+
+
+ com.bsd
+ pjcloud-common-security
+
+
+
+ org.springdoc
+ springdoc-openapi-starter-webmvc-ui
+
+
+ org.springdoc
+ springdoc-openapi-starter-webmvc-api
+
+
+ io.springboot
+ knife4j-boot-openapi3-ui
+ ${knife4j.version}
+
+
+
+ com.bsd
+ pjcloud-common-swagger
+
+
+
+ org.springframework.boot
+ spring-boot-starter-undertow
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+ io.fabric8
+ docker-maven-plugin
+
+
+
+
diff --git a/pjcloud-boot/src/main/java/com/bsd/pjcloud/PjcloudBootApplication.java b/pjcloud-boot/src/main/java/com/bsd/pjcloud/PjcloudBootApplication.java
new file mode 100644
index 00000000..63e3e712
--- /dev/null
+++ b/pjcloud-boot/src/main/java/com/bsd/pjcloud/PjcloudBootApplication.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.bsd.pjcloud;
+
+import com.bsd.pjcloud.common.security.annotation.EnablePjcloudResourceServer;
+import com.bsd.pjcloud.common.swagger.annotation.EnableOpenApi;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+/**
+ * @author pjcloud 单体版本启动器,只需要运行此模块则整个系统启动
+ */
+@EnableOpenApi(value = "admin", isMicro = false)
+@EnablePjcloudResourceServer
+@SpringBootApplication
+public class PjcloudBootApplication {
+
+ public static void main(String[] args) {
+ SpringApplication.run(PjcloudBootApplication.class, args);
+ }
+
+}
diff --git a/pjcloud-boot/src/main/java/com/bsd/pjcloud/bootstrap/PjcloudBootSecurityServerConfiguration.java b/pjcloud-boot/src/main/java/com/bsd/pjcloud/bootstrap/PjcloudBootSecurityServerConfiguration.java
new file mode 100644
index 00000000..6b129845
--- /dev/null
+++ b/pjcloud-boot/src/main/java/com/bsd/pjcloud/bootstrap/PjcloudBootSecurityServerConfiguration.java
@@ -0,0 +1,156 @@
+/*
+ *
+ * Copyright (c) 2018-2025, pjcloud All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the pig4cloud.com developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: pjcloud
+ *
+ */
+
+package com.bsd.pjcloud.bootstrap;
+
+import com.bsd.pjcloud.auth.support.core.PjcloudDaoAuthenticationProvider;
+import com.bsd.pjcloud.auth.support.filter.PasswordDecoderFilter;
+import com.bsd.pjcloud.auth.support.filter.ValidateCodeFilter;
+import com.bsd.pjcloud.auth.support.handler.PjcloudAuthenticationFailureEventHandler;
+import com.bsd.pjcloud.auth.support.handler.PjcloudAuthenticationSuccessEventHandler;
+import com.bsd.pjcloud.auth.support.password.OAuth2ResourceOwnerPasswordAuthenticationProvider;
+import com.bsd.pjcloud.auth.support.sms.OAuth2ResourceOwnerSmsAuthenticationProvider;
+import com.bsd.pjcloud.common.core.constant.SecurityConstants;
+import com.bsd.pjcloud.common.security.component.PermitAllUrlProperties;
+import com.bsd.pjcloud.common.security.component.ResourceAuthExceptionEntryPoint;
+import lombok.RequiredArgsConstructor;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.core.Ordered;
+import org.springframework.core.annotation.Order;
+import org.springframework.security.authentication.AuthenticationManager;
+import org.springframework.security.config.Customizer;
+import org.springframework.security.config.annotation.web.builders.HttpSecurity;
+import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer;
+import org.springframework.security.config.annotation.web.configurers.HeadersConfigurer;
+import org.springframework.security.oauth2.server.authorization.OAuth2AuthorizationService;
+import org.springframework.security.oauth2.server.authorization.config.annotation.web.configurers.OAuth2AuthorizationServerConfigurer;
+import org.springframework.security.oauth2.server.authorization.settings.AuthorizationServerSettings;
+import org.springframework.security.oauth2.server.authorization.token.OAuth2TokenGenerator;
+import org.springframework.security.oauth2.server.resource.introspection.OpaqueTokenIntrospector;
+import org.springframework.security.web.DefaultSecurityFilterChain;
+import org.springframework.security.web.SecurityFilterChain;
+import org.springframework.security.web.authentication.AuthenticationConverter;
+import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
+import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
+
+/**
+ * @author pjcloud 认证授权服务器配置
+ */
+@Configuration
+@RequiredArgsConstructor
+public class PjcloudBootSecurityServerConfiguration {
+
+ private final ResourceAuthExceptionEntryPoint resourceAuthExceptionEntryPoint;
+
+ private final OpaqueTokenIntrospector customOpaqueTokenIntrospector;
+
+ private final AuthenticationConverter accessTokenRequestConverter;
+
+ private final OAuth2AuthorizationService authorizationService;
+
+ private final PasswordDecoderFilter passwordDecoderFilter;
+
+ private final OAuth2TokenGenerator oAuth2TokenGenerator;
+
+ private final ValidateCodeFilter validateCodeFilter;
+
+ private final PermitAllUrlProperties permitAllUrl;
+
+ @Bean
+ @Order(Ordered.HIGHEST_PRECEDENCE)
+ public SecurityFilterChain authorizationServerSecurityFilterChain(HttpSecurity http,
+ PjcloudAuthenticationSuccessEventHandler successEventHandler,
+ PjcloudAuthenticationFailureEventHandler failureEventHandler) throws Exception {
+ OAuth2AuthorizationServerConfigurer authorizationServerConfigurer = new OAuth2AuthorizationServerConfigurer();
+
+ // 增加验证码过滤器
+ http.addFilterBefore(validateCodeFilter, UsernamePasswordAuthenticationFilter.class);
+ // 增加密码解密过滤器
+ http.addFilterBefore(passwordDecoderFilter, UsernamePasswordAuthenticationFilter.class);
+
+ // 认证服务器配置
+ http.with(authorizationServerConfigurer.tokenEndpoint((tokenEndpoint) -> {// 个性化认证授权端点
+ tokenEndpoint.accessTokenRequestConverter(accessTokenRequestConverter) // 注入自定义的授权认证Converter
+ .accessTokenResponseHandler(successEventHandler) // 登录成功处理器
+ .errorResponseHandler(failureEventHandler);// 登录失败处理器
+ }).clientAuthentication(oAuth2ClientAuthenticationConfigurer -> // 个性化客户端认证
+ oAuth2ClientAuthenticationConfigurer.errorResponseHandler(failureEventHandler))// 处理客户端认证异常
+ , Customizer.withDefaults())
+ .with(authorizationServerConfigurer.authorizationService(authorizationService)// redis存储token的实现
+ .authorizationServerSettings(
+ AuthorizationServerSettings.builder().issuer(SecurityConstants.PIGX_LICENSE).build()),
+ Customizer.withDefaults());
+
+ // 资源服务器配置
+ AntPathRequestMatcher[] requestMatchers = permitAllUrl.getIgnoreUrls()
+ .stream()
+ .map(AntPathRequestMatcher::new)
+ .toList()
+ .toArray(new AntPathRequestMatcher[]{});
+
+ http.authorizeHttpRequests(authorizeRequests -> authorizeRequests.requestMatchers(requestMatchers)
+ .permitAll()
+ .anyRequest()
+ .authenticated())
+ .oauth2ResourceServer(
+ oauth2 -> oauth2.opaqueToken(token -> token.introspector(customOpaqueTokenIntrospector))
+ .authenticationEntryPoint(resourceAuthExceptionEntryPoint))
+ .exceptionHandling(configurer -> configurer.authenticationEntryPoint(resourceAuthExceptionEntryPoint))
+ .headers(headers -> headers.frameOptions(HeadersConfigurer.FrameOptionsConfig::disable))
+ .csrf(AbstractHttpConfigurer::disable);
+
+ http.with(authorizationServerConfigurer.authorizationService(authorizationService)// redis存储token的实现
+ .authorizationServerSettings(
+ AuthorizationServerSettings.builder().issuer(SecurityConstants.PIGX_LICENSE).build()),
+ Customizer.withDefaults());
+
+ DefaultSecurityFilterChain securityFilterChain = http.build();
+
+ // 注入自定义授权模式实现
+ addCustomOAuth2GrantAuthenticationProvider(http);
+ return securityFilterChain;
+ }
+
+ /**
+ * 注入授权模式实现提供方
+ *
+ * 1. 密码模式
+ * 2. 短信登录
+ */
+ @SuppressWarnings("unchecked")
+ private void addCustomOAuth2GrantAuthenticationProvider(HttpSecurity http) {
+ AuthenticationManager authenticationManager = http.getSharedObject(AuthenticationManager.class);
+ OAuth2AuthorizationService authorizationService = http.getSharedObject(OAuth2AuthorizationService.class);
+
+ OAuth2ResourceOwnerPasswordAuthenticationProvider resourceOwnerPasswordAuthenticationProvider = new OAuth2ResourceOwnerPasswordAuthenticationProvider(
+ authenticationManager, authorizationService, oAuth2TokenGenerator);
+
+ OAuth2ResourceOwnerSmsAuthenticationProvider resourceOwnerSmsAuthenticationProvider = new OAuth2ResourceOwnerSmsAuthenticationProvider(
+ authenticationManager, authorizationService, oAuth2TokenGenerator);
+
+ // 处理 UsernamePasswordAuthenticationToken
+ http.authenticationProvider(new PjcloudDaoAuthenticationProvider());
+ // 处理 OAuth2ResourceOwnerPasswordAuthenticationToken
+ http.authenticationProvider(resourceOwnerPasswordAuthenticationProvider);
+ // 处理 OAuth2ResourceOwnerSmsAuthenticationToken
+ http.authenticationProvider(resourceOwnerSmsAuthenticationProvider);
+ }
+
+}
diff --git a/pjcloud-boot/src/main/resources/application-dev.yml b/pjcloud-boot/src/main/resources/application-dev.yml
new file mode 100644
index 00000000..aa06b877
--- /dev/null
+++ b/pjcloud-boot/src/main/resources/application-dev.yml
@@ -0,0 +1,38 @@
+spring:
+ data:
+ redis:
+ host: pjcloud-redis
+ # 数据库相关配置
+ datasource:
+ type: com.alibaba.druid.pool.DruidDataSource
+ druid:
+ driver-class-name: com.mysql.cj.jdbc.Driver
+ username: root
+ password: root
+ url: jdbc:mysql://pjcloud-mysql:3306/pjcloudx_boot?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
+
+
+# 文件上传配置
+file:
+ local:
+ enable: true
+ base-path: /Users/pjcloud/Downloads/img
+
+# 验证码配置
+aj:
+ captcha:
+ water-mark: pig4cloud
+
+# 登录报文加密根密钥 ,必须是16位
+security:
+ encodeKey: pigxpigxpigxpigx
+
+# 配置文件加密根密码
+jasypt:
+ encryptor:
+ password: pjcloud
+
+# swagger token url 配置
+swagger:
+ token-url: ${swagger.gateway}/admin/oauth2/token
+
diff --git a/pjcloud-boot/src/main/resources/application.yml b/pjcloud-boot/src/main/resources/application.yml
new file mode 100644
index 00000000..785ad1d6
--- /dev/null
+++ b/pjcloud-boot/src/main/resources/application.yml
@@ -0,0 +1,72 @@
+server:
+ port: 9999
+ servlet:
+ context-path: /admin
+
+spring:
+ application:
+ name: @project.artifactId@
+ # 缓存相关配置
+ cache:
+ type: redis
+ # 上传文件大小限制
+ servlet:
+ multipart:
+ max-file-size: 100MB
+ max-request-size: 100MB
+ cloud:
+ nacos:
+ config:
+ enabled: false
+ discovery:
+ enabled: false
+ gateway:
+ enabled: false
+ redis.enabled: false
+ sentinel:
+ enabled: false
+ main:
+ allow-bean-definition-overriding: true
+ profiles:
+ active: dev
+
+## spring security 对外暴露接口设置
+security:
+ micro: false
+ oauth2:
+ client:
+ ignore-urls:
+ - /webjars/**
+ - /v3/api-docs/**
+ - /doc.html
+ - /swagger-ui.html
+ - /swagger-ui/**
+ - /swagger-resources
+ - /token/check_token
+ - /error
+ - /druid/**
+ - /actuator/**
+ - /code/**
+
+#--------------如下配置尽量不要变动-------------
+# mybatis-plus 配置
+mybatis-plus:
+ mapper-locations: classpath*:/mapper/*Mapper.xml
+ global-config:
+ banner: false
+ db-config:
+ id-type: auto
+ where-strategy: not_empty
+ insert-strategy: not_empty
+ update-strategy: not_null
+ type-handlers-package: com.bsd.pjcloud.common.data.handler
+ configuration:
+ jdbc-type-for-null: 'null'
+ call-setters-on-nulls: true
+ shrink-whitespaces-in-sql: true
+# 查询以下前缀的表,不输出日志
+pjcloud:
+ mybatis:
+ skip-table:
+ - QRTZ_ #quartz 定时任务的表
+ - ACT_ #工作流相关的表
diff --git a/pjcloud-boot/src/main/resources/logback-spring.xml b/pjcloud-boot/src/main/resources/logback-spring.xml
new file mode 100644
index 00000000..58904d49
--- /dev/null
+++ b/pjcloud-boot/src/main/resources/logback-spring.xml
@@ -0,0 +1,94 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ${CONSOLE_LOG_PATTERN}
+
+
+
+
+
+ ${log.path}/debug.log
+
+ ${log.path}/%d{yyyy-MM, aux}/debug.%d{yyyy-MM-dd}.%i.log.gz
+ 50MB
+ 30
+
+
+ %date [%thread] %-5level [%logger{50}] %file:%line - %msg%n
+
+
+
+
+
+ ${log.path}/error.log
+
+ ${log.path}/%d{yyyy-MM}/error.%d{yyyy-MM-dd}.%i.log.gz
+ 50MB
+ 30
+
+
+ %date [%thread] %-5level [%logger{50}] %file:%line - %msg%n
+
+
+ ERROR
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pjcloud-canteen/.editorconfig b/pjcloud-canteen/.editorconfig
new file mode 100644
index 00000000..2f2262bb
--- /dev/null
+++ b/pjcloud-canteen/.editorconfig
@@ -0,0 +1,18 @@
+# 开发组IDE 编辑器标准 V2.1.0
+root = true
+
+[*.{adoc, bat, groovy, html, java, js, jsp, kt, kts, md, properties, py, rb, sh, sql, svg, txt, xml, xsd}]
+charset = utf-8
+
+[*.{groovy, java, kt, kts, xml, xsd}]
+indent_style = tab
+indent_size = 4
+continuation_indent_size = 8
+end_of_line = lf
+
+[*.{js, html}]
+indent_style = space
+indent_size = 2
+end_of_line = lf
+insert_final_newline = true
+trim_trailing_whitespace = true
diff --git a/pjcloud-canteen/README.md b/pjcloud-canteen/README.md
new file mode 100644
index 00000000..4b0434bf
--- /dev/null
+++ b/pjcloud-canteen/README.md
@@ -0,0 +1,22 @@
+食堂模块,包括在线食堂,和线下点餐
+项目描述 ....
+
+
+
+
+| 姓名 | 角色 | 时间 |
+| ---- | ---- |---------|
+| xxx | 开发 | 2023-01 |
+| | | |
+| | | |
+
+
+
+
+```
+项目根目录
+├── xxx-api -- 业务接口(实体,DTO,utils,feign接口)
+├── xxx-biz -- 业务实现[默认服务端口 : 6060]
+```
+
+
diff --git a/pjcloud-canteen/pjcloud-canteen-api/pom.xml b/pjcloud-canteen/pjcloud-canteen-api/pom.xml
new file mode 100644
index 00000000..67568f57
--- /dev/null
+++ b/pjcloud-canteen/pjcloud-canteen-api/pom.xml
@@ -0,0 +1,42 @@
+
+
+ 4.0.0
+
+ com.bsd
+ pjcloud-canteen
+ 5.7.0
+
+
+ pjcloud-canteen-api
+
+
+
+
+ com.github.yulichang
+ mybatis-plus-join-annotation
+
+
+
+ com.bsd
+ pjcloud-common-core
+
+
+
+ com.baomidou
+ mybatis-plus-extension
+
+
+
+ com.bsd
+ pjcloud-common-feign
+
+
+
+ com.bsd
+ pjcloud-common-excel
+
+
+
diff --git a/pjcloud-canteen/pjcloud-canteen-biz/pom.xml b/pjcloud-canteen/pjcloud-canteen-biz/pom.xml
new file mode 100644
index 00000000..eac081a6
--- /dev/null
+++ b/pjcloud-canteen/pjcloud-canteen-biz/pom.xml
@@ -0,0 +1,134 @@
+
+
+ 4.0.0
+
+ com.bsd
+ pjcloud-canteen
+ 5.7.0
+
+
+ pjcloud-canteen-biz
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-undertow
+
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+
+ com.alibaba.cloud
+ spring-cloud-starter-alibaba-nacos-discovery
+
+
+
+ com.alibaba.cloud
+ spring-cloud-starter-alibaba-nacos-config
+
+
+
+ com.bsd
+ pjcloud-common-data
+
+
+
+ com.bsd
+ pjcloud-common-security
+
+
+
+ com.bsd
+ pjcloud-common-xss
+
+
+
+ com.bsd
+ pjcloud-common-sentinel
+
+
+
+ com.bsd
+ pjcloud-common-feign
+
+
+
+ com.bsd
+ pjcloud-canteen-api
+ 5.7.0
+
+
+
+ com.bsd
+ pjcloud-common-log
+
+
+
+ com.baomidou
+ mybatis-plus-spring-boot3-starter
+
+
+
+ com.alibaba
+ druid-spring-boot-3-starter
+
+
+
+ com.mysql
+ mysql-connector-j
+
+
+
+ com.bsd
+ pjcloud-common-swagger
+
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+
+
+
+
+ cloud
+
+ true
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+ repackage
+
+
+ CLASSIC
+
+
+
+
+
+ io.fabric8
+ docker-maven-plugin
+
+ false
+
+
+
+
+
+
+ boot
+
+
+
diff --git a/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/CanteenApp.java b/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/CanteenApp.java
new file mode 100644
index 00000000..21b8f177
--- /dev/null
+++ b/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/CanteenApp.java
@@ -0,0 +1,24 @@
+package com.bsd.pjcloud.canteen;
+
+import com.bsd.pjcloud.common.feign.annotation.EnablePjcloudFeignClients;
+import com.bsd.pjcloud.common.security.annotation.EnablePjcloudResourceServer;
+import com.bsd.pjcloud.common.swagger.annotation.EnableOpenApi;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
+
+/**
+ * @author archetype auto
+ *
+ * 项目启动类
+ */
+@EnableOpenApi("pjcloud-canteen")
+@EnablePjcloudFeignClients
+@EnableDiscoveryClient
+@EnablePjcloudResourceServer
+@SpringBootApplication
+public class CanteenApp {
+ public static void main(String[] args) {
+ SpringApplication.run(CanteenApp.class, args);
+ }
+}
diff --git a/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/controller/CanteenCategoryController.java b/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/controller/CanteenCategoryController.java
new file mode 100644
index 00000000..206c92d1
--- /dev/null
+++ b/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/controller/CanteenCategoryController.java
@@ -0,0 +1,121 @@
+package com.bsd.pjcloud.canteen.controller;
+
+import cn.hutool.core.util.StrUtil;
+import cn.hutool.core.util.ArrayUtil;
+import cn.hutool.core.collection.CollUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.bsd.pjcloud.canteen.entity.CanteenCategoryEntity;
+import com.bsd.pjcloud.canteen.service.CanteenCategoryService;
+import com.bsd.pjcloud.common.core.util.R;
+import com.bsd.pjcloud.common.excel.annotation.ResponseExcel;
+import com.bsd.pjcloud.common.log.annotation.SysLog;
+import org.springframework.security.access.prepost.PreAuthorize;
+import io.swagger.v3.oas.annotations.security.SecurityRequirement;
+import org.springdoc.core.annotations.ParameterObject;
+import org.springframework.http.HttpHeaders;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import io.swagger.v3.oas.annotations.Operation;
+import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+import java.util.Objects;
+
+/**
+ * 菜品分类
+ *
+ * @author zhangjifu
+ * @date 2024-12-05 17:54:19
+ */
+@RestController
+@RequiredArgsConstructor
+@RequestMapping("/canteenCategory" )
+@Tag(description = "canteenCategory" , name = "菜品分类管理" )
+@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
+public class CanteenCategoryController {
+
+ private final CanteenCategoryService canteenCategoryService;
+
+ /**
+ * 分页查询
+ * @param page 分页对象
+ * @param canteenCategory 菜品分类
+ * @return
+ */
+ @Operation(summary = "分页查询" , description = "分页查询" )
+ @GetMapping("/page" )
+ @PreAuthorize("@pms.hasPermission('canteen_canteenCategory_view')" )
+ public R getCanteenCategoryPage(@ParameterObject Page page, @ParameterObject CanteenCategoryEntity canteenCategory) {
+ LambdaQueryWrapper wrapper = Wrappers.lambdaQuery();
+ wrapper.like(StrUtil.isNotBlank(canteenCategory.getName()),CanteenCategoryEntity::getName,canteenCategory.getName());
+ return R.ok(canteenCategoryService.page(page, wrapper));
+ }
+
+
+ /**
+ * 通过id查询菜品分类
+ * @param id id
+ * @return R
+ */
+ @Operation(summary = "通过id查询" , description = "通过id查询" )
+ @GetMapping("/{id}" )
+ @PreAuthorize("@pms.hasPermission('canteen_canteenCategory_view')" )
+ public R getById(@PathVariable("id" ) Long id) {
+ return R.ok(canteenCategoryService.getById(id));
+ }
+
+ /**
+ * 新增菜品分类
+ * @param canteenCategory 菜品分类
+ * @return R
+ */
+ @Operation(summary = "新增菜品分类" , description = "新增菜品分类" )
+ @SysLog("新增菜品分类" )
+ @PostMapping
+ @PreAuthorize("@pms.hasPermission('canteen_canteenCategory_add')" )
+ public R save(@RequestBody CanteenCategoryEntity canteenCategory) {
+ return R.ok(canteenCategoryService.save(canteenCategory));
+ }
+
+ /**
+ * 修改菜品分类
+ * @param canteenCategory 菜品分类
+ * @return R
+ */
+ @Operation(summary = "修改菜品分类" , description = "修改菜品分类" )
+ @SysLog("修改菜品分类" )
+ @PutMapping
+ @PreAuthorize("@pms.hasPermission('canteen_canteenCategory_edit')" )
+ public R updateById(@RequestBody CanteenCategoryEntity canteenCategory) {
+ return R.ok(canteenCategoryService.updateById(canteenCategory));
+ }
+
+ /**
+ * 通过id删除菜品分类
+ * @param ids id列表
+ * @return R
+ */
+ @Operation(summary = "通过id删除菜品分类" , description = "通过id删除菜品分类" )
+ @SysLog("通过id删除菜品分类" )
+ @DeleteMapping
+ @PreAuthorize("@pms.hasPermission('canteen_canteenCategory_del')" )
+ public R removeById(@RequestBody Long[] ids) {
+ return R.ok(canteenCategoryService.removeBatchByIds(CollUtil.toList(ids)));
+ }
+
+
+ /**
+ * 导出excel 表格
+ * @param canteenCategory 查询条件
+ * @param ids 导出指定ID
+ * @return excel 文件流
+ */
+ @ResponseExcel
+ @GetMapping("/export")
+ @PreAuthorize("@pms.hasPermission('canteen_canteenCategory_export')" )
+ public List export(CanteenCategoryEntity canteenCategory,Long[] ids) {
+ return canteenCategoryService.list(Wrappers.lambdaQuery(canteenCategory).in(ArrayUtil.isNotEmpty(ids), CanteenCategoryEntity::getId, ids));
+ }
+}
\ No newline at end of file
diff --git a/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/controller/CanteenSpuController.java b/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/controller/CanteenSpuController.java
new file mode 100644
index 00000000..0b36e596
--- /dev/null
+++ b/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/controller/CanteenSpuController.java
@@ -0,0 +1,122 @@
+package com.bsd.pjcloud.canteen.controller;
+
+import cn.hutool.core.util.StrUtil;
+import cn.hutool.core.util.ArrayUtil;
+import cn.hutool.core.collection.CollUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.bsd.pjcloud.common.core.util.R;
+import com.bsd.pjcloud.common.log.annotation.SysLog;
+import com.bsd.pjcloud.canteen.entity.CanteenSpuEntity;
+import com.bsd.pjcloud.canteen.service.CanteenSpuService;
+import org.springframework.security.access.prepost.PreAuthorize;
+import com.bsd.pjcloud.common.excel.annotation.ResponseExcel;
+import io.swagger.v3.oas.annotations.security.SecurityRequirement;
+import org.springdoc.core.annotations.ParameterObject;
+import org.springframework.http.HttpHeaders;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import io.swagger.v3.oas.annotations.Operation;
+import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+import java.util.Objects;
+
+/**
+ * 菜品spu
+ *
+ * @author zhangjiafu
+ * @date 2024-12-06 15:48:25
+ */
+@RestController
+@RequiredArgsConstructor
+@RequestMapping("/canteenSpu" )
+@Tag(description = "canteenSpu" , name = "菜品spu管理" )
+@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
+public class CanteenSpuController {
+
+ private final CanteenSpuService canteenSpuService;
+
+ /**
+ * 分页查询
+ * @param page 分页对象
+ * @param canteenSpu 菜品spu
+ * @return
+ */
+ @Operation(summary = "分页查询" , description = "分页查询" )
+ @GetMapping("/page" )
+ @PreAuthorize("@pms.hasPermission('canteen_canteenSpu_view')" )
+ public R getCanteenSpuPage(@ParameterObject Page page, @ParameterObject CanteenSpuEntity canteenSpu) {
+ LambdaQueryWrapper wrapper = Wrappers.lambdaQuery();
+ wrapper.like(StrUtil.isNotBlank(canteenSpu.getName()),CanteenSpuEntity::getName,canteenSpu.getName());
+ wrapper.eq(Objects.nonNull(canteenSpu.getCategoryId()),CanteenSpuEntity::getCategoryId,canteenSpu.getCategoryId());
+ return R.ok(canteenSpuService.page(page, wrapper));
+ }
+
+
+ /**
+ * 通过id查询菜品spu
+ * @param id id
+ * @return R
+ */
+ @Operation(summary = "通过id查询" , description = "通过id查询" )
+ @GetMapping("/{id}" )
+ @PreAuthorize("@pms.hasPermission('canteen_canteenSpu_view')" )
+ public R getById(@PathVariable("id" ) Long id) {
+ return R.ok(canteenSpuService.getById(id));
+ }
+
+ /**
+ * 新增菜品spu
+ * @param canteenSpu 菜品spu
+ * @return R
+ */
+ @Operation(summary = "新增菜品spu" , description = "新增菜品spu" )
+ @SysLog("新增菜品spu" )
+ @PostMapping
+ @PreAuthorize("@pms.hasPermission('canteen_canteenSpu_add')" )
+ public R save(@RequestBody CanteenSpuEntity canteenSpu) {
+ return R.ok(canteenSpuService.save(canteenSpu));
+ }
+
+ /**
+ * 修改菜品spu
+ * @param canteenSpu 菜品spu
+ * @return R
+ */
+ @Operation(summary = "修改菜品spu" , description = "修改菜品spu" )
+ @SysLog("修改菜品spu" )
+ @PutMapping
+ @PreAuthorize("@pms.hasPermission('canteen_canteenSpu_edit')" )
+ public R updateById(@RequestBody CanteenSpuEntity canteenSpu) {
+ return R.ok(canteenSpuService.updateById(canteenSpu));
+ }
+
+ /**
+ * 通过id删除菜品spu
+ * @param ids id列表
+ * @return R
+ */
+ @Operation(summary = "通过id删除菜品spu" , description = "通过id删除菜品spu" )
+ @SysLog("通过id删除菜品spu" )
+ @DeleteMapping
+ @PreAuthorize("@pms.hasPermission('canteen_canteenSpu_del')" )
+ public R removeById(@RequestBody Long[] ids) {
+ return R.ok(canteenSpuService.removeBatchByIds(CollUtil.toList(ids)));
+ }
+
+
+ /**
+ * 导出excel 表格
+ * @param canteenSpu 查询条件
+ * @param ids 导出指定ID
+ * @return excel 文件流
+ */
+ @ResponseExcel
+ @GetMapping("/export")
+ @PreAuthorize("@pms.hasPermission('canteen_canteenSpu_export')" )
+ public List export(CanteenSpuEntity canteenSpu,Long[] ids) {
+ return canteenSpuService.list(Wrappers.lambdaQuery(canteenSpu).in(ArrayUtil.isNotEmpty(ids), CanteenSpuEntity::getId, ids));
+ }
+}
\ No newline at end of file
diff --git a/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/entity/CanteenCategoryEntity.java b/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/entity/CanteenCategoryEntity.java
new file mode 100644
index 00000000..e8733384
--- /dev/null
+++ b/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/entity/CanteenCategoryEntity.java
@@ -0,0 +1,111 @@
+package com.bsd.pjcloud.canteen.entity;
+
+import com.baomidou.mybatisplus.annotation.*;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import com.bsd.pjcloud.common.core.util.TenantTable;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import java.time.LocalDateTime;
+
+/**
+ * 菜品分类
+ *
+ * @author zhangjifu
+ * @date 2024-12-05 17:54:19
+ */
+@Data
+@TenantTable
+@TableName("canteen_category")
+@EqualsAndHashCode(callSuper = true)
+@Schema(description = "菜品分类")
+public class CanteenCategoryEntity extends Model {
+
+
+ /**
+ * 分类编号
+ */
+ @TableId(type = IdType.ASSIGN_ID)
+ @Schema(description="分类编号")
+ private Long id;
+
+ /**
+ * 父分类编号
+ */
+ @Schema(description="父分类编号")
+ private Long parentId;
+
+ /**
+ * 分类名称
+ */
+ @Schema(description="分类名称")
+ private String name;
+
+ /**
+ * 分类图
+ */
+ @Schema(description="分类图")
+ private String picUrl;
+
+ /**
+ * 分类排序
+ */
+ @Schema(description="分类排序")
+ private Integer sort;
+
+ /**
+ * 开启状态
+ */
+ @Schema(description="开启状态")
+ private Integer status;
+
+ /**
+ * 创建者
+ */
+ @Schema(description="创建者")
+ private String creator;
+
+ /**
+ * 更新者
+ */
+ @Schema(description="更新者")
+ private String updater;
+
+ /**
+ * 是否删除
+ */
+ @Schema(description="是否删除")
+ private String delFlag;
+
+ /**
+ * 系统类型 1商品 2每日 3在线订餐
+ */
+ @Schema(description="系统类型 1商品 2每日 3在线订餐")
+ private Integer systemType;
+
+ /**
+ * 部门id
+ */
+ @Schema(description="部门id")
+ private Long deptId;
+
+ /**
+ * 创建时间
+ */
+ @TableField(fill = FieldFill.INSERT)
+ @Schema(description="创建时间")
+ private LocalDateTime createTime;
+
+ /**
+ * 更新时间
+ */
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ @Schema(description="更新时间")
+ private LocalDateTime updateTime;
+
+ /**
+ * 租户编号
+ */
+ @Schema(description="租户编号")
+ private Long tenantId;
+}
\ No newline at end of file
diff --git a/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/entity/CanteenSpuEntity.java b/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/entity/CanteenSpuEntity.java
new file mode 100644
index 00000000..84aa202a
--- /dev/null
+++ b/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/entity/CanteenSpuEntity.java
@@ -0,0 +1,193 @@
+package com.bsd.pjcloud.canteen.entity;
+
+import com.baomidou.mybatisplus.annotation.*;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import com.bsd.pjcloud.common.core.util.TenantTable;
+import java.time.LocalDateTime;
+
+/**
+ * 菜品spu
+ *
+ * @author zhangjiafu
+ * @date 2024-12-06 15:48:25
+ */
+@Data
+@TenantTable
+@TableName("canteen_spu")
+@EqualsAndHashCode(callSuper = true)
+@Schema(description = "菜品spu")
+public class CanteenSpuEntity extends Model {
+
+
+ /**
+ * 商品 SPU 编号,自增
+ */
+ @TableId(type = IdType.ASSIGN_ID)
+ @Schema(description="商品 SPU 编号,自增")
+ private Long id;
+
+ /**
+ * 商品名称
+ */
+ @Schema(description="商品名称")
+ private String name;
+
+ /**
+ * 商品简介
+ */
+ @Schema(description="商品简介")
+ private String introduction;
+
+ /**
+ * 商品详情
+ */
+ @Schema(description="商品详情")
+ private String description;
+
+ /**
+ * 商品分类编号
+ */
+ @Schema(description="商品分类编号")
+ private Long categoryId;
+
+ /**
+ * 商品封面图
+ */
+ @Schema(description="商品封面图")
+ private String picUrl;
+
+ /**
+ * 商品轮播图地址
+ 数组,以逗号分隔
+ 最多上传15张
+ */
+ @Schema(description="商品轮播图地址")
+ private String sliderPicUrls;
+
+ /**
+ * 排序字段
+ */
+ @Schema(description="排序字段")
+ private Integer sort;
+
+ /**
+ * 商品状态: 1 上架(开启) 0 下架(禁用) -1 回收
+ */
+ @Schema(description="商品状态: 1 上架(开启) 0 下架(禁用) -1 回收")
+ private Integer status;
+
+ /**
+ * 规格类型:0 单规格 1 多规格
+ */
+ @Schema(description="规格类型:0 单规格 1 多规格")
+ private Boolean specType;
+
+ /**
+ * 商品价格,单位使用:分
+ */
+ @Schema(description="商品价格,单位使用:分")
+ private Integer price;
+
+ /**
+ * 市场价,单位使用:分
+ */
+ @Schema(description="市场价,单位使用:分")
+ private Integer marketPrice;
+
+ /**
+ * 成本价,单位: 分
+ */
+ @Schema(description="成本价,单位: 分")
+ private Integer costPrice;
+
+ /**
+ * 库存
+ */
+ @Schema(description="库存")
+ private Integer stock;
+
+ /**
+ * 赠送积分
+ */
+ @Schema(description="赠送积分")
+ private Integer giveIntegral;
+
+ /**
+ * 商品销量
+ */
+ @Schema(description="商品销量")
+ private Integer salesCount;
+
+ /**
+ * 虚拟销量
+ */
+ @Schema(description="虚拟销量")
+ private Integer virtualSalesCount;
+
+ /**
+ * 商品点击量
+ */
+ @Schema(description="商品点击量")
+ private Integer browseCount;
+
+ /**
+ * 是否删除
+ */
+ @Schema(description="是否删除")
+ private String delFlag;
+
+ /**
+ * 系统类型 2每日 3在线订餐
+ */
+ @Schema(description="系统类型 2每日 3在线订餐")
+ private Long systemType;
+
+ /**
+ * 商户编号
+ */
+ @Schema(description="商户编号")
+ private Long merchantId;
+
+ /**
+ * 部门id
+ */
+ @Schema(description="部门id")
+ private Long deptId;
+
+ /**
+ * 创建人
+ */
+ @TableField(fill = FieldFill.INSERT)
+ @Schema(description="创建人")
+ private String createBy;
+
+ /**
+ * 创建时间
+ */
+ @TableField(fill = FieldFill.INSERT)
+ @Schema(description="创建时间")
+ private LocalDateTime createTime;
+
+ /**
+ * 更新人
+ */
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ @Schema(description="更新人")
+ private String updateBy;
+
+ /**
+ * 更新时间
+ */
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ @Schema(description="更新时间")
+ private LocalDateTime updateTime;
+
+ /**
+ * 租户编号
+ */
+ @Schema(description="租户编号")
+ private Long tenantId;
+}
\ No newline at end of file
diff --git a/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/mapper/CanteenCategoryMapper.java b/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/mapper/CanteenCategoryMapper.java
new file mode 100644
index 00000000..c66844d0
--- /dev/null
+++ b/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/mapper/CanteenCategoryMapper.java
@@ -0,0 +1,11 @@
+package com.bsd.pjcloud.canteen.mapper;
+
+import com.bsd.pjcloud.canteen.entity.CanteenCategoryEntity;
+import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+@Mapper
+public interface CanteenCategoryMapper extends PjcloudBaseMapper {
+
+
+}
\ No newline at end of file
diff --git a/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/mapper/CanteenSpuMapper.java b/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/mapper/CanteenSpuMapper.java
new file mode 100644
index 00000000..de55b62a
--- /dev/null
+++ b/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/mapper/CanteenSpuMapper.java
@@ -0,0 +1,11 @@
+package com.bsd.pjcloud.canteen.mapper;
+
+import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
+import com.bsd.pjcloud.canteen.entity.CanteenSpuEntity;
+import org.apache.ibatis.annotations.Mapper;
+
+@Mapper
+public interface CanteenSpuMapper extends PjcloudBaseMapper {
+
+
+}
\ No newline at end of file
diff --git a/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/service/CanteenCategoryService.java b/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/service/CanteenCategoryService.java
new file mode 100644
index 00000000..5f75299b
--- /dev/null
+++ b/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/service/CanteenCategoryService.java
@@ -0,0 +1,8 @@
+package com.bsd.pjcloud.canteen.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.bsd.pjcloud.canteen.entity.CanteenCategoryEntity;
+
+public interface CanteenCategoryService extends IService {
+
+}
\ No newline at end of file
diff --git a/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/service/CanteenSpuService.java b/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/service/CanteenSpuService.java
new file mode 100644
index 00000000..7eb80b20
--- /dev/null
+++ b/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/service/CanteenSpuService.java
@@ -0,0 +1,8 @@
+package com.bsd.pjcloud.canteen.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.bsd.pjcloud.canteen.entity.CanteenSpuEntity;
+
+public interface CanteenSpuService extends IService {
+
+}
\ No newline at end of file
diff --git a/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/service/impl/CanteenCategoryServiceImpl.java b/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/service/impl/CanteenCategoryServiceImpl.java
new file mode 100644
index 00000000..c76bbe57
--- /dev/null
+++ b/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/service/impl/CanteenCategoryServiceImpl.java
@@ -0,0 +1,16 @@
+package com.bsd.pjcloud.canteen.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.bsd.pjcloud.canteen.entity.CanteenCategoryEntity;
+import com.bsd.pjcloud.canteen.mapper.CanteenCategoryMapper;
+import com.bsd.pjcloud.canteen.service.CanteenCategoryService;
+import org.springframework.stereotype.Service;
+/**
+ * 菜品分类
+ *
+ * @author zhangjifu
+ * @date 2024-12-05 17:54:19
+ */
+@Service
+public class CanteenCategoryServiceImpl extends ServiceImpl implements CanteenCategoryService {
+}
\ No newline at end of file
diff --git a/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/service/impl/CanteenSpuServiceImpl.java b/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/service/impl/CanteenSpuServiceImpl.java
new file mode 100644
index 00000000..e0d2c83a
--- /dev/null
+++ b/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/service/impl/CanteenSpuServiceImpl.java
@@ -0,0 +1,16 @@
+package com.bsd.pjcloud.canteen.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.bsd.pjcloud.canteen.entity.CanteenSpuEntity;
+import com.bsd.pjcloud.canteen.mapper.CanteenSpuMapper;
+import com.bsd.pjcloud.canteen.service.CanteenSpuService;
+import org.springframework.stereotype.Service;
+/**
+ * 菜品spu
+ *
+ * @author zhangjiafu
+ * @date 2024-12-06 15:48:25
+ */
+@Service
+public class CanteenSpuServiceImpl extends ServiceImpl implements CanteenSpuService {
+}
\ No newline at end of file
diff --git a/pjcloud-canteen/pjcloud-canteen-biz/src/main/resources/application.yml b/pjcloud-canteen/pjcloud-canteen-biz/src/main/resources/application.yml
new file mode 100644
index 00000000..663b6994
--- /dev/null
+++ b/pjcloud-canteen/pjcloud-canteen-biz/src/main/resources/application.yml
@@ -0,0 +1,25 @@
+server:
+ port: 6060
+
+spring:
+ application:
+ name: @artifactId@
+ cloud:
+ nacos:
+ username: @nacos.username@
+ password: @nacos.password@
+ discovery:
+ server-addr: pjcloud-register:8848
+ config:
+ server-addr: ${spring.cloud.nacos.discovery.server-addr}
+ config:
+ import:
+ - optional:nacos:application-@profiles.active@.yml
+ - optional:nacos:${spring.application.name}-@profiles.active@.yml
+ datasource:
+ type: com.alibaba.druid.pool.DruidDataSource
+ druid:
+ driver-class-name: com.mysql.cj.jdbc.Driver
+ username: root
+ password: root
+ url: jdbc:mysql://pjcloud-mysql:3306/pjcloudx_canteen?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true
diff --git a/pjcloud-canteen/pjcloud-canteen-biz/src/main/resources/logback-spring.xml b/pjcloud-canteen/pjcloud-canteen-biz/src/main/resources/logback-spring.xml
new file mode 100644
index 00000000..964ca873
--- /dev/null
+++ b/pjcloud-canteen/pjcloud-canteen-biz/src/main/resources/logback-spring.xml
@@ -0,0 +1,70 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ${CONSOLE_LOG_PATTERN}
+
+
+
+
+
+ ${log.path}/debug.log
+
+ ${log.path}/%d{yyyy-MM, aux}/debug.%d{yyyy-MM-dd}.%i.log.gz
+ 50MB
+ 30
+
+
+ %date [%thread] %-5level [%logger{50}] %file:%line - %msg%n
+
+
+
+
+
+ ${log.path}/error.log
+
+ ${log.path}/%d{yyyy-MM}/error.%d{yyyy-MM-dd}.%i.log.gz
+ 50MB
+ 30
+
+
+ %date [%thread] %-5level [%logger{50}] %file:%line - %msg%n
+
+
+ ERROR
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pjcloud-canteen/pjcloud-canteen-biz/src/main/resources/mapper/CanteenCategoryMapper.xml b/pjcloud-canteen/pjcloud-canteen-biz/src/main/resources/mapper/CanteenCategoryMapper.xml
new file mode 100644
index 00000000..332420fa
--- /dev/null
+++ b/pjcloud-canteen/pjcloud-canteen-biz/src/main/resources/mapper/CanteenCategoryMapper.xml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pjcloud-canteen/pjcloud-canteen-biz/src/main/resources/mapper/CanteenSpuMapper.xml b/pjcloud-canteen/pjcloud-canteen-biz/src/main/resources/mapper/CanteenSpuMapper.xml
new file mode 100644
index 00000000..4a2b02b4
--- /dev/null
+++ b/pjcloud-canteen/pjcloud-canteen-biz/src/main/resources/mapper/CanteenSpuMapper.xml
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pjcloud-canteen/pom.xml b/pjcloud-canteen/pom.xml
new file mode 100644
index 00000000..1ba95a20
--- /dev/null
+++ b/pjcloud-canteen/pom.xml
@@ -0,0 +1,21 @@
+
+
+
+ 4.0.0
+
+
+ com.bsd
+ pjcloud
+ 5.7.0
+
+
+ pjcloud-canteen
+ pom
+
+
+
+ pjcloud-canteen-api
+ pjcloud-canteen-biz
+
+
diff --git a/pjcloud-common/pjcloud-common-audit/pom.xml b/pjcloud-common/pjcloud-common-audit/pom.xml
new file mode 100644
index 00000000..91b9415a
--- /dev/null
+++ b/pjcloud-common/pjcloud-common-audit/pom.xml
@@ -0,0 +1,38 @@
+
+
+ 4.0.0
+
+ com.bsd
+ pjcloud-common
+ 5.7.0
+
+
+ pjcloud-common-audit
+ jar
+
+ pjcloud 数据审计相关工具类
+
+
+
+
+ org.javers
+ javers-core
+
+
+
+ org.springframework.boot
+ spring-boot-starter-aop
+
+
+
+ com.bsd
+ pjcloud-upms-api
+
+
+
+ org.springframework.security
+ spring-security-core
+
+
+
diff --git a/pjcloud-common/pjcloud-common-audit/src/main/java/com/bsd/pjcloud/common/audit/AuditAutoConfiguration.java b/pjcloud-common/pjcloud-common-audit/src/main/java/com/bsd/pjcloud/common/audit/AuditAutoConfiguration.java
new file mode 100644
index 00000000..ad6e28e4
--- /dev/null
+++ b/pjcloud-common/pjcloud-common-audit/src/main/java/com/bsd/pjcloud/common/audit/AuditAutoConfiguration.java
@@ -0,0 +1,51 @@
+package com.bsd.pjcloud.common.audit;
+
+import com.bsd.pjcloud.admin.api.feign.RemoteAuditLogService;
+import com.bsd.pjcloud.common.audit.aop.AuditAspect;
+import com.bsd.pjcloud.common.audit.handle.DefaultAuditLogHandle;
+import com.bsd.pjcloud.common.audit.handle.IAuditLogHandle;
+import com.bsd.pjcloud.common.audit.handle.ICompareHandle;
+import com.bsd.pjcloud.common.audit.handle.JavesCompareHandle;
+import com.bsd.pjcloud.common.audit.support.SpelParser;
+import com.bsd.pjcloud.common.core.util.KeyStrResolver;
+import org.springframework.boot.autoconfigure.AutoConfiguration;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Import;
+import org.springframework.scheduling.annotation.EnableAsync;
+
+import java.util.Optional;
+
+/**
+ * 审计自动配置类
+ *
+ * @author pjcloud
+ * @date 2023/2/26
+ */
+@EnableAsync
+@AutoConfiguration
+@Import({ AuditAspect.class, SpelParser.class })
+public class AuditAutoConfiguration {
+
+ /**
+ * 默认注入 javers 的比较器实现
+ * @param auditNameHandleOptional 注入审计用户来源
+ * @return ICompareHandle
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public ICompareHandle compareHandle(Optional auditNameHandleOptional) {
+ return new JavesCompareHandle(auditNameHandleOptional);
+ }
+
+ /**
+ * 默认的审计日志存储策略
+ * @return DefaultAuditLogHandle
+ */
+ @Bean
+ @ConditionalOnMissingBean
+ public IAuditLogHandle auditLogHandle(RemoteAuditLogService logService, KeyStrResolver tenantKeyStrResolver) {
+ return new DefaultAuditLogHandle(logService, tenantKeyStrResolver);
+ }
+
+}
diff --git a/pjcloud-common/pjcloud-common-audit/src/main/java/com/bsd/pjcloud/common/audit/annotation/Audit.java b/pjcloud-common/pjcloud-common-audit/src/main/java/com/bsd/pjcloud/common/audit/annotation/Audit.java
new file mode 100644
index 00000000..ec816a03
--- /dev/null
+++ b/pjcloud-common/pjcloud-common-audit/src/main/java/com/bsd/pjcloud/common/audit/annotation/Audit.java
@@ -0,0 +1,47 @@
+package com.bsd.pjcloud.common.audit.annotation;
+
+import org.springframework.core.annotation.AliasFor;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * @author pjcloud
+ *
+ * 记需要进行审计的方法
+ */
+@Target(ElementType.METHOD)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Audit {
+
+ /**
+ * 此审计的名称
+ * @return 审计名称
+ */
+ String name();
+
+ @AliasFor("spel")
+ String value() default "";
+
+ /**
+ * 默认查询的表达式
+ * @return string
+ */
+ @AliasFor("value")
+ String spel() default "";
+
+ /**
+ * 查询原有结果的表达式,如果为空取 spel()
+ * @return string
+ */
+ String oldVal() default "";
+
+ /**
+ * 查询编辑后的表达式,如果为空取 spel()
+ * @return string
+ */
+ String newVal() default "";
+
+}
diff --git a/pjcloud-common/pjcloud-common-audit/src/main/java/com/bsd/pjcloud/common/audit/aop/AuditAspect.java b/pjcloud-common/pjcloud-common-audit/src/main/java/com/bsd/pjcloud/common/audit/aop/AuditAspect.java
new file mode 100644
index 00000000..d8665d7b
--- /dev/null
+++ b/pjcloud-common/pjcloud-common-audit/src/main/java/com/bsd/pjcloud/common/audit/aop/AuditAspect.java
@@ -0,0 +1,36 @@
+package com.bsd.pjcloud.common.audit.aop;
+
+import com.bsd.pjcloud.common.audit.annotation.Audit;
+import com.bsd.pjcloud.common.audit.handle.ICompareHandle;
+import com.bsd.pjcloud.common.audit.support.SpelParser;
+import lombok.RequiredArgsConstructor;
+import org.aspectj.lang.ProceedingJoinPoint;
+import org.aspectj.lang.annotation.Around;
+import org.aspectj.lang.annotation.Aspect;
+import org.springframework.util.StringUtils;
+
+/**
+ * @author pjcloud
+ * @date 2023/2/26
+ *
+ * 拦截被@Audit注解标记的方法,并记录前后变化值
+ */
+
+@Aspect
+@RequiredArgsConstructor
+public class AuditAspect {
+
+ private final ICompareHandle compareHandle;
+
+ @Around("@annotation(audit)")
+ public Object auditLog(ProceedingJoinPoint joinPoint, Audit audit) throws Throwable {
+ // 获取变更之前的结果
+ Object oldVal = SpelParser.parser(joinPoint,
+ StringUtils.hasText(audit.oldVal()) ? audit.oldVal() : audit.spel());
+ Object result = joinPoint.proceed();
+
+ compareHandle.compare(oldVal, joinPoint, audit);
+ return result;
+ }
+
+}
diff --git a/pjcloud-common/pjcloud-common-audit/src/main/java/com/bsd/pjcloud/common/audit/handle/DefaultAuditLogHandle.java b/pjcloud-common/pjcloud-common-audit/src/main/java/com/bsd/pjcloud/common/audit/handle/DefaultAuditLogHandle.java
new file mode 100644
index 00000000..24d5c240
--- /dev/null
+++ b/pjcloud-common/pjcloud-common-audit/src/main/java/com/bsd/pjcloud/common/audit/handle/DefaultAuditLogHandle.java
@@ -0,0 +1,83 @@
+package com.bsd.pjcloud.common.audit.handle;
+
+import com.bsd.pjcloud.admin.api.entity.SysAuditLog;
+import com.bsd.pjcloud.admin.api.feign.RemoteAuditLogService;
+import com.bsd.pjcloud.common.audit.annotation.Audit;
+import com.bsd.pjcloud.common.core.constant.SecurityConstants;
+import com.bsd.pjcloud.common.core.util.KeyStrResolver;
+import com.bsd.pjcloud.common.core.util.SpringContextHolder;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.javers.core.Changes;
+import org.javers.core.diff.Change;
+import org.javers.core.diff.changetype.ValueChange;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.security.core.Authentication;
+import org.springframework.security.core.context.SecurityContextHolder;
+
+import java.time.LocalDateTime;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+
+/**
+ * 默认的审计日志存储
+ *
+ * @author pjcloud
+ * @date 2023/2/27
+ */
+@Slf4j
+@RequiredArgsConstructor
+public class DefaultAuditLogHandle implements IAuditLogHandle {
+
+ private final RemoteAuditLogService remoteLogService;
+
+ private final KeyStrResolver tenantKeyStrResolver;
+
+ @Override
+ public void handle(Audit audit, Changes changes) {
+ // 如果变更项为空则不进行审计
+ if (changes.isEmpty()) {
+ return;
+ }
+
+ // 获取当前操作人
+ Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
+ // 如果获取不到授权信息、或者没有身份信息的接口 直接跳过处理
+ if (Objects.isNull(authentication) || !authentication.isAuthenticated()) {
+ return;
+ }
+
+ List auditLogList = new ArrayList<>();
+ for (Change change : changes) {
+ ValueChange valueChange = (ValueChange) change;
+
+ SysAuditLog auditLog = new SysAuditLog();
+ auditLog.setAuditName(audit.name());
+ auditLog.setAuditField(valueChange.getPropertyName()); // 修改的字段名称
+
+ if (Objects.nonNull(valueChange.getLeft())) {
+ auditLog.setBeforeVal(valueChange.getLeft().toString()); // 更改前的值
+ }
+ if (Objects.nonNull(valueChange.getRight())) {
+ auditLog.setAfterVal(valueChange.getRight().toString()); // getRight
+ }
+
+ auditLog.setCreateBy(authentication.getName()); // 操作人
+ auditLog.setCreateTime(LocalDateTime.now()); // 操作时间
+ auditLog.setTenantId(Long.parseLong(tenantKeyStrResolver.key())); // 设置操作所属租户
+
+ auditLogList.add(auditLog);
+ }
+
+ // 异步保存日志,提升性能
+ IAuditLogHandle auditLogHandle = SpringContextHolder.getBean(IAuditLogHandle.class);
+ auditLogHandle.asyncSend(auditLogList);
+ }
+
+ @Async
+ public void asyncSend(List auditLogList) {
+ remoteLogService.saveLog(auditLogList);
+ }
+
+}
diff --git a/pjcloud-common/pjcloud-common-audit/src/main/java/com/bsd/pjcloud/common/audit/handle/IAuditLogHandle.java b/pjcloud-common/pjcloud-common-audit/src/main/java/com/bsd/pjcloud/common/audit/handle/IAuditLogHandle.java
new file mode 100644
index 00000000..7aaa7793
--- /dev/null
+++ b/pjcloud-common/pjcloud-common-audit/src/main/java/com/bsd/pjcloud/common/audit/handle/IAuditLogHandle.java
@@ -0,0 +1,21 @@
+package com.bsd.pjcloud.common.audit.handle;
+
+import com.bsd.pjcloud.admin.api.entity.SysAuditLog;
+import com.bsd.pjcloud.common.audit.annotation.Audit;
+import org.javers.core.Changes;
+
+import java.util.List;
+
+/**
+ * @author pjcloud
+ * @date 2023/2/26
+ *
+ * 审计日志处理器
+ */
+public interface IAuditLogHandle {
+
+ void handle(Audit audit, Changes changes);
+
+ void asyncSend(List auditLogList);
+
+}
diff --git a/pjcloud-common/pjcloud-common-audit/src/main/java/com/bsd/pjcloud/common/audit/handle/ICompareHandle.java b/pjcloud-common/pjcloud-common-audit/src/main/java/com/bsd/pjcloud/common/audit/handle/ICompareHandle.java
new file mode 100644
index 00000000..875fb35d
--- /dev/null
+++ b/pjcloud-common/pjcloud-common-audit/src/main/java/com/bsd/pjcloud/common/audit/handle/ICompareHandle.java
@@ -0,0 +1,22 @@
+package com.bsd.pjcloud.common.audit.handle;
+
+import com.bsd.pjcloud.common.audit.annotation.Audit;
+import org.aspectj.lang.ProceedingJoinPoint;
+import org.javers.core.Changes;
+
+/**
+ * 比较器抽象类
+ *
+ * @author pjcloud
+ * @date 2023/2/26
+ */
+public interface ICompareHandle {
+
+ /**
+ * 比较两个对象是否变更,及其变更后如何审计
+ * @param oldVal 原有值
+ * @param newVal 变更后值
+ */
+ Changes compare(Object oldVal, ProceedingJoinPoint joinPoint, Audit audit);
+
+}
diff --git a/pjcloud-common/pjcloud-common-audit/src/main/java/com/bsd/pjcloud/common/audit/handle/JavesCompareHandle.java b/pjcloud-common/pjcloud-common-audit/src/main/java/com/bsd/pjcloud/common/audit/handle/JavesCompareHandle.java
new file mode 100644
index 00000000..ff92132f
--- /dev/null
+++ b/pjcloud-common/pjcloud-common-audit/src/main/java/com/bsd/pjcloud/common/audit/handle/JavesCompareHandle.java
@@ -0,0 +1,37 @@
+package com.bsd.pjcloud.common.audit.handle;
+
+import com.bsd.pjcloud.common.audit.annotation.Audit;
+import com.bsd.pjcloud.common.audit.support.DataAuditor;
+import com.bsd.pjcloud.common.audit.support.SpelParser;
+import lombok.RequiredArgsConstructor;
+import org.aspectj.lang.ProceedingJoinPoint;
+import org.javers.core.Changes;
+import org.springframework.util.StringUtils;
+
+import java.util.Optional;
+
+/**
+ * javers 比较实现
+ *
+ * @author pjcloud
+ * @date 2023/2/26
+ */
+@RequiredArgsConstructor
+public class JavesCompareHandle implements ICompareHandle {
+
+ private final Optional auditLogHandleOptional;
+
+ /**
+ * 比较两个对象是否变更,及其变更后如何审计
+ * @param oldVal 原有值
+ */
+ @Override
+ public Changes compare(Object oldVal, ProceedingJoinPoint joinPoint, Audit audit) {
+ Object newVal = SpelParser.parser(joinPoint,
+ StringUtils.hasText(audit.newVal()) ? audit.newVal() : audit.spel());
+ Changes compare = DataAuditor.compare(oldVal, newVal);
+ auditLogHandleOptional.ifPresent(handle -> handle.handle(audit, compare));
+ return compare;
+ }
+
+}
diff --git a/pjcloud-common/pjcloud-common-audit/src/main/java/com/bsd/pjcloud/common/audit/support/DataAuditor.java b/pjcloud-common/pjcloud-common-audit/src/main/java/com/bsd/pjcloud/common/audit/support/DataAuditor.java
new file mode 100644
index 00000000..1cca3957
--- /dev/null
+++ b/pjcloud-common/pjcloud-common-audit/src/main/java/com/bsd/pjcloud/common/audit/support/DataAuditor.java
@@ -0,0 +1,27 @@
+package com.bsd.pjcloud.common.audit.support;
+
+import lombok.experimental.UtilityClass;
+import org.javers.core.Changes;
+import org.javers.core.Javers;
+import org.javers.core.JaversBuilder;
+import org.javers.core.diff.Diff;
+
+import static org.javers.core.diff.ListCompareAlgorithm.LEVENSHTEIN_DISTANCE;
+
+/**
+ * javers 审计工具
+ *
+ * @author pjcloud
+ * @date 2023/2/26
+ */
+@UtilityClass
+public class DataAuditor {
+
+ private final Javers javers = JaversBuilder.javers().withListCompareAlgorithm(LEVENSHTEIN_DISTANCE).build();
+
+ public Changes compare(Object newObj, Object oldObj) {
+ Diff compare = javers.compare(newObj, oldObj);
+ return compare.getChanges();
+ }
+
+}
diff --git a/pjcloud-common/pjcloud-common-audit/src/main/java/com/bsd/pjcloud/common/audit/support/SpelParser.java b/pjcloud-common/pjcloud-common-audit/src/main/java/com/bsd/pjcloud/common/audit/support/SpelParser.java
new file mode 100644
index 00000000..86403b64
--- /dev/null
+++ b/pjcloud-common/pjcloud-common-audit/src/main/java/com/bsd/pjcloud/common/audit/support/SpelParser.java
@@ -0,0 +1,39 @@
+package com.bsd.pjcloud.common.audit.support;
+
+import org.aspectj.lang.ProceedingJoinPoint;
+import org.aspectj.lang.reflect.MethodSignature;
+import org.springframework.beans.BeansException;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationContextAware;
+import org.springframework.context.expression.BeanFactoryResolver;
+import org.springframework.expression.spel.standard.SpelExpressionParser;
+import org.springframework.expression.spel.support.StandardEvaluationContext;
+
+/**
+ * 表达式处理器
+ *
+ * @author pjcloud
+ * @date 2023/2/26
+ */
+public class SpelParser implements ApplicationContextAware {
+
+ private final static SpelExpressionParser parser = new SpelExpressionParser();
+
+ private static ApplicationContext applicationContext;
+
+ public static Object parser(ProceedingJoinPoint joinPoint, String spel) {
+ StandardEvaluationContext context = new StandardEvaluationContext();
+ context.setBeanResolver(new BeanFactoryResolver(applicationContext));
+ for (int i = 0; i < joinPoint.getArgs().length; i++) {
+ String paramName = ((MethodSignature) joinPoint.getSignature()).getParameterNames()[i];
+ context.setVariable(paramName, joinPoint.getArgs()[i]);
+ }
+ return parser.parseExpression(spel).getValue(context);
+ }
+
+ @Override
+ public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
+ SpelParser.applicationContext = applicationContext;
+ }
+
+}
diff --git a/pjcloud-common/pjcloud-common-audit/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/pjcloud-common/pjcloud-common-audit/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 00000000..350a64a5
--- /dev/null
+++ b/pjcloud-common/pjcloud-common-audit/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1 @@
+com.bsd.pjcloud.common.audit.AuditAutoConfiguration
diff --git a/pjcloud-common/pjcloud-common-bom/pom.xml b/pjcloud-common/pjcloud-common-bom/pom.xml
new file mode 100644
index 00000000..aa59cd92
--- /dev/null
+++ b/pjcloud-common/pjcloud-common-bom/pom.xml
@@ -0,0 +1,530 @@
+
+
+ 4.0.0
+
+ group.springframework
+ spring-cloud-dependencies-parent
+ 2024.0.0
+
+
+
+ com.bsd
+ pjcloud-common-bom
+ pom
+ ${pjcloud.version}
+ pjcloud 公共版本控制,在此pom定义的依赖,全局业务微服务不需要指定版本。
+
+
+ 5.7.0
+ 3.5.9
+ 1.5.2
+ 4.3.1
+ 1.2.23
+ 5.8.34
+ 8.3.0
+ 21.3.0.0
+ 8.4.1.jre8
+ 8.1.3.140
+ 6.2.0
+ 3.0.5
+ 2.1.0
+ 2.2.14
+ 4.6.7.B
+ 2.9.10-17
+ 3.0.3
+ 4.0.1
+ 1.15.3
+ 5.4.3
+ 7.0.0
+ 2.5.2.RELEASE
+ 1.2.83
+ 2.4.2
+ 3.0.52.ALL
+ 1.12.261
+ 7.3.3
+ 1.7.0
+ 7.1
+ 0.21.0
+ 2.17.1
+ 0.33.0
+ 1.0.0
+ 1.8.4
+ 8.7.2-jdk17-20240808
+ 3.2.1
+ 2.0.1
+ 2.16.5
+ 2.3
+ 2.16.1
+ 3.1
+
+
+
+
+
+ com.bsd
+ pjcloud-common-core
+ ${pjcloud.version}
+
+
+ com.bsd
+ pjcloud-common-audit
+ ${pjcloud.version}
+
+
+ com.bsd
+ pjcloud-common-data
+ ${pjcloud.version}
+
+
+ com.bsd
+ pjcloud-common-gateway
+ ${pjcloud.version}
+
+
+ com.bsd
+ pjcloud-common-gray
+ ${pjcloud.version}
+
+
+ com.bsd
+ pjcloud-common-datasource
+ ${pjcloud.version}
+
+
+ com.bsd
+ pjcloud-common-idempotent
+ ${pjcloud.version}
+
+
+ com.bsd
+ pjcloud-common-job
+ ${pjcloud.version}
+
+
+ com.bsd
+ pjcloud-common-log
+ ${pjcloud.version}
+
+
+ com.bsd
+ pjcloud-common-oss
+ ${pjcloud.version}
+
+
+ com.bsd
+ pjcloud-common-security
+ ${pjcloud.version}
+
+
+ com.bsd
+ pjcloud-common-sensitive
+ ${pjcloud.version}
+
+
+ com.bsd
+ pjcloud-common-sentinel
+ ${pjcloud.version}
+
+
+ com.bsd
+ pjcloud-common-feign
+ ${pjcloud.version}
+
+
+ com.bsd
+ pjcloud-common-sequence
+ ${pjcloud.version}
+
+
+ com.bsd
+ pjcloud-common-swagger
+ ${pjcloud.version}
+
+
+ com.bsd
+ pjcloud-common-seata
+ ${pjcloud.version}
+
+
+ com.bsd
+ pjcloud-common-xss
+ ${pjcloud.version}
+
+
+ com.bsd
+ pjcloud-common-sse
+ ${pjcloud.version}
+
+
+ com.bsd
+ pjcloud-common-websocket
+ ${pjcloud.version}
+
+
+ com.bsd
+ pjcloud-common-encrypt-api
+ ${pjcloud.version}
+
+
+ com.bsd
+ pjcloud-common-excel
+ ${pjcloud.version}
+
+
+ com.bsd
+ pjcloud-upms-api
+ ${pjcloud.version}
+
+
+
+ com.bsd
+ pjcloud-app-server-api
+ ${pjcloud.version}
+
+
+
+ com.bsd
+ pjcloud-flow-task-api
+ ${pjcloud.version}
+
+
+
+ com.bsd
+ pjcloud-flow-engine-api
+ ${pjcloud.version}
+
+
+
+ org.ow2.asm
+ asm
+ ${asm.version}
+
+
+
+ com.github.houbb
+ sensitive-word
+ ${sensitive.word.version}
+
+
+ com.baomidou
+ dynamic-datasource-spring-boot3-starter
+ ${dynamic-ds.version}
+
+
+
+ com.github.yulichang
+ mybatis-plus-join-boot-starter
+ ${mybatis-plus-join.version}
+
+
+
+ com.github.yulichang
+ mybatis-plus-join-annotation
+ ${mybatis-plus-join.version}
+
+
+
+ com.alibaba
+ druid-spring-boot-3-starter
+ ${druid.version}
+
+
+ com.alibaba
+ druid
+ ${druid.version}
+
+
+
+ com.mysql
+ mysql-connector-j
+ ${mysql.connector.version}
+
+
+
+ com.oracle.database.jdbc
+ ojdbc8
+ ${oracle.version}
+
+
+
+ com.microsoft.sqlserver
+ mssql-jdbc
+ ${sqlserver.version}
+
+
+
+ com.dameng
+ DmJdbcDriver18
+ ${dm.version}
+
+
+ com.dameng
+ DmDialect-for-hibernate6.1
+ ${dm.version}
+
+
+ com.highgo
+ HgdbJdbc
+ ${highgo.version}
+
+
+
+ org.anyline
+ anyline-environment-spring-data-jdbc
+ ${anyline.version}
+
+
+ org.anyline
+ anyline-data-jdbc-mysql
+ ${anyline.version}
+
+
+ org.anyline
+ anyline-data-jdbc-oracle
+ ${anyline.version}
+
+
+ org.anyline
+ anyline-data-jdbc-postgresql
+ ${anyline.version}
+
+
+ org.anyline
+ anyline-data-jdbc-dm
+ ${anyline.version}
+
+
+
+ com.alibaba
+ fastjson
+ ${fastjson.version}
+
+
+
+ commons-io
+ commons-io
+ ${common.io.version}
+
+
+
+ com.googlecode.aviator
+ aviator
+ ${aviator.version}
+
+
+
+ org.javers
+ javers-core
+ ${javers.version}
+
+
+
+ io.springboot
+ knife4j-openapi3-ui
+ ${knife4j.version}
+
+
+
+
+ org.springdoc
+ springdoc-openapi-starter-webflux-ui
+ ${springdoc.version}
+
+
+ org.springdoc
+ springdoc-openapi-starter-webmvc-ui
+ ${springdoc.version}
+
+
+ org.springdoc
+ springdoc-openapi-starter-webmvc-api
+ ${springdoc.version}
+
+
+ io.swagger.core.v3
+ swagger-annotations-jakarta
+ ${swagger.core.version}
+
+
+
+ com.github.binarywang
+ weixin-java-mp
+ ${mp.weixin.version}
+
+
+ com.github.binarywang
+ weixin-java-cp
+ ${mp.weixin.version}
+
+
+ commons-io
+ commons-io
+
+
+
+
+ com.github.binarywang
+ weixin-java-common
+ ${mp.weixin.version}
+
+
+
+ com.github.javen205
+ IJPay-WxPay
+ ${ijpay.version}
+
+
+ com.github.javen205
+ IJPay-AliPay
+ ${ijpay.version}
+
+
+
+ org.codehaus.groovy
+ groovy
+ ${groovy.version}
+
+
+ javax.servlet
+ javax.servlet-api
+ ${javax.version}
+
+
+
+ org.springframework.security.oauth
+ spring-security-oauth2
+ ${security.oauth.version}
+
+
+
+ org.jsoup
+ jsoup
+ ${jsoup.version}
+
+
+
+ org.flowable
+ flowable-spring-boot-starter-process
+ ${flowable.version}
+
+
+
+ org.dromara.sms4j
+ sms4j-spring-boot-starter
+ ${sms4j.version}
+
+
+
+ com.sun.mail
+ jakarta.mail
+ ${jakarta.mail.version}
+
+
+
+ com.alibaba
+ dashscope-sdk-java
+ ${dashscope.version}
+
+
+ slf4j-simple
+ org.slf4j
+
+
+
+
+
+ org.dromara.sms4j
+ sms4j-oa-core
+ ${sms4j.version}
+
+
+
+ org.apache.velocity
+ velocity-engine-core
+ ${velocity.version}
+
+
+ org.apache.velocity.tools
+ velocity-tools-generic
+ ${velocity.tool.version}
+
+
+
+ org.apache.logging.log4j
+ log4j-to-slf4j
+ ${log4j2.version}
+
+
+ org.apache.logging.log4j
+ log4j-bom
+ ${log4j2.version}
+ pom
+ import
+
+
+
+ cn.hutool
+ hutool-bom
+ ${hutool.version}
+ pom
+ import
+
+
+ com.alibaba.csp
+ sentinel-core
+ ${sentinel.version}
+ pom
+ import
+
+
+ com.alibaba.csp
+ sentinel-web-servlet
+ ${sentinel.version}
+ pom
+ import
+
+
+ com.alibaba.csp
+ sentinel-transport-simple-http
+ ${sentinel.version}
+ pom
+ import
+
+
+ com.alibaba.csp
+ sentinel-parameter-flow-control
+ ${sentinel.version}
+ pom
+ import
+
+
+ com.alibaba.csp
+ sentinel-api-gateway-adapter-common
+ ${sentinel.version}
+ pom
+ import
+
+
+ com.baomidou
+ mybatis-plus-bom
+ ${mybatis-plus.version}
+ pom
+ import
+
+
+
+
+
+
+
+ rdc-releases
+ https://packages.aliyun.com/maven/repository/2161442-release-DcBZC1/
+
+
+ rdc-snapshots
+ https://packages.aliyun.com/maven/repository/2161442-snapshot-FzKqZK/
+
+
+
diff --git a/pjcloud-common/pjcloud-common-core/pom.xml b/pjcloud-common/pjcloud-common-core/pom.xml
new file mode 100644
index 00000000..aa4a2eb6
--- /dev/null
+++ b/pjcloud-common/pjcloud-common-core/pom.xml
@@ -0,0 +1,75 @@
+
+
+
+
+ 4.0.0
+
+ com.bsd
+ pjcloud-common
+ 5.7.0
+
+
+ pjcloud-common-core
+ jar
+
+ pjcloud 公共工具类核心包
+
+
+
+
+
+ cn.hutool
+ hutool-json
+
+
+
+ org.springframework
+ spring-webmvc
+ provided
+
+
+
+ jakarta.servlet
+ jakarta.servlet-api
+
+
+
+ org.springframework.boot
+ spring-boot-starter-validation
+
+
+
+ org.springframework.boot
+ spring-boot-starter-json
+
+
+
+ com.alibaba
+ transmittable-thread-local
+ ${ttl.version}
+
+
+
+ io.swagger.core.v3
+ swagger-annotations-jakarta
+
+
+
diff --git a/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/config/AsyncConfiguration.java b/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/config/AsyncConfiguration.java
new file mode 100644
index 00000000..ff0aeff1
--- /dev/null
+++ b/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/config/AsyncConfiguration.java
@@ -0,0 +1,26 @@
+package com.bsd.pjcloud.common.core.config;
+
+import lombok.RequiredArgsConstructor;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.scheduling.annotation.AsyncConfigurer;
+import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
+
+import java.util.concurrent.Executor;
+
+/**
+ * 明确异步线程池配置,避免和 @EnableScheduling 造成的线程池冲突
+ *
+ * @author pjcloud
+ * @date 2024/4/20
+ */
+@Configuration(proxyBeanMethods = false)
+@RequiredArgsConstructor
+public class AsyncConfiguration implements AsyncConfigurer {
+
+ private final ThreadPoolTaskExecutor applicationTaskExecutor;
+
+ @Override
+ public Executor getAsyncExecutor() {
+ return applicationTaskExecutor;
+ }
+}
diff --git a/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/config/ImmutableConfiguration.java b/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/config/ImmutableConfiguration.java
new file mode 100644
index 00000000..44c51711
--- /dev/null
+++ b/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/config/ImmutableConfiguration.java
@@ -0,0 +1,14 @@
+package com.bsd.pjcloud.common.core.config;
+
+import com.bsd.pjcloud.common.core.factory.YamlPropertySourceFactory;
+import org.springframework.context.annotation.PropertySource;
+
+/**
+ * 加载不可变配置项,这样的配置文件一舦是放在jar包中的,不会随着环境的变化而变化。
+ *
+ * @author pjcloud
+ * @date 2024/7/20
+ */
+@PropertySource(value = "classpath:common-config.yml", factory = YamlPropertySourceFactory.class)
+public class ImmutableConfiguration {
+}
diff --git a/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/config/JacksonConfiguration.java b/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/config/JacksonConfiguration.java
new file mode 100644
index 00000000..1f2c5bea
--- /dev/null
+++ b/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/config/JacksonConfiguration.java
@@ -0,0 +1,86 @@
+package com.bsd.pjcloud.common.core.config;
+
+import cn.hutool.core.date.DatePattern;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import com.bsd.pjcloud.common.core.jackson.PjcloudJavaTimeModule;
+import org.springframework.boot.autoconfigure.AutoConfigureBefore;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
+import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer;
+import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration;
+import org.springframework.boot.web.servlet.filter.OrderedCharacterEncodingFilter;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.core.Ordered;
+import org.springframework.format.FormatterRegistry;
+import org.springframework.format.datetime.standard.DateTimeFormatterRegistrar;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
+
+import java.nio.charset.StandardCharsets;
+import java.time.format.DateTimeFormatter;
+import java.util.Locale;
+import java.util.TimeZone;
+
+/**
+ * JacksonConfig 配置时间转换规则
+ * {@link com.bsd.pjcloud.common.core.jackson.PjcloudJavaTimeModule}、默认时区等
+ *
+ * @author L.cm
+ * @author pjcloud
+ * @author lishangbu
+ * @date 2020-06-15
+ */
+@Configuration
+@ConditionalOnClass(ObjectMapper.class)
+@AutoConfigureBefore(JacksonAutoConfiguration.class)
+@ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.SERVLET)
+public class JacksonConfiguration implements WebMvcConfigurer {
+
+ private static final String ASIA_SHANGHAI = "Asia/Shanghai";
+
+ @Bean
+ @ConditionalOnMissingBean
+ public Jackson2ObjectMapperBuilderCustomizer customizer() {
+ return builder -> {
+ builder.locale(Locale.CHINA);
+ builder.timeZone(TimeZone.getTimeZone(ASIA_SHANGHAI));
+ builder.simpleDateFormat(DatePattern.NORM_DATETIME_PATTERN);
+ builder.serializerByType(Long.class, ToStringSerializer.instance);
+ builder.modules(new PjcloudJavaTimeModule());
+ };
+ }
+
+ /**
+ * 增加GET请求参数中时间类型转换 {@link com.bsd.pjcloud.common.core.jackson.PjcloudJavaTimeModule}
+ *
+ * HH:mm:ss -> LocalTime
+ * yyyy-MM-dd -> LocalDate
+ * yyyy-MM-dd HH:mm:ss -> LocalDateTime
+ *
+ * @param registry
+ */
+ @Override
+ public void addFormatters(FormatterRegistry registry) {
+ DateTimeFormatterRegistrar registrar = new DateTimeFormatterRegistrar();
+ registrar.setTimeFormatter(DateTimeFormatter.ofPattern(DatePattern.NORM_TIME_PATTERN));
+ registrar.setDateFormatter(DateTimeFormatter.ofPattern(DatePattern.NORM_DATE_PATTERN));
+ registrar.setDateTimeFormatter(DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN));
+ registrar.registerFormatters(registry);
+ }
+
+ /**
+ * 避免form 提交 context-type 不规范中文乱码
+ * @return Filter
+ */
+ @Bean
+ public OrderedCharacterEncodingFilter characterEncodingFilter() {
+ OrderedCharacterEncodingFilter filter = new OrderedCharacterEncodingFilter();
+ filter.setEncoding(StandardCharsets.UTF_8.name());
+ filter.setForceEncoding(true);
+ filter.setOrder(Ordered.HIGHEST_PRECEDENCE);
+ return filter;
+ }
+
+}
diff --git a/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/config/MessageSourceConfiguration.java b/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/config/MessageSourceConfiguration.java
new file mode 100644
index 00000000..68e04ff9
--- /dev/null
+++ b/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/config/MessageSourceConfiguration.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2018-2025, pjcloud All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the pig4cloud.com developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: pjcloud
+ */
+
+package com.bsd.pjcloud.common.core.config;
+
+import org.springframework.context.MessageSource;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.support.ReloadableResourceBundleMessageSource;
+
+/**
+ * @author pjcloud
+ * @date 2018/11/14
+ *
+ * 国际化配置
+ */
+@Configuration
+public class MessageSourceConfiguration {
+
+ @Bean
+ public MessageSource pjcloudMessageSource() {
+ ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
+ messageSource.setBasename("classpath:i18n/messages");
+ return messageSource;
+ }
+
+}
diff --git a/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/config/RestTemplateConfiguration.java b/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/config/RestTemplateConfiguration.java
new file mode 100644
index 00000000..0f7337ff
--- /dev/null
+++ b/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/config/RestTemplateConfiguration.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2018-2025, pjcloud All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the pig4cloud.com developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: pjcloud
+ */
+
+package com.bsd.pjcloud.common.core.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.client.RestTemplate;
+
+/**
+ * @author pjcloud
+ * @date 2018/8/16 RestTemplate
+ */
+@Configuration
+public class RestTemplateConfiguration {
+
+ @Bean
+ public RestTemplate restTemplate() {
+ return new RestTemplate();
+ }
+
+}
diff --git a/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/constant/CacheConstants.java b/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/constant/CacheConstants.java
new file mode 100644
index 00000000..4699950c
--- /dev/null
+++ b/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/constant/CacheConstants.java
@@ -0,0 +1,123 @@
+package com.bsd.pjcloud.common.core.constant;
+
+/**
+ * @author pjcloud
+ * @date 2019-04-28
+ *
+ * 缓存的key 常量
+ */
+public interface CacheConstants {
+
+ /**
+ * 全局缓存,在缓存名称上加上该前缀表示该缓存不区分租户,比如:
+ *
+ * {@code @Cacheable(value = CacheConstants.GLOBALLY+CacheConstants.MENU_DETAILS, key = "#roleId + '_menu'", unless = "#result == null")}
+ */
+ String GLOBALLY = "gl:";
+
+ /**
+ * 验证码前缀
+ */
+ String DEFAULT_CODE_KEY = "DEFAULT_CODE_KEY:";
+
+ /**
+ * 菜单信息缓存
+ */
+ String MENU_DETAILS = "menu_details";
+
+ /**
+ * 用户信息缓存
+ */
+ String USER_DETAILS = "user_details";
+
+ /**
+ * 移动端用户信息缓存
+ */
+ String USER_DETAILS_MINI = "user_details_mini";
+
+ /**
+ * 角色信息缓存
+ */
+ String ROLE_DETAILS = "role_details";
+
+ /**
+ * 字典信息缓存
+ */
+ String DICT_DETAILS = "dict_details";
+
+ /**
+ * oauth 客户端信息
+ */
+ String CLIENT_DETAILS_KEY = "pjcloud_oauth:client:details";
+
+ /**
+ * spring boot admin 事件key
+ */
+ String EVENT_KEY = GLOBALLY + "event_key";
+
+ /**
+ * 路由存放
+ */
+ String ROUTE_KEY = GLOBALLY + "gateway_route_key";
+
+ /**
+ * 内存reload 时间
+ */
+ String ROUTE_JVM_RELOAD_TOPIC = "gateway_jvm_route_reload_topic";
+
+ /**
+ * redis 重新加载 路由信息
+ */
+ String ROUTE_REDIS_RELOAD_TOPIC = "upms_redis_route_reload_topic";
+
+ /**
+ * redis 重新加载客户端信息
+ */
+ String CLIENT_REDIS_RELOAD_TOPIC = "upms_redis_client_reload_topic";
+
+ /**
+ * 敏感词重新加载
+ */
+ String SENSITIVE_REDIS_RELOAD_TOPIC = "sensitive_client_reload_topic";
+
+ /**
+ * 公众号 reload
+ */
+ String MP_REDIS_RELOAD_TOPIC = "mp_redis_reload_topic";
+
+ /**
+ * 支付 reload 事件
+ */
+ String PAY_REDIS_RELOAD_TOPIC = "pay_redis_reload_topic";
+
+ /**
+ * 参数缓存
+ */
+ String PARAMS_DETAILS = "params_details";
+
+ /**
+ * 租户缓存 (不区分租户)
+ */
+ String TENANT_DETAILS = GLOBALLY + "tenant_details";
+
+ /**
+ * i18n缓存 (不区分租户)
+ */
+ String I18N_DETAILS = GLOBALLY + "i18n_details";
+
+ /**
+ * 客户端配置缓存
+ */
+ String CLIENT_FLAG = "client_config_flag";
+
+ /**
+ * 登录错误次数
+ */
+ String LOGIN_ERROR_TIMES = "login_error_times";
+
+ /**
+ * oauth 缓存前缀
+ */
+ String PROJECT_OAUTH_ACCESS = "token::access_token";
+
+}
diff --git a/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/constant/CommonConstants.java b/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/constant/CommonConstants.java
new file mode 100644
index 00000000..1642428b
--- /dev/null
+++ b/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/constant/CommonConstants.java
@@ -0,0 +1,138 @@
+/*
+ *
+ * Copyright (c) 2018-2025, pjcloud All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the pig4cloud.com developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: pjcloud
+ *
+ */
+
+package com.bsd.pjcloud.common.core.constant;
+
+/**
+ * @author pjcloud
+ * @date 2017/10/29
+ */
+public interface CommonConstants {
+
+ /**
+ * header 中租户ID
+ */
+ String TENANT_ID = "TENANT-ID";
+
+ /**
+ * header 中版本信息
+ */
+ String VERSION = "VERSION";
+
+ /**
+ * 租户ID
+ */
+ Long TENANT_ID_1 = 1L;
+
+ /**
+ * 删除
+ */
+ String STATUS_DEL = "1";
+
+ /**
+ * 正常
+ */
+ String STATUS_NORMAL = "0";
+
+ /**
+ * 锁定
+ */
+ String STATUS_LOCK = "9";
+
+ /**
+ * 菜单树根节点
+ */
+ Long MENU_TREE_ROOT_ID = -1L;
+
+ /**
+ * 编码
+ */
+ String UTF8 = "UTF-8";
+
+ /**
+ * 前端工程名
+ */
+ String FRONT_END_PROJECT = "pjcloud-ui";
+
+ /**
+ * 移动端工程名
+ */
+ String UNI_END_PROJECT = "pjcloud-app";
+
+ /**
+ * 后端工程名
+ */
+ String BACK_END_PROJECT = "pjcloud";
+
+ /**
+ * 公共参数
+ */
+ String PIG_PUBLIC_PARAM_KEY = "PIG_PUBLIC_PARAM_KEY";
+
+ /**
+ * 成功标记
+ */
+ Integer SUCCESS = 0;
+
+ /**
+ * 失败标记
+ */
+ Integer FAIL = 1;
+
+ /**
+ * 默认存储bucket
+ */
+ String BUCKET_NAME = "pjcloud";
+
+ /**
+ * 滑块验证码
+ */
+ String IMAGE_CODE_TYPE = "blockPuzzle";
+
+ /**
+ * 验证码开关
+ */
+ String CAPTCHA_FLAG = "captcha_flag";
+
+ /**
+ * 密码传输是否加密
+ */
+ String ENC_FLAG = "enc_flag";
+
+ /**
+ * 客户端允许同时在线数量
+ */
+ String ONLINE_QUANTITY = "online_quantity";
+
+ /**
+ * 请求开始时间
+ */
+ String REQUEST_START_TIME = "REQUEST-START-TIME";
+
+ /**
+ * 当前页
+ */
+ String CURRENT = "current";
+
+ /**
+ * size
+ */
+ String SIZE = "size";
+
+}
diff --git a/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/constant/PaginationConstants.java b/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/constant/PaginationConstants.java
new file mode 100644
index 00000000..34ea0536
--- /dev/null
+++ b/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/constant/PaginationConstants.java
@@ -0,0 +1,21 @@
+package com.bsd.pjcloud.common.core.constant;
+
+/**
+ * 分页相关的参数
+ *
+ * @author lishangbu
+ * @date 2018/11/22
+ */
+public interface PaginationConstants {
+
+ /**
+ * 当前页
+ */
+ String CURRENT = "current";
+
+ /**
+ * 每页大小
+ */
+ String SIZE = "size";
+
+}
diff --git a/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/constant/SecurityConstants.java b/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/constant/SecurityConstants.java
new file mode 100644
index 00000000..47a71dd4
--- /dev/null
+++ b/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/constant/SecurityConstants.java
@@ -0,0 +1,257 @@
+/*
+ *
+ * Copyright (c) 2018-2025, pjcloud All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the pig4cloud.com developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: pjcloud
+ *
+ */
+
+package com.bsd.pjcloud.common.core.constant;
+
+/**
+ * @author pjcloud
+ * @date 2017-12-18
+ */
+public interface SecurityConstants {
+
+ /**
+ * 启动时是否检查Inner注解安全性
+ */
+ boolean INNER_CHECK = true;
+
+ /**
+ * 刷新
+ */
+ String REFRESH_TOKEN = "refresh_token";
+
+ /**
+ * 验证码有效期
+ */
+ int CODE_TIME = 60;
+
+ /**
+ * 验证码长度
+ */
+ String CODE_SIZE = "4";
+
+ /**
+ * 角色前缀
+ */
+ String ROLE = "ROLE_";
+
+ /**
+ * 前缀
+ */
+ String PIGX_PREFIX = "pjcloud_";
+
+ /**
+ * token 相关前缀
+ */
+ String TOKEN_PREFIX = "token:";
+
+ /**
+ * oauth 相关前缀
+ */
+ String OAUTH_PREFIX = "oauth:";
+
+ /**
+ * 授权码模式code key 前缀
+ */
+ String OAUTH_CODE_PREFIX = "oauth:code:";
+
+ /**
+ * 项目的license
+ */
+ String PIGX_LICENSE = "https://pig4cloud.com";
+
+ /**
+ * 内部
+ */
+ String FROM_IN = "Y";
+
+ /**
+ * 标志
+ */
+ String FROM = "from";
+
+ /**
+ * 请求header
+ */
+ String HEADER_FROM_IN = FROM + "=" + FROM_IN;
+
+ /**
+ * OAUTH URL
+ */
+ String OAUTH_TOKEN_URL = "/oauth2/token";
+
+ /**
+ * 移动端授权
+ */
+ String GRANT_MOBILE = "mobile";
+
+ /**
+ * TOC 客户端
+ */
+ String HEADER_TOC = "CLIENT-TOC";
+
+ /**
+ * TOC 客户端
+ */
+ String HEADER_TOC_YES = "Y";
+
+ /**
+ * QQ获取token
+ */
+ String QQ_AUTHORIZATION_CODE_URL = "https://graph.qq.com/oauth2.0/token?grant_type="
+ + "authorization_code&code=%S&client_id=%s&redirect_uri=" + "%s&client_secret=%s";
+
+ /**
+ * 微信获取OPENID
+ */
+ String WX_AUTHORIZATION_CODE_URL = "https://api.weixin.qq.com/sns/oauth2/access_token"
+ + "?appid=%s&secret=%s&code=%s&grant_type=authorization_code";
+
+ /**
+ * 微信小程序OPENID
+ */
+ String MINI_APP_AUTHORIZATION_CODE_URL = "https://api.weixin.qq.com/sns/jscode2session"
+ + "?appid=%s&secret=%s&js_code=%s&grant_type=authorization_code";
+
+ /**
+ * 码云获取token
+ */
+ String GITEE_AUTHORIZATION_CODE_URL = "https://gitee.com/oauth/token?grant_type="
+ + "authorization_code&code=%S&client_id=%s&redirect_uri=" + "%s&client_secret=%s";
+
+ /**
+ * 开源中国获取token
+ */
+ String OSC_AUTHORIZATION_CODE_URL = "https://www.oschina.net/action/openapi/token";
+
+ /**
+ * QQ获取用户信息
+ */
+ String QQ_USER_INFO_URL = "https://graph.qq.com/oauth2.0/me?access_token=%s";
+
+ /**
+ * 码云获取用户信息
+ */
+ String GITEE_USER_INFO_URL = "https://gitee.com/api/v5/user?access_token=%s";
+
+ /**
+ * 开源中国用户信息
+ */
+ String OSC_USER_INFO_URL = "https://www.oschina.net/action/openapi/user?access_token=%s&dataType=json";
+
+ /**
+ * 钉钉获取 token
+ */
+ String DING_OLD_GET_TOKEN = "https://oapi.dingtalk.com/gettoken";
+
+ /**
+ * 钉钉同步部门列表
+ */
+ String DING_OLD_DEPT_URL = "https://oapi.dingtalk.com/topapi/v2/department/listsub";
+
+ /**
+ * 钉钉部门用户id列表
+ */
+ String DING_DEPT_USERIDS_URL = "https://oapi.dingtalk.com/topapi/user/listid";
+
+ /**
+ * 钉钉用户详情
+ */
+ String DING_USER_INFO_URL = "https://oapi.dingtalk.com/topapi/v2/user/get";
+
+ /**
+ * {bcrypt} 加密的特征码
+ */
+ String BCRYPT = "{bcrypt}";
+
+ /**
+ * 客户端模式
+ */
+ String CLIENT_CREDENTIALS = "client_credentials";
+
+ /**
+ * 客户端编号
+ */
+ String CLIENT_ID = "client_id";
+
+ /**
+ * 客户端唯一令牌
+ */
+ String CLIENT_RECREATE = "recreate_flag";
+
+ /**
+ * 用户ID字段
+ */
+ String DETAILS_USER_ID = "user_id";
+
+ /**
+ * 用户名
+ */
+ String DETAILS_USERNAME = "username";
+
+ /**
+ * 姓名
+ */
+ String NAME = "name";
+
+ /**
+ * 协议字段
+ */
+ String DETAILS_LICENSE = "license";
+
+ /**
+ * 激活字段 兼容外围系统接入
+ */
+ String ACTIVE = "active";
+
+ /**
+ * AES 加密
+ */
+ String AES = "aes";
+
+ /**
+ * 授权码模式confirm
+ */
+ String CUSTOM_CONSENT_PAGE_URI = "/token/confirm_access";
+
+ /**
+ * {noop} 加密的特征码
+ */
+ String NOOP = "{noop}";
+
+ /**
+ * 短信登录 参数名称
+ */
+ String SMS_PARAMETER_NAME = "mobile";
+
+ /**
+ * 手机号登录
+ */
+ String APP = "mobile";
+
+ /**
+ * 用户信息
+ */
+ String DETAILS_USER = "user_info";
+
+ /**
+ * 不脱敏的权限
+ */
+ String NO_MASK = "no_mask";
+
+}
diff --git a/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/constant/ServiceNameConstants.java b/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/constant/ServiceNameConstants.java
new file mode 100644
index 00000000..5c4702ba
--- /dev/null
+++ b/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/constant/ServiceNameConstants.java
@@ -0,0 +1,58 @@
+/*
+ *
+ * Copyright (c) 2018-2025, pjcloud All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the pig4cloud.com developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: pjcloud
+ *
+ */
+
+package com.bsd.pjcloud.common.core.constant;
+
+/**
+ * @author pjcloud
+ * @date 2018年06月22日16:41:01 服务名称
+ */
+public interface ServiceNameConstants {
+
+ /**
+ * 认证中心
+ */
+ String AUTH_SERVICE = "pjcloud-auth";
+
+ /**
+ * UMPS模块
+ */
+ String UPMS_SERVICE = "pjcloud-upms-biz";
+
+ /**
+ * app服务
+ */
+ String APP_SERVER = "pjcloud-app-server-biz";
+
+ /**
+ * 流程引擎
+ */
+ String FLOW_ENGINE_SERVER = "pjcloud-flow-engine-biz";
+
+ /**
+ * 流程工单
+ */
+ String FLOW_TASK_SERVER = "pjcloud-flow-task-biz";
+
+ /**
+ * 代码生成模块
+ */
+ String CODEGEN_SERVICE = "pjcloud-codegen";
+
+}
diff --git a/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/constant/enums/CaptchaFlagTypeEnum.java b/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/constant/enums/CaptchaFlagTypeEnum.java
new file mode 100644
index 00000000..9ee27860
--- /dev/null
+++ b/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/constant/enums/CaptchaFlagTypeEnum.java
@@ -0,0 +1,36 @@
+package com.bsd.pjcloud.common.core.constant.enums;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+/**
+ * @author pjcloud
+ * @date 2020-11-18
+ *
+ * 验证码状态
+ */
+@Getter
+@AllArgsConstructor
+public enum CaptchaFlagTypeEnum {
+
+ /**
+ * 开启验证码
+ */
+ ON("1", "开启验证码"),
+
+ /**
+ * 关闭验证码
+ */
+ OFF("0", "关闭验证码");
+
+ /**
+ * 类型
+ */
+ private String type;
+
+ /**
+ * 描述
+ */
+ private String description;
+
+}
diff --git a/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/constant/enums/DictTypeEnum.java b/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/constant/enums/DictTypeEnum.java
new file mode 100644
index 00000000..a88649d9
--- /dev/null
+++ b/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/constant/enums/DictTypeEnum.java
@@ -0,0 +1,36 @@
+package com.bsd.pjcloud.common.core.constant.enums;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+/**
+ * @author pjcloud
+ * @date 2019-05-16
+ *
+ * 字典类型
+ */
+@Getter
+@AllArgsConstructor
+public enum DictTypeEnum {
+
+ /**
+ * 字典类型-系统内置(不可修改)
+ */
+ SYSTEM("1", "系统内置"),
+
+ /**
+ * 字典类型-业务类型
+ */
+ BIZ("0", "业务类");
+
+ /**
+ * 类型
+ */
+ private String type;
+
+ /**
+ * 描述
+ */
+ private String description;
+
+}
diff --git a/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/constant/enums/EncFlagTypeEnum.java b/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/constant/enums/EncFlagTypeEnum.java
new file mode 100644
index 00000000..164a4156
--- /dev/null
+++ b/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/constant/enums/EncFlagTypeEnum.java
@@ -0,0 +1,36 @@
+package com.bsd.pjcloud.common.core.constant.enums;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+/**
+ * @author pjcloud
+ * @date 2020-11-18
+ *
+ * 密码是否加密传输
+ */
+@Getter
+@AllArgsConstructor
+public enum EncFlagTypeEnum {
+
+ /**
+ * 是
+ */
+ YES("1", "是"),
+
+ /**
+ * 否
+ */
+ NO("0", "否");
+
+ /**
+ * 类型
+ */
+ private String type;
+
+ /**
+ * 描述
+ */
+ private String description;
+
+}
diff --git a/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/constant/enums/LoginTypeEnum.java b/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/constant/enums/LoginTypeEnum.java
new file mode 100644
index 00000000..7a83d679
--- /dev/null
+++ b/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/constant/enums/LoginTypeEnum.java
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2018-2025, pjcloud All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the pig4cloud.com developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: pjcloud
+ */
+
+package com.bsd.pjcloud.common.core.constant.enums;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+/**
+ * @author pjcloud
+ * @date 2018/8/15 社交登录类型
+ */
+@Getter
+@AllArgsConstructor
+public enum LoginTypeEnum {
+
+ /**
+ * 账号密码登录
+ */
+ PWD("PWD", "账号密码登录"),
+
+ /**
+ * 验证码登录
+ */
+ SMS("SMS", "验证码登录"),
+
+ APPSMS("APP-SMS", "APP验证码登录"),
+
+ /**
+ * QQ登录
+ */
+ QQ("QQ", "QQ登录"),
+
+ /**
+ * 微信登录
+ */
+ WECHAT("WX", "微信登录"),
+
+ /**
+ * 微信小程序
+ */
+ MINI_APP("MINI", "微信小程序"),
+
+ /**
+ * 码云登录
+ */
+ GITEE("GITEE", "码云登录"),
+
+ /**
+ * 开源中国登录
+ */
+ OSC("OSC", "开源中国登录"),
+
+ /**
+ * 钉钉
+ */
+ DINGTALK("DINGTALK", "钉钉"),
+
+ /**
+ * 企业微信
+ */
+ WEIXIN_CP("WEIXIN_CP", "企业微信"),
+
+ /**
+ * CAS 登录
+ */
+ CAS("CAS", "CAS 登录");
+
+ /**
+ * 类型
+ */
+ private String type;
+
+ /**
+ * 描述
+ */
+ private String description;
+
+}
diff --git a/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/constant/enums/MenuTypeEnum.java b/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/constant/enums/MenuTypeEnum.java
new file mode 100644
index 00000000..06b96efb
--- /dev/null
+++ b/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/constant/enums/MenuTypeEnum.java
@@ -0,0 +1,41 @@
+package com.bsd.pjcloud.common.core.constant.enums;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+/**
+ * @author pjcloud
+ * @date 2020-02-17
+ *
+ * 菜单类型
+ */
+@Getter
+@AllArgsConstructor
+public enum MenuTypeEnum {
+
+ /**
+ * 左侧菜单
+ */
+ LEFT_MENU("0", "left"),
+
+ /**
+ * 顶部菜单
+ */
+ TOP_MENU("2", "top"),
+
+ /**
+ * 按钮
+ */
+ BUTTON("1", "button");
+
+ /**
+ * 类型
+ */
+ private String type;
+
+ /**
+ * 描述
+ */
+ private String description;
+
+}
diff --git a/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/constant/enums/ProcessStatusEnum.java b/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/constant/enums/ProcessStatusEnum.java
new file mode 100644
index 00000000..3d2066cf
--- /dev/null
+++ b/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/constant/enums/ProcessStatusEnum.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2018-2025, pjcloud All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the pig4cloud.com developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: pjcloud
+ */
+
+package com.bsd.pjcloud.common.core.constant.enums;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+/**
+ * @author pjcloud
+ * @date 2018/9/30 流程状态
+ */
+@Getter
+@AllArgsConstructor
+public enum ProcessStatusEnum {
+
+ /**
+ * 激活
+ */
+ ACTIVE("active"),
+
+ /**
+ * 暂停
+ */
+ SUSPEND("suspend");
+
+ /**
+ * 状态
+ */
+ private final String status;
+
+}
diff --git a/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/constant/enums/ResourceTypeEnum.java b/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/constant/enums/ResourceTypeEnum.java
new file mode 100644
index 00000000..22594861
--- /dev/null
+++ b/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/constant/enums/ResourceTypeEnum.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2018-2025, pjcloud All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the pig4cloud.com developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: pjcloud
+ */
+
+package com.bsd.pjcloud.common.core.constant.enums;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+/**
+ * @author pjcloud
+ * @date 2018/9/30 资源类型
+ */
+@Getter
+@AllArgsConstructor
+public enum ResourceTypeEnum {
+
+ /**
+ * 图片资源
+ */
+ IMAGE("image", "图片资源"),
+
+ /**
+ * xml资源
+ */
+ XML("xml", "xml资源");
+
+ /**
+ * 类型
+ */
+ private final String type;
+
+ /**
+ * 描述
+ */
+ private final String description;
+
+}
diff --git a/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/constant/enums/StyleTypeEnum.java b/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/constant/enums/StyleTypeEnum.java
new file mode 100644
index 00000000..67473036
--- /dev/null
+++ b/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/constant/enums/StyleTypeEnum.java
@@ -0,0 +1,60 @@
+package com.bsd.pjcloud.common.core.constant.enums;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+import java.util.Arrays;
+
+/**
+ * @author pjcloud
+ * @date 2020-01-19
+ *
+ * 前端类型类型
+ */
+@Getter
+@AllArgsConstructor
+public enum StyleTypeEnum {
+
+ /**
+ * 前端类型-avue 风格
+ */
+ AVUE("0", "avue"),
+
+ /**
+ * 前端类型-element 风格
+ */
+ ELEMENT("1", "element"),
+
+ /**
+ * 前端风格-uview 风格
+ */
+ UVIEW("2", "uview"),
+
+ /**
+ * magic
+ */
+ MAGIC("3", "magic"),
+ /**
+ * element-plus
+ */
+ PLUS("4", "plus");
+
+ /**
+ * 类型
+ */
+ private String style;
+
+ /**
+ * 描述
+ */
+ private String description;
+
+ public static String getDesc(String style) {
+ return Arrays.stream(StyleTypeEnum.values())
+ .filter(styleTypeEnum -> styleTypeEnum.getStyle().equals(style))
+ .findFirst()
+ .get()
+ .getDescription();
+ }
+
+}
diff --git a/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/constant/enums/TaskStatusEnum.java b/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/constant/enums/TaskStatusEnum.java
new file mode 100644
index 00000000..73495f84
--- /dev/null
+++ b/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/constant/enums/TaskStatusEnum.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2018-2025, pjcloud All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the pig4cloud.com developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: pjcloud
+ */
+
+package com.bsd.pjcloud.common.core.constant.enums;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+/**
+ * @author pjcloud
+ * @date 2018/9/30 流程状态
+ */
+@Getter
+@AllArgsConstructor
+public enum TaskStatusEnum {
+
+ /**
+ * 未提交
+ */
+ UNSUBMIT("0", "未提交"),
+
+ /**
+ * 审核中
+ */
+ CHECK("1", "审核中"),
+
+ /**
+ * 已完成
+ */
+ COMPLETED("2", "已完成"),
+
+ /**
+ * 驳回
+ */
+ OVERRULE("9", "驳回");
+
+ /**
+ * 类型
+ */
+ private final String status;
+
+ /**
+ * 描述
+ */
+ private final String description;
+
+}
diff --git a/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/constant/enums/UserTypeEnum.java b/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/constant/enums/UserTypeEnum.java
new file mode 100644
index 00000000..c1974af7
--- /dev/null
+++ b/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/constant/enums/UserTypeEnum.java
@@ -0,0 +1,22 @@
+package com.bsd.pjcloud.common.core.constant.enums;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+@Getter
+@AllArgsConstructor
+public enum UserTypeEnum {
+
+ TOB("0", "面向后台应用"), TOC("1", "面向小程序");
+
+ /**
+ * 类型
+ */
+ private final String status;
+
+ /**
+ * 描述
+ */
+ private final String description;
+
+}
diff --git a/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/constant/enums/YesNoEnum.java b/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/constant/enums/YesNoEnum.java
new file mode 100644
index 00000000..776deb71
--- /dev/null
+++ b/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/constant/enums/YesNoEnum.java
@@ -0,0 +1,28 @@
+package com.bsd.pjcloud.common.core.constant.enums;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+/**
+ * yes and no enum
+ *
+ * @author pjcloud
+ * @date 2023/10/25
+ */
+@Getter
+@AllArgsConstructor
+public enum YesNoEnum {
+
+ YES("1", "是"), NO("0", "否");
+
+ /**
+ * 编码
+ */
+ private String code;
+
+ /**
+ * 描述
+ */
+ private String desc;
+
+}
diff --git a/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/exception/CheckedException.java b/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/exception/CheckedException.java
new file mode 100644
index 00000000..80a3863f
--- /dev/null
+++ b/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/exception/CheckedException.java
@@ -0,0 +1,49 @@
+/*
+ *
+ * Copyright (c) 2018-2025, pjcloud All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the pig4cloud.com developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: pjcloud
+ *
+ */
+
+package com.bsd.pjcloud.common.core.exception;
+
+import lombok.NoArgsConstructor;
+
+/**
+ * @author pjcloud
+ * @date 😴2018年06月22日16:21:57
+ */
+@NoArgsConstructor
+public class CheckedException extends RuntimeException {
+
+ private static final long serialVersionUID = 1L;
+
+ public CheckedException(String message) {
+ super(message);
+ }
+
+ public CheckedException(Throwable cause) {
+ super(cause);
+ }
+
+ public CheckedException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public CheckedException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
+ super(message, cause, enableSuppression, writableStackTrace);
+ }
+
+}
diff --git a/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/exception/ErrorCodes.java b/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/exception/ErrorCodes.java
new file mode 100644
index 00000000..c2603dd2
--- /dev/null
+++ b/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/exception/ErrorCodes.java
@@ -0,0 +1,113 @@
+package com.bsd.pjcloud.common.core.exception;
+
+/**
+ * 错误编码
+ *
+ * @author pjcloud
+ * @date 2022/3/30
+ */
+public interface ErrorCodes {
+
+ /**
+ * 系统编码错误
+ */
+ String SYS_PARAM_CONFIG_ERROR = "sys.param.config.error";
+
+ /**
+ * 系统内置参数不能删除
+ */
+ String SYS_PARAM_DELETE_SYSTEM = "sys.param.delete.system";
+
+ /**
+ * 用户已存在
+ */
+ String SYS_USER_USERNAME_EXISTING = "sys.user.username.existing";
+
+ /**
+ * 用户已存在
+ */
+ String SYS_USER_PHONE_EXISTING = "sys.user.phone.existing";
+
+ /**
+ * 用户原密码错误,修改失败
+ */
+ String SYS_USER_UPDATE_PASSWORDERROR = "sys.user.update.passwordError";
+
+ /**
+ * 用户信息为空
+ */
+ String SYS_USER_USERINFO_EMPTY = "sys.user.userInfo.empty";
+
+ /**
+ * 获取当前用户信息失败
+ */
+ String SYS_USER_QUERY_ERROR = "sys.user.query.error";
+
+ String SYS_USER_IMPORT_SUCCEED = "sys.user.import.succeed";
+
+ /**
+ * 部门名称不存在
+ */
+ String SYS_DEPT_DEPTNAME_INEXISTENCE = "sys.dept.deptName.inexistence";
+
+ /**
+ * 岗位名称不存在
+ */
+ String SYS_POST_POSTNAME_INEXISTENCE = "sys.post.postName.inexistence";
+
+ /**
+ * 岗位名称或编码已经存在
+ */
+ String SYS_POST_NAMEORCODE_EXISTING = "sys.post.nameOrCode.existing";
+
+ /**
+ * 角色名称不存在
+ */
+ String SYS_ROLE_ROLENAME_INEXISTENCE = "sys.role.roleName.inexistence";
+
+ /**
+ * 角色名或角色编码已经存在
+ */
+ String SYS_ROLE_NAMEORCODE_EXISTING = "sys.role.nameOrCode.existing";
+
+ /**
+ * 菜单存在下级节点 删除失败
+ */
+ String SYS_MENU_DELETE_EXISTING = "sys.menu.delete.existing";
+
+ /**
+ * 系统内置字典不允许删除
+ */
+ String SYS_DICT_DELETE_SYSTEM = "sys.dict.delete.system";
+
+ /**
+ * 系统内置字典不能修改
+ */
+ String SYS_DICT_UPDATE_SYSTEM = "sys.dict.update.system";
+
+ /**
+ * 验证码发送频繁
+ */
+ String SYS_APP_SMS_OFTEN = "sys.app.sms.often";
+
+ /**
+ * 手机号未注册
+ */
+ String SYS_APP_PHONE_UNREGISTERED = "sys.app.phone.unregistered";
+
+ /**
+ * 企微调用接口错误
+ */
+ String SYS_CONNECT_CP_DEPT_SYNC_ERROR = "sys.connect.cp.dept.sync.error";
+
+ /**
+ * 企微调用接口错误
+ */
+ String SYS_CONNECT_CP_USER_SYNC_ERROR = "sys.connect.cp.user.sync.error";
+
+ /**
+ * 用户信息为空
+ */
+ String APP_USER_USERINFO_EMPTY = "app.user.userInfo.empty";
+
+}
diff --git a/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/exception/ValidateCodeException.java b/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/exception/ValidateCodeException.java
new file mode 100644
index 00000000..b948b252
--- /dev/null
+++ b/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/exception/ValidateCodeException.java
@@ -0,0 +1,37 @@
+/*
+ *
+ * Copyright (c) 2018-2025, pjcloud All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the pig4cloud.com developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: pjcloud
+ *
+ */
+
+package com.bsd.pjcloud.common.core.exception;
+
+/**
+ * @author pjcloud
+ * @date 2018年06月22日16:22:15
+ */
+public class ValidateCodeException extends RuntimeException {
+
+ private static final long serialVersionUID = -7285211528095468156L;
+
+ public ValidateCodeException() {
+ }
+
+ public ValidateCodeException(String msg) {
+ super(msg);
+ }
+
+}
diff --git a/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/factory/YamlPropertySourceFactory.java b/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/factory/YamlPropertySourceFactory.java
new file mode 100644
index 00000000..b76f5b3a
--- /dev/null
+++ b/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/factory/YamlPropertySourceFactory.java
@@ -0,0 +1,44 @@
+package com.bsd.pjcloud.common.core.factory;
+
+import org.springframework.beans.factory.config.YamlPropertiesFactoryBean;
+import org.springframework.core.env.PropertiesPropertySource;
+import org.springframework.core.env.PropertySource;
+import org.springframework.core.io.support.EncodedResource;
+import org.springframework.core.io.support.PropertySourceFactory;
+import org.springframework.lang.Nullable;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.Properties;
+
+/**
+ * @author pjcloud
+ * @date 2022/3/29
+ *
+ * 读取自定义 yaml 文件工厂类
+ */
+public class YamlPropertySourceFactory implements PropertySourceFactory {
+
+ @Override
+ public PropertySource> createPropertySource(@Nullable String name, EncodedResource resource) throws IOException {
+ Properties propertiesFromYaml = loadYamlIntoProperties(resource);
+ String sourceName = name != null ? name : resource.getResource().getFilename();
+ return new PropertiesPropertySource(sourceName, propertiesFromYaml);
+ }
+
+ private Properties loadYamlIntoProperties(EncodedResource resource) throws FileNotFoundException {
+ try {
+ YamlPropertiesFactoryBean factory = new YamlPropertiesFactoryBean();
+ factory.setResources(resource.getResource());
+ factory.afterPropertiesSet();
+ return factory.getObject();
+ }
+ catch (IllegalStateException e) {
+ Throwable cause = e.getCause();
+ if (cause instanceof FileNotFoundException)
+ throw (FileNotFoundException) e.getCause();
+ throw e;
+ }
+ }
+
+}
diff --git a/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/jackson/PjcloudJavaTimeModule.java b/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/jackson/PjcloudJavaTimeModule.java
new file mode 100644
index 00000000..02358b30
--- /dev/null
+++ b/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/jackson/PjcloudJavaTimeModule.java
@@ -0,0 +1,61 @@
+package com.bsd.pjcloud.common.core.jackson;
+
+import cn.hutool.core.date.DatePattern;
+import com.fasterxml.jackson.databind.module.SimpleModule;
+import com.fasterxml.jackson.datatype.jsr310.PackageVersion;
+import com.fasterxml.jackson.datatype.jsr310.deser.*;
+import com.fasterxml.jackson.datatype.jsr310.ser.*;
+
+import java.time.*;
+import java.time.format.DateTimeFormatter;
+
+/**
+ * java 8 时间默认序列化
+ *
+ * @author L.cm
+ * @author lishanbu
+ */
+public class PjcloudJavaTimeModule extends SimpleModule {
+
+ /**
+ * 指定序列化规则
+ */
+ public PjcloudJavaTimeModule() {
+ super(PackageVersion.VERSION);
+
+ // ======================= 时间序列化规则 ===============================
+ // yyyy-MM-dd HH:mm:ss
+ this.addSerializer(LocalDateTime.class,
+ new LocalDateTimeSerializer(DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN)));
+ // yyyy-MM-dd
+ this.addSerializer(LocalDate.class,
+ new LocalDateSerializer(DateTimeFormatter.ofPattern(DatePattern.NORM_DATE_PATTERN)));
+ // HH:mm:ss
+ this.addSerializer(LocalTime.class,
+ new LocalTimeSerializer(DateTimeFormatter.ofPattern(DatePattern.NORM_TIME_PATTERN)));
+
+ // Instant 类型序列化
+ this.addSerializer(Instant.class, InstantSerializer.INSTANCE);
+
+ // Duration 类型序列化
+ this.addSerializer(Duration.class, DurationSerializer.INSTANCE);
+
+ // ======================= 时间反序列化规则 ==============================
+ // yyyy-MM-dd HH:mm:ss
+ this.addDeserializer(LocalDateTime.class,
+ new LocalDateTimeDeserializer(DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN)));
+ // yyyy-MM-dd
+ this.addDeserializer(LocalDate.class,
+ new LocalDateDeserializer(DateTimeFormatter.ofPattern(DatePattern.NORM_DATE_PATTERN)));
+ // HH:mm:ss
+ this.addDeserializer(LocalTime.class,
+ new LocalTimeDeserializer(DateTimeFormatter.ofPattern(DatePattern.NORM_TIME_PATTERN)));
+ // Instant 反序列化
+ this.addDeserializer(Instant.class, InstantDeserializer.INSTANT);
+
+ // Duration 反序列化
+ this.addDeserializer(Duration.class, DurationDeserializer.INSTANCE);
+
+ }
+
+}
diff --git a/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/util/ClassUtils.java b/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/util/ClassUtils.java
new file mode 100644
index 00000000..592e4329
--- /dev/null
+++ b/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/util/ClassUtils.java
@@ -0,0 +1,113 @@
+/*
+ *
+ * Copyright (c) 2018-2025, pjcloud All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the pig4cloud.com developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: pjcloud
+ *
+ */
+
+package com.bsd.pjcloud.common.core.util;
+
+import lombok.experimental.UtilityClass;
+import org.springframework.core.BridgeMethodResolver;
+import org.springframework.core.DefaultParameterNameDiscoverer;
+import org.springframework.core.MethodParameter;
+import org.springframework.core.ParameterNameDiscoverer;
+import org.springframework.core.annotation.AnnotatedElementUtils;
+import org.springframework.core.annotation.SynthesizingMethodParameter;
+import org.springframework.web.method.HandlerMethod;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+
+/**
+ * 类工具类
+ *
+ * @author L.cm
+ */
+@UtilityClass
+public class ClassUtils extends org.springframework.util.ClassUtils {
+
+ private final ParameterNameDiscoverer PARAMETERNAMEDISCOVERER = new DefaultParameterNameDiscoverer();
+
+ /**
+ * 获取方法参数信息
+ * @param constructor 构造器
+ * @param parameterIndex 参数序号
+ * @return {MethodParameter}
+ */
+ public MethodParameter getMethodParameter(Constructor> constructor, int parameterIndex) {
+ MethodParameter methodParameter = new SynthesizingMethodParameter(constructor, parameterIndex);
+ methodParameter.initParameterNameDiscovery(PARAMETERNAMEDISCOVERER);
+ return methodParameter;
+ }
+
+ /**
+ * 获取方法参数信息
+ * @param method 方法
+ * @param parameterIndex 参数序号
+ * @return {MethodParameter}
+ */
+ public MethodParameter getMethodParameter(Method method, int parameterIndex) {
+ MethodParameter methodParameter = new SynthesizingMethodParameter(method, parameterIndex);
+ methodParameter.initParameterNameDiscovery(PARAMETERNAMEDISCOVERER);
+ return methodParameter;
+ }
+
+ /**
+ * 获取Annotation
+ * @param method Method
+ * @param annotationType 注解类
+ * @param 泛型标记
+ * @return {Annotation}
+ */
+ public A getAnnotation(Method method, Class annotationType) {
+ Class> targetClass = method.getDeclaringClass();
+ // The method may be on an interface, but we need attributes from the target
+ // class.
+ // If the target class is null, the method will be unchanged.
+ Method specificMethod = ClassUtils.getMostSpecificMethod(method, targetClass);
+ // If we are dealing with method with generic parameters, find the original
+ // method.
+ specificMethod = BridgeMethodResolver.findBridgedMethod(specificMethod);
+ // 先找方法,再找方法上的类
+ A annotation = AnnotatedElementUtils.findMergedAnnotation(specificMethod, annotationType);
+
+ if (null != annotation) {
+ return annotation;
+ }
+ // 获取类上面的Annotation,可能包含组合注解,故采用spring的工具类
+ return AnnotatedElementUtils.findMergedAnnotation(specificMethod.getDeclaringClass(), annotationType);
+ }
+
+ /**
+ * 获取Annotation
+ * @param handlerMethod HandlerMethod
+ * @param annotationType 注解类
+ * @param 泛型标记
+ * @return {Annotation}
+ */
+ public A getAnnotation(HandlerMethod handlerMethod, Class annotationType) {
+ // 先找方法,再找方法上的类
+ A annotation = handlerMethod.getMethodAnnotation(annotationType);
+ if (null != annotation) {
+ return annotation;
+ }
+ // 获取类上面的Annotation,可能包含组合注解,故采用spring的工具类
+ Class> beanType = handlerMethod.getBeanType();
+ return AnnotatedElementUtils.findMergedAnnotation(beanType, annotationType);
+ }
+
+}
diff --git a/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/util/KeyStrResolver.java b/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/util/KeyStrResolver.java
new file mode 100644
index 00000000..5c51f820
--- /dev/null
+++ b/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/util/KeyStrResolver.java
@@ -0,0 +1,25 @@
+package com.bsd.pjcloud.common.core.util;
+
+/**
+ * @author pjcloud
+ * @date 2020/9/29
+ *
+ * 字符串处理,方便其他模块解耦处理
+ */
+public interface KeyStrResolver {
+
+ /**
+ * 字符串加工
+ * @param in 输入字符串
+ * @param split 分割符
+ * @return 输出字符串
+ */
+ String extract(String in, String split);
+
+ /**
+ * 字符串获取
+ * @return 模块返回字符串
+ */
+ String key();
+
+}
diff --git a/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/util/MsgUtils.java b/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/util/MsgUtils.java
new file mode 100644
index 00000000..e7d8828d
--- /dev/null
+++ b/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/util/MsgUtils.java
@@ -0,0 +1,47 @@
+package com.bsd.pjcloud.common.core.util;
+
+import lombok.experimental.UtilityClass;
+import org.springframework.context.MessageSource;
+
+import java.util.Locale;
+
+/**
+ * i18n 工具类
+ *
+ * @author pjcloud
+ * @date 2022/3/30
+ */
+@UtilityClass
+public class MsgUtils {
+
+ /**
+ * 通过code 获取中文错误信息
+ * @param code
+ * @return
+ */
+ public String getMessage(String code) {
+ MessageSource messageSource = SpringContextHolder.getBean("pjcloudMessageSource");
+ return messageSource.getMessage(code, null, Locale.CHINA);
+ }
+
+ /**
+ * 通过code 和参数获取中文错误信息
+ * @param code
+ * @return
+ */
+ public String getMessage(String code, Object... objects) {
+ MessageSource messageSource = SpringContextHolder.getBean("pjcloudMessageSource");
+ return messageSource.getMessage(code, objects, Locale.CHINA);
+ }
+
+ /**
+ * security 通过code 和参数获取中文错误信息
+ * @param code
+ * @return
+ */
+ public String getSecurityMessage(String code, Object... objects) {
+ MessageSource messageSource = SpringContextHolder.getBean("securityMessageSource");
+ return messageSource.getMessage(code, objects, Locale.CHINA);
+ }
+
+}
diff --git a/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/util/R.java b/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/util/R.java
new file mode 100644
index 00000000..e728b702
--- /dev/null
+++ b/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/util/R.java
@@ -0,0 +1,105 @@
+/*
+ *
+ * Copyright (c) 2018-2025, pjcloud All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the pig4cloud.com developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: pjcloud
+ *
+ */
+
+package com.bsd.pjcloud.common.core.util;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyDescription;
+import com.bsd.pjcloud.common.core.constant.CommonConstants;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.*;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+
+/**
+ * 响应信息主体
+ *
+ * @param
+ * @author pjcloud
+ */
+@Builder
+@ToString
+@NoArgsConstructor
+@AllArgsConstructor
+@Accessors(chain = true)
+@Schema(description = "响应信息主体")
+public class R implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ @Getter
+ @Setter
+ @JsonPropertyDescription(value = "调用成功返回0,调用失败返回1")
+ @Schema(description = "返回标记:成功标记=0,失败标记=1")
+ private int code;
+
+ @Getter
+ @Setter
+ @JsonPropertyDescription(value = "返回具体的信息")
+ @Schema(description = "返回信息")
+ private String msg;
+
+ @Getter
+ @Setter
+ @Schema(description = "数据")
+ private T data;
+
+ public static R ok() {
+ return restResult(null, CommonConstants.SUCCESS, null);
+ }
+
+ public static R ok(T data) {
+ return restResult(data, CommonConstants.SUCCESS, null);
+ }
+
+ public static R ok(T data, String msg) {
+ return restResult(data, CommonConstants.SUCCESS, msg);
+ }
+
+ public static R failed() {
+ return restResult(null, CommonConstants.FAIL, null);
+ }
+
+ public static R failed(String msg) {
+ return restResult(null, CommonConstants.FAIL, msg);
+ }
+
+ public static R failed(T data) {
+ return restResult(data, CommonConstants.FAIL, null);
+ }
+
+ public static R failed(T data, String msg) {
+ return restResult(data, CommonConstants.FAIL, msg);
+ }
+
+ static R restResult(T data, int code, String msg) {
+ R apiResult = new R<>();
+ apiResult.setCode(code);
+ apiResult.setData(data);
+ apiResult.setMsg(msg);
+ return apiResult;
+ }
+
+ @JsonProperty(access = JsonProperty.Access.READ_ONLY)
+ public boolean isOk() {
+ return this.code == CommonConstants.SUCCESS;
+ }
+
+}
diff --git a/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/util/RepeatBodyRequestWrapper.java b/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/util/RepeatBodyRequestWrapper.java
new file mode 100644
index 00000000..4b90a365
--- /dev/null
+++ b/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/util/RepeatBodyRequestWrapper.java
@@ -0,0 +1,118 @@
+/*
+ * Copyright 2023-2024 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.bsd.pjcloud.common.core.util;
+
+import jakarta.servlet.ReadListener;
+import jakarta.servlet.ServletInputStream;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletRequestWrapper;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.util.ObjectUtils;
+import org.springframework.util.StreamUtils;
+
+import java.io.BufferedReader;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Request包装类:允许 body 重复读取
+ *
+ * @author Hccake
+ */
+@Slf4j
+public class RepeatBodyRequestWrapper extends HttpServletRequestWrapper {
+
+ private final byte[] bodyByteArray;
+ private final Map parameterMap;
+
+ public RepeatBodyRequestWrapper(HttpServletRequest request) {
+ super(request);
+ this.bodyByteArray = getByteBody(request);
+ // 使用 HashMap 以便后续可以修改
+ this.parameterMap = new HashMap<>(request.getParameterMap());
+ }
+
+ @Override
+ public BufferedReader getReader() {
+ return ObjectUtils.isEmpty(this.bodyByteArray) ? null
+ : new BufferedReader(new InputStreamReader(getInputStream()));
+ }
+
+ @Override
+ public ServletInputStream getInputStream() {
+ final ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(this.bodyByteArray);
+ return new ServletInputStream() {
+ @Override
+ public boolean isFinished() {
+ return byteArrayInputStream.available() == 0;
+ }
+
+ @Override
+ public boolean isReady() {
+ return true; // 可以读取
+ }
+
+ @Override
+ public void setReadListener(ReadListener readListener) {
+ // doNothing
+ }
+
+ @Override
+ public int read() {
+ return byteArrayInputStream.read();
+ }
+ };
+ }
+
+ private static byte[] getByteBody(HttpServletRequest request) {
+ byte[] body = new byte[0];
+ try {
+ body = StreamUtils.copyToByteArray(request.getInputStream());
+ } catch (IOException e) {
+ log.error("解析流中数据异常", e);
+ }
+ return body;
+ }
+
+ @Override
+ public Map getParameterMap() {
+ return this.parameterMap; // 返回可变的 parameterMap
+ }
+
+ /**
+ * 设置新的参数映射
+ * @param parameterMap 新的参数映射
+ */
+ public void setParameterMap(Map parameterMap) {
+ this.parameterMap.clear();
+ this.parameterMap.putAll(parameterMap);
+ }
+
+ @Override
+ public String getParameter(String name) {
+ String[] values = parameterMap.get(name);
+ return (values != null && values.length > 0) ? values[0] : null;
+ }
+
+ @Override
+ public String[] getParameterValues(String name) {
+ return parameterMap.get(name);
+ }
+}
diff --git a/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/util/RetOps.java b/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/util/RetOps.java
new file mode 100644
index 00000000..cf616f20
--- /dev/null
+++ b/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/util/RetOps.java
@@ -0,0 +1,289 @@
+/*
+ *
+ * Copyright (c) 2018-2025, pjcloud All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the pig4cloud.com developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: pjcloud
+ *
+ */
+
+package com.bsd.pjcloud.common.core.util;
+
+import cn.hutool.core.util.ObjectUtil;
+import com.bsd.pjcloud.common.core.constant.CommonConstants;
+
+import java.util.Arrays;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.function.Consumer;
+import java.util.function.Function;
+import java.util.function.Predicate;
+
+/**
+ * 简化{@code R} 的访问操作,例子
+ * R result = R.ok(0);
+ * // 使用场景1: 链式操作: 断言然后消费
+ * RetOps.of(result)
+ * .assertCode(-1,r -> new RuntimeException("error "+r.getCode()))
+ * .assertDataNotEmpty(r -> new IllegalStateException("oops!"))
+ * .useData(System.out::println);
+ *
+ * // 使用场景2: 读取原始值(data),这里返回的是Optional
+ * RetOps.of(result).getData().orElse(null);
+ *
+ * // 使用场景3: 类型转换
+ * R s = RetOps.of(result)
+ * .assertDataNotNull(r -> new IllegalStateException("nani??"))
+ * .map(i -> Integer.toHexString(i))
+ * .peek();
+ *
+ *
+ * @author CJ (power4j@outlook.com)
+ * @date 2022/5/12
+ * @since 4.4
+ */
+public class RetOps {
+
+ /** 状态码为成功 */
+ public static final Predicate> CODE_SUCCESS = r -> CommonConstants.SUCCESS == r.getCode();
+
+ /** 数据有值 */
+ public static final Predicate> HAS_DATA = r -> ObjectUtil.isNotEmpty(r.getData());
+
+ /** 数据有值,并且包含元素 */
+ public static final Predicate> HAS_ELEMENT = r -> ObjectUtil.isNotEmpty(r.getData());
+
+ /** 状态码为成功并且有值 */
+ public static final Predicate> DATA_AVAILABLE = CODE_SUCCESS.and(HAS_DATA);
+
+ private final R original;
+
+ // ~ 初始化
+ // ===================================================================================================
+
+ RetOps(R original) {
+ this.original = original;
+ }
+
+ public static RetOps of(R original) {
+ return new RetOps<>(Objects.requireNonNull(original));
+ }
+
+ // ~ 杂项方法
+ // ===================================================================================================
+
+ /**
+ * 观察原始值
+ * @return R
+ */
+ public R peek() {
+ return original;
+ }
+
+ /**
+ * 读取{@code code}的值
+ * @return 返回code的值
+ */
+ public int getCode() {
+ return original.getCode();
+ }
+
+ /**
+ * 读取{@code data}的值
+ * @return 返回 Optional 包装的data
+ */
+ public Optional getData() {
+ return Optional.ofNullable(original.getData());
+ }
+
+ /**
+ * 有条件地读取{@code data}的值
+ * @param predicate 断言函数
+ * @return 返回 Optional 包装的data,如果断言失败返回empty
+ */
+ public Optional getDataIf(Predicate super R>> predicate) {
+ return predicate.test(original) ? getData() : Optional.empty();
+ }
+
+ /**
+ * 读取{@code msg}的值
+ * @return 返回Optional包装的 msg
+ */
+ public Optional getMsg() {
+ return Optional.ofNullable(original.getMsg());
+ }
+
+ /**
+ * 对{@code code}的值进行相等性测试
+ * @param value 基准值
+ * @return 返回ture表示相等
+ */
+ public boolean codeEquals(int value) {
+ return original.getCode() == value;
+ }
+
+ /**
+ * 对{@code code}的值进行相等性测试
+ * @param value 基准值
+ * @return 返回ture表示不相等
+ */
+ public boolean codeNotEquals(int value) {
+ return !codeEquals(value);
+ }
+
+ /**
+ * 是否成功
+ * @return 返回ture表示成功
+ * @see CommonConstants#SUCCESS
+ */
+ public boolean isSuccess() {
+ return codeEquals(CommonConstants.SUCCESS);
+ }
+
+ /**
+ * 是否失败
+ * @return 返回ture表示失败
+ */
+ public boolean notSuccess() {
+ return !isSuccess();
+ }
+
+ // ~ 链式操作
+ // ===================================================================================================
+
+ /**
+ * 断言{@code code}的值
+ * @param expect 预期的值
+ * @param func 用户函数,负责创建异常对象
+ * @param 异常类型
+ * @return 返回实例,以便于继续进行链式操作
+ * @throws Ex 断言失败时抛出
+ */
+ public