Merge branch 'main' of https://fcd.gdyditc.com/itc/GAS-SCM/ms-back into main
# Conflicts: # .gitignore # README.md # pom.xml
This commit is contained in:
5
.gitignore
vendored
5
.gitignore
vendored
@ -107,14 +107,13 @@ local.properties
|
||||
/dist/
|
||||
/nbdist/
|
||||
/.nb-gradle/
|
||||
build/
|
||||
!**/src/main/**/build/
|
||||
!**/src/test/**/build/
|
||||
|
||||
### VS Code ###
|
||||
.vscode/
|
||||
|
||||
|
||||
|
||||
target
|
||||
**/target
|
||||
!**/target
|
||||
/logs
|
||||
|
||||
4
Dockerfile
Normal file
4
Dockerfile
Normal file
@ -0,0 +1,4 @@
|
||||
FROM openjdk:11-jre
|
||||
EXPOSE 8080
|
||||
ADD target/xjrsoft-boot.jar /app.jar
|
||||
ENTRYPOINT ["java","-jar","/app.jar"]
|
||||
114
README.md
114
README.md
@ -1,3 +1,113 @@
|
||||
# geg-gas-pcitc
|
||||
**项目说明**
|
||||
|
||||
石化对广东能源后台管理系统进行功能扩展的开发
|
||||
- xjrsoft-boot是一个轻量级的,前后端分离的Java快速开发平台,能快速开发项目并交付
|
||||
- 支持MySQL、Oracle、SQL Server、PostgreSQL等主流数据库
|
||||
|
||||
**具有如下特点**
|
||||
|
||||
- 友好的代码结构及注释,便于阅读及二次开发
|
||||
- 实现前后端分离,通过token进行数据交互,前端再也不用关注后端技术
|
||||
- 灵活的权限控制,可控制到菜单、列表、按钮、表单,满足绝大部分的权限需求
|
||||
- 配套前端框架使用Vue3.x,最新的技术,最好的性能、极大的提高了开发效率
|
||||
- 引入power-job定时任务,可动态完成任务的添加、修改、删除、暂停、恢复及日志查看等功能
|
||||
- 引入Hibernate Validator校验框架,轻松实现后端校验
|
||||
- 引入云存储服务,已支持:七牛云、阿里云、腾讯云、华为云、minio等
|
||||
- 引入knife4J文档支持,方便编写API接口文档
|
||||
- 引入sms4j支持,支持多种短信平台
|
||||
- 引入ureport报表支持
|
||||
- 引入liteflow框架 开发规则引擎功能
|
||||
- 引入magic-api 封装 实现在线开发接口
|
||||
- 引入hutool包 作为工具类
|
||||
- 接入chatgpt,只需要配置中填写相应key 即可使用chatgpt赋能
|
||||
- 使用mybatisplusjoin 增强mybatisplus 实现多表联查功能
|
||||
- 使用satoken 作为权限框架 功能强大 好用
|
||||
- 完善的代码生成器,可以自动生成各种各样的代码,包括:DTO、VO、Service、Controller、Mapper、JavaBean、Swagger等
|
||||
- 支持一键发布docker镜像,方便快速部署
|
||||
- 完善的xss防御 sql注入防御 黑白名单 接口限流。
|
||||
- 使用camunda工作流引擎 为基础 实现符合中国的流程使用功能。
|
||||
- 项目中除了个别业务逻辑需要,使用ORM完全实现零SQL编程。可以无需再编写XML文件,更好的适配所有的数据库.
|
||||
|
||||
**项目结构**
|
||||
|
||||
```
|
||||
xjrsoft-boot
|
||||
├─common 公共模块
|
||||
│ ├─annotation 常用注解
|
||||
│ ├─aspect 系统日志
|
||||
│ ├─exception 异常处理
|
||||
│ ├─enums 后台枚举
|
||||
│ ├─constant 后台常量
|
||||
│ ├─handler 处理器
|
||||
│ ├─model 常用数据模型
|
||||
│ │ ├─base 实体类父类
|
||||
│ │ ├─datasrouce 数据源有关模型封装
|
||||
│ │ ├─generator 代码生成器有关模型封装
|
||||
│ │ ├─result 返回值封装
|
||||
│ │ └─tree 树结构模型封装
|
||||
│ ├─page 分页工具类
|
||||
│ ├─satoken 权限框架注解鉴权实现类
|
||||
│ ├─tree 树结构接口 --用于限定数据结构
|
||||
│ ├─utils 各种工具类
|
||||
│ └─xss XSS过滤
|
||||
│
|
||||
├─config 配置信息
|
||||
│
|
||||
├─modules 功能模块
|
||||
│ ├─bi 数据大屏模块
|
||||
│ ├─generator 代码生成器模块
|
||||
│ ├─oss 文件服务模块
|
||||
│ ├─organization 组织架构模块
|
||||
│ ├─form 自定义表单模块
|
||||
│ ├─report 报表模块
|
||||
│ └─system 系统管理模块
|
||||
│
|
||||
├─XjrsoftApplication 项目启动类
|
||||
│
|
||||
├──resources
|
||||
│ ├─mapper SQL对应的XML文件
|
||||
│ │─template freemark模板文件
|
||||
│ │─banner 启动banner图
|
||||
│ └─logback 日志配置文件
|
||||
|
||||
```
|
||||
|
||||
<br/>
|
||||
|
||||
**技术选型:**
|
||||
|
||||
- 项目 [jdk](https://www.oracle.com/java/technologies/downloads/) 采用 11 版本
|
||||
- 开发框架 采用 [springboot ](https://spring.io/projects/spring-boot)版本 2.7.5 +
|
||||
- ORM框架 采用 [mybatis-plus](https://baomidou.com/) 版本 3.5.2+
|
||||
- ORM动态数据源 采用 [dynamic-datasource](https://www.kancloud.cn/tracy5546/dynamic-datasource/2264611) 版本 3.5.1
|
||||
- ORM多表联查工具类 采用 [mybatis-plus-join](https://https://gitee.com/best_handsome/mybatis-plus-join/wikis/%E5%AE%89%E8%A3%85) 版本 1.2.2+
|
||||
- ORM动态数据源 采用 [mybatis-plus-dynamic-datasource](https://gitee.com/baomidou/dynamic-datasource-spring-boot-starter) 版本 3.5.1
|
||||
- 数据库连接池框架采用 [druid](https://github.com/alibaba/druid) 版本 1.1.22+
|
||||
- 接口文档框架采用 [knife4j](https://doc.xiaominfo.com/) 版本 2.0.7+
|
||||
- json格式化工具 采用 [fastjson](https://github.com/alibaba/fastjson/wiki/Quick-Start-CN)等 版本 1.2.72+
|
||||
- 代码模板框架 采用 [Freemark](http://freemarker.foofun.cn/) 版本 2.3.30+
|
||||
- 权限框架采用 [sa-token](https://sa-token.dev33.cn/) 版本 1.29.0+
|
||||
- 常用工具类库 采用 [hutool](https://www.hutool.cn/) 版本5.7.20+
|
||||
- 注解验证 [hibernate-validator](https://hibernate.org/validator/) 版本 6.0.13.Final
|
||||
- 分布式定时任务框架 采用 [power-job](http://www.powerjob.tech/) 版本 4.3.2
|
||||
- 工作流引擎 采用 [camunda](https://camunda.com/) 版本 7.18.0
|
||||
- 在线接口 采用 [magic-api](https://www.ssssssss.org/magic-api/) 版本 2.1.1
|
||||
- 短信工具类库 采用 [sms4j](https://wind.kim/) 版本 2.1.0
|
||||
- java动态类库 采用 [javassist](http://www.javassist.org/) 版本 3.29.2-GA
|
||||
- 规则引擎 采用 [liteflow](https://liteflow.yomahub.com/) 版本 2.10.1
|
||||
- excel工具类库 采用 [easyexcel](https://github.com/alibaba/easyexcel) 版本 3.1.4
|
||||
- 云存储 适配 平台([minio](http://www.minio.org.cn/),阿里云,腾讯云,华为云,七牛云)
|
||||
|
||||
**注意事项:**
|
||||
- idea 必须安装lombok插件使用
|
||||
- 开发或者部署 需要在application.yml 设置相应的 yml
|
||||
- idea 直接使用 dockerfile 打包上传到镜像 需要配置docker docker所在服务器也需要打开2375端口
|
||||
- pom 里面docker-plugin 插件 用途在于 执行打包命令 会直接上传到docker 也需要打开2375端口
|
||||
- 代码生成器 如果想要拥有审计字段(create_user_id 等字段)自动填充功能 表结构必须要符合框架的约定 比需要拥有这些字段(create_user_id | create_date | modify_user_id | modify_date | delete_mark | enabled_mark)
|
||||
- 框架默认使用jdk11 您也可以自己修改为jdk8 原则上jdk版本 最低jdk8 上不封顶 。
|
||||
- 如果哪些接口您需要记录日志,请自行在控制器 controller 的方法上 添加 XjrLog注解 参数填写接口描述即可
|
||||
- 如果您需要放行某些接口 /src/main/java/com/xjrsoft/config/SaTokenConfig.java 文件 对应新增
|
||||
- 非数据优先的代码生成器功能 用户所配置的表结构 表名 字段名 如果配置的为大小写混用 默认会改为 蛇形命名法 而且默认全小写 (oracle dm 等数据库默认全大写的除外)
|
||||
- 代码生成器-数据优先 模板 如果 子表的外键 关联 父表的非主键字段 级联删除会失效。 如果需要级联删除 请默认子表外键 关联 父表的主键
|
||||
- 如果需要使用定时任务 请根据 power-job 官网文档部署服务端 再来使用。 定时任务新增或者修改数据 将不会自动填充 审计字段
|
||||
- 前端想要内嵌其他url 需要把外链地址填写到组件地址栏
|
||||
- 工作流模块中 审批人、传阅人 数量不能超过21人
|
||||
|
||||
105
demo/demo-api/pom.xml
Normal file
105
demo/demo-api/pom.xml
Normal file
@ -0,0 +1,105 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>com.geg</groupId>
|
||||
<artifactId>demo</artifactId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>demo-api</artifactId>
|
||||
<name>demo-api</name>
|
||||
<description>demo-api</description>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||
<maven.compiler.target>${java.version}</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.geg</groupId>
|
||||
<artifactId>itc-ms-common-api</artifactId>
|
||||
<version>${framework.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>easyexcel</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.ssssssss</groupId>
|
||||
<artifactId>magic-api-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>me.zhyd.oauth</groupId>
|
||||
<artifactId>JustAuth</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>${java.version}</source>
|
||||
<target>${java.version}</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/java</directory>
|
||||
<includes>
|
||||
<include>**/*.xml</include>
|
||||
</includes>
|
||||
</resource>
|
||||
<resource>
|
||||
<directory>src/main/java</directory>
|
||||
<includes>
|
||||
<include>**/*.yml</include>
|
||||
<include>**/*.properties</include>
|
||||
<include>**/*.xml</include>
|
||||
</includes>
|
||||
<filtering>false</filtering>
|
||||
</resource>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<includes>
|
||||
<include>**/*.yml</include>
|
||||
<include>**/*.properties</include>
|
||||
<include>**/*.xml</include>
|
||||
<include>**/*.vm</include>
|
||||
<include>**/*.ftl</include>
|
||||
<include>**/*.jpg</include>
|
||||
<include>**/*.png</include>
|
||||
<include>**/*.xls</include>
|
||||
<include>**/*.xlsx</include>
|
||||
</includes>
|
||||
<filtering>false</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
</build>
|
||||
</project>
|
||||
@ -0,0 +1,22 @@
|
||||
package com.xjrsoft.module.prdManage.client;
|
||||
|
||||
import com.xjrsoft.common.constant.GlobalConstant;
|
||||
import com.xjrsoft.module.prdManage.dto.DemoAppliancePageDto;
|
||||
import com.xjrsoft.module.prdManage.vo.DemoApplianceVo;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author: yjw
|
||||
* @since: 2025/3/4
|
||||
*/
|
||||
@FeignClient(value = "demo-service",
|
||||
path = GlobalConstant.CLIENT_API_PRE + "prdManage/demoAppliance")
|
||||
public interface IDemoApplianceClient {
|
||||
|
||||
@PostMapping("/getListByQuery")
|
||||
List<DemoApplianceVo> getListByQuery(@RequestBody DemoAppliancePageDto dto);
|
||||
}
|
||||
@ -0,0 +1,67 @@
|
||||
package com.xjrsoft.module.prdManage.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
|
||||
/**
|
||||
* @title: 示例-家电管理
|
||||
* @Author 管理员
|
||||
* @Date: 2025-03-12
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
public class AddDemoApplianceDto implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private String name;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private String serialNumber;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private String category;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private LocalDateTime purchaseDate;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private Integer warrantyPeriod;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private Integer powerRating;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private String brand;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private Double sellingPrice;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private String status;
|
||||
|
||||
}
|
||||
@ -0,0 +1,35 @@
|
||||
package com.xjrsoft.module.prdManage.dto;
|
||||
|
||||
import com.xjrsoft.common.page.PageInput;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
|
||||
/**
|
||||
* @title: 分页查询入参
|
||||
* @Author 管理员
|
||||
* @Date: 2025-03-12
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class DemoAppliancePageDto extends PageInput {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private String name;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private String serialNumber;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private String category;
|
||||
|
||||
}
|
||||
@ -0,0 +1,72 @@
|
||||
package com.xjrsoft.module.prdManage.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
|
||||
/**
|
||||
* @title: 示例-家电管理
|
||||
* @Author 管理员
|
||||
* @Date: 2025-03-12
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
public class UpdateDemoApplianceDto implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private Integer id;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private String name;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private String serialNumber;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private String category;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private LocalDateTime purchaseDate;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private Integer warrantyPeriod;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private Integer powerRating;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private String brand;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private Double sellingPrice;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private String status;
|
||||
|
||||
}
|
||||
@ -0,0 +1,68 @@
|
||||
package com.xjrsoft.module.prdManage.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @title: 分页列表出参
|
||||
* @Author 管理员
|
||||
* @Date: 2025-03-12
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
public class DemoAppliancePageVo {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private String id;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private String name;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private String serialNumber;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private String category;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private LocalDateTime purchaseDate;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private Integer warrantyPeriod;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private Integer powerRating;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private String brand;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private Double sellingPrice;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private String status;
|
||||
|
||||
}
|
||||
@ -0,0 +1,70 @@
|
||||
package com.xjrsoft.module.prdManage.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @title: 表单出参
|
||||
* @Author 管理员
|
||||
* @Date: 2025-03-12
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
public class DemoApplianceVo {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private Integer id;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private String name;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private String serialNumber;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private String category;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private LocalDateTime purchaseDate;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private Integer warrantyPeriod;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private Integer powerRating;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private String brand;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private Double sellingPrice;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private String status;
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,57 @@
|
||||
package com.xjrsoft.module.relationManage.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
|
||||
/**
|
||||
* @title: demo_客户管理
|
||||
* @Author 管理员
|
||||
* @Date: 2025-03-11
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
public class AddDemoCustomerDto implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private String name;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private String gender;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private String phone;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private String email;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private String address;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private String company;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private String position;
|
||||
|
||||
}
|
||||
@ -0,0 +1,40 @@
|
||||
package com.xjrsoft.module.relationManage.dto;
|
||||
|
||||
import com.xjrsoft.common.page.PageInput;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
|
||||
/**
|
||||
* @title: 分页查询入参
|
||||
* @Author 管理员
|
||||
* @Date: 2025-03-11
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class DemoCustomerPageDto extends PageInput {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private String name;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private String gender;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private String phone;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private String email;
|
||||
|
||||
}
|
||||
@ -0,0 +1,61 @@
|
||||
package com.xjrsoft.module.relationManage.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
|
||||
/**
|
||||
* @title: demo_客户管理
|
||||
* @Author 管理员
|
||||
* @Date: 2025-03-11
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
public class UpdateDemoCustomerDto implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private Long id;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private String name;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private String gender;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private String phone;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private String email;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private String address;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private String company;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private String position;
|
||||
}
|
||||
@ -0,0 +1,56 @@
|
||||
package com.xjrsoft.module.relationManage.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @title: 分页列表出参
|
||||
* @Author 管理员
|
||||
* @Date: 2025-03-11
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
public class DemoCustomerPageVo {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private String id;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private String name;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private String gender;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private String phone;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private String email;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private String address;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private String company;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private String position;
|
||||
|
||||
}
|
||||
@ -0,0 +1,74 @@
|
||||
package com.xjrsoft.module.relationManage.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @title: 表单出参
|
||||
* @Author 管理员
|
||||
* @Date: 2025-03-11
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
public class DemoCustomerVo {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private Long id;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private String name;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private String gender;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private String phone;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private String email;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private String address;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private String company;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private String position;
|
||||
|
||||
@ApiModelProperty("")
|
||||
private LocalDateTime createDate;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private Long createUserId;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private Long deptId;
|
||||
|
||||
|
||||
}
|
||||
220
demo/demo-service/pom.xml
Normal file
220
demo/demo-service/pom.xml
Normal file
@ -0,0 +1,220 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>com.geg</groupId>
|
||||
<artifactId>demo</artifactId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>demo-service</artifactId>
|
||||
<name>demo-service</name>
|
||||
<description>demo-service</description>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||
<maven.compiler.target>${java.version}</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.geg</groupId>
|
||||
<artifactId>itc-ms-common-service</artifactId>
|
||||
<version>${framework.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.geg</groupId>
|
||||
<artifactId>demo-api</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- springCloud 整合的openFeign -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-loadbalancer</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>redis.clients</groupId>
|
||||
<artifactId>jedis</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!--引入nacos依赖-->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!--引入spring-cloud-alibaba-nacos-config依赖-->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!--引入spring-cloud-alibaba-nacos-config bootstrap依赖-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-bootstrap</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!--引入sentinel依赖-->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>com.fasterxml.jackson.dataformat</groupId>
|
||||
<artifactId>jackson-dataformat-xml</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.alibaba.csp</groupId>
|
||||
<artifactId>sentinel-datasource-nacos</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- mybatis-plus 多表关联 -->
|
||||
<dependency>
|
||||
<groupId>com.github.yulichang</groupId>
|
||||
<artifactId>mybatis-plus-join</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.cloud.govern</groupId>
|
||||
<artifactId>service-invoke-sdk</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.freemarker</groupId>
|
||||
<artifactId>freemarker</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.unfbx</groupId>
|
||||
<artifactId>chatgpt-java</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-simple</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>tech.powerjob</groupId>
|
||||
<artifactId>powerjob-worker-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>me.zhyd.oauth</groupId>
|
||||
<artifactId>JustAuth</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<artifactId>keycloak-authz-client</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.microsoft.ews-java-api</groupId>
|
||||
<artifactId>ews-java-api</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>tech.powerjob</groupId>
|
||||
<artifactId>powerjob-official-processors</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>tech.powerjob</groupId>
|
||||
<artifactId>powerjob-worker</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.smallbun.screw</groupId>
|
||||
<artifactId>screw-core</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.github.openfeign</groupId>
|
||||
<artifactId>feign-okhttp</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.belerweb</groupId>
|
||||
<artifactId>pinyin4j</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>${java.version}</source>
|
||||
<target>${java.version}</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/java</directory>
|
||||
<includes>
|
||||
<include>**/*.xml</include>
|
||||
</includes>
|
||||
</resource>
|
||||
<resource>
|
||||
<directory>src/main/java</directory>
|
||||
<includes>
|
||||
<include>**/*.yml</include>
|
||||
<include>**/*.properties</include>
|
||||
<include>**/*.xml</include>
|
||||
</includes>
|
||||
<filtering>false</filtering>
|
||||
</resource>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<includes>
|
||||
<include>**/*.yml</include>
|
||||
<include>**/*.properties</include>
|
||||
<include>**/*.xml</include>
|
||||
<include>**/*.vm</include>
|
||||
<include>**/*.ftl</include>
|
||||
<include>**/*.jpg</include>
|
||||
<include>**/*.png</include>
|
||||
<include>**/*.xls</include>
|
||||
<include>**/*.xlsx</include>
|
||||
</includes>
|
||||
<filtering>false</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
</build>
|
||||
</project>
|
||||
@ -0,0 +1,25 @@
|
||||
package com.xjrsoft;
|
||||
|
||||
import com.xjrsoft.common.annotation.UniqueNameGenerator;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.EnableAspectJAutoProxy;
|
||||
|
||||
/**
|
||||
* @author Zexy
|
||||
*/
|
||||
@SpringBootApplication
|
||||
@EnableAspectJAutoProxy(exposeProxy = true)
|
||||
@ComponentScan(nameGenerator = UniqueNameGenerator.class)
|
||||
@EnableFeignClients
|
||||
@EnableDiscoveryClient
|
||||
public class ITCDemoApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(ITCDemoApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,28 @@
|
||||
package com.xjrsoft.common.schedule;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
@Component
|
||||
@ConditionalOnProperty(name = {"schedule.enabled","schedule.sync-xx.enabled"}, havingValue = "true")
|
||||
@Slf4j
|
||||
@EnableScheduling
|
||||
public class DemoSysncTask {
|
||||
@Scheduled(cron = "${schedule.sync-xx.cron:0 0/60 * * * *}") //60分钟跑一次
|
||||
public void sync(){
|
||||
log.info("同步XX数据 => " + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
|
||||
try{
|
||||
//todo 任务具体实现
|
||||
} catch (Exception e){
|
||||
log.error("同步XX数据失败:" + e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,28 @@
|
||||
package com.xjrsoft.common.util;
|
||||
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class SpringContextUtil implements ApplicationContextAware {
|
||||
|
||||
private static ApplicationContext context;
|
||||
|
||||
@Override
|
||||
public void setApplicationContext(ApplicationContext applicationContext) {
|
||||
SpringContextUtil.context = applicationContext;
|
||||
}
|
||||
|
||||
public static ApplicationContext getApplicationContext() {
|
||||
return context;
|
||||
}
|
||||
|
||||
public static <T> T getBean(Class<T> beanClass) {
|
||||
return context.getBean(beanClass);
|
||||
}
|
||||
|
||||
public static Object getBean(String beanName) {
|
||||
return context.getBean(beanName);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,98 @@
|
||||
package com.xjrsoft.module.prdManage.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.xjrsoft.common.model.result.R;
|
||||
import com.xjrsoft.common.page.ConventPage;
|
||||
import com.xjrsoft.common.page.PageOutput;
|
||||
import com.xjrsoft.common.utils.VoToColumnUtil;
|
||||
import com.xjrsoft.module.prdManage.dto.AddDemoApplianceDto;
|
||||
import com.xjrsoft.module.prdManage.dto.DemoAppliancePageDto;
|
||||
import com.xjrsoft.module.prdManage.dto.UpdateDemoApplianceDto;
|
||||
import com.xjrsoft.module.prdManage.entity.DemoAppliance;
|
||||
import com.xjrsoft.module.prdManage.service.IDemoApplianceService;
|
||||
import com.xjrsoft.module.prdManage.vo.DemoAppliancePageVo;
|
||||
import com.xjrsoft.module.prdManage.vo.DemoApplianceVo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @title: 示例-家电管理
|
||||
* @Author 管理员
|
||||
* @Date: 2025-03-12
|
||||
* @Version 1.0
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/prdManage" + "/demoAppliance")
|
||||
@Api(value = "/prdManage" + "/demoAppliance",tags = "示例-家电管理代码")
|
||||
@AllArgsConstructor
|
||||
public class DemoApplianceController {
|
||||
|
||||
|
||||
private final IDemoApplianceService demoApplianceService;
|
||||
|
||||
@GetMapping(value = "/page")
|
||||
@ApiOperation(value="DemoAppliance列表(分页)")
|
||||
@SaCheckPermission("demoAppliance:list")
|
||||
public R page(@Valid DemoAppliancePageDto dto){
|
||||
|
||||
LambdaQueryWrapper<DemoAppliance> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper
|
||||
.like(StrUtil.isNotBlank(dto.getName()),DemoAppliance::getName,dto.getName())
|
||||
.like(StrUtil.isNotBlank(dto.getSerialNumber()),DemoAppliance::getSerialNumber,dto.getSerialNumber())
|
||||
.like(StrUtil.isNotBlank(dto.getCategory()),DemoAppliance::getCategory,dto.getCategory())
|
||||
.orderByDesc(DemoAppliance::getId)
|
||||
.select(DemoAppliance.class,x -> VoToColumnUtil.fieldsToColumns(DemoAppliancePageVo.class).contains(x.getProperty()));
|
||||
IPage<DemoAppliance> page = demoApplianceService.page(ConventPage.getPage(dto), queryWrapper);
|
||||
PageOutput<DemoAppliancePageVo> pageOutput = ConventPage.getPageOutput(page, DemoAppliancePageVo.class);
|
||||
return R.ok(pageOutput);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/info")
|
||||
@ApiOperation(value="根据id查询DemoAppliance信息")
|
||||
@SaCheckPermission("demoAppliance:detail")
|
||||
public R info(@RequestParam Integer id){
|
||||
DemoAppliance demoAppliance = demoApplianceService.getById(id);
|
||||
if (demoAppliance == null) {
|
||||
return R.error("找不到此数据!");
|
||||
}
|
||||
return R.ok(BeanUtil.toBean(demoAppliance, DemoApplianceVo.class));
|
||||
}
|
||||
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation(value = "新增DemoAppliance")
|
||||
@SaCheckPermission("demoAppliance:add")
|
||||
public R add(@Valid @RequestBody AddDemoApplianceDto dto){
|
||||
DemoAppliance demoAppliance = BeanUtil.toBean(dto, DemoAppliance.class);
|
||||
boolean isSuccess = demoApplianceService.save(demoAppliance);
|
||||
return R.ok(demoAppliance.getId());
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@ApiOperation(value = "修改DemoAppliance")
|
||||
@SaCheckPermission("demoAppliance:edit")
|
||||
public R update(@Valid @RequestBody UpdateDemoApplianceDto dto){
|
||||
|
||||
DemoAppliance demoAppliance = BeanUtil.toBean(dto, DemoAppliance.class);
|
||||
return R.ok(demoApplianceService.updateById(demoAppliance));
|
||||
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@ApiOperation(value = "删除")
|
||||
@SaCheckPermission("demoAppliance:delete")
|
||||
public R delete(@Valid @RequestBody List<Integer> ids){
|
||||
return R.ok(demoApplianceService.removeBatchByIds(ids));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,79 @@
|
||||
package com.xjrsoft.module.prdManage.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
|
||||
/**
|
||||
* @title: 示例-家电管理
|
||||
* @Author 管理员
|
||||
* @Date: 2025-03-12
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("demo_appliance")
|
||||
@ApiModel(value = "示例-家电管理对象", description = "示例-家电管理")
|
||||
public class DemoAppliance implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
@TableId
|
||||
private Integer id;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private String name;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private String serialNumber;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private String category;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private LocalDateTime purchaseDate;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private Integer warrantyPeriod;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private Integer powerRating;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private String brand;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private Double sellingPrice;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private String status;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package com.xjrsoft.module.prdManage.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.xjrsoft.module.prdManage.entity.DemoAppliance;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @title: mapper
|
||||
* @Author 管理员
|
||||
* @Date: 2025-03-12
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface DemoApplianceMapper extends BaseMapper<DemoAppliance> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
package com.xjrsoft.module.prdManage.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.xjrsoft.module.prdManage.entity.DemoAppliance;
|
||||
|
||||
/**
|
||||
* @title: service
|
||||
* @Author 管理员
|
||||
* @Date: 2025-03-12
|
||||
* @Version 1.0
|
||||
*/
|
||||
|
||||
public interface IDemoApplianceService extends IService<DemoAppliance> {
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
package com.xjrsoft.module.prdManage.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.xjrsoft.module.prdManage.entity.DemoAppliance;
|
||||
import com.xjrsoft.module.prdManage.mapper.DemoApplianceMapper;
|
||||
import com.xjrsoft.module.prdManage.service.IDemoApplianceService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @title: service
|
||||
* @Author 管理员
|
||||
* @Date: 2025-03-12
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class DemoApplianceServiceImpl extends ServiceImpl<DemoApplianceMapper, DemoAppliance> implements IDemoApplianceService {
|
||||
}
|
||||
@ -0,0 +1,99 @@
|
||||
package com.xjrsoft.module.relationManage.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.xjrsoft.common.model.result.R;
|
||||
import com.xjrsoft.common.page.ConventPage;
|
||||
import com.xjrsoft.common.page.PageOutput;
|
||||
import com.xjrsoft.common.utils.VoToColumnUtil;
|
||||
import com.xjrsoft.module.relationManage.dto.AddDemoCustomerDto;
|
||||
import com.xjrsoft.module.relationManage.dto.DemoCustomerPageDto;
|
||||
import com.xjrsoft.module.relationManage.dto.UpdateDemoCustomerDto;
|
||||
import com.xjrsoft.module.relationManage.entity.DemoCustomer;
|
||||
import com.xjrsoft.module.relationManage.service.IDemoCustomerManageService;
|
||||
import com.xjrsoft.module.relationManage.vo.DemoCustomerPageVo;
|
||||
import com.xjrsoft.module.relationManage.vo.DemoCustomerVo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @title: demo_客户管理
|
||||
* @Author 管理员
|
||||
* @Date: 2025-03-11
|
||||
* @Version 1.0
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/relationManage" + "/demoCustomerManage")
|
||||
@Api(value = "/relationManage" + "/demoCustomerManage",tags = "demo_客户管理代码")
|
||||
@AllArgsConstructor
|
||||
public class DemoCustomerManageController {
|
||||
|
||||
|
||||
private final IDemoCustomerManageService demoCustomerManageService;
|
||||
|
||||
@GetMapping(value = "/page")
|
||||
@ApiOperation(value="DemoCustomer列表(分页)")
|
||||
@SaCheckPermission("demoCustomerManage:list")
|
||||
public R page(@Valid DemoCustomerPageDto dto){
|
||||
|
||||
LambdaQueryWrapper<DemoCustomer> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper
|
||||
.like(StrUtil.isNotBlank(dto.getName()),DemoCustomer::getName,dto.getName())
|
||||
.like(StrUtil.isNotBlank(dto.getGender()),DemoCustomer::getGender,dto.getGender())
|
||||
.like(StrUtil.isNotBlank(dto.getPhone()),DemoCustomer::getPhone,dto.getPhone())
|
||||
.like(StrUtil.isNotBlank(dto.getEmail()),DemoCustomer::getEmail,dto.getEmail())
|
||||
.orderByDesc(DemoCustomer::getId)
|
||||
.select(DemoCustomer.class,x -> VoToColumnUtil.fieldsToColumns(DemoCustomerPageVo.class).contains(x.getProperty()));
|
||||
IPage<DemoCustomer> page = demoCustomerManageService.page(ConventPage.getPage(dto), queryWrapper);
|
||||
PageOutput<DemoCustomerPageVo> pageOutput = ConventPage.getPageOutput(page, DemoCustomerPageVo.class);
|
||||
return R.ok(pageOutput);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/info")
|
||||
@ApiOperation(value="根据id查询DemoCustomer信息")
|
||||
@SaCheckPermission("demoCustomerManage:detail")
|
||||
public R info(@RequestParam Long id){
|
||||
DemoCustomer demoCustomer = demoCustomerManageService.getById(id);
|
||||
if (demoCustomer == null) {
|
||||
return R.error("找不到此数据!");
|
||||
}
|
||||
return R.ok(BeanUtil.toBean(demoCustomer, DemoCustomerVo.class));
|
||||
}
|
||||
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation(value = "新增DemoCustomer")
|
||||
@SaCheckPermission("demoCustomerManage:add")
|
||||
public R add(@Valid @RequestBody AddDemoCustomerDto dto){
|
||||
DemoCustomer demoCustomer = BeanUtil.toBean(dto, DemoCustomer.class);
|
||||
boolean isSuccess = demoCustomerManageService.save(demoCustomer);
|
||||
return R.ok(demoCustomer.getId());
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@ApiOperation(value = "修改DemoCustomer")
|
||||
@SaCheckPermission("demoCustomerManage:edit")
|
||||
public R update(@Valid @RequestBody UpdateDemoCustomerDto dto){
|
||||
|
||||
DemoCustomer demoCustomer = BeanUtil.toBean(dto, DemoCustomer.class);
|
||||
return R.ok(demoCustomerManageService.updateById(demoCustomer));
|
||||
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@ApiOperation(value = "删除")
|
||||
@SaCheckPermission("demoCustomerManage:delete")
|
||||
public R delete(@Valid @RequestBody List<Long> ids){
|
||||
return R.ok(demoCustomerManageService.removeBatchByIds(ids));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,90 @@
|
||||
package com.xjrsoft.module.relationManage.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
|
||||
/**
|
||||
* @title: demo_客户管理
|
||||
* @Author 管理员
|
||||
* @Date: 2025-03-11
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("demo_customer")
|
||||
@ApiModel(value = "demo_客户管理对象", description = "demo_客户管理")
|
||||
public class DemoCustomer implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private String name;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private String gender;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private String phone;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private String email;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private String address;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private String company;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
private String position;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private LocalDateTime createDate;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Long createUserId;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty("")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Long deptId;
|
||||
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package com.xjrsoft.module.relationManage.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.xjrsoft.module.relationManage.entity.DemoCustomer;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @title: mapper
|
||||
* @Author 管理员
|
||||
* @Date: 2025-03-11
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface DemoCustomerMapper extends BaseMapper<DemoCustomer> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
package com.xjrsoft.module.relationManage.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.xjrsoft.module.relationManage.entity.DemoCustomer;
|
||||
|
||||
/**
|
||||
* @title: service
|
||||
* @Author 管理员
|
||||
* @Date: 2025-03-11
|
||||
* @Version 1.0
|
||||
*/
|
||||
|
||||
public interface IDemoCustomerManageService extends IService<DemoCustomer> {
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
package com.xjrsoft.module.relationManage.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.xjrsoft.module.relationManage.entity.DemoCustomer;
|
||||
import com.xjrsoft.module.relationManage.mapper.DemoCustomerMapper;
|
||||
import com.xjrsoft.module.relationManage.service.IDemoCustomerManageService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @title: service
|
||||
* @Author 管理员
|
||||
* @Date: 2025-03-11
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class DemoCustomerManageServiceImpl extends ServiceImpl<DemoCustomerMapper, DemoCustomer> implements IDemoCustomerManageService {
|
||||
}
|
||||
6
demo/demo-service/src/main/resources/banner.txt
Normal file
6
demo/demo-service/src/main/resources/banner.txt
Normal file
@ -0,0 +1,6 @@
|
||||
██╗ ██╗ ██╗██████╗ ███████╗ ██████╗ ███████╗████████╗
|
||||
╚██╗██╔╝ ██║██╔══██╗██╔════╝██╔═══██╗██╔════╝╚══██╔══╝
|
||||
╚███╔╝ ██║██████╔╝███████╗██║ ██║█████╗ ██║
|
||||
██╔██╗ ██ ██║██╔══██╗╚════██║██║ ██║██╔══╝ ██║
|
||||
██╔╝ ██╗╚█████╔╝██║ ██║███████║╚██████╔╝██║ ██║
|
||||
╚═╝ ╚═╝ ╚════╝ ╚═╝ ╚═╝╚══════╝ ╚═════╝ ╚═╝ ╚═╝
|
||||
51
demo/demo-service/src/main/resources/bootstrap.yml
Normal file
51
demo/demo-service/src/main/resources/bootstrap.yml
Normal file
@ -0,0 +1,51 @@
|
||||
spring:
|
||||
application:
|
||||
name: demo-service
|
||||
main:
|
||||
allow-bean-definition-overriding: true
|
||||
|
||||
cloud:
|
||||
nacos: #nacos监控
|
||||
config:
|
||||
server-addr: 10.0.252.1:8848 # nacos 配置中心地址
|
||||
namespace: ITC-MS
|
||||
group: DNE
|
||||
username: nacos
|
||||
password: ABcd1234@
|
||||
file-extension: yml # 默认配置 ${spring.application.name}-${spring.profiles.active}.${file-extension}
|
||||
extension-configs:
|
||||
- data-id: global.yml
|
||||
refresh: true
|
||||
group: DNE
|
||||
|
||||
- data-id: discovery.yml
|
||||
refresh: true
|
||||
group: DNE
|
||||
|
||||
- data-id: datasource.yml
|
||||
refresh: true
|
||||
group: DNE
|
||||
|
||||
- data-id: seata.yml
|
||||
refresh: true
|
||||
group: DNE
|
||||
|
||||
- data-id: redis.yml
|
||||
refresh: true
|
||||
group: DNE
|
||||
|
||||
- data-id: magic-api.yml
|
||||
refresh: true
|
||||
group: DNE
|
||||
|
||||
- data-id: sa-token.yml
|
||||
refresh: true
|
||||
group: DNE
|
||||
|
||||
- data-id: camunda.yml
|
||||
refresh: true
|
||||
group: DNE
|
||||
|
||||
- data-id: sentinel.yml
|
||||
refresh: true
|
||||
group: DNE
|
||||
29
demo/pom.xml
Normal file
29
demo/pom.xml
Normal file
@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>com.geg</groupId>
|
||||
<artifactId>ms-demo</artifactId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>demo</artifactId>
|
||||
<name>demo</name>
|
||||
<description>demo</description>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<modules>
|
||||
<module>demo-api</module>
|
||||
<module>demo-service</module>
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||
<maven.compiler.target>${java.version}</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
</project>
|
||||
8
docker-compose.yml
Normal file
8
docker-compose.yml
Normal file
@ -0,0 +1,8 @@
|
||||
version: '1'
|
||||
services:
|
||||
xjrsoft-boot:
|
||||
image: xjrsoft-boot
|
||||
ports:
|
||||
- "8080:8080"
|
||||
environment:
|
||||
- spring.profiles.active=prod
|
||||
237
facade-service/pom.xml
Normal file
237
facade-service/pom.xml
Normal file
@ -0,0 +1,237 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>com.geg</groupId>
|
||||
<artifactId>ms-demo</artifactId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>facade-service</artifactId>
|
||||
<name>facade-service</name>
|
||||
<description>facade-service</description>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||
<maven.compiler.target>${java.version}</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.geg</groupId>
|
||||
<artifactId>itc-ms-common-service</artifactId>
|
||||
<version>${framework.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.geg</groupId>
|
||||
<artifactId>itc-ms-facade-api</artifactId>
|
||||
<version>${framework.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- springCloud 整合的openFeign -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-loadbalancer</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>redis.clients</groupId>
|
||||
<artifactId>jedis</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!--引入nacos依赖-->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!--引入spring-cloud-alibaba-nacos-config依赖-->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!--引入spring-cloud-alibaba-nacos-config bootstrap依赖-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-bootstrap</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!--引入sentinel依赖-->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>com.fasterxml.jackson.dataformat</groupId>
|
||||
<artifactId>jackson-dataformat-xml</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.alibaba.csp</groupId>
|
||||
<artifactId>sentinel-datasource-nacos</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- mybatis-plus 多表关联 -->
|
||||
<dependency>
|
||||
<groupId>com.github.yulichang</groupId>
|
||||
<artifactId>mybatis-plus-join</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.cloud.govern</groupId>
|
||||
<artifactId>service-invoke-sdk</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.freemarker</groupId>
|
||||
<artifactId>freemarker</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.unfbx</groupId>
|
||||
<artifactId>chatgpt-java</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-simple</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>tech.powerjob</groupId>
|
||||
<artifactId>powerjob-worker-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>me.zhyd.oauth</groupId>
|
||||
<artifactId>JustAuth</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<artifactId>keycloak-authz-client</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.microsoft.ews-java-api</groupId>
|
||||
<artifactId>ews-java-api</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>tech.powerjob</groupId>
|
||||
<artifactId>powerjob-official-processors</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>tech.powerjob</groupId>
|
||||
<artifactId>powerjob-worker</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.smallbun.screw</groupId>
|
||||
<artifactId>screw-core</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.github.openfeign</groupId>
|
||||
<artifactId>feign-okhttp</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.belerweb</groupId>
|
||||
<artifactId>pinyin4j</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>2.7.6</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<!--<classifier>classes</classifier>-->
|
||||
<attach>false</attach>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>${java.version}</source>
|
||||
<target>${java.version}</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/java</directory>
|
||||
<includes>
|
||||
<include>**/*.xml</include>
|
||||
</includes>
|
||||
</resource>
|
||||
<resource>
|
||||
<directory>src/main/java</directory>
|
||||
<includes>
|
||||
<include>**/*.yml</include>
|
||||
<include>**/*.properties</include>
|
||||
<include>**/*.xml</include>
|
||||
</includes>
|
||||
<filtering>false</filtering>
|
||||
</resource>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<includes>
|
||||
<include>**/*.yml</include>
|
||||
<include>**/*.properties</include>
|
||||
<include>**/*.xml</include>
|
||||
<include>**/*.vm</include>
|
||||
<include>**/*.ftl</include>
|
||||
<include>**/*.jpg</include>
|
||||
<include>**/*.png</include>
|
||||
<include>**/*.xls</include>
|
||||
<include>**/*.xlsx</include>
|
||||
</includes>
|
||||
<filtering>false</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
</build>
|
||||
</project>
|
||||
@ -0,0 +1,25 @@
|
||||
package com.xjrsoft;
|
||||
|
||||
import com.xjrsoft.common.annotation.UniqueNameGenerator;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.EnableAspectJAutoProxy;
|
||||
|
||||
/**
|
||||
* @author Zexy
|
||||
*/
|
||||
@SpringBootApplication
|
||||
@EnableAspectJAutoProxy(exposeProxy = true)
|
||||
@ComponentScan(nameGenerator = UniqueNameGenerator.class)
|
||||
@EnableFeignClients
|
||||
@EnableDiscoveryClient
|
||||
public class ITCFacadeApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(ITCFacadeApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,42 @@
|
||||
package com.xjrsoft.module.magicapi.client;
|
||||
|
||||
import com.xjrsoft.common.constant.GlobalConstant;
|
||||
import com.xjrsoft.module.magicapi.dto.ExecuteWorkflowApiDto;
|
||||
import com.xjrsoft.module.magicapi.vo.MagicApiInfoVo;
|
||||
import com.xjrsoft.module.magicapi.service.IMagicApiService;
|
||||
import io.swagger.annotations.Api;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* @Author: tzx
|
||||
* @Date: 2023/10/10 17:43
|
||||
*/
|
||||
@Api(hidden = true)
|
||||
@RestController
|
||||
@RequestMapping(GlobalConstant.CLIENT_API_PRE + GlobalConstant.MAGICAPI_MODULE_PREFIX + "/magic-api")
|
||||
@AllArgsConstructor
|
||||
public class MagicApiClientImpl implements IMagicApiClient {
|
||||
|
||||
private IMagicApiService magicApiService;
|
||||
|
||||
|
||||
@Override
|
||||
@GetMapping("/executeApi")
|
||||
public Object executeApi(@RequestParam("id") String id) {
|
||||
return magicApiService.executeApi(id);
|
||||
}
|
||||
|
||||
@PostMapping("/executeWorkflowApi")
|
||||
@Override
|
||||
public Object executeWorkflowApi(@RequestBody ExecuteWorkflowApiDto dto) {
|
||||
return magicApiService.executeWorkflowApi(dto.getApiConfig(), dto.getProcessParam(), dto.getVarMap(), dto.getProcessInstId(), dto.getExecutionId());
|
||||
}
|
||||
|
||||
@GetMapping("/info")
|
||||
@Override
|
||||
public MagicApiInfoVo info(@RequestParam("id") String id) {
|
||||
return magicApiService.info(id);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,64 @@
|
||||
package com.xjrsoft.module.magicapi.controller;
|
||||
|
||||
|
||||
import com.xjrsoft.common.annotation.XjrLog;
|
||||
import com.xjrsoft.common.constant.GlobalConstant;
|
||||
import com.xjrsoft.common.model.result.R;
|
||||
import com.xjrsoft.module.magicapi.vo.MagicApiTreeVo;
|
||||
import com.xjrsoft.module.magicapi.service.IMagicApiService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
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.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* magic-api模块接口
|
||||
* </p>
|
||||
*
|
||||
* @author tzx
|
||||
* @since 2022-10-30
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping(GlobalConstant.MAGICAPI_MODULE_PREFIX)
|
||||
@Api(value = GlobalConstant.MAGICAPI_MODULE_PREFIX, tags = "magic-api模块接口")
|
||||
@AllArgsConstructor
|
||||
public class MagicApiController {
|
||||
|
||||
private final IMagicApiService magicApiService;
|
||||
|
||||
@GetMapping(value = "/tree")
|
||||
@ApiOperation("查询所有分组以及api 树结构")
|
||||
@XjrLog(value = "查询所有分组以及api 树结构")
|
||||
public R tree(@RequestParam(required = false) String keyword ) {
|
||||
List<MagicApiTreeVo> tree = magicApiService.tree(keyword);
|
||||
return R.ok(tree);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/group/tree")
|
||||
@ApiOperation("查询所有树结构分组")
|
||||
@XjrLog(value = "查询所有树结构分组")
|
||||
public R groupTree(){
|
||||
return R.ok(magicApiService.groupTree());
|
||||
}
|
||||
|
||||
@GetMapping(value = "/info")
|
||||
@ApiOperation("查询api详情")
|
||||
@XjrLog(value = "查询api详情")
|
||||
public R info(@RequestParam String id){
|
||||
return R.ok(magicApiService.info(id));
|
||||
}
|
||||
|
||||
@GetMapping(value = "/list")
|
||||
@ApiOperation("根据分组id 查询所有api")
|
||||
@XjrLog(value = "根据分组id 查询所有api")
|
||||
public R list(@RequestParam String groupId){
|
||||
return R.ok(magicApiService.list(groupId));
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,55 @@
|
||||
package com.xjrsoft.module.magicapi.service;
|
||||
|
||||
import com.xjrsoft.module.magicapi.vo.MagicApiGroupTreeVo;
|
||||
import com.xjrsoft.module.magicapi.vo.MagicApiInfoVo;
|
||||
import com.xjrsoft.module.magicapi.vo.MagicApiTreeVo;
|
||||
import com.xjrsoft.module.workflow.model.ApiConfig;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface IMagicApiService {
|
||||
|
||||
/**
|
||||
* 分组以及api 树结构
|
||||
* @return
|
||||
*/
|
||||
List<MagicApiTreeVo> tree(String keyword);
|
||||
|
||||
/**
|
||||
* 分组树
|
||||
* @return
|
||||
*/
|
||||
List<MagicApiGroupTreeVo> groupTree();
|
||||
|
||||
/**
|
||||
* 根据 id 获取 接口信息
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
MagicApiInfoVo info(String id);
|
||||
|
||||
/**
|
||||
* 根据分组查询所有接口
|
||||
* @param groupId
|
||||
* @return
|
||||
*/
|
||||
List<MagicApiInfoVo> list(String groupId);
|
||||
|
||||
/**
|
||||
* 执行API
|
||||
* @param id 接口id
|
||||
* @param <T>
|
||||
* @return
|
||||
*/
|
||||
<T> T executeApi(String id);
|
||||
|
||||
/**
|
||||
* 执行工作流api
|
||||
* @param apiConfig
|
||||
* @param processParam
|
||||
* @param varMap
|
||||
* @return
|
||||
*/
|
||||
Object executeWorkflowApi(ApiConfig apiConfig, Map<String, Object> processParam, Map<String, Object> varMap,String processInstId,String executionId);
|
||||
}
|
||||
@ -0,0 +1,195 @@
|
||||
package com.xjrsoft.module.magicapi.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
import com.xjrsoft.common.utils.TreeUtil;
|
||||
import com.xjrsoft.module.magicapi.vo.MagicApiGroupTreeVo;
|
||||
import com.xjrsoft.module.magicapi.vo.MagicApiInfoVo;
|
||||
import com.xjrsoft.module.magicapi.vo.MagicApiTreeVo;
|
||||
import com.xjrsoft.module.workflow.model.ApiConfig;
|
||||
import com.xjrsoft.module.workflow.model.ApiRequestParamsConfig;
|
||||
import com.xjrsoft.module.magicapi.service.IMagicApiService;
|
||||
import com.xjrsoft.module.magicapi.utils.MagicApiUtil;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.ssssssss.magicapi.core.model.*;
|
||||
import org.ssssssss.magicapi.core.service.MagicAPIService;
|
||||
import org.ssssssss.magicapi.core.service.MagicResourceService;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* magic-api服务
|
||||
*
|
||||
* @author apple
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class MagicApiServiceImpl implements IMagicApiService {
|
||||
|
||||
private final MagicResourceService magicResourceService;
|
||||
|
||||
private final MagicAPIService magicAPIService;
|
||||
|
||||
@Override
|
||||
public List<MagicApiTreeVo> tree(String keyword) {
|
||||
TreeNode<Group> tree = magicResourceService.tree("api");
|
||||
|
||||
List<TreeNode<Group>> children = tree.getChildren();
|
||||
|
||||
return TreeUtil.build(buildTreeData(children, keyword));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MagicApiGroupTreeVo> groupTree() {
|
||||
TreeNode<Group> tree = magicResourceService.tree("api");
|
||||
|
||||
List<TreeNode<Group>> children = tree.getChildren();
|
||||
List<MagicApiGroupTreeVo> treeVoList = new ArrayList<>();
|
||||
buildGroupTreeData(treeVoList, children);
|
||||
return TreeUtil.build(treeVoList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MagicApiInfoVo info(String id) {
|
||||
MagicEntity entity = magicResourceService.file(id);
|
||||
BaseDefinition requestBodyDefinition = ((ApiInfo) entity).getRequestBodyDefinition();
|
||||
MagicApiInfoVo magicApiInfoVo = BeanUtil.toBean(entity, MagicApiInfoVo.class);
|
||||
String groupId = entity.getGroupId();
|
||||
if (StringUtils.isNotEmpty(groupId)) {
|
||||
String groupPath = magicResourceService.getGroupPath(groupId);
|
||||
magicApiInfoVo.setPath(groupPath + magicApiInfoVo.getPath());
|
||||
}
|
||||
magicApiInfoVo.setRequestBodyDefinition(requestBodyDefinition);
|
||||
return magicApiInfoVo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MagicApiInfoVo> list(String groupId) {
|
||||
String groupPath = magicResourceService.getGroupPath(groupId);
|
||||
|
||||
List<MagicEntity> magicEntities = magicResourceService.listFiles(groupId);
|
||||
|
||||
List<MagicApiInfoVo> magicApiInfoVos = BeanUtil.copyToList(magicEntities, MagicApiInfoVo.class);
|
||||
for (MagicApiInfoVo magicApiInfoVo : magicApiInfoVos) {
|
||||
magicApiInfoVo.setPath(groupPath + magicApiInfoVo.getPath());
|
||||
}
|
||||
|
||||
return magicApiInfoVos;
|
||||
}
|
||||
|
||||
public <T> T executeApi(String id) {
|
||||
MagicApiInfoVo info = info(id);
|
||||
return magicAPIService.execute(info.getMethod(), info.getPath(), new HashMap<>());
|
||||
}
|
||||
|
||||
public Object executeWorkflowApi(ApiConfig apiConfig, Map<String, Object> processParam, Map<String, Object> varMap,String processInstId,String executionId){
|
||||
MagicApiInfoVo info = info(apiConfig.getId());
|
||||
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
for(List<ApiRequestParamsConfig>requestParamsConfigs:new List[]{
|
||||
apiConfig.getRequestParamsConfigs(),
|
||||
apiConfig.getRequestHeaderConfigs(),
|
||||
apiConfig.getRequestBodyConfigs()
|
||||
}){
|
||||
for (ApiRequestParamsConfig requestParamsConfig : requestParamsConfigs) {
|
||||
MagicApiUtil.initApiParams(processParam,varMap,params,requestParamsConfig);
|
||||
}
|
||||
}
|
||||
//补充流程参数
|
||||
params.put("processInstId",processInstId);
|
||||
params.put("executionId",executionId);
|
||||
|
||||
Object result = magicAPIService.execute(info.getMethod(), info.getPath(), params);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询分组以及api 树结构
|
||||
*
|
||||
* @param treeNodes
|
||||
* @return
|
||||
*/
|
||||
private List<MagicApiTreeVo> buildTreeData(List<TreeNode<Group>> treeNodes, String keyword) {
|
||||
|
||||
List<MagicApiTreeVo> treeVoList = new ArrayList<>();
|
||||
for (TreeNode<Group> treeNode : treeNodes) {
|
||||
Group node = treeNode.getNode();
|
||||
|
||||
List<MagicEntity> nodeEntity = magicResourceService.listFiles(node.getId());
|
||||
|
||||
|
||||
if(StringUtils.isNotBlank(keyword) && !node.getName().contains(keyword) && nodeEntity.stream().noneMatch(x -> x.getName().contains(keyword) || ((ApiInfo)x).getPath().contains(keyword))){
|
||||
continue;
|
||||
}
|
||||
|
||||
MagicApiTreeVo groupVo = new MagicApiTreeVo();
|
||||
groupVo.setId(node.getId());
|
||||
groupVo.setParentId(node.getParentId());
|
||||
groupVo.setType("group");
|
||||
groupVo.setName(node.getName());
|
||||
|
||||
treeVoList.add(groupVo);
|
||||
|
||||
|
||||
for (MagicEntity magicEntity : nodeEntity) {
|
||||
MagicApiTreeVo vo = new MagicApiTreeVo();
|
||||
|
||||
ApiInfo apiInfo = (ApiInfo) magicEntity;
|
||||
if(StringUtils.isNotBlank(keyword) && !magicEntity.getName().contains(keyword) && !apiInfo.getPath().contains(keyword)){
|
||||
continue;
|
||||
}
|
||||
|
||||
vo.setId(magicEntity.getId());
|
||||
vo.setType("api");
|
||||
vo.setParentId(magicEntity.getGroupId());
|
||||
vo.setName(magicEntity.getName());
|
||||
String groupPath = StringUtils.isEmpty(node.getPath()) ? StringPool.EMPTY : node.getPath();
|
||||
|
||||
vo.setPath(groupPath + apiInfo.getPath());
|
||||
vo.setMethod(apiInfo.getMethod());
|
||||
|
||||
treeVoList.add(vo);
|
||||
}
|
||||
|
||||
|
||||
if (treeNode.getChildren().size() > 0) {
|
||||
treeVoList.addAll(buildTreeData(treeNode.getChildren(), keyword));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return treeVoList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建 分组树结构
|
||||
*
|
||||
* @param treeNodes
|
||||
* @return
|
||||
*/
|
||||
private void buildGroupTreeData(List<MagicApiGroupTreeVo> treeVoList, List<TreeNode<Group>> treeNodes) {
|
||||
|
||||
for (TreeNode<Group> treeNode : treeNodes) {
|
||||
Group node = treeNode.getNode();
|
||||
|
||||
MagicApiGroupTreeVo groupVo = new MagicApiGroupTreeVo();
|
||||
|
||||
groupVo.setId(node.getId());
|
||||
groupVo.setParentId(node.getParentId());
|
||||
groupVo.setName(node.getName());
|
||||
|
||||
treeVoList.add(groupVo);
|
||||
List<TreeNode<Group>> children = treeNode.getChildren();
|
||||
if (CollectionUtils.isNotEmpty(children)) {
|
||||
buildGroupTreeData(treeVoList, children);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,77 @@
|
||||
package com.xjrsoft.module.magicapi.utils;
|
||||
|
||||
import cn.dev33.satoken.session.SaSession;
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.hutool.core.lang.TypeReference;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
import com.xjrsoft.common.constant.GlobalConstant;
|
||||
import com.xjrsoft.common.utils.RedisUtil;
|
||||
import com.xjrsoft.module.organization.dto.DepartmentDto;
|
||||
import com.xjrsoft.module.organization.dto.UserDeptRelationDto;
|
||||
import com.xjrsoft.module.organization.dto.UserDto;
|
||||
import com.xjrsoft.module.workflow.constant.WorkflowConstant;
|
||||
import com.xjrsoft.module.workflow.model.ApiRequestParamsConfig;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author: yjw
|
||||
* @since: 2025/3/17
|
||||
*/
|
||||
public class MagicApiUtil {
|
||||
|
||||
public static void initApiParams(Map<String, Object> processParam, Map<String, Object> varMap, Map<String, Object> params, ApiRequestParamsConfig requestParamsConfig) {
|
||||
if (Objects.equals(requestParamsConfig.getAssignmentType(), "value")) { //值
|
||||
params.put(requestParamsConfig.getName(), requestParamsConfig.getValue());
|
||||
} else if (Objects.equals(requestParamsConfig.getAssignmentType(), "processParameter")) { //流程参数
|
||||
params.put(requestParamsConfig.getName(), processParam.get(requestParamsConfig.getConfig()));
|
||||
} else if (Objects.equals(requestParamsConfig.getAssignmentType(), "originator")) {//发起人信息
|
||||
dealApiParam(requestParamsConfig,params,varMap);
|
||||
} else {//表单数据
|
||||
//使用3下划线切割
|
||||
String[] split = requestParamsConfig.getConfig().split(StringPool.UNDERSCORE + StringPool.UNDERSCORE + StringPool.UNDERSCORE);
|
||||
String formKey = split[1];
|
||||
Map<String, Object> formData = MapUtil.get(varMap, formKey, new TypeReference<Map<String, Object>>() {
|
||||
});
|
||||
Object fieldValue = MapUtil.get(formData, split[2], Object.class);
|
||||
params.put(requestParamsConfig.getName(), fieldValue);
|
||||
}
|
||||
}
|
||||
|
||||
private static void dealApiParam(ApiRequestParamsConfig requestParamsConfig, Map<String, Object> params, Map<String, Object> varMap){
|
||||
Long startUserId;
|
||||
if (CollectionUtils.isEmpty(varMap)) {//为空就是发起时的数据
|
||||
//如果是拿发起人的数据,作为流程参数,发起和重新发起赋值,使用当前登录人的信息,如果是其它节点,使用流程的发起人数据信息
|
||||
SaSession tokenSession = StpUtil.getTokenSession();
|
||||
UserDto user = tokenSession.get(GlobalConstant.LOGIN_USER_INFO_KEY, new UserDto());
|
||||
startUserId = user.getId();
|
||||
}else {
|
||||
startUserId = MapUtil.get(varMap, WorkflowConstant.PROCESS_START_USER_ID_KEY, Long.class);
|
||||
}
|
||||
//如果是设置的发起人
|
||||
if (requestParamsConfig.getConfig().contains("initiator_id")) {
|
||||
params.put(requestParamsConfig.getName(), startUserId);
|
||||
}
|
||||
//组织架构名称
|
||||
if (requestParamsConfig.getConfig().contains("initiator_dept_name")) {
|
||||
RedisUtil redisUtil = SpringUtil.getBean(RedisUtil.class);
|
||||
List<UserDeptRelationDto> userDeptRelations = redisUtil.get(GlobalConstant.USER_DEPT_RELATION_CACHE_KEY, new TypeReference<List<UserDeptRelationDto>>() {
|
||||
});
|
||||
List<DepartmentDto> departmentList = redisUtil.get(GlobalConstant.DEP_CACHE_KEY, new TypeReference<List<DepartmentDto>>() {
|
||||
});
|
||||
List<UserDeptRelationDto> startUserDeptRelation = userDeptRelations.stream().filter(x -> x.getUserId().equals(startUserId)).collect(Collectors.toList());
|
||||
|
||||
List<Long> allDeptIds = startUserDeptRelation.stream().map(UserDeptRelationDto::getDeptId).collect(Collectors.toList());
|
||||
|
||||
List<DepartmentDto> allDept = departmentList.stream().filter(x -> allDeptIds.contains(x.getId())).collect(Collectors.toList());
|
||||
|
||||
params.put(requestParamsConfig.getName(), allDept.stream().map(DepartmentDto::getName).collect(Collectors.joining(",")));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,87 @@
|
||||
package com.xjrsoft.module.workflow.client;
|
||||
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import com.xjrsoft.common.constant.GlobalConstant;
|
||||
import com.xjrsoft.module.workflow.dto.WorkflowBusinessInvokeDto;
|
||||
import io.swagger.annotations.Api;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author: tzx
|
||||
* @Date: 2023/10/10 17:43
|
||||
*/
|
||||
@Api(hidden = true)
|
||||
@RestController
|
||||
@RequestMapping(GlobalConstant.CLIENT_API_PRE + GlobalConstant.MAGICAPI_MODULE_PREFIX + "/invoke")
|
||||
@AllArgsConstructor
|
||||
public class WorkflowBusinessClientImpl implements IWorkflowBusinessClient {
|
||||
|
||||
/**
|
||||
* 统一调用方法
|
||||
*
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@PostMapping("/invoke")
|
||||
@Override
|
||||
public Boolean invoke(@RequestBody @Valid WorkflowBusinessInvokeDto dto) {
|
||||
String classNameAndMethodName = dto.getClassNameAndMethodName();
|
||||
try {
|
||||
// 分割类名和方法名
|
||||
String[] parts = classNameAndMethodName.split("\\.");
|
||||
if (parts.length < 2) {
|
||||
throw new IllegalArgumentException("Invalid format: className.methodName");
|
||||
}
|
||||
String className = String.join(".", java.util.Arrays.copyOf(parts, parts.length - 1));
|
||||
String methodName = parts[parts.length - 1];
|
||||
|
||||
// 动态加载类
|
||||
Class<?> clazz = Class.forName(className);
|
||||
|
||||
// 获取方法的参数类型
|
||||
List<Object> args = dto.getArgs();
|
||||
Class<?>[] parameterTypes = new Class[args.size()];
|
||||
for (int i = 0; i < dto.getArgs().size(); i++) {
|
||||
if (dto.getArgs().get(i) instanceof HashMap) {
|
||||
parameterTypes[i] = Map.class;
|
||||
} else {
|
||||
parameterTypes[i] = args.get(i).getClass();
|
||||
}
|
||||
}
|
||||
|
||||
// 获取方法对象
|
||||
Method method = clazz.getDeclaredMethod(methodName, parameterTypes);
|
||||
method.setAccessible(true); // 确保可以访问私有方法
|
||||
|
||||
// 判断是否为静态方法
|
||||
boolean isStatic = java.lang.reflect.Modifier.isStatic(method.getModifiers());
|
||||
|
||||
// 调用方法
|
||||
if (isStatic) {
|
||||
return (Boolean) method.invoke(null, args.toArray()); // 静态方法,传入 null
|
||||
} else {
|
||||
Object bean = SpringUtil.getBean(className);
|
||||
if (bean != null) {
|
||||
Method methodBean = bean.getClass().getMethod(methodName, parameterTypes);
|
||||
return (Boolean) methodBean.invoke(bean, args.toArray());
|
||||
} else {
|
||||
Object instance = clazz.getDeclaredConstructor().newInstance(); // 创建实例
|
||||
return (Boolean) method.invoke(instance, args.toArray()); // 实例方法,传入实例
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("Failed to invoke method: " + classNameAndMethodName, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
6
facade-service/src/main/resources/banner.txt
Normal file
6
facade-service/src/main/resources/banner.txt
Normal file
@ -0,0 +1,6 @@
|
||||
██╗ ██╗ ██╗██████╗ ███████╗ ██████╗ ███████╗████████╗
|
||||
╚██╗██╔╝ ██║██╔══██╗██╔════╝██╔═══██╗██╔════╝╚══██╔══╝
|
||||
╚███╔╝ ██║██████╔╝███████╗██║ ██║█████╗ ██║
|
||||
██╔██╗ ██ ██║██╔══██╗╚════██║██║ ██║██╔══╝ ██║
|
||||
██╔╝ ██╗╚█████╔╝██║ ██║███████║╚██████╔╝██║ ██║
|
||||
╚═╝ ╚═╝ ╚════╝ ╚═╝ ╚═╝╚══════╝ ╚═════╝ ╚═╝ ╚═╝
|
||||
51
facade-service/src/main/resources/bootstrap.yml
Normal file
51
facade-service/src/main/resources/bootstrap.yml
Normal file
@ -0,0 +1,51 @@
|
||||
spring:
|
||||
application:
|
||||
name: facade-service
|
||||
main:
|
||||
allow-bean-definition-overriding: true
|
||||
|
||||
cloud:
|
||||
nacos: #nacos监控
|
||||
config:
|
||||
server-addr: 10.0.252.1:8848 # nacos 配置中心地址
|
||||
namespace: ITC-MS
|
||||
group: DNE
|
||||
username: nacos
|
||||
password: ABcd1234@
|
||||
file-extension: yml # 默认配置 ${spring.application.name}-${spring.profiles.active}.${file-extension}
|
||||
extension-configs:
|
||||
- data-id: global.yml
|
||||
refresh: true
|
||||
group: DNE
|
||||
|
||||
- data-id: discovery.yml
|
||||
refresh: true
|
||||
group: DNE
|
||||
|
||||
- data-id: datasource.yml
|
||||
refresh: true
|
||||
group: DNE
|
||||
|
||||
- data-id: seata.yml
|
||||
refresh: true
|
||||
group: DNE
|
||||
|
||||
- data-id: redis.yml
|
||||
refresh: true
|
||||
group: DNE
|
||||
|
||||
- data-id: magic-api.yml
|
||||
refresh: true
|
||||
group: DNE
|
||||
|
||||
- data-id: sa-token.yml
|
||||
refresh: true
|
||||
group: DNE
|
||||
|
||||
- data-id: camunda.yml
|
||||
refresh: true
|
||||
group: DNE
|
||||
|
||||
- data-id: sentinel.yml
|
||||
refresh: true
|
||||
group: DNE
|
||||
Binary file not shown.
BIN
facade-service/src/main/resources/lib/kingbase8-8.6.0.jar
Normal file
BIN
facade-service/src/main/resources/lib/kingbase8-8.6.0.jar
Normal file
Binary file not shown.
BIN
facade-service/src/main/resources/lib/ojdbc7.jar
Normal file
BIN
facade-service/src/main/resources/lib/ojdbc7.jar
Normal file
Binary file not shown.
BIN
facade-service/src/main/resources/lib/taobao-sdk-java-auto.jar
Normal file
BIN
facade-service/src/main/resources/lib/taobao-sdk-java-auto.jar
Normal file
Binary file not shown.
108
facade-service/src/main/resources/logback.xml
Normal file
108
facade-service/src/main/resources/logback.xml
Normal file
@ -0,0 +1,108 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration>
|
||||
<!--<include resource="org/springframework/boot/logging/logback/base.xml" />-->
|
||||
|
||||
<!-- 日志存放路径 -->
|
||||
<property name="log.path" value="./logs" />
|
||||
<!-- 日志输出格式 -->
|
||||
<property name="log.pattern" value="[%d{yyyy-MM-dd HH:mm:ss.SSS}][fcd2-ma][%-5p][%t][%c.%M:%L] %msg%xEx%n" />
|
||||
|
||||
<!-- 控制台输出 -->
|
||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 系统日志输出 -->
|
||||
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/sys-info.log</file>
|
||||
<!-- 循环政策:基于时间创建日志文件 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 日志文件名格式 -->
|
||||
<fileNamePattern>${log.path}/sys-info.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<!-- 过滤的级别 -->
|
||||
<level>INFO</level>
|
||||
<!-- 匹配时的操作:接收(记录) -->
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/sys-error.log</file>
|
||||
<!-- 循环政策:基于时间创建日志文件 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 日志文件名格式 -->
|
||||
<fileNamePattern>${log.path}/sys-error.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<!-- 过滤的级别 -->
|
||||
<level>ERROR</level>
|
||||
<!-- 匹配时的操作:接收(记录) -->
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<!-- 用户访问日志输出 -->
|
||||
<appender name="sys-user" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/sys-user.log</file>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 按天回滚 daily -->
|
||||
<fileNamePattern>${log.path}/sys-user.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!--系统操作日志-->
|
||||
<root level="info">
|
||||
<appender-ref ref="console" />
|
||||
<appender-ref ref="file_info" />
|
||||
<appender-ref ref="file_error" />
|
||||
</root>
|
||||
|
||||
<!--系统用户操作日志-->
|
||||
<logger name="sys-user" level="info">
|
||||
<appender-ref ref="sys-user"/>
|
||||
</logger>
|
||||
<!-- 系统模块日志级别控制 -->
|
||||
<!--<logger name="com.xjrsoft" level="info" />-->
|
||||
<!-- Spring日志级别控制 -->
|
||||
<!--<logger name="org.springframework" level="info" />
|
||||
<logger name="org.springframework.web" level="INFO"/>
|
||||
<logger name="org.springboot.sample" level="TRACE" />-->
|
||||
|
||||
<!-- 开发、测试环境 -->
|
||||
<springProfile name="dev,test">
|
||||
<logger name="org.springframework.web" level="INFO"/>
|
||||
<logger name="org.springboot.sample" level="INFO" />
|
||||
<logger name="com.xjrsoft" level="DEBUG" />
|
||||
</springProfile>
|
||||
|
||||
<!-- 生产环境 -->
|
||||
<springProfile name="prod">
|
||||
<logger name="org.springframework.web" level="ERROR"/>
|
||||
<logger name="org.springboot.sample" level="ERROR" />
|
||||
<logger name="com.xjrsoft" level="ERROR" />
|
||||
</springProfile>
|
||||
|
||||
</configuration>
|
||||
21
facade-service/src/main/resources/magic-editor-config.js
Normal file
21
facade-service/src/main/resources/magic-editor-config.js
Normal file
@ -0,0 +1,21 @@
|
||||
var MAGIC_EDITOR_CONFIG = {
|
||||
title: 'Admin Web IDE',
|
||||
header: {
|
||||
skin: true, // 屏蔽皮肤按钮
|
||||
document: false, // 屏蔽文档按钮
|
||||
repo: false, // 屏蔽gitee和github
|
||||
qqGroup: false // 屏蔽加入QQ群
|
||||
},
|
||||
// 其它配置参考本页中其它配置项
|
||||
request: {
|
||||
beforeSend: function (config) {
|
||||
// console.log('请求设置', window.location.href);
|
||||
config.headers.Authorization = "Bearer " + window.location.href.split('Authorization=')[1];
|
||||
return config;
|
||||
},
|
||||
onError: function (err) {
|
||||
// console.log('请求出错');
|
||||
return Promise.reject(err)
|
||||
}
|
||||
},
|
||||
}
|
||||
4
facade-service/src/main/resources/spy.properties
Normal file
4
facade-service/src/main/resources/spy.properties
Normal file
@ -0,0 +1,4 @@
|
||||
# spy.properties
|
||||
driverlist=com.kingbase8.Driver
|
||||
appender=com.p6spy.engine.spy.appender.Slf4JLogger
|
||||
logMessageFormat=com.xjrsoft.common.handler.P6spySqlLogHandler
|
||||
72
package.xml
Normal file
72
package.xml
Normal file
@ -0,0 +1,72 @@
|
||||
<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd">
|
||||
|
||||
<!--
|
||||
assembly 打包配置更多配置可参考官方文档:
|
||||
http://maven.apache.org/plugins/maven-assembly-plugin/assembly.html
|
||||
-->
|
||||
|
||||
<id>release</id>
|
||||
|
||||
<!--
|
||||
设置打包格式,可同时设置多种格式,常用格式有:dir、zip、tar、tar.gz
|
||||
dir 格式便于在本地测试打包结果
|
||||
zip 格式便于 windows 系统下解压运行
|
||||
tar、tar.gz 格式便于 linux 系统下解压运行
|
||||
-->
|
||||
<formats>
|
||||
<!-- <format>dir</format> -->
|
||||
<!-- <format>zip</format> -->
|
||||
<!-- <format>tar.gz</format> -->
|
||||
</formats>
|
||||
|
||||
<!-- 打 zip 设置为 true 时,会在 zip 包中生成一个根目录,打 dir 时设置为 false 少层目录 -->
|
||||
<includeBaseDirectory>true</includeBaseDirectory>
|
||||
|
||||
<fileSets>
|
||||
<!-- src/main/resources 全部 copy 到 config 目录下 -->
|
||||
<fileSet>
|
||||
<directory>${basedir}/src/main/resources</directory>
|
||||
<outputDirectory>config</outputDirectory>
|
||||
</fileSet>
|
||||
|
||||
<fileSet>
|
||||
<directory>${basedir}/src/main/resources/lib</directory>
|
||||
<outputDirectory>lib</outputDirectory>
|
||||
</fileSet>
|
||||
|
||||
<!-- src/main/webapp 全部 copy 到 webapp 目录下 -->
|
||||
<fileSet>
|
||||
<directory>${basedir}/src/main/webapp</directory>
|
||||
<outputDirectory>webapp</outputDirectory>
|
||||
<excludes>
|
||||
<exclude>WEB-INF</exclude>
|
||||
<exclude>WEB-INF/web.xml</exclude>
|
||||
</excludes>
|
||||
</fileSet>
|
||||
|
||||
<!-- 项目根下面的脚本文件 copy 到根目录下 -->
|
||||
<fileSet>
|
||||
<directory>${basedir}</directory>
|
||||
<outputDirectory></outputDirectory>
|
||||
<!-- 脚本文件在 linux 下的权限设为 755,无需 chmod 可直接运行 -->
|
||||
<fileMode>755</fileMode>
|
||||
<includes>
|
||||
<include>*.sh</include>
|
||||
<include>*.bat</include>
|
||||
</includes>
|
||||
</fileSet>
|
||||
</fileSets>
|
||||
|
||||
<!-- 依赖的 jar 包 copy 到 lib 目录下 -->
|
||||
<dependencySets>
|
||||
<dependencySet>
|
||||
<outputDirectory>lib</outputDirectory>
|
||||
</dependencySet>
|
||||
</dependencySets>
|
||||
|
||||
</assembly>
|
||||
|
||||
|
||||
|
||||
6
script/20250410/新增配置验证码和blockIp的系统配置项的sql.sql
Normal file
6
script/20250410/新增配置验证码和blockIp的系统配置项的sql.sql
Normal file
@ -0,0 +1,6 @@
|
||||
INSERT INTO xjr_system_config
|
||||
(id, code, "name", value, remark, create_date, create_user_id, modify_date, modify_user_id, delete_mark, enabled_mark, tenant_id)
|
||||
VALUES(1909523692669673474, 'checkErrorLoginCaptchaPriv', '登录验证码配置', '{"checkErrorLoginCaptcha":"Y","checkErrorLoginCaptchaCount":3}', '登录验证码开启配置,true 为打开,主要功能是如果checkErrorLoginCaptchaCount=0 每次登录都需要验证码。如果checkErrorLoginCaptchaCount>0 既失败多少次后需要验证码', '2025-04-08 16:28:20.249', 1000000000000000000, '2025-04-10 10:33:18.426', 1000000000000000000, 0, 1, NULL);
|
||||
INSERT INTO xjr_system_config
|
||||
(id, code, "name", value, remark, create_date, create_user_id, modify_date, modify_user_id, delete_mark, enabled_mark, tenant_id)
|
||||
VALUES(1910134795422154754, 'checkErrorLoginBlockIpPriv', '登录错误开启ip拦截开关', '{"checkErrorLoginBlockIp":"N","checkErrorLoginBlockIpCount":20,"checkErrorLoginBlockIpRestoreTime":1}', '登录错误开启ip拦截开关checkErrorLoginBlockIp 配置Y为打开,N为关闭, checkErrorLoginBlockIpCount为最大次数, checkErrorLoginBlockIpRestoreTime为ip拦截的恢复时间(小时)使用', '2025-04-10 08:56:38.477', 1000000000000000000, '2025-04-10 14:51:58.972', 1000000000000000000, 0, 1, NULL);
|
||||
5
script/20250422/草稿表加字段.sql
Normal file
5
script/20250422/草稿表加字段.sql
Normal file
@ -0,0 +1,5 @@
|
||||
ALTER TABLE xjr_workflow_draft
|
||||
ADD COLUMN process_id VARCHAR(50);
|
||||
|
||||
COMMENT ON COLUMN xjr_workflow_draft.process_id
|
||||
IS '流程id';
|
||||
BIN
script/nacos_config_export_20250428101111.zip
Normal file
BIN
script/nacos_config_export_20250428101111.zip
Normal file
Binary file not shown.
70268
script/人大金仓全库脚本20250401.sql
Normal file
70268
script/人大金仓全库脚本20250401.sql
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user