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

@@ -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;
}
}

View File

@@ -0,0 +1,63 @@
package com.zt.plat.module.system.dal.dataobject.dept;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.KeySequence;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.zt.plat.framework.common.enums.CommonStatusEnum;
import com.zt.plat.framework.tenant.core.db.TenantBaseDO;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 部门推送消息 DO
*/
@TableName("system_dept_push_msg")
@KeySequence("system_dept_push_msg_seq")
@Data
@EqualsAndHashCode(callSuper = true)
public class DeptPushMsgDO extends TenantBaseDO {
/**
* 主键编号
*/
@TableId(type = IdType.ASSIGN_ID)
private Long id;
/**
* 本系统部门 ID
*/
private Long deptId;
/**
* 外部系统标识
*/
private String systemCode;
/**
* 外部系统组织编码
*/
private String externalDeptCode;
/**
* 外部系统组织名称
*/
private String externalDeptName;
/**
* 映射状态
* 枚举 {@link CommonStatusEnum}
*/
private Integer status;
/**
* 备注
*/
private String remark;
/**
* 是否发送消息
*/
private Integer isSendMsg;
}

View File

@@ -0,0 +1,65 @@
package com.zt.plat.module.system.dal.mysql.dept;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.zt.plat.module.system.api.dept.dto.DeptSaveReqDTO;
import com.zt.plat.module.system.controller.admin.dept.vo.depexternalcode.EspPageReqVO;
import com.zt.plat.module.system.dal.dataobject.dept.DeptPushMsgDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
/**
* 部门推送消息接口Mapper
*/
@Mapper
public interface EspMapper extends BaseMapperX<DeptPushMsgDO> {
/**
* 分页查询
* @param reqVO 消息推送VO
* @return PageResult
*/
default PageResult<DeptPushMsgDO> selectPage(EspPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<DeptPushMsgDO>()
.eqIfPresent(DeptPushMsgDO::getDeptId,reqVO.getDeptId())
.eqIfPresent(DeptPushMsgDO::getSystemCode, reqVO.getSystemCode())
.likeIfPresent(DeptPushMsgDO::getExternalDeptCode, reqVO.getExternalDeptCode())
.eqIfPresent(DeptPushMsgDO::getStatus, reqVO.getStatus())
.orderByDesc(DeptPushMsgDO::getId));
}
default DeptPushMsgDO selectBySystemCodeAndDeptId(String systemCode, Long deptId) {
return selectOne(new LambdaQueryWrapperX<DeptPushMsgDO>()
.eq(DeptPushMsgDO::getSystemCode, systemCode)
.eq(DeptPushMsgDO::getDeptId, deptId));
}
default DeptPushMsgDO selectBySystemCodeAndExternalCode(String systemCode, String externalDeptCode) {
return selectOne(new LambdaQueryWrapperX<DeptPushMsgDO>()
.eq(DeptPushMsgDO::getSystemCode, systemCode)
.eq(DeptPushMsgDO::getExternalDeptCode, externalDeptCode));
}
default List<DeptPushMsgDO> selectListByDeptId(Long deptId) {
return selectList(DeptPushMsgDO::getDeptId, deptId);
}
default int deleteByDeptId(Long deptId) {
return delete(DeptPushMsgDO::getDeptId, deptId);
}
default List<DeptPushMsgDO> selectListBySystemCode(String systemCode) {
return selectList(DeptPushMsgDO::getSystemCode, systemCode);
}
@Select("SELECT ID,DEPT_ID, SYSTEM_CODE,EXTERNAL_DEPT_CODE,EXTERNAL_DEPT_NAME,STATUS,REMARK,TENANT_ID,CREATOR,CREATE_TIME,UPDATER,UPDATE_TIME" +
"FROM" +
"SYSTEM_DEPT_PUSH_MSG" +
"WHERE" +
" ID = #{id} AND IS_SEND_MSG = '0' AND DELETED = '0' ")
List<DeptPushMsgDO> selectpushMsg(@Param("syncReqDTO") DeptSaveReqDTO syncReqDTO);
}

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