Przeglądaj źródła

oa pms 免登录跳转

zhangcl 2 dni temu
rodzic
commit
62b0bed2b8
24 zmienionych plików z 1339 dodań i 0 usunięć
  1. 32 0
      yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/AuthController.java
  2. 28 0
      yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/vo/AuthOaLoginReqVO.java
  3. 42 0
      yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/oa/IotOaCompanyPageReqVO.java
  4. 36 0
      yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/oa/IotOaCompanyRespVO.java
  5. 31 0
      yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/oa/IotOaCompanySaveReqVO.java
  6. 45 0
      yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/oa/IotOaDepartPageReqVO.java
  7. 39 0
      yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/oa/IotOaDepartRespVO.java
  8. 34 0
      yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/oa/IotOaDepartSaveReqVO.java
  9. 80 0
      yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/oa/IotOaPersonPageReqVO.java
  10. 74 0
      yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/oa/IotOaPersonRespVO.java
  11. 67 0
      yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/oa/IotOaPersonSaveReqVO.java
  12. 54 0
      yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/oa/IotOaCompanyDO.java
  13. 58 0
      yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/oa/IotOaDepartDO.java
  14. 102 0
      yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/oa/IotOaPersonDO.java
  15. 30 0
      yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/oa/IotOaCompanyMapper.java
  16. 31 0
      yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/oa/IotOaDepartMapper.java
  17. 42 0
      yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/oa/IotOaPersonMapper.java
  18. 24 0
      yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/job/OaPeopleJob.java
  19. 44 0
      yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/oa/E9ApiTokenUtil.java
  20. 316 0
      yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/oa/OaFlow.java
  21. 18 0
      yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/oa/OaVo.java
  22. 43 0
      yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/oa/SslSkippingRestTemplate.java
  23. 13 0
      yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthService.java
  24. 56 0
      yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthServiceImpl.java

+ 32 - 0
yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/AuthController.java

@@ -13,6 +13,7 @@ import cn.iocoder.yudao.module.system.dal.dataobject.permission.MenuDO;
 import cn.iocoder.yudao.module.system.dal.dataobject.permission.RoleDO;
 import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
 import cn.iocoder.yudao.module.system.enums.logger.LoginLogTypeEnum;
+import cn.iocoder.yudao.module.system.oa.OaFlow;
 import cn.iocoder.yudao.module.system.service.auth.AdminAuthService;
 import cn.iocoder.yudao.module.system.service.permission.MenuService;
 import cn.iocoder.yudao.module.system.service.permission.PermissionService;
@@ -24,6 +25,7 @@ import io.swagger.v3.oas.annotations.Parameter;
 import io.swagger.v3.oas.annotations.Parameters;
 import io.swagger.v3.oas.annotations.tags.Tag;
 import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
