Merge remote-tracking branch 'base-version/main' into dev

This commit is contained in:
chenbowen
2026-01-06 15:24:13 +08:00
39 changed files with 1457 additions and 35 deletions

View File

@@ -0,0 +1,24 @@
package com.zt.plat.module.system.api.esp;
import com.zt.plat.framework.common.pojo.CommonResult;
import com.zt.plat.module.system.api.dept.dto.*;
import com.zt.plat.module.system.api.esp.dto.EspDto;
import com.zt.plat.module.system.enums.ApiConstants;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@FeignClient(name = ApiConstants.NAME)
@Tag(name = "RPC 服务 - 部门")
public interface EspApi {
String PREFIX = ApiConstants.PREFIX + "/dept";
@PostMapping(PREFIX + "/pushMsg")
@Operation(summary = "推送消息")
CommonResult<List<EspDto>> pushMsg(@RequestBody DeptSaveReqDTO syncReqDTO);
}

View File

@@ -0,0 +1,27 @@
package com.zt.plat.module.system.api.esp.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.util.List;
@Schema(description = "RPC 服务 - 推送外部系统配置信息 Response DTO")
@Data
public class EspDto {
@Schema(description = "部门名称,模糊匹配", example = "ZT")
private String name;
@Schema(description = "展示状态,参见 CommonStatusEnum 枚举类", example = "1")
private Integer status;
@Schema(description = "是否公司", example = "false")
private Boolean isCompany;
@Schema(description = "是否集团", example = "false")
private Boolean isGroup;
@Schema(description = "部门编号集合,支持多部门查询", example = "[\"1001\", \"1002\"]")
private List<String> ids;
}

View File

@@ -13,7 +13,6 @@ import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RestController;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;

View File

@@ -0,0 +1,33 @@
package com.zt.plat.module.system.api.esp;
import com.zt.plat.framework.common.exception.enums.GlobalErrorCodeConstants;
import com.zt.plat.framework.common.pojo.CommonResult;
import com.zt.plat.framework.common.util.object.ObjectUtils;
import com.zt.plat.module.system.api.dept.dto.DeptSaveReqDTO;
import com.zt.plat.module.system.api.esp.dto.EspDto;
import com.zt.plat.module.system.service.dept.IEspService;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Objects;
@RestController
@Validated
public class EspApiImpl implements EspApi {
@Resource
private IEspService deptService;
@Override
public CommonResult<List<EspDto>> pushMsg(DeptSaveReqDTO syncReqDTO)
{
if(Objects.isNull(syncReqDTO) || null == syncReqDTO.getId())
{
return CommonResult.error(GlobalErrorCodeConstants.BAD_REQUEST.getCode(),
"ID不能为空");
}
return CommonResult.success(deptService.pushMsg(syncReqDTO));
}
}

View File

