1.初始化版本,2.引入thirdpart模块,引入canteen模块,初始化菜品分类,spu

This commit is contained in:
zjf committed 2024-12-06 16:54:30 +08:00
commit aff77150d6
1595 files changed
+168833

No files matched your search

+18
View File
@@ -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
+22
View File
@@ -0,0 +1,22 @@
项目描述 ....
| 姓名 | 角色 | 时间 |
| ---- | ---- |---------|
| xxx | 开发 | 2023-01 |
| | | |
| | | |
```
项目根目录
├── xxx-api -- 业务接口(实体,DTO,utils,feign接口)
├── xxx-biz -- 业务实现[默认服务端口 : 6060]
```
+42
View File
@@ -0,0 +1,42 @@
<?xml version="1.0"?>
<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.bsd</groupId>
<artifactId>pjcloud-thirdparty</artifactId>
<version>5.7.0</version>
</parent>
<artifactId>pjcloud-thirdparty-api</artifactId>
<dependencies>
<!-- 连表查询注解 -->
<dependency>
<groupId>com.github.yulichang</groupId>
<artifactId>mybatis-plus-join-annotation</artifactId>
</dependency>
<!--core 工具类-->
<dependency>
<groupId>com.bsd</groupId>
<artifactId>pjcloud-common-core</artifactId>
</dependency>
<!--mybatis plus extension,包含了mybatis plus core-->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-extension</artifactId>
</dependency>
<!--feign 工具类-->
<dependency>
<groupId>com.bsd</groupId>
<artifactId>pjcloud-common-feign</artifactId>
</dependency>
<!-- excel 导入导出 -->
<dependency>
<groupId>com.bsd</groupId>
<artifactId>pjcloud-common-excel</artifactId>
</dependency>
</dependencies>
</project>
@@ -0,0 +1,51 @@
package com.bsd.pjcloud.thirdparty.dto;
public class ApiResponse<T> {
private String code;
private String description;
private T data; // 泛型类型
private String timestamp;
// Getters and Setters
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public T getData() {
return data;
}
public void setData(T data) {
this.data = data;
}
public String getTimestamp() {
return timestamp;
}
public void setTimestamp(String timestamp) {
this.timestamp = timestamp;
}
@Override
public String toString() {
return "ApiResponse{" +
"code='" + code + '\'' +
", description='" + description + '\'' +
", data=" + data +
", timestamp='" + timestamp + '\'' +
'}';
}
}
@@ -0,0 +1,34 @@
package com.bsd.pjcloud.thirdparty.dto;
import lombok.Data;
import java.util.List;
@Data
public class DeptUserResponse {
private String code;
private String description;
private Data data;
private String timestamp;
@lombok.Data
public static class Data {
private int total;
private List<DeptUser> rows;
}
@lombok.Data
public static class DeptUser {
private String organizationId;
private String deptId;
private String userId;
private String username;
private String nickName;
private String dingtalkEmployeeCode;
}
}
@@ -0,0 +1,13 @@
package com.bsd.pjcloud.thirdparty.dto;
import lombok.Data;
import java.util.List;
@Data
public class OrgUserDTO {
private String code;
private String description;
private List<OrganizationDTO> data;
private String timestamp;
}
@@ -0,0 +1,10 @@
package com.bsd.pjcloud.thirdparty.dto;
import lombok.Data;
@Data
public class OrganizationDTO {
private String organizationId;
private String orgnizationName;
}
@@ -0,0 +1,33 @@
package com.bsd.pjcloud.thirdparty.dto;
import lombok.Data;
import java.util.List;
@Data
public class SubDeptDTO {
private String code;
private String description;
private Data data;
private String timestamp;
@lombok.Data
public static class Data {
private int total;
private List<SubDept> rows;
}
@lombok.Data
public static class SubDept {
private String organizationId;
private String parentId;
private String deptId;
private String deptName;
private String dingtalkOrgCode;
private String regionCode;
}
}
@@ -0,0 +1,33 @@
package com.bsd.pjcloud.thirdparty.dto;
import lombok.Data;
import java.util.List;
@Data
public class SubDeptResponse {
private String code;
private String description;
private Data data;
private String timestamp;
@lombok.Data
public static class Data {
private int total;
private List<SubDept> rows;
}
@lombok.Data
public static class SubDept {
private Long organizationId;
private Long deptId;
private String deptName;
private Long parentId;
private List<SubDept> subDepts; // 新增子部门列表属性
}
}
@@ -0,0 +1,11 @@
package com.bsd.pjcloud.thirdparty.dto;
import lombok.Data;
@Data
public class TokenDTO {
private String access_token;
private String scope;
private String token_type;
private long expires_in;
}
@@ -0,0 +1,101 @@
package com.bsd.pjcloud.thirdparty.dto;
public class UserDetailResponse {
private String code;
private String description;
private Data data;
private String timestamp;
// Getters and Setters
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Data getData() {
return data;
}
public void setData(Data data) {
this.data = data;
}
public String getTimestamp() {
return timestamp;
}
public void setTimestamp(String timestamp) {
this.timestamp = timestamp;
}
// Inner class to represent the data structure
public static class Data {
private String organizationId;
private String deptId;
private String userId;
private String username;
private String nickName;
private String mobile;
// Getters and Setters
public String getOrganizationId() {
return organizationId;
}
public void setOrganizationId(String organizationId) {
this.organizationId = organizationId;
}
public String getDeptId() {
return deptId;
}
public void setDeptId(String deptId) {
this.deptId = deptId;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getNickName() {
return nickName;
}
public void setNickName(String nickName) {
this.nickName = nickName;
}
public String getMobile() {
return mobile;
}
public void setMobile(String mobile) {
this.mobile = mobile;
}
}
}
@@ -0,0 +1,11 @@
package com.bsd.pjcloud.thirdparty.dto;
import lombok.Data;
@Data
public class ZZDResponse {
private String code;
private String description;
private String data;
}
@@ -0,0 +1,17 @@
package com.bsd.pjcloud.thirdparty.dto;
import lombok.Data;
@Data
public class ZZDUser {
private String username;
private int organizationId;
private int userId;
private String nickName;
private String mobile;
private String regionCode;
private String ext;
private String employeeCode;
}
@@ -0,0 +1,28 @@
package com.bsd.pjcloud.thirdparty.dto;
import lombok.Data;
@Data
public class ZZDUserDTO {
private String username;
private int organizationId;
private int userId;
private String nickName;
private String mobile;
private String regionCode;
private Ext ext;
@Data
public class Ext {
private String employeeCode;
private String organizationCode;
private String nickNameCn;
private String openid;
private String realmId;
private String mobile;
//以下字段,诗画独有
private String headImgUrl;
}
}
+134
View File
@@ -0,0 +1,134 @@
<?xml version="1.0"?>
<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.bsd</groupId>
<artifactId>pjcloud-thirdparty</artifactId>
<version>5.7.0</version>
</parent>
<artifactId>pjcloud-thirdparty-biz</artifactId>
<dependencies>
<!--必备: undertow容器-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-undertow</artifactId>
</dependency>
<!--必备: spring boot web-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!--必备: 注册中心客户端-->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>
<!--必备: 配置中心客户端-->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
</dependency>
<!--必备: 操作数据源相关-->
<dependency>
<groupId>com.bsd</groupId>
<artifactId>pjcloud-common-data</artifactId>
</dependency>
<!--必备:pigx安全模块-->
<dependency>
<groupId>com.bsd</groupId>
<artifactId>pjcloud-common-security</artifactId>
</dependency>
<!--必备:xss 过滤模块-->
<dependency>
<groupId>com.bsd</groupId>
<artifactId>pjcloud-common-xss</artifactId>
</dependency>
<!--必备: sentinel 依赖-->
<dependency>
<groupId>com.bsd</groupId>
<artifactId>pjcloud-common-sentinel</artifactId>
</dependency>
<!--必备: feign 依赖-->
<dependency>
<groupId>com.bsd</groupId>
<artifactId>pjcloud-common-feign</artifactId>
</dependency>
<!--必备: 依赖api模块-->
<dependency>
<groupId>com.bsd</groupId>
<artifactId>pjcloud-thirdparty-api</artifactId>
<version>5.7.0</version>
</dependency>
<!--必备: log 依赖-->
<dependency>
<groupId>com.bsd</groupId>
<artifactId>pjcloud-common-log</artifactId>
</dependency>
<!--选配: mybatis 依赖 -->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-spring-boot3-starter</artifactId>
</dependency>
<!--选配: druid 连接池 -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-3-starter</artifactId>
</dependency>
<!--选配: mysql 数据库驱动 -->
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
</dependency>
<!--选配: swagger文档-->
<dependency>
<groupId>com.bsd</groupId>
<artifactId>pjcloud-common-swagger</artifactId>
</dependency>
<!--测试: spring boot test-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
</dependency>
</dependencies>
<profiles>
<profile>
<id>cloud</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
<configuration>
<loaderImplementation>CLASSIC</loaderImplementation>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<configuration>
<skip>false</skip>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>boot</id>
</profile>
</profiles>
</project>
@@ -0,0 +1,24 @@
package com.bsd.pjcloud.thirdparty;
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
* <p>
* 项目启动类
*/
@EnableOpenApi("pjcloud-thirdparty")
@EnablePjcloudFeignClients
@EnableDiscoveryClient
@EnablePjcloudResourceServer
@SpringBootApplication
public class ThirdPartyApp {
public static void main(String[] args) {
SpringApplication.run(com.bsd.pjcloud.thirdparty.ThirdPartyApp.class, args);
}
}
@@ -0,0 +1,42 @@
package com.bsd.pjcloud.thirdparty.config;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
@Component
@ConfigurationProperties(prefix = "oauth2.client")
@Data
public class OAuth2ClientConfig {
private String tokenUrl;
private String redirectUri;
private String appKey;
private String appSecret;
private String scope;
private String grantType;
private String orgUrl;
private String deptUrl;
private String deptUsersUrl;
private String userDetailUrl;
/**
* 浙政钉获取token的接口
*/
private String zzdTokenUrl;
/**
* 诗画江南的token接口
*/
private String shjnTokenUrl;
/**
* 浙政钉跟诗画的获取用户信息的url
*/
private String zzdShUserInfoUrl;
}
@@ -0,0 +1,118 @@
package com.bsd.pjcloud.thirdparty.controller;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ArrayUtil;
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.excel.annotation.ResponseExcel;
import com.bsd.pjcloud.common.log.annotation.SysLog;
import com.bsd.pjcloud.thirdparty.entity.ThirdPartyDeptEntity;
import com.bsd.pjcloud.thirdparty.service.ThirdPartyDeptService;
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.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 联通底座部门表
*
* @author pigx
* @date 2024-12-03 12:43:57
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/thirdPartyDept" )
@Tag(description = "thirdPartyDept" , name = "联通底座部门表管理" )
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
public class ThirdPartyDeptController {
private final ThirdPartyDeptService thirdPartyDeptService;
/**
* 分页查询
* @param page 分页对象
* @param thirdPartyDept 联通底座部门表
* @return
*/
@Operation(summary = "分页查询" , description = "分页查询" )
@GetMapping("/page" )
@PreAuthorize("@pms.hasPermission('thirdparty_thirdPartyDept_view')" )
public R getThirdPartyDeptPage(@ParameterObject Page page, @ParameterObject ThirdPartyDeptEntity thirdPartyDept) {
LambdaQueryWrapper<ThirdPartyDeptEntity> wrapper = Wrappers.lambdaQuery();
return R.ok(thirdPartyDeptService.page(page, wrapper));
}
/**
* 通过id查询联通底座部门表
* @param id id
* @return R
*/
@Operation(summary = "通过id查询" , description = "通过id查询" )
@GetMapping("/{id}" )
@PreAuthorize("@pms.hasPermission('thirdparty_thirdPartyDept_view')" )
public R getById(@PathVariable("id" ) Long id) {
return R.ok(thirdPartyDeptService.getById(id));
}
/**
* 新增联通底座部门表
* @param thirdPartyDept 联通底座部门表
* @return R
*/
@Operation(summary = "新增联通底座部门表" , description = "新增联通底座部门表" )
@SysLog("新增联通底座部门表" )
@PostMapping
@PreAuthorize("@pms.hasPermission('thirdparty_thirdPartyDept_add')" )
public R save(@RequestBody ThirdPartyDeptEntity thirdPartyDept) {
return R.ok(thirdPartyDeptService.save(thirdPartyDept));
}
/**
* 修改联通底座部门表
* @param thirdPartyDept 联通底座部门表
* @return R
*/
@Operation(summary = "修改联通底座部门表" , description = "修改联通底座部门表" )
@SysLog("修改联通底座部门表" )
@PutMapping
@PreAuthorize("@pms.hasPermission('thirdparty_thirdPartyDept_edit')" )
public R updateById(@RequestBody ThirdPartyDeptEntity thirdPartyDept) {
return R.ok(thirdPartyDeptService.updateById(thirdPartyDept));
}
/**
* 通过id删除联通底座部门表
* @param ids id列表
* @return R
*/
@Operation(summary = "通过id删除联通底座部门表" , description = "通过id删除联通底座部门表" )
@SysLog("通过id删除联通底座部门表" )
@DeleteMapping
@PreAuthorize("@pms.hasPermission('thirdparty_thirdPartyDept_del')" )
public R removeById(@RequestBody Long[] ids) {
return R.ok(thirdPartyDeptService.removeBatchByIds(CollUtil.toList(ids)));
}
/**
* 导出excel 表格
* @param thirdPartyDept 查询条件
* @param ids 导出指定ID
* @return excel 文件流
*/
@ResponseExcel
@GetMapping("/export")
@PreAuthorize("@pms.hasPermission('thirdparty_thirdPartyDept_export')" )
public List<ThirdPartyDeptEntity> export(ThirdPartyDeptEntity thirdPartyDept,Long[] ids) {
return thirdPartyDeptService.list(Wrappers.lambdaQuery(thirdPartyDept).in(ArrayUtil.isNotEmpty(ids), ThirdPartyDeptEntity::getId, ids));
}
}
@@ -0,0 +1,118 @@
package com.bsd.pjcloud.thirdparty.controller;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ArrayUtil;
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.excel.annotation.ResponseExcel;
import com.bsd.pjcloud.common.log.annotation.SysLog;
import com.bsd.pjcloud.thirdparty.entity.ThirdPartyUserEntity;
import com.bsd.pjcloud.thirdparty.service.ThirdPartyUserService;
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.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 浙政钉用户表
*
* @author zjf
* @date 2024-12-03 13:38:08
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/thirdPartyUser" )
@Tag(description = "thirdPartyUser" , name = "浙政钉用户表管理" )
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
public class ThirdPartyUserController {
private final ThirdPartyUserService thirdPartyUserService;
/**
* 分页查询
* @param page 分页对象
* @param thirdPartyUser 浙政钉用户表
* @return
*/
@Operation(summary = "分页查询" , description = "分页查询" )
@GetMapping("/page" )
@PreAuthorize("@pms.hasPermission('thirdparty_thirdPartyUser_view')" )
public R getThirdPartyUserPage(@ParameterObject Page page, @ParameterObject ThirdPartyUserEntity thirdPartyUser) {
LambdaQueryWrapper<ThirdPartyUserEntity> wrapper = Wrappers.lambdaQuery();
return R.ok(thirdPartyUserService.page(page, wrapper));
}
/**
* 通过id查询浙政钉用户表
* @param id id
* @return R
*/
@Operation(summary = "通过id查询" , description = "通过id查询" )
@GetMapping("/{id}" )
@PreAuthorize("@pms.hasPermission('thirdparty_thirdPartyUser_view')" )
public R getById(@PathVariable("id" ) Long id) {
return R.ok(thirdPartyUserService.getById(id));
}
/**
* 新增浙政钉用户表
* @param thirdPartyUser 浙政钉用户表
* @return R
*/
@Operation(summary = "新增浙政钉用户表" , description = "新增浙政钉用户表" )
@SysLog("新增浙政钉用户表" )
@PostMapping
@PreAuthorize("@pms.hasPermission('thirdparty_thirdPartyUser_add')" )
public R save(@RequestBody ThirdPartyUserEntity thirdPartyUser) {
return R.ok(thirdPartyUserService.save(thirdPartyUser));
}
/**
* 修改浙政钉用户表
* @param thirdPartyUser 浙政钉用户表
* @return R
*/
@Operation(summary = "修改浙政钉用户表" , description = "修改浙政钉用户表" )
@SysLog("修改浙政钉用户表" )
@PutMapping
@PreAuthorize("@pms.hasPermission('thirdparty_thirdPartyUser_edit')" )
public R updateById(@RequestBody ThirdPartyUserEntity thirdPartyUser) {
return R.ok(thirdPartyUserService.updateById(thirdPartyUser));
}
/**
* 通过id删除浙政钉用户表
* @param ids id列表
* @return R
*/
@Operation(summary = "通过id删除浙政钉用户表" , description = "通过id删除浙政钉用户表" )
@SysLog("通过id删除浙政钉用户表" )
@DeleteMapping
@PreAuthorize("@pms.hasPermission('thirdparty_thirdPartyUser_del')" )
public R removeById(@RequestBody Long[] ids) {
return R.ok(thirdPartyUserService.removeBatchByIds(CollUtil.toList(ids)));
}
/**
* 导出excel 表格
* @param thirdPartyUser 查询条件
* @param ids 导出指定ID
* @return excel 文件流
*/
@ResponseExcel
@GetMapping("/export")
@PreAuthorize("@pms.hasPermission('thirdparty_thirdPartyUser_export')" )
public List<ThirdPartyUserEntity> export(ThirdPartyUserEntity thirdPartyUser,Long[] ids) {
return thirdPartyUserService.list(Wrappers.lambdaQuery(thirdPartyUser).in(ArrayUtil.isNotEmpty(ids), ThirdPartyUserEntity::getId, ids));
}
}
@@ -0,0 +1,102 @@
package com.bsd.pjcloud.thirdparty.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 pigx
* @date 2024-12-03 12:43:57
*/
@Data
@TenantTable
@TableName("third_party_dept")
@EqualsAndHashCode(callSuper = true)
@Schema(description = "联通底座部门表")
public class ThirdPartyDeptEntity extends Model<ThirdPartyDeptEntity> {
/**
* id主键
*/
@TableId(type = IdType.ASSIGN_ID)
@Schema(description="id主键")
private Long id;
/**
* 部门名称
*/
@Schema(description="部门名称")
private String deptName;
/**
* 是否删除
*/
@Schema(description="是否删除")
private Boolean deleted;
/**
* 浙政钉组织编号
*/
@Schema(description="浙政钉组织编号")
private String dingtalkOrgCode;
/**
* 组织区域编码
*/
@Schema(description="组织区域编码")
private String regionCode;
/**
* 父id
*/
@Schema(description="父id")
private Long parentId;
/**
* 部门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;
}
@@ -0,0 +1,109 @@
package com.bsd.pjcloud.thirdparty.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 zjf
* @date 2024-12-03 13:38:08
*/
@Data
@TenantTable
@TableName("third_party_user")
@EqualsAndHashCode(callSuper = true)
@Schema(description = "浙政钉用户表")
public class ThirdPartyUserEntity extends Model<ThirdPartyUserEntity> {
/**
* id
*/
@TableId(type = IdType.ASSIGN_ID)
@Schema(description="id")
private Long id;
/**
* 组织名称
*/
@Schema(description="组织名称")
private String orgnizationId;
/**
* 是否删除
*/
@Schema(description="是否删除")
private Boolean deleted;
/**
* 部门id
*/
@Schema(description="部门id")
private Long deptId;
/**
* 用户id
*/
@Schema(description="用户id")
private Long userId;
/**
* 用户名
*/
@Schema(description="用户名")
private String username;
/**
* 昵称
*/
@Schema(description="昵称")
@TableField("nickName")
private String nickName;
/**
* 员工浙政钉编码
*/
@Schema(description="员工浙政钉编码")
private String dingtalkEmployeeCode;
/**
* 创建者
*/
@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;
}
@@ -0,0 +1,15 @@
package com.bsd.pjcloud.thirdparty.mapper;
import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
import com.bsd.pjcloud.thirdparty.entity.ThirdPartyDeptEntity;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface ThirdPartyDeptMapper extends PjcloudBaseMapper<ThirdPartyDeptEntity> {
/**
* 清空表
*/
void truncateTable();
}
@@ -0,0 +1,15 @@
package com.bsd.pjcloud.thirdparty.mapper;
import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
import com.bsd.pjcloud.thirdparty.entity.ThirdPartyUserEntity;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface ThirdPartyUserMapper extends PjcloudBaseMapper<ThirdPartyUserEntity> {
/**
* 清空表
*/
void truncateTable();
}
@@ -0,0 +1,13 @@
package com.bsd.pjcloud.thirdparty.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.bsd.pjcloud.thirdparty.entity.ThirdPartyDeptEntity;
public interface ThirdPartyDeptService extends IService<ThirdPartyDeptEntity> {
/**
* 删除所有数据
*/
void truncateTable();
}
@@ -0,0 +1,516 @@
package com.bsd.pjcloud.thirdparty.service;
import com.bsd.pjcloud.thirdparty.config.OAuth2ClientConfig;
import com.bsd.pjcloud.thirdparty.dto.*;
import com.bsd.pjcloud.thirdparty.entity.ThirdPartyDeptEntity;
import com.bsd.pjcloud.thirdparty.entity.ThirdPartyUserEntity;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.*;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.DigestUtils;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.util.StringUtils;
import org.springframework.web.client.RestTemplate;
import java.nio.charset.StandardCharsets;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
@Slf4j
@Service
@RequiredArgsConstructor
public class ThirdPartyOAuth2Service {
private static final ConcurrentHashMap<String, TokenDTO> tokenCache = new ConcurrentHashMap<>();
private static final RestTemplate restTemplate = new RestTemplate();
@Autowired
private OAuth2ClientConfig config;
//private final String baseUrl = "http://123.156.178.21:10898";
private final String baseUrl = "https://jgsw.pj.gov.cn";
private static final int TOKEN_EXPIRATION_TIME = 7100;
private final int MAX_PAGE_SIZE = 100; // 每次最多获取 100 条
private final ThirdPartyDeptService partyDeptService;
private final ThirdPartyUserService partyUserService;
public TokenDTO getAccessToken() {
TokenDTO cachedToken = tokenCache.get("access_token");
if (cachedToken != null && System.currentTimeMillis() < cachedToken.getExpires_in()) {
return cachedToken;
}
// 将 appKey 和 appSecret 拼接并进行 Base64 编码
String auth = config.getAppKey() + ":" + config.getAppSecret();
String encodedAuth = Base64.getEncoder().encodeToString(auth.getBytes());
// 设置请求头,使用 Basic Auth
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
headers.set("Authorization", "Basic " + encodedAuth); // Basic 认证
// 构造请求体
MultiValueMap<String, String> requestBody = new LinkedMultiValueMap<>();
requestBody.add("grant_type", "client_credentials");
requestBody.add("scope", config.getScope()); // 授权域(scope)
// 构造 HTTP 请求
HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<>(requestBody, headers);
// 发送 POST 请求,并将响应映射到 TokenResponse 类
ResponseEntity<TokenDTO> response = restTemplate.exchange(
baseUrl + config.getTokenUrl(), // token URL
HttpMethod.POST,
requestEntity,
TokenDTO.class // 期望返回的类型
);
// 返回 TokenResponse 对象或错误信息
if (response.getStatusCode() == HttpStatus.OK) {
TokenDTO token = response.getBody();
// 设置过期时间
long expirationTime = System.currentTimeMillis() + TOKEN_EXPIRATION_TIME * 1000;
token.setExpires_in(expirationTime);
tokenCache.put("access_token", token);
return token; // 返回封装的 TokenResponse 对象
} else {
System.out.println("Error: " + response.getStatusCode());
return null; // 错误时返回 null
}
}
public OrgUserDTO getAccessibleOrgs() {
// 获取 Bearer Token
String accessToken = getAccessToken().getAccess_token();
// 设置请求头,使用 Bearer Token
HttpHeaders headers = new HttpHeaders();
headers.set("Authorization", "Bearer " + accessToken);
// 构造 HTTP 请求
HttpEntity<String> requestEntity = new HttpEntity<>(headers);
// 发送 GET 请求,并将响应映射到 OrgUserResponse 类
ResponseEntity<OrgUserDTO> response = restTemplate.exchange(
baseUrl + config.getOrgUrl(),
HttpMethod.GET,
requestEntity,
OrgUserDTO.class
);
// 返回封装的响应数据
return response.getBody();
}
// 递归获取部门树
public SubDeptResponse.Data getDeptTree(Long organizationId, Long deptId) {
// 从根部门开始递归获取子部门
return fetchDeptTree(organizationId, deptId);
}
// 递归获取子部门
private SubDeptResponse.Data fetchDeptTree(Long organizationId, Long deptId) {
// 获取 Bearer Token
String accessToken = getAccessToken().getAccess_token();
// 设置请求头
HttpHeaders headers = new HttpHeaders();
headers.set("Authorization", "Bearer " + accessToken);
// 初始化分页参数
int pageNum = 1;
int pageSize = 100; // 最大为100
// 构造 URL
String url = String.format("%s?pageNum=%d&pageSize=%d&organizationId=%s&deptId=%s",
baseUrl + config.getDeptUrl(), pageNum, pageSize, organizationId, deptId);
// 构造 HTTP 请求
HttpEntity<String> requestEntity = new HttpEntity<>(headers);
// 发送 GET 请求并获取响应
ResponseEntity<SubDeptResponse> response = restTemplate.exchange(
url,
HttpMethod.GET,
requestEntity,
SubDeptResponse.class
);
// 获取响应数据
SubDeptResponse responseBody = response.getBody();
if (responseBody.getData().getTotal() == 0 || responseBody == null) {
System.out.println("为空");
return null; // 没有子部门,返回空
}
SubDeptResponse.Data data = responseBody.getData();
List<SubDeptResponse.SubDept> subDepts = data.getRows(); // 当前部门的子部门列表
// 递归获取每个子部门的子部门
for (SubDeptResponse.SubDept subDept : subDepts) {
// 递归获取子部门
System.out.println("请求" + subDept.getDeptId());
SubDeptResponse.Data subDeptTree = fetchDeptTree(subDept.getOrganizationId(), subDept.getDeptId());
if (subDeptTree != null) {
subDept.setSubDepts(subDeptTree.getRows()); // 将子部门列表设置到当前部门
}
}
//返回
System.out.println("结束");
return data;
}
// 递归获取部门树并插入数据库
@Transactional
public void getDeptTreeAndSave(Long organizationId, Long deptId) {
//先清除数据
partyDeptService.truncateTable();
partyUserService.truncateTable();
// 从根部门开始递归获取子部门并保存
fetchAndSaveDeptTree(organizationId, deptId, 1); // 从第一页开始
}
// 递归获取子部门,并处理分页和数据库插入逻辑
@Async
protected void fetchAndSaveDeptTree(Long organizationId, Long deptId, int pageNum) {
String accessToken = getAccessToken().getAccess_token();
HttpHeaders headers = new HttpHeaders();
headers.set("Authorization", "Bearer " + accessToken);
String url = String.format("%s?pageNum=%d&pageSize=%d&organizationId=%s&deptId=%s",
baseUrl + config.getDeptUrl(), pageNum, MAX_PAGE_SIZE, organizationId, deptId);
// 构造 HTTP 请求
HttpEntity<String> requestEntity = new HttpEntity<>(headers);
// 发送 GET 请求并获取响应
ResponseEntity<SubDeptResponse> response = restTemplate.exchange(
url,
HttpMethod.GET,
requestEntity,
SubDeptResponse.class
);
// 获取响应数据
SubDeptResponse responseBody = response.getBody();
if (responseBody == null || responseBody.getData().getTotal() == 0) {
System.out.println("没有更多子部门");
return; // 没有子部门或数据为空,结束递归
}
SubDeptResponse.Data data = responseBody.getData();
List<SubDeptResponse.SubDept> subDepts = data.getRows(); // 当前页的子部门列表
// 批量插入部门和用户数据
List<ThirdPartyDeptEntity> deptSaveList = new ArrayList<>();
List<ThirdPartyUserEntity> userSaveList = new ArrayList<>();
// 遍历当前页的子部门
for (SubDeptResponse.SubDept subDept : subDepts) {
// 打印当前处理的部门 ID
System.out.println("处理部门 ID:" + subDept.getDeptId());
// 将当前子部门插入数据库
ThirdPartyDeptEntity partyDeptSaveReqVO = new ThirdPartyDeptEntity();
BeanUtils.copyProperties(subDept, partyDeptSaveReqVO);
deptSaveList.add(partyDeptSaveReqVO);
// partyDeptService.createPartyDept(partyDeptSaveReqVO);
//获取部门用户
DeptUserResponse deptUserResponse = getDeptUsers(pageNum, MAX_PAGE_SIZE, subDept.getDeptId());
deptUserResponse.getData().getRows().forEach(item -> {
ThirdPartyUserEntity partyUserSaveReqVO = new ThirdPartyUserEntity();
BeanUtils.copyProperties(item, partyUserSaveReqVO);
partyUserSaveReqVO.setOrgnizationId("2");
partyUserSaveReqVO.setUserId(Long.valueOf(item.getUserId()));
partyUserSaveReqVO.setDeptId(Long.valueOf(item.getDeptId()));
// partyUserService.createPartyUser(partyUserSaveReqVO);
userSaveList.add(partyUserSaveReqVO);
});
// 递归获取子部门的子部门
fetchAndSaveDeptTree(subDept.getOrganizationId(), subDept.getDeptId(), 1); // 从第一页开始获取子部门
}
// 批量保存部门和用户数据
if (!deptSaveList.isEmpty()) {
partyDeptService.saveBatch(deptSaveList);
}
if (!userSaveList.isEmpty()) {
partyUserService.saveBatch(userSaveList);
}
// 检查是否还有下一页
if (subDepts.size() == MAX_PAGE_SIZE) {
// 继续获取下一页的子部门
fetchAndSaveDeptTree(organizationId, deptId, pageNum + 1);
}
// 所有分页获取完成,递归结束
System.out.println("处理完成部门 ID:" + deptId);
}
public SubDeptDTO getSubDepts(int pageNum, int pageSize, String organizationId, String deptId) {
RestTemplate restTemplate = new RestTemplate();
// 获取 Bearer Token
String accessToken = getAccessToken().getAccess_token();
// 设置请求头,使用 Bearer Token
HttpHeaders headers = new HttpHeaders();
headers.set("Authorization", "Bearer " + accessToken);
// 构造 URL 参数
String url = String.format("%s?pageNum=%d&pageSize=%d&organizationId=%s&deptId=%s", baseUrl + config.getDeptUrl(),
pageNum, pageSize, organizationId, deptId);
// 构造 HTTP 请求
HttpEntity<String> requestEntity = new HttpEntity<>(headers);
// 发送 GET 请求,并将响应映射到 SubDeptResponse 类
ResponseEntity<SubDeptDTO> response = restTemplate.exchange(
url, // 动态构造的 URL
HttpMethod.GET,
requestEntity,
SubDeptDTO.class
);
// 返回封装的响应数据
return response.getBody();
}
public DeptUserResponse getDeptUsers(int pageNum, int pageSize, Long deptId) {
RestTemplate restTemplate = new RestTemplate();
// 获取 Bearer Token
String accessToken = getAccessToken().getAccess_token();
// 设置请求头,使用 Bearer Token
HttpHeaders headers = new HttpHeaders();
headers.set("Authorization", "Bearer " + accessToken);
// 构造 URL 参数
String url = String.format("%s?pageNum=%d&pageSize=%d&deptId=%s", baseUrl + config.getDeptUsersUrl(),
pageNum, pageSize, deptId);
// 构造 HTTP 请求
HttpEntity<String> requestEntity = new HttpEntity<>(headers);
// 发送 GET 请求,并将响应映射到 DeptUserResponse 类
ResponseEntity<DeptUserResponse> response = restTemplate.exchange(
url, // 动态构造的 URL
HttpMethod.GET,
requestEntity,
DeptUserResponse.class
);
// 返回封装的响应数据
return response.getBody();
}
public UserDetailResponse getUserDetail(String userId) {
String accessToken = getAccessToken().getAccess_token();
// 设置请求头,使用 Bearer Token
HttpHeaders headers = new HttpHeaders();
headers.set("Authorization", "Bearer " + accessToken);
// 构造 URL
String url = String.format("%s?userId=%s", baseUrl + config.getUserDetailUrl(), userId);
// 构造 HTTP 请求
HttpEntity<String> requestEntity = new HttpEntity<>(headers);
// 发送 GET 请求,并将响应映射到 UserDetailResponse 类
ResponseEntity<UserDetailResponse> response = restTemplate.exchange(
url, // 动态构造的 URL
HttpMethod.GET,
requestEntity,
UserDetailResponse.class
);
// 返回封装的响应数据
return response.getBody();
}
/**
* 获取浙政钉的token
* @param token
* @return
*/
public ZZDUserDTO zzdsso(String token) {
// String zzdToken = getZZDToken(token);
//todo 根据是诗画还是浙政钉分别去获取不同的token
//使用token获取当前登录人的信息(浙政钉和诗画的在一起)
// ZZDUserDTO zzdUser = getZZDUserInfo(zzdToken);
ZZDUserDTO zzdUser = getZZDUserInfo(token);
return zzdUser;
}
public String getZZDToken(String token) {
String url = baseUrl+config.getZzdTokenUrl()+token;
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
HttpEntity<String> requestEntity = new HttpEntity<>(null, headers);
ResponseEntity<ZZDResponse> response = restTemplate.exchange(
url, HttpMethod.POST, requestEntity, ZZDResponse.class
);
String zzdToken = response.getBody().getData();
return zzdToken;
}
/**
* 浙证钉和诗画工用
* @param zzdToken
* @return
*/
public ZZDUserDTO getZZDUserInfo(String zzdToken) {
// 构建请求URL
String url = baseUrl + config.getZzdShUserInfoUrl()+"?token=" + zzdToken;
// 获取 Bearer Token
String accessToken = getAccessToken().getAccess_token();
// 设置请求头
HttpHeaders headers = new HttpHeaders();
headers.set("Authorization", "Bearer " + accessToken);
HttpEntity<String> requestEntity = new HttpEntity<>(headers);
// 构建请求实体
// 发送请求
ParameterizedTypeReference<ApiResponse<ZZDUserDTO>> responseType = new ParameterizedTypeReference<ApiResponse<ZZDUserDTO>>() {};
ResponseEntity<ApiResponse<ZZDUserDTO>> response = restTemplate.exchange(
url, HttpMethod.GET, requestEntity, responseType
);
if (response.getBody().getCode().equals("-1")){
throw new RuntimeException("获取浙政钉用户信息失败");
}
return response.getBody().getData();
}
/**
* 诗画江南的请求token
* @param accountId
* @param sessionId
* @return
*/
public String getSHJNToken(String accountId,String sessionId){
// 构建请求URL
String url = baseUrl + config.getShjnTokenUrl()+"?accountId=" + accountId + "&sessionId=" + sessionId;
ResponseEntity<ApiResponse<String>> response = restTemplate.exchange(
url, HttpMethod.POST, null, new ParameterizedTypeReference<ApiResponse<String>>() {}
);
return response.getBody().getData();
}
public String getUserDetails(String accountId, String sessionId, String connectNo, String appkey, String appsecret) {
String timestamp = System.currentTimeMillis() + "";
String noncestr = timestamp;
// 构造请求参数
Map<String, String> params = new HashMap<>();
params.put("connectNo", connectNo);
params.put("sessionId", sessionId);
// 签名生成
String signature = generateSignature(timestamp, appkey, appsecret, noncestr, params);
params.put("signature", signature);
params.put("timestamp", timestamp);
params.put("appkey", appkey);
params.put("noncestr", noncestr);
// 构造 URL
String url = String.format("https://vcms.tmuyun.com/openapi/v2/%s/detail?%s", accountId, mapToUrl(params));
// 构造请求头
HttpHeaders headers = new HttpHeaders();
headers.set("Content-Type", "application/json");
// 构造请求实体
HttpEntity<String> entity = new HttpEntity<>(headers);
// 发起请求
ResponseEntity<String> response = restTemplate.exchange(url, HttpMethod.GET, entity, String.class);
// 返回响应体
return response.getBody();
}
/**
* 生成签名
*/
private String generateSignature(String timestamp, String appkey, String appsecret, String noncestr, Map<String, String> params) {
// 移除不需要参与签名的字段
params.remove("appkey");
params.remove("timestamp");
params.remove("noncestr");
params.remove("signature");
// 参数名按照ASCII码表升序排序
String[] keys = params.keySet().toArray(new String[0]);
Arrays.sort(keys);
// 按照排序拼接参数值
StringBuilder paramBuffer = new StringBuilder();
for (String key : keys) {
String value = params.get(key);
if (StringUtils.hasLength(value) && !"0".equals(value)) {
paramBuffer.append("&&").append(value);
}
}
// 拼接最终签名串
String rawSignature = String.format("%s&&%s&&%s&&%s", timestamp, appkey, appsecret, noncestr) + paramBuffer.toString();
return DigestUtils.md5DigestAsHex(rawSignature.getBytes(StandardCharsets.UTF_8));
}
/**
* 将Map转换为URL参数字符串
*/
private String mapToUrl(Map<String, String> map) {
StringBuilder sb = new StringBuilder();
for (Map.Entry<String, String> entry : map.entrySet()) {
sb.append(entry.getKey()).append("=").append(entry.getValue()).append("&");
}
if (sb.length() > 0) {
sb.deleteCharAt(sb.length() - 1);
}
return sb.toString();
}
/**
* 诗画
* @param accountId
* @param sessionId
* @return
*/
public ZZDUserDTO shjnsso(String accountId, String sessionId) {
String shjnToken = getSHJNToken(accountId, sessionId);
return getZZDUserInfo(shjnToken);
}
}
@@ -0,0 +1,13 @@
package com.bsd.pjcloud.thirdparty.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.bsd.pjcloud.thirdparty.entity.ThirdPartyUserEntity;
public interface ThirdPartyUserService extends IService<ThirdPartyUserEntity> {
/**
* 删除所有数据
*/
void truncateTable();
}
@@ -0,0 +1,20 @@
package com.bsd.pjcloud.thirdparty.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bsd.pjcloud.thirdparty.entity.ThirdPartyDeptEntity;
import com.bsd.pjcloud.thirdparty.mapper.ThirdPartyDeptMapper;
import com.bsd.pjcloud.thirdparty.service.ThirdPartyDeptService;
import org.springframework.stereotype.Service;
/**
* 联通底座部门表
*
* @author pigx
* @date 2024-12-03 12:43:57
*/
@Service
public class ThirdPartyDeptServiceImpl extends ServiceImpl<ThirdPartyDeptMapper, ThirdPartyDeptEntity> implements ThirdPartyDeptService {
@Override
public void truncateTable() {
baseMapper.truncateTable();
}
}
@@ -0,0 +1,21 @@
package com.bsd.pjcloud.thirdparty.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bsd.pjcloud.thirdparty.entity.ThirdPartyUserEntity;
import com.bsd.pjcloud.thirdparty.mapper.ThirdPartyUserMapper;
import com.bsd.pjcloud.thirdparty.service.ThirdPartyUserService;
import org.springframework.stereotype.Service;
/**
* 浙政钉用户表
*
* @author zjf
* @date 2024-12-03 13:38:08
*/
@Service
public class ThirdPartyUserServiceImpl extends ServiceImpl<ThirdPartyUserMapper, ThirdPartyUserEntity> implements ThirdPartyUserService {
@Override
public void truncateTable() {
baseMapper.truncateTable();
}
}
@@ -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/pjcloud_demo?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true
@@ -0,0 +1,70 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
小技巧: 在根pom里面设置统一存放路径,统一管理方便维护
<properties>
<log-path>/Users/lengleng</log-path>
</properties>
1. 其他模块加日志输出,直接copy本文件放在resources 目录即可
2. 注意修改 <property name="${log-path}/log.path" value=""/> 的value模块
-->
<configuration debug="false" scan="false">
<property name="log.path" value="logs/${project.artifactId}"/>
<!-- 彩色日志格式 -->
<property name="CONSOLE_LOG_PATTERN"
value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>
<!-- 彩色日志依赖的渲染类 -->
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter"/>
<conversionRule conversionWord="wex"
converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter"/>
<conversionRule conversionWord="wEx"
converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter"/>
<!-- Console log output -->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
</encoder>
</appender>
<!-- Log file debug output -->
<appender name="debug" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/debug.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>${log.path}/%d{yyyy-MM, aux}/debug.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
<maxFileSize>50MB</maxFileSize>
<maxHistory>30</maxHistory>
</rollingPolicy>
<encoder>
<pattern>%date [%thread] %-5level [%logger{50}] %file:%line - %msg%n</pattern>
</encoder>
</appender>
<!-- Log file error output -->
<appender name="error" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/error.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>${log.path}/%d{yyyy-MM}/error.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
<maxFileSize>50MB</maxFileSize>
<maxHistory>30</maxHistory>
</rollingPolicy>
<encoder>
<pattern>%date [%thread] %-5level [%logger{50}] %file:%line - %msg%n</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>ERROR</level>
</filter>
</appender>
<logger name="org.activiti.engine.impl.db" level="DEBUG">
<appender-ref ref="debug"/>
</logger>
<!--nacos 心跳 INFO 屏蔽-->
<logger name="com.alibaba.nacos" level="OFF">
<appender-ref ref="error"/>
</logger>
<!-- Level: FATAL 0 ERROR 3 WARN 4 INFO 6 DEBUG 7 -->
<root level="INFO">
<appender-ref ref="console"/>
<appender-ref ref="debug"/>
</root>
</configuration>
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.pig4cloud.pigx.thirdparty.mapper.ThirdPartyDeptMapper">
<resultMap id="thirdPartyDeptMap" type="com.pig4cloud.pigx.thirdparty.entity.ThirdPartyDeptEntity">
<id property="id" column="id"/>
<result property="deptName" column="dept_name"/>
<result property="deleted" column="deleted"/>
<result property="dingtalkOrgCode" column="dingtalk_org_code"/>
<result property="regionCode" column="region_code"/>
<result property="parentId" column="parent_id"/>
<result property="deptId" column="dept_id"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="tenantId" column="tenant_id"/>
</resultMap>
<delete id="truncateTable">
TRUNCATE TABLE third_party_dept;
</delete>
</mapper>
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.pig4cloud.pigx.thirdparty.mapper.ThirdPartyUserMapper">
<resultMap id="thirdPartyUserMap" type="com.pig4cloud.pigx.thirdparty.entity.ThirdPartyUserEntity">
<id property="id" column="id"/>
<result property="orgnizationId" column="orgnization_id"/>
<result property="deleted" column="deleted"/>
<result property="deptId" column="dept_id"/>
<result property="userId" column="user_id"/>
<result property="username" column="username"/>
<result property="nickName" column="nickName"/>
<result property="dingtalkEmployeeCode" column="dingtalk_employee_code"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="tenantId" column="tenant_id"/>
</resultMap>
<delete id="truncateTable">
TRUNCATE TABLE third_party_user;
</delete>
</mapper>
+21
View File
@@ -0,0 +1,21 @@
<?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.bsd</groupId>
<artifactId>pjcloud</artifactId>
<version>5.7.0</version>
</parent>
<artifactId>pjcloud-thirdparty</artifactId>
<packaging>pom</packaging>
<!--项目子模块-->
<modules>
<module>pjcloud-thirdparty-api</module>
<module>pjcloud-thirdparty-biz</module>
</modules>
</project>