@@ -62,6 +64,9 @@ public class AuthController {
     @Resource
     private SecurityProperties securityProperties;
 
+    @Autowired
+    private OaFlow oaFlow;
+
     @PostMapping("/login")
     @PermitAll
     @Operation(summary = "使用账号密码登录")
@@ -69,6 +74,19 @@ public class AuthController {
         return success(authService.login(reqVO));
     }
 
+    @PermitAll
+    @GetMapping("/oa/register")
+    public void oaRegister() {
+        try {
+            // oaFlow.getCompany();
+//            oaFlow.getDepart();
+//            oaFlow.getPerson();
+            oaFlow.getPerson();
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+
     @PostMapping("/logout")
     @PermitAll
     @Operation(summary = "登出系统")
@@ -171,4 +189,18 @@ public class AuthController {
         return success(authService.socialLogin(reqVO));
     }
 
+    @PostMapping("/oaSsoToken")
+    @PermitAll
+    @Operation(summary = "根据当前登录人工号 获取随机验证码", description = "快捷登录OA")
+    public CommonResult<String> oaSsoToken(@RequestBody @Valid AuthOaLoginReqVO reqVO) {
+        return success(authService.oaSsoToken(reqVO));
+    }
+
+    @PostMapping("/pmsSsoToken")
+    @PermitAll
+    @Operation(summary = "根据当前登录人工号 获取随机验证码", description = "快捷登录OA")
+    public CommonResult<String> pmsSsoToken(@RequestBody @Valid AuthOaLoginReqVO reqVO) {
+        return success(authService.pmsSsoToken(reqVO));
+    }
+
 }

+ 28 - 0
yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/vo/AuthOaLoginReqVO.java

@@ -0,0 +1,28 @@
+package cn.iocoder.yudao.module.system.controller.admin.auth.vo;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import javax.validation.constraints.NotEmpty;
+
+@Schema(description = "管理后台 - 社交绑定登录 Request VO,使用 code 授权码 + 账号密码")
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+@Builder
+public class AuthOaLoginReqVO {
+
+    @Schema(description = "社交平台的类型,参见 UserSocialTypeEnum 枚举值", requiredMode = Schema.RequiredMode.REQUIRED, example = "10")
+    private Integer type;
+
+    @Schema(description = "工号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
+    @NotEmpty(message = "工号不能为空")
+    private String username;
+
+    @Schema(description = "state", requiredMode = Schema.RequiredMode.REQUIRED, example = "9b2ffbc1-7425-4155-9894-9d5c08541d62")
+    private String state;
+
+}

+ 42 - 0
yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/oa/IotOaCompanyPageReqVO.java

@@ -0,0 +1,42 @@
+package cn.iocoder.yudao.module.system.controller.admin.oa;
+
+import cn.iocoder.yudao.framework.common.pojo.PageParam;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.ToString;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.time.LocalDateTime;
+
+import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
+
+@Schema(description = "管理后台 - oa公司分页 Request VO")
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ToString(callSuper = true)
+public class IotOaCompanyPageReqVO extends PageParam {
+
+    @Schema(description = "公司描述")
+    private String subcompanydesc;
+
+    @Schema(description = "公司代码")
+    private String subcompanycode;
+
+    @Schema(description = "无", example = "407")
+    private String supsubcomid;
+
+    @Schema(description = "oaId", example = "27563")
+    private String oaId;
+
+    @Schema(description = "公司名称", example = "赵六")
+    private String subcompanyname;
+
+    @Schema(description = "排序")
+    private String showorder;
+
+    @Schema(description = "创建时间")
+    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
+    private LocalDateTime[] createTime;
+
+}

+ 36 - 0
yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/oa/IotOaCompanyRespVO.java

@@ -0,0 +1,36 @@
+package cn.iocoder.yudao.module.system.controller.admin.oa;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.time.LocalDateTime;
+
+@Schema(description = "管理后台 - oa公司 Response VO")
+@Data
+public class IotOaCompanyRespVO {
+
+    @Schema(description = "主键id", requiredMode = Schema.RequiredMode.REQUIRED, example = "1921")
+    private Long id;
+
+    @Schema(description = "公司描述")
+    private String subcompanydesc;
+
+    @Schema(description = "公司代码")
+    private String subcompanycode;
+
+    @Schema(description = "无", example = "407")
+    private String supsubcomid;
+
+    @Schema(description = "oaId", example = "27563")
+    private String oaId;
+
+    @Schema(description = "公司名称", example = "赵六")
+    private String subcompanyname;
+
+    @Schema(description = "排序")
+    private String showorder;
+
+    @Schema(description = "创建时间")
+    private LocalDateTime createTime;
+
+}

+ 31 - 0
yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/oa/IotOaCompanySaveReqVO.java

@@ -0,0 +1,31 @@
+package cn.iocoder.yudao.module.system.controller.admin.oa;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+@Schema(description = "管理后台 - oa公司新增/修改 Request VO")
+@Data
+public class IotOaCompanySaveReqVO {
+
+    @Schema(description = "主键id", requiredMode = Schema.RequiredMode.REQUIRED, example = "1921")
+    private Long id;
+
+    @Schema(description = "公司描述")
+    private String subcompanydesc;
+
+    @Schema(description = "公司代码")
+    private String subcompanycode;
+
+    @Schema(description = "无", example = "407")
+    private String supsubcomid;
+
+    @Schema(description = "oaId", example = "27563")
+    private String oaId;
+
+    @Schema(description = "公司名称", example = "赵六")
+    private String subcompanyname;
+
+    @Schema(description = "排序")
+    private String showorder;
+
+}

+ 45 - 0
yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/oa/IotOaDepartPageReqVO.java

@@ -0,0 +1,45 @@
+package cn.iocoder.yudao.module.system.controller.admin.oa;
+
+import cn.iocoder.yudao.framework.common.pojo.PageParam;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.ToString;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.time.LocalDateTime;
+
+import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
+
+@Schema(description = "管理后台 - oa部门分页 Request VO")
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ToString(callSuper = true)
+public class IotOaDepartPageReqVO extends PageParam {
+
+    @Schema(description = "无", example = "21826")
+    private String supdepid;
+
+    @Schema(description = "部门描述")
+    private String departmentmark;
+
+    @Schema(description = "部门名称", example = "王五")
+    private String departmentname;
+
+    @Schema(description = "部门编码")
+    private String departmentcode;
+
+    @Schema(description = "oaid", example = "13606")
+    private String oaId;
+
+    @Schema(description = "无")
+    private String subcompanyid1;
+
+    @Schema(description = "排序")
+    private String showorder;
+
+    @Schema(description = "创建时间")
+    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
+    private LocalDateTime[] createTime;
+
+}

+ 39 - 0
yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/oa/IotOaDepartRespVO.java

@@ -0,0 +1,39 @@
+package cn.iocoder.yudao.module.system.controller.admin.oa;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.time.LocalDateTime;
+
+@Schema(description = "管理后台 - oa部门 Response VO")
+@Data
+public class IotOaDepartRespVO {
+
+    @Schema(description = "主键id", requiredMode = Schema.RequiredMode.REQUIRED, example = "27509")
+    private Long id;
+
+    @Schema(description = "无", example = "21826")
+    private String supdepid;
+
+    @Schema(description = "部门描述")
+    private String departmentmark;
+
+    @Schema(description = "部门名称", example = "王五")
+    private String departmentname;
+
+    @Schema(description = "部门编码")
+    private String departmentcode;
+
+    @Schema(description = "oaid", example = "13606")
+    private String oaId;
+
+    @Schema(description = "无")
+    private String subcompanyid1;
+
+    @Schema(description = "排序")
+    private String showorder;
+
+    @Schema(description = "创建时间")
+    private LocalDateTime createTime;
+
+}

+ 34 - 0
yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/oa/IotOaDepartSaveReqVO.java

@@ -0,0 +1,34 @@
+package cn.iocoder.yudao.module.system.controller.admin.oa;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+@Schema(description = "管理后台 - oa部门新增/修改 Request VO")
+@Data
+public class IotOaDepartSaveReqVO {
+
+    @Schema(description = "主键id", requiredMode = Schema.RequiredMode.REQUIRED, example = "27509")
+    private Long id;
+
+    @Schema(description = "无", example = "21826")
+    private String supdepid;
+
+    @Schema(description = "部门描述")
+    private String departmentmark;
+
+    @Schema(description = "部门名称", example = "王五")
+    private String departmentname;
+
+    @Schema(description = "部门编码")
+    private String departmentcode;
+
+    @Schema(description = "oaid", example = "13606")
+    private String oaId;
+
+    @Schema(description = "无")
+    private String subcompanyid1;
+
+    @Schema(description = "排序")
+    private String showorder;
+
+}

+ 80 - 0
yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/oa/IotOaPersonPageReqVO.java

@@ -0,0 +1,80 @@
+package cn.iocoder.yudao.module.system.controller.admin.oa;
+
+import cn.iocoder.yudao.framework.common.pojo.PageParam;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.ToString;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.time.LocalDateTime;
+
+import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
+
+@Schema(description = "管理后台 - oa人员分页 Request VO")
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ToString(callSuper = true)
+public class IotOaPersonPageReqVO extends PageParam {
+
+    @Schema(description = "公司开始日期")
+    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
+    private String[] companystartdate;
+
+    @Schema(description = "所属分部1")
+    private String subcompanyid1;
+
+    @Schema(description = "所属分部名称", example = "张三")
+    private String subcompanyname;
+
+    @Schema(description = "工作序列", example = "王五")
+    private String jobgroupname;
+
+    @Schema(description = "无", example = "11411")
+    private String belongtoid;
+
+    @Schema(description = "所属集团编码")
+    private String subcompanycode;
+
+    @Schema(description = "oaid", example = "32027")
+    private String oaId;
+
+    @Schema(description = "姓名", example = "王五")
+    private String lastname;
+
+    @Schema(description = "合同结束日期")
+    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
+    private String[] enddate;
+
+    @Schema(description = "所属部门名称", example = "芋艿")
+    private String departmentname;
+
+    @Schema(description = "状态", example = "2")
+    private String status;
+
+    @Schema(description = "工作职务", example = "王五")
+    private String jobtitlename;
+
+    @Schema(description = "部门编码")
+    private String departmentcode;
+
+    @Schema(description = "工号")
+    private String workcode;
+
+    @Schema(description = "性别")
+    private String sex;
+
+    @Schema(description = "部门id", example = "12290")
+    private String departmentid;
+
+    @Schema(description = "手机号")
+    private String mobile;
+
+    @Schema(description = "工作地点", example = "22757")
+    private String locationid;
+
+    @Schema(description = "创建时间")
+    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
+    private LocalDateTime[] createTime;
+
+}

+ 74 - 0
yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/oa/IotOaPersonRespVO.java

@@ -0,0 +1,74 @@
+package cn.iocoder.yudao.module.system.controller.admin.oa;
+
+import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.time.LocalDateTime;
+
+@Schema(description = "管理后台 - oa人员 Response VO")
+@Data
+@ExcelIgnoreUnannotated
+public class IotOaPersonRespVO {
+
+    @Schema(description = "主键id", requiredMode = Schema.RequiredMode.REQUIRED, example = "10139")
+    private Long id;
+
+    @Schema(description = "公司开始日期")
+    private String companystartdate;
+
+    @Schema(description = "所属分部1")
+    private String subcompanyid1;
+
+    @Schema(description = "所属分部名称", example = "张三")
+    private String subcompanyname;
+
+    @Schema(description = "工作序列", example = "王五")
+    private String jobgroupname;
+
+    @Schema(description = "无", example = "11411")
+    private String belongtoid;
+
+    @Schema(description = "所属集团编码")
+    private String subcompanycode;
+
+    @Schema(description = "oaid", example = "32027")
+    private String oaId;
+
+    @Schema(description = "姓名", example = "王五")
+    private String lastname;
+
+    @Schema(description = "合同结束日期")
+    private String enddate;
+
+    @Schema(description = "所属部门名称", example = "芋艿")
+    private String departmentname;
+
+    @Schema(description = "状态", example = "2")
+    private String status;
+
+    @Schema(description = "工作职务", example = "王五")
+    private String jobtitlename;
+
+    @Schema(description = "部门编码")
+    private String departmentcode;
+
+    @Schema(description = "工号")
+    private String workcode;
+
+    @Schema(description = "性别")
+    private String sex;
+
+    @Schema(description = "部门id", example = "12290")
+    private String departmentid;
+
+    @Schema(description = "手机号")
+    private String mobile;
+
+    @Schema(description = "工作地点", example = "22757")
+    private String locationid;
+
+    @Schema(description = "创建时间")
+    private LocalDateTime createTime;
+
+}

+ 67 - 0
yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/oa/IotOaPersonSaveReqVO.java

@@ -0,0 +1,67 @@
+package cn.iocoder.yudao.module.system.controller.admin.oa;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+@Schema(description = "管理后台 - oa人员新增/修改 Request VO")
+@Data
+public class IotOaPersonSaveReqVO {
+
+    @Schema(description = "主键id", requiredMode = Schema.RequiredMode.REQUIRED, example = "10139")
+    private Long id;
+
+    @Schema(description = "公司开始日期")
+    private String companystartdate;
+
+    @Schema(description = "所属分部1")
+    private String subcompanyid1;
+
+    @Schema(description = "所属分部名称", example = "张三")
+    private String subcompanyname;
+
+    @Schema(description = "工作序列", example = "王五")
+    private String jobgroupname;
+
+    @Schema(description = "无", example = "11411")
+    private String belongtoid;
+
+    @Schema(description = "所属集团编码")
+    private String subcompanycode;
+
+    @Schema(description = "oaid", example = "32027")
+    private String oaId;
+
+    @Schema(description = "姓名", example = "王五")
+    private String lastname;
+
+    @Schema(description = "合同结束日期")
+    private String enddate;
+
+    @Schema(description = "所属部门名称", example = "芋艿")
+    private String departmentname;
+
+    @Schema(description = "状态", example = "2")
+    private String status;
+
+    @Schema(description = "工作职务", example = "王五")
+    private String jobtitlename;
+
+    @Schema(description = "部门编码")
+    private String departmentcode;
+
+    @Schema(description = "工号")
+    private String workcode;
+
+    @Schema(description = "性别")
+    private String sex;
+
+    @Schema(description = "部门id", example = "12290")
+    private String departmentid;
+
+    @Schema(description = "手机号")
+    private String mobile;
+
+    @Schema(description = "工作地点", example = "22757")
+    private String locationid;
+
+}

+ 54 - 0
yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/oa/IotOaCompanyDO.java

@@ -0,0 +1,54 @@
+package cn.iocoder.yudao.module.system.dal.dataobject.oa;
+
+import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
+import com.baomidou.mybatisplus.annotation.KeySequence;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.*;
+
+/**
+ * oa公司 DO
+ *
+ * @author 超级管理员
+ */
+@TableName("rq_iot_oa_company")
+@KeySequence("rq_iot_oa_company_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ToString(callSuper = true)
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+public class IotOaCompanyDO extends BaseDO {
+
+    /**
+     * 主键id
+     */
+    @TableId
+    private Long id;
+    /**
+     * 公司描述
+     */
+    private String subcompanydesc;
+    /**
+     * 公司代码
+     */
+    private String subcompanycode;
+    /**
+     * 无
+     */
+    private String supsubcomid;
+    /**
+     * oaId
+     */
+    private String oaId;
+    /**
+     * 公司名称
+     */
+    private String subcompanyname;
+    /**
+     * 排序
+     */
+    private String showorder;
+
+}

+ 58 - 0
yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/oa/IotOaDepartDO.java

@@ -0,0 +1,58 @@
+package cn.iocoder.yudao.module.system.dal.dataobject.oa;
+
+import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
+import com.baomidou.mybatisplus.annotation.KeySequence;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.*;
+
+/**
+ * oa部门 DO
+ *
+ * @author 超级管理员
+ */
+@TableName("rq_iot_oa_depart")
+@KeySequence("rq_iot_oa_depart_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ToString(callSuper = true)
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+public class IotOaDepartDO extends BaseDO {
+
+    /**
+     * 主键id
+     */
+    @TableId
+    private Long id;
+    /**
+     * 无
+     */
+    private String supdepid;
+    /**
+     * 部门描述
+     */
+    private String departmentmark;
+    /**
+     * 部门名称
+     */
+    private String departmentname;
+    /**
+     * 部门编码
+     */
+    private String departmentcode;
+    /**
+     * oaid
+     */
+    private String oaId;
+    /**
+     * 无
+     */
+    private String subcompanyid1;
+    /**
+     * 排序
+     */
+    private String showorder;
+
+}

+ 102 - 0
yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/oa/IotOaPersonDO.java

@@ -0,0 +1,102 @@
+package cn.iocoder.yudao.module.system.dal.dataobject.oa;
+
+import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
+import com.baomidou.mybatisplus.annotation.KeySequence;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.*;
+
+/**
+ * oa人员 DO
+ *
+ * @author 超级管理员
+ */
+@TableName("rq_iot_oa_person")
+@KeySequence("rq_iot_oa_person_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ToString(callSuper = true)
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+public class IotOaPersonDO extends BaseDO {
+
+    /**
+     * 主键id
+     */
+    @TableId
+    private Long id;
+    /**
+     * 公司开始日期
+     */
+    private String companystartdate;
+    /**
+     * 所属分部1
+     */
+    private String subcompanyid1;
+    /**
+     * 所属分部名称
+     */
+    private String subcompanyname;
+    /**
+     * 工作序列
+     */
+    private String jobgroupname;
+    /**
+     * 无
+     */
+    private String belongtoid;
+    /**
+     * 所属集团编码
+     */
+    private String subcompanycode;
+    /**
+     * oaid
+     */
+    private String oaId;
+    /**
+     * 姓名
+     */
+    private String lastname;
+    /**
+     * 合同结束日期
+     */
+    private String enddate;
+    /**
+     * 所属部门名称
+     */
+    private String departmentname;
+    /**
+     * 状态
+     */
+    private String status;
+    /**
+     * 工作职务
+     */
+    private String jobtitlename;
+    /**
+     * 部门编码
+     */
+    private String departmentcode;
+    /**
+     * 工号
+     */
+    private String workcode;
+    /**
+     * 性别
+     */
+    private String sex;
+    /**
+     * 部门id
+     */
+    private String departmentid;
+    /**
+     * 手机号
+     */
+    private String mobile;
+    /**
+     * 工作地点
+     */
+    private String locationid;
+
+}

+ 30 - 0
yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/oa/IotOaCompanyMapper.java

@@ -0,0 +1,30 @@
+package cn.iocoder.yudao.module.system.dal.mysql.oa;
+
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
+import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
+import cn.iocoder.yudao.module.system.controller.admin.oa.IotOaCompanyPageReqVO;
+import cn.iocoder.yudao.module.system.dal.dataobject.oa.IotOaCompanyDO;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * oa公司 Mapper
+ *
+ * @author 超级管理员
+ */
+@Mapper
+public interface IotOaCompanyMapper extends BaseMapperX<IotOaCompanyDO> {
+
+    default PageResult<IotOaCompanyDO> selectPage(IotOaCompanyPageReqVO reqVO) {
+        return selectPage(reqVO, new LambdaQueryWrapperX<IotOaCompanyDO>()
+                .eqIfPresent(IotOaCompanyDO::getSubcompanydesc, reqVO.getSubcompanydesc())
+                .eqIfPresent(IotOaCompanyDO::getSubcompanycode, reqVO.getSubcompanycode())
+                .eqIfPresent(IotOaCompanyDO::getSupsubcomid, reqVO.getSupsubcomid())
+                .eqIfPresent(IotOaCompanyDO::getOaId, reqVO.getOaId())
+                .likeIfPresent(IotOaCompanyDO::getSubcompanyname, reqVO.getSubcompanyname())
+                .eqIfPresent(IotOaCompanyDO::getShoworder, reqVO.getShoworder())
+                .betweenIfPresent(IotOaCompanyDO::getCreateTime, reqVO.getCreateTime())
+                .orderByDesc(IotOaCompanyDO::getId));
+    }
+
+}

+ 31 - 0
yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/oa/IotOaDepartMapper.java

@@ -0,0 +1,31 @@
+package cn.iocoder.yudao.module.system.dal.mysql.oa;
+
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
+import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
+import cn.iocoder.yudao.module.system.controller.admin.oa.IotOaDepartPageReqVO;
+import cn.iocoder.yudao.module.system.dal.dataobject.oa.IotOaDepartDO;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * oa部门 Mapper
+ *
+ * @author 超级管理员
+ */
+@Mapper
+public interface IotOaDepartMapper extends BaseMapperX<IotOaDepartDO> {
+
+    default PageResult<IotOaDepartDO> selectPage(IotOaDepartPageReqVO reqVO) {
+        return selectPage(reqVO, new LambdaQueryWrapperX<IotOaDepartDO>()
+                .eqIfPresent(IotOaDepartDO::getSupdepid, reqVO.getSupdepid())
+                .eqIfPresent(IotOaDepartDO::getDepartmentmark, reqVO.getDepartmentmark())
+                .likeIfPresent(IotOaDepartDO::getDepartmentname, reqVO.getDepartmentname())
+                .eqIfPresent(IotOaDepartDO::getDepartmentcode, reqVO.getDepartmentcode())
+                .eqIfPresent(IotOaDepartDO::getOaId, reqVO.getOaId())
+                .eqIfPresent(IotOaDepartDO::getSubcompanyid1, reqVO.getSubcompanyid1())
+                .eqIfPresent(IotOaDepartDO::getShoworder, reqVO.getShoworder())
+                .betweenIfPresent(IotOaDepartDO::getCreateTime, reqVO.getCreateTime())
+                .orderByDesc(IotOaDepartDO::getId));
+    }
+
+}

+ 42 - 0
yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/oa/IotOaPersonMapper.java

@@ -0,0 +1,42 @@
+package cn.iocoder.yudao.module.system.dal.mysql.oa;
+
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
+import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
+import cn.iocoder.yudao.module.system.controller.admin.oa.IotOaPersonPageReqVO;
+import cn.iocoder.yudao.module.system.dal.dataobject.oa.IotOaPersonDO;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * oa人员 Mapper
+ *
+ * @author 超级管理员
+ */
+@Mapper
+public interface IotOaPersonMapper extends BaseMapperX<IotOaPersonDO> {
+
+    default PageResult<IotOaPersonDO> selectPage(IotOaPersonPageReqVO reqVO) {
+        return selectPage(reqVO, new LambdaQueryWrapperX<IotOaPersonDO>()
+                .betweenIfPresent(IotOaPersonDO::getCompanystartdate, reqVO.getCompanystartdate())
+                .eqIfPresent(IotOaPersonDO::getSubcompanyid1, reqVO.getSubcompanyid1())
+                .likeIfPresent(IotOaPersonDO::getSubcompanyname, reqVO.getSubcompanyname())
+                .likeIfPresent(IotOaPersonDO::getJobgroupname, reqVO.getJobgroupname())
+                .eqIfPresent(IotOaPersonDO::getBelongtoid, reqVO.getBelongtoid())
+                .eqIfPresent(IotOaPersonDO::getSubcompanycode, reqVO.getSubcompanycode())
+                .eqIfPresent(IotOaPersonDO::getOaId, reqVO.getOaId())
+                .likeIfPresent(IotOaPersonDO::getLastname, reqVO.getLastname())
+                .betweenIfPresent(IotOaPersonDO::getEnddate, reqVO.getEnddate())
+                .likeIfPresent(IotOaPersonDO::getDepartmentname, reqVO.getDepartmentname())
+                .eqIfPresent(IotOaPersonDO::getStatus, reqVO.getStatus())
+                .likeIfPresent(IotOaPersonDO::getJobtitlename, reqVO.getJobtitlename())
+                .eqIfPresent(IotOaPersonDO::getDepartmentcode, reqVO.getDepartmentcode())
+                .eqIfPresent(IotOaPersonDO::getWorkcode, reqVO.getWorkcode())
+                .eqIfPresent(IotOaPersonDO::getSex, reqVO.getSex())
+                .eqIfPresent(IotOaPersonDO::getDepartmentid, reqVO.getDepartmentid())
+                .eqIfPresent(IotOaPersonDO::getMobile, reqVO.getMobile())
+                .eqIfPresent(IotOaPersonDO::getLocationid, reqVO.getLocationid())
+                .betweenIfPresent(IotOaPersonDO::getCreateTime, reqVO.getCreateTime())
+                .orderByDesc(IotOaPersonDO::getId));
+    }
+
+}

+ 24 - 0
yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/job/OaPeopleJob.java

@@ -0,0 +1,24 @@
+package cn.iocoder.yudao.module.system.job;
+
+import cn.iocoder.yudao.framework.quartz.core.handler.JobHandler;
+import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
+import cn.iocoder.yudao.module.system.oa.OaFlow;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+@Slf4j
+public class OaPeopleJob implements JobHandler {
+    @Autowired
+    private OaFlow oaFlow;
+
+    @Override
+    @TenantIgnore
+    public String execute(String param) throws Exception {
+        oaFlow.getCompany();
+        oaFlow.getDepart();
+        oaFlow.getPerson();
+        return "";
+    }
+}

+ 44 - 0
yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/oa/E9ApiTokenUtil.java

@@ -0,0 +1,44 @@
+package cn.iocoder.yudao.module.system.oa;
+
+import javax.crypto.Cipher;
+import java.security.KeyFactory;
+import java.security.PublicKey;
+import java.security.spec.X509EncodedKeySpec;
+import java.util.Base64;
+
+public class E9ApiTokenUtil {
+    public static String encryptString(String pubkey, String plaintext) {
+        PublicKey publicKey = null;
+        try {
+            publicKey = getFromBase64String(pubkey);
+        }
+        catch (Exception e) {
+            e.printStackTrace();
+        }
+        if (publicKey == null || plaintext == null) {
+            return null;
+        }
+        byte[] data = plaintext.getBytes();
+        try {
+            byte[] en_data = encrypt(publicKey, data);
+            return Base64.getEncoder().encodeToString(en_data);
+        }
+        catch (Exception ex) {
+            ex.printStackTrace();
+        }
+        return null;
+    }
+    public static PublicKey getFromBase64String(String publicKeyString) throws
+            Exception {
+        byte[] keyBytes = publicKeyString.getBytes();
+        byte[] ks = Base64.getDecoder().decode(keyBytes);
+        X509EncodedKeySpec spec = new X509EncodedKeySpec(ks);
+        KeyFactory kf = KeyFactory.getInstance("RSA");
+        return kf.generatePublic(spec);
+    }
+    public static byte[] encrypt(PublicKey publicKey, byte[] data) throws Exception {
+        Cipher ci = Cipher.getInstance("RSA/ECB/PKCS1Padding");
+        ci.init(Cipher.ENCRYPT_MODE, publicKey);
+        return ci.doFinal(data);
+    }
+}

+ 316 - 0
yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/oa/OaFlow.java

@@ -0,0 +1,316 @@
+package cn.iocoder.yudao.module.system.oa;
+
+import cn.iocoder.yudao.framework.tenant.core.util.TenantUtils;
+import cn.iocoder.yudao.module.system.dal.dataobject.oa.IotOaCompanyDO;
+import cn.iocoder.yudao.module.system.dal.dataobject.oa.IotOaDepartDO;
+import cn.iocoder.yudao.module.system.dal.dataobject.oa.IotOaPersonDO;
+import cn.iocoder.yudao.module.system.dal.mysql.oa.IotOaCompanyMapper;
+import cn.iocoder.yudao.module.system.dal.mysql.oa.IotOaDepartMapper;
+import cn.iocoder.yudao.module.system.dal.mysql.oa.IotOaPersonMapper;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpHeaders;
+import org.springframework.stereotype.Component;
+import org.springframework.util.MultiValueMap;
+import org.springframework.web.client.RestTemplate;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.stream.Collectors;
+
+@Component
+public class OaFlow {
+    private final IotOaCompanyMapper iotOaCompanyMapper;
+    private final IotOaDepartMapper iotOaDepartMapper;
+    private final IotOaPersonMapper iotOaPersonMapper;
+    @Value("${oa.appid}")
+    private String appid;
+    @Value("${oa.cpk}")
+    private String cpk;
+    @Value("${oa.register}")
+    private String registerUrl;
+    @Value("${oa.gettoken}")
+    private String tokenUrl;
+    @Value("${oa.ssoToken}")
+    private String ssoToken;
+    @Value("${oa.companyUrl}")
+    private String companyUrl;
+    @Value("${oa.departmentUrl}")
+    private String departmentUrl;
+    @Value("${oa.userUrl}")
+    private String userUrl;
+    @Value("${oa.workflowId}")
+    private String workflowId;
+    @Value("${oa.requestName}")
+    private String requestName;
+    @Value("${oa.outMaintain}")
+    private String outMaintainUrl;
+    @Value("${oa.userid}")
+    private String userid;
+
+    private static String spk = "";
+    private static String secret = "";
+
+    public OaFlow(IotOaCompanyMapper iotOaCompanyMapper, IotOaDepartMapper iotOaDepartMapper, IotOaPersonMapper iotOaPersonMapper) {
+        this.iotOaCompanyMapper = iotOaCompanyMapper;
+        this.iotOaDepartMapper = iotOaDepartMapper;
+        this.iotOaPersonMapper = iotOaPersonMapper;
+    }
+
+
+    public void register() throws Exception {
+        HttpHeaders headers = new HttpHeaders();
+        headers.add("appid", appid);
+        headers.add("cpk", cpk);
+
+        HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<>(headers);
+        RestTemplate restTemplate = SslSkippingRestTemplate.createRestTemplate();
+
+        String result = restTemplate.postForObject(registerUrl, requestEntity, String.class);
+        JSONObject jsonObject = JSON.parseObject(result);
+        spk = String.valueOf(jsonObject.get("spk"));
+        secret = String.valueOf(jsonObject.get("secret"));
+        System.out.println("result register:" + result);
+
+    }
+
+    public String ssoToken() throws Exception{
+        HttpHeaders headers = new HttpHeaders();
+        headers.add("Content-Type", "application/x-www-form-urlencoded");
+
+        HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<>(headers);
+        RestTemplate restTemplate = SslSkippingRestTemplate.createRestTemplate();
+
+        String result = restTemplate.postForObject(tokenUrl, requestEntity, String.class);
+        JSONObject jsonObject = JSON.parseObject(result);
+        String token = String.valueOf(jsonObject.get("token"));
+        System.out.println("result token:" + result);
+        return token;
+    }
+
+    public String getToken() throws Exception{
+        if (StringUtils.isBlank(spk) || StringUtils.isBlank(secret)) {
+            register();
+        }
+        String secretEn = E9ApiTokenUtil.encryptString(spk, secret);
+        HttpHeaders headers = new HttpHeaders();
+        headers.add("appid", appid);
+        headers.add("secret", secretEn);
+
+        HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<>(headers);
+        RestTemplate restTemplate = SslSkippingRestTemplate.createRestTemplate();
+
+        String result = restTemplate.postForObject(tokenUrl, requestEntity, String.class);
+        JSONObject jsonObject = JSON.parseObject(result);
+        String token = String.valueOf(jsonObject.get("token"));
+        System.out.println("result token:" + result);
+        return token;
+    }
+
+    public void getCompany() throws Exception{
+        String token = getToken();
+        HttpHeaders headersOut = new HttpHeaders();
+        headersOut.add("token", token);
+        headersOut.add("appid", appid);
+        headersOut.add("userid", "cLPEaFs9moW6b3xZMl1kNNWAAo7bp61ZRRTKmpiJUe56hSxQvrC2vWtY5ogj7g5FAnUOlzYjYg9MRktKXcseh/nsvZCQGa3BAlYixlDJruV19y4Omx5dYnqu/qv2rJAqTzUS71sOwuB1M2nKlLVsphw1GF74UhGP4xsjpZP7mC8=");
+
+        Map<String, Object> params = new HashMap<>();
+        Map<String, Object> map = new HashMap<>();
+        map.put("pagesize",1000000);
+        params.put("params", map);
+        // 3. 组合请求头和请求体
+        HttpEntity<Map<String, Object>> requestEntityOut = new HttpEntity<>(params, headersOut);
+        RestTemplate restTemplate = SslSkippingRestTemplate.createRestTemplate();
+        String company = restTemplate.postForObject(companyUrl, requestEntityOut, String.class);
+        JSONObject companyInfo = JSON.parseObject(company);
+        //请求成功
+        if (Objects.nonNull(companyInfo)&&"1".equals(String.valueOf(companyInfo.get("code")))){
+            if (Objects.nonNull(companyInfo.get("data"))) {
+                JSONObject resultJson = JSON.parseObject(companyInfo.get("data").toString());
+                if (Objects.nonNull(resultJson.get("dataList"))) {
+                    //先删除
+                    List<Long> ids = iotOaCompanyMapper.selectList().stream().map(IotOaCompanyDO::getId).collect(Collectors.toList());
+                    iotOaCompanyMapper.deleteByIds(ids);
+                    JSON.parseArray(resultJson.get("dataList").toString(), IotOaCompanyDO.class).forEach(item -> {
+                        IotOaCompanyDO companyDO = new IotOaCompanyDO();
+                        BeanUtils.copyProperties(item,companyDO);
+                        companyDO.setOaId(String.valueOf(companyDO.getId()));
+                        companyDO.setId(null);
+                        companyDO.setDeleted(false);
+                        iotOaCompanyMapper.insert(companyDO);
+                    });
+                }
+            }
+        }
+    }
+
+    public void getDepart() throws Exception {
+        String token = getToken();
+        HttpHeaders headersOut = new HttpHeaders();
+        headersOut.add("token", token);
+        headersOut.add("appid", appid);
+        headersOut.add("userid", "cLPEaFs9moW6b3xZMl1kNNWAAo7bp61ZRRTKmpiJUe56hSxQvrC2vWtY5ogj7g5FAnUOlzYjYg9MRktKXcseh/nsvZCQGa3BAlYixlDJruV19y4Omx5dYnqu/qv2rJAqTzUS71sOwuB1M2nKlLVsphw1GF74UhGP4xsjpZP7mC8=");
+
+        Map<String, Object> params = new HashMap<>();
+        Map<String, Object> map = new HashMap<>();
+        map.put("pagesize",1000000);
+        params.put("params", map);
+        // 3. 组合请求头和请求体
+        HttpEntity<Map<String, Object>> requestEntityOut = new HttpEntity<>(params, headersOut);
+        RestTemplate restTemplate = SslSkippingRestTemplate.createRestTemplate();
+        String company = restTemplate.postForObject(departmentUrl, requestEntityOut, String.class);
+        JSONObject companyInfo = JSON.parseObject(company);
+        //请求成功
+        if (Objects.nonNull(companyInfo) && "1".equals(String.valueOf(companyInfo.get("code")))) {
+            if (Objects.nonNull(companyInfo.get("data"))) {
+                JSONObject resultJson = JSON.parseObject(companyInfo.get("data").toString());
+                if (Objects.nonNull(resultJson.get("dataList"))) {
+                    //先删除
+                    List<Long> ids = iotOaDepartMapper.selectList().stream().map(IotOaDepartDO::getId).collect(Collectors.toList());
+                    iotOaDepartMapper.deleteByIds(ids);
+                    JSON.parseArray(resultJson.get("dataList").toString(), IotOaDepartDO.class).forEach(item -> {
+                        IotOaDepartDO iotOaDepartDO = new IotOaDepartDO();
+                        BeanUtils.copyProperties(item, iotOaDepartDO);
+                        iotOaDepartDO.setOaId(String.valueOf(iotOaDepartDO.getId()));
+                        iotOaDepartDO.setId(null);
+                        iotOaDepartDO.setDeleted(false);
+                        iotOaDepartMapper.insert(iotOaDepartDO);
+                    });
+                }
+            }
+        }
+    }
+
+    public void getPerson() throws Exception {
+        String token = getToken();
+        HttpHeaders headersOut = new HttpHeaders();
+        headersOut.add("token", token);
+        headersOut.add("appid", appid);
+        // headersOut.add("userid", userid);
+
+        Map<String, Object> params = new HashMap<>();
+        Map<String, Object> map = new HashMap<>();
+        map.put("pagesize",1000000);
+        map.put("id", 3012);
+        params.put("params", map);
+        // 3. 组合请求头和请求体
+        HttpEntity<Map<String, Object>> requestEntityOut = new HttpEntity<>(params, headersOut);
+        RestTemplate restTemplate = SslSkippingRestTemplate.createRestTemplate();
+        String company = restTemplate.postForObject(userUrl, requestEntityOut, String.class);
+        JSONObject companyInfo = JSON.parseObject(company);
+        //请求成功
+        if (Objects.nonNull(companyInfo) && "1".equals(String.valueOf(companyInfo.get("code")))) {
+            if (Objects.nonNull(companyInfo.get("data"))) {
+                JSONObject resultJson = JSON.parseObject(companyInfo.get("data").toString());
+                if (Objects.nonNull(resultJson.get("dataList"))) {
+                    //先删除
+                    List<Long> ids = iotOaPersonMapper.selectList().stream().map(IotOaPersonDO::getId).collect(Collectors.toList());
+                    iotOaPersonMapper.deleteByIds(ids);
+                    TenantUtils.execute(1L, () -> {
+                        JSON.parseArray(resultJson.get("dataList").toString(), IotOaPersonDO.class).forEach(item -> {
+                            IotOaPersonDO iotOaPersonDO = new IotOaPersonDO();
+                            BeanUtils.copyProperties(item, iotOaPersonDO);
+                            iotOaPersonDO.setOaId(String.valueOf(iotOaPersonDO.getId()));
+                            iotOaPersonDO.setId(null);
+                            iotOaPersonDO.setDeleted(false);
+                            iotOaPersonMapper.insert(iotOaPersonDO);
+                        });
+                    });
+                }
+            }
+        }
+    }
+
+    @Autowired
+    private RestTemplate restTemplate;
+
+    /* public void createOutRepairFlow(IotMaintainDO iotMaintainDO) throws Exception {
+        String token = getToken();
+        HttpHeaders headersOut = new HttpHeaders();
+        headersOut.add("token", token);
+        headersOut.add("appid", appid);
+        String person = E9ApiTokenUtil.encryptString(spk, iotMaintainDO.getApplyPersonId());
+        headersOut.add("userid", person);
+        headersOut.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
+
+        OutRepairFlow flow = new OutRepairFlow().setFieldName("xmjl").setFieldValue(iotMaintainDO.getProjectManager());
+        OutRepairFlow flow1 = new OutRepairFlow().setFieldName("sqr").setFieldValue(iotMaintainDO.getApplyPersonId());
+        List<IotOaPersonDO> dos = iotOaPersonMapper.selectList("oa_id", iotMaintainDO.getApplyPersonId());
+        if (CollUtil.isEmpty(dos)) {
+            throw new ServiceException(new ErrorCode(111, "不存在oa部门"));
+        }
+        OutRepairFlow flow2 = new OutRepairFlow().setFieldName("sqbm").setFieldValue(dos.get(0).getDepartmentid());
+        OutRepairFlow flow3 = new OutRepairFlow().setFieldName("sqrq").setFieldValue(DateUtil.format(new Date(), DatePattern.NORM_DATE_PATTERN));
+        OutRepairFlow flow4 = new OutRepairFlow().setFieldName("clxh").setFieldValue(iotMaintainDO.getDeviceName());
+        OutRepairFlow flow5 = new OutRepairFlow().setFieldName("cph").setFieldValue(iotMaintainDO.getDeviceName());
+        OutRepairFlow flow6 = new OutRepairFlow().setFieldName("wxyy").setFieldValue(iotMaintainDO.getMaintainDescription());
+        OutRepairFlow flow7 = new OutRepairFlow().setFieldName("ygjey").setFieldValue(String.valueOf(iotMaintainDO.getMaintainFee()));
+        OutRepairFlow flow8 = new OutRepairFlow().setFieldName("wxdd").setFieldValue(Objects.isNull(iotMaintainDO.getAddress())?"": iotMaintainDO.getAddress());
+        OutRepairFlow flow9 = new OutRepairFlow().setFieldName("ggxh").setFieldValue(String.valueOf(iotMaintainDO.getModel()));
+        OutRepairFlow flow10 = new OutRepairFlow().setFieldName("qyrq").setFieldValue(StringUtils.substring(iotMaintainDO.getEnableDate(), 0,10));
+        OutRepairFlow flow11 = new OutRepairFlow().setFieldName("wxlb").setFieldValue(String.valueOf(iotMaintainDO.getMaintainClassify()));
+        OutRepairFlow flow12 = new OutRepairFlow().setFieldName("yzglxs").setFieldValue(Objects.isNull(iotMaintainDO.getKmHour())?"": iotMaintainDO.getKmHour());
+        OutRepairFlow flow13 = new OutRepairFlow().setFieldName("wxcj").setFieldValue(String.valueOf(iotMaintainDO.getSupplier()));
+        OutRepairFlow flow14 = new OutRepairFlow().setFieldName("gzms").setFieldValue(String.valueOf(iotMaintainDO.getDescription()));
+        OutRepairFlow flow15 = new OutRepairFlow().setFieldName("wxxm").setFieldValue(String.valueOf(iotMaintainDO.getMaintainItem()));
+        List<String> strings = JSON.parseArray(iotMaintainDO.getOutFile(), String.class);
+        List<ImmutableMap> files = new ArrayList<>();
+        strings.forEach(e ->{
+            String fileName = FileUtils.getFileNameByUrlParse(e);
+            String s1 = FileUtils.encodePathSegment(fileName);
+            String s = StringUtils.substringBeforeLast(e, "/");
+            files.add(ImmutableMap.of("filePath", s+"/"+s1,"fileName", fileName));
+        });
+
+        OutRepairFlow flow16 = new OutRepairFlow().setFieldName("fjsc").setFieldValue(JSON.toJSONString(files));
+        OutRepairFlow flow17 = new OutRepairFlow().setFieldName("sfdy").setFieldValue("1");
+        ImmutableList<OutRepairFlow> outRepairFlows = ImmutableList.of(flow16,flow12, flow3, flow4, flow5, flow6, flow7, flow8, flow9, flow10, flow11, flow2, flow, flow14, flow1, flow15, flow13,flow17);
+
+
+
+        // 创建表单数据
+        MultiValueMap<String, Object> params = new LinkedMultiValueMap<>();
+        params.add("workflowId", workflowId);
+        params.add("requestName", requestName);
+        params.add("mainData", JSON.toJSONString(outRepairFlows));
+        Map<String, String> other = new HashMap<>();
+        other.put("isnextflow", "1");
+        params.add("otherParams", JSON.toJSONString(other));
+        System.out.println("------------"+JSON.toJSONString(outRepairFlows));
+        // 3. 组合请求头和请求体
+        HttpEntity<MultiValueMap<String, Object>> requestEntityOut = new HttpEntity<>(params, headersOut);
+//        RestTemplate restTemplate = SslSkippingRestTemplate.createRestTemplate();
+        String out = restTemplate.postForObject(outMaintainUrl, requestEntityOut, String.class);
+        JSONObject outInfo = JSON.parseObject(out);
+        //请求成功
+        if (Objects.isNull(outInfo) || !"success".equalsIgnoreCase(String.valueOf(outInfo.get("code")))) {
+            throw new ServiceException(new ErrorCode(777, String.valueOf(outInfo.get("msg"))));
+        }
+        JSONObject jsonObject = JSON.parseObject(outInfo.get("data").toString());
+        String requestid = String.valueOf(jsonObject.get("requestid"));
+        iotMaintainDO.setRequestId(requestid);
+        iotMaintainMapper.updateById(iotMaintainDO);
+
+    } */
+
+    @Data
+    @Builder
+    @NoArgsConstructor
+    @AllArgsConstructor
+    public static class OutRepairFlow {
+        private String fieldName;
+        private String fieldValue;
+    }
+
+}

+ 18 - 0
yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/oa/OaVo.java

@@ -0,0 +1,18 @@
+package cn.iocoder.yudao.module.system.oa;
+
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class OaVo {
+    private String workflowId;
+    private String requestName;
+    private List<MainData> mainData;
+
+    @Data
+    public static class MainData{
+        private String fieldName;
+        private String fieldValue;
+    }
+}

+ 43 - 0
yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/oa/SslSkippingRestTemplate.java

@@ -0,0 +1,43 @@
+package cn.iocoder.yudao.module.system.oa;
+
+import org.springframework.http.client.SimpleClientHttpRequestFactory;
+import org.springframework.web.client.RestTemplate;
+
+import javax.net.ssl.*;
+import java.security.cert.X509Certificate;
+
+public class SslSkippingRestTemplate {
+
+    public static RestTemplate createRestTemplate() {
+        try {
+            // 创建不验证证书的SSL上下文
+            TrustManager[] trustAllCerts = new TrustManager[]{
+                    new X509TrustManager() {
+                        public X509Certificate[] getAcceptedIssuers() {
+                            return null;
+                        }
+                        public void checkClientTrusted(X509Certificate[] certs, String authType) {
+                        }
+                        public void checkServerTrusted(X509Certificate[] certs, String authType) {
+                        }
+                    }
+            };
+
+            SSLContext sslContext = SSLContext.getInstance("SSL");
+            sslContext.init(null, trustAllCerts, new java.security.SecureRandom());
+
+            // 获取SSL连接工厂
+            HttpsURLConnection.setDefaultSSLSocketFactory(sslContext.getSocketFactory());
+
+            // 创建不验证主机名的主机名验证器
+            HostnameVerifier allHostsValid = (hostname, session) -> true;
+            HttpsURLConnection.setDefaultHostnameVerifier(allHostsValid);
+
+            // 创建RestTemplate并设置自定义请求工厂
+            SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();
+            return new RestTemplate(requestFactory);
+        } catch (Exception e) {
+            throw new RuntimeException("创建RestTemplate失败", e);
+        }
+    }
+}

+ 13 - 0
yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthService.java

@@ -85,4 +85,17 @@ public interface AdminAuthService {
      */
     void resetPassword(AuthResetPasswordReqVO reqVO);
 
+    /**
+     * 免登录OA
+     *
+     * @param reqVO 验证码信息
+     */
+    String oaSsoToken(AuthOaLoginReqVO reqVO);
+
+    /**
+     * 免登录OA
+     *
+     * @param reqVO 验证码信息
+     */
+    String pmsSsoToken(AuthOaLoginReqVO reqVO);
 }

+ 56 - 0
yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthServiceImpl.java

@@ -23,12 +23,15 @@ import cn.iocoder.yudao.module.system.enums.logger.LoginResultEnum;
 import cn.iocoder.yudao.module.system.enums.oauth2.OAuth2ClientConstants;
 import cn.iocoder.yudao.module.system.enums.sms.SmsSceneEnum;
 import cn.iocoder.yudao.module.system.enums.social.SocialTypeEnum;
+import cn.iocoder.yudao.module.system.oa.SslSkippingRestTemplate;
 import cn.iocoder.yudao.module.system.service.logger.LoginLogService;
 import cn.iocoder.yudao.module.system.service.member.MemberService;
 import cn.iocoder.yudao.module.system.service.oauth2.OAuth2TokenService;
 import cn.iocoder.yudao.module.system.service.social.SocialUserService;
 import cn.iocoder.yudao.module.system.service.user.AdminUserService;
 import cn.iocoder.yudao.module.system.util.DingtalkUtil;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
 import com.anji.captcha.model.common.ResponseModel;
 import com.anji.captcha.model.vo.CaptchaVO;
 import com.anji.captcha.service.CaptchaService;
@@ -37,11 +40,18 @@ import com.google.common.annotations.VisibleForTesting;
 import lombok.Setter;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Value;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpHeaders;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.LinkedMultiValueMap;
+import org.springframework.util.MultiValueMap;
+import org.springframework.web.client.RestTemplate;
 
 import javax.annotation.Resource;
 import javax.validation.Validator;
+import java.util.HashMap;
+import java.util.Map;
 import java.util.Objects;
 
 import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
@@ -75,6 +85,17 @@ public class AdminAuthServiceImpl implements AdminAuthService {
     private SmsCodeApi smsCodeApi;
     @Resource
     private SocialUserBindMapper socialUserBindMapper;
+    @Value("${oa.ssoToken}")
+    private String ssoToken;
+
+    @Value("${pms.ssoToken}")
+    private String pmsSsoToken;
+
+    @Value("${pms.secret}")
+    private String pmsSecret;
+
+    @Value("${oa.secret}")
+    private String oaSecret;
 
     /**
      * 验证码的开关,默认为 true
@@ -326,4 +347,39 @@ public class AdminAuthServiceImpl implements AdminAuthService {
 
         userService.updateUserPassword(userByMobile.getId(), reqVO.getPassword());
     }
+
+    @Override
+    public String oaSsoToken(AuthOaLoginReqVO reqVO) {
+        HttpHeaders headers = new HttpHeaders();
+        headers.add("Content-Type", "application/x-www-form-urlencoded");
+        RestTemplate restTemplate = SslSkippingRestTemplate.createRestTemplate();
+        // 使用 MultiValueMap 而不是 HashMap
+        MultiValueMap<String, String> params1 = new LinkedMultiValueMap<>();
+        params1.add("appid", oaSecret);
+        params1.add("loginid", reqVO.getUsername());
+        HttpEntity<MultiValueMap<String, String>> requestEntityOut = new HttpEntity<>(params1, headers);
+        String result = restTemplate.postForObject(ssoToken, requestEntityOut, String.class);
+        JSONObject jsonObject = JSON.parseObject(result);
+        String token = String.valueOf(jsonObject.get("token"));
+        System.out.println("result token:" + token);
+        return token;
+    }
+
+    @Override
+    public String pmsSsoToken(AuthOaLoginReqVO reqVO) {
+        HttpHeaders headers = new HttpHeaders();
+        headers.add("Content-Type", "application/json");
+        headers.add("tenant-id", "1");
+        RestTemplate restTemplate = SslSkippingRestTemplate.createRestTemplate();
+        // 使用 MultiValueMap 而不是 HashMap
+        Map<String, String> params1 = new HashMap<>();
+        params1.put("appid", pmsSecret);
+        params1.put("username", reqVO.getUsername());
+        HttpEntity<Map<String, String>> requestEntityOut = new HttpEntity<>(params1, headers);
+        String result = restTemplate.postForObject(pmsSsoToken, requestEntityOut, String.class);
+        JSONObject jsonObject = JSON.parseObject(result);
+        String token = String.valueOf(jsonObject.get("data"));
+        System.out.println("result token:" + token);
+        return token;
+    }
 }