@@ -0,0 +1,25 @@
package com.zt.plat.module.system.controller.admin.dept.vo.depexternalcode;
import com.zt.plat.framework.common.pojo.PageParam;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
@Schema(description = "管理后台 - 部门外部组织编码映射分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
public class EspPageReqVO extends PageParam {
@Schema(description = "部门编号", example = "1024")
private Long deptId;
@Schema(description = "外部系统标识", example = "ERP")
private String systemCode;
@Schema(description = "外部组织编码", example = "100200")
private String externalDeptCode;
@Schema(description = "状态", example = "0")
private Integer status;
}

View File

@@ -0,0 +1,31 @@
package com.zt.plat.module.system.controller.admin.dept.vo.depexternalcode;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.time.LocalDateTime;
@Schema(description = "管理后台 - 部门外消息推送创建/修改 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
public class EspSaveRespVo extends DeptExternalCodeBaseVO {
@Schema(description = "映射编号", example = "1024")
private Long id;
@Schema(description = "所属部门名称", example = "技术部")
private String deptName;
@Schema(description = "所属部门编码", example = "DEPT_001")
private String deptCode;
@Schema(description = "创建时间")
private LocalDateTime createTime;
@Schema(description = "最后更新时间")
private LocalDateTime updateTime;
@Schema(description = "是否发送消息")
private Integer isSendMsg;
}

View File

@@ -6,6 +6,7 @@ import com.zt.plat.module.system.controller.admin.integration.iwork.vo.*;
import com.zt.plat.module.system.service.integration.iwork.IWorkIntegrationService;
import com.zt.plat.module.system.service.integration.iwork.IWorkOrgRestService;
import com.zt.plat.module.system.service.integration.iwork.IWorkSyncService;
import lombok.extern.slf4j.Slf4j;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.security.PermitAll;
@@ -18,9 +19,7 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import static com.zt.plat.framework.common.pojo.CommonResult.success;
/**
* 提供统一 iWork 流程能力的管理端接口。
*/
@@ -29,6 +28,7 @@ import static com.zt.plat.framework.common.pojo.CommonResult.success;
@RequestMapping("/system/integration/iwork")
@RequiredArgsConstructor
@Validated
@Slf4j
public class IWorkIntegrationController {
private final IWorkIntegrationService integrationService;
@@ -139,6 +139,17 @@ public class IWorkIntegrationController {
return success(syncService.fullSyncUsers(reqVO));
}
// ----------------- 根据ID同步到本地 -----------------
@PostMapping("/syncById")
@Operation(summary = "根据ID触发 iWork 同步公司")
public CommonResult<IWorkFullSyncRespVO> syncById(@Valid @RequestBody IWorkSyncByIdReqVO reqVO) {
log.error("IWork集成后端手动录入syncById{}",reqVO);
return success(syncService.manuallySyncData(reqVO));
}
private ResponseEntity<String> buildOaResponse(IWorkOaRawResponse resp) {
if (resp == null) {
return ResponseEntity.internalServerError().body("OA 响应为空");

View File

@@ -0,0 +1,99 @@
package com.zt.plat.module.system.controller.admin.integration.iwork.vo;
import com.zt.plat.module.system.enums.integration.IWorkSyncEntityTypeEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Max;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotBlank;
import lombok.Data;
import java.util.EnumSet;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
/**
* iWork 手动同步请求
*/
@Data
public class IWorkSyncByIdReqVO {
@Schema(description = "起始页码,从 1 开始", example = "1")
@Min(1)
private Integer startPage = 1;
@Schema(description = "最大处理页数null 表示处理至 iWork 返回的末页", example = "10")
@Min(1)
private Integer maxPages;
@Schema(description = "每次分页从 iWork 拉取的记录数", example = "100")
@Min(1)
@Max(500)
private Integer pageSize = 100;
@Schema(description = "同步范围列表默认同步全部。可选subcompany、department、jobTitle、user")
private List<String> scopes;
@Schema(description = "是否包含已失效canceled=1的记录", example = "false")
private Boolean includeCanceled = Boolean.FALSE;
@Schema(description = "是否允许更新已存在的本地实体", example = "false")
private Boolean allowUpdate = Boolean.FALSE;
@Schema(description = "指定同步记录的 iWork ID。传入后仅同步对应记录", example = "12345")
@NotBlank(message = "ID不能为空")
private String id;
@Schema(description = "部门编码", example = "ZT001")
private String code;
@Schema(description = "部门名称", example = "ZT")
private String name;
@Schema(description = "部门简称", example = "技术")
private String shortName;
@Schema(description = "父部门 ID", example = "1024")
private String parentId;
@Schema(description = "负责人的用户编号", example = "2048")
private String leaderUserId;
@Schema(description = "联系电话", example = "15601691000")
private String phone;
@Schema(description = "邮箱", example = "zt@iocoder.cn")
private String email;
@Schema(description = "状态,见 CommonStatusEnum 枚举0 开启 1 关闭", example = "0")
private Integer status;
private Long tenantId;
@Schema(description = "是否公司", example = "false")
private boolean isCompany;
@Schema(description = "是否集团", example = "false")
private boolean isGroup;
private boolean hasChildren;
public Set<IWorkSyncEntityTypeEnum> resolveScopes() {
EnumSet<IWorkSyncEntityTypeEnum> defaults = EnumSet.allOf(IWorkSyncEntityTypeEnum.class);
if (scopes == null || scopes.isEmpty()) {
return defaults;
}
Set<IWorkSyncEntityTypeEnum> resolved = scopes.stream()
.map(IWorkSyncEntityTypeEnum::fromCode)
.filter(java.util.Objects::nonNull)
.collect(Collectors.toCollection(() -> EnumSet.noneOf(IWorkSyncEntityTypeEnum.class)));
if (resolved.isEmpty()) {
return defaults;
}
return resolved;
}
}

Some files were not shown because too many files have changed in this diff Show More