[+]增加部门推动消息功能
This commit is contained in:
@@ -1,18 +1,15 @@
|
|||||||
package com.zt.plat.module.system.api.esp;
|
package com.zt.plat.module.system.api.esp;
|
||||||
|
|
||||||
import com.zt.plat.framework.common.pojo.CommonResult;
|
import com.zt.plat.framework.common.pojo.CommonResult;
|
||||||
import com.zt.plat.framework.common.util.collection.CollectionUtils;
|
|
||||||
import com.zt.plat.module.system.api.dept.dto.*;
|
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 com.zt.plat.module.system.enums.ApiConstants;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.Parameter;
|
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
@FeignClient(name = ApiConstants.NAME)
|
@FeignClient(name = ApiConstants.NAME)
|
||||||
@Tag(name = "RPC 服务 - 部门")
|
@Tag(name = "RPC 服务 - 部门")
|
||||||
@@ -20,75 +17,8 @@ public interface EspApi {
|
|||||||
|
|
||||||
String PREFIX = ApiConstants.PREFIX + "/dept";
|
String PREFIX = ApiConstants.PREFIX + "/dept";
|
||||||
|
|
||||||
// === 以下为补全的接口方法 ===
|
@PostMapping(PREFIX + "/pushMsg")
|
||||||
@PostMapping(PREFIX + "/create")
|
@Operation(summary = "推送消息")
|
||||||
@Operation(summary = "新增部门")
|
CommonResult<List<EspDto>> pushMsg(@RequestBody DeptSaveReqDTO syncReqDTO);
|
||||||
CommonResult<Long> createDept(@RequestBody DeptSaveReqDTO createReqVO);
|
|
||||||
|
|
||||||
@PutMapping(PREFIX + "/update")
|
|
||||||
@Operation(summary = "修改部门")
|
|
||||||
CommonResult<Boolean> updateDept(@RequestBody DeptSaveReqDTO updateReqVO);
|
|
||||||
|
|
||||||
@DeleteMapping(PREFIX + "/delete")
|
|
||||||
@Operation(summary = "删除部门")
|
|
||||||
CommonResult<Boolean> deleteDept(@RequestParam("id") Long id);
|
|
||||||
|
|
||||||
@PostMapping(PREFIX + "/list-all")
|
|
||||||
@Operation(summary = "获得部门列表")
|
|
||||||
CommonResult<List<DeptDetailRespDTO>> getDeptList(@RequestBody DeptListReqDTO reqVO);
|
|
||||||
|
|
||||||
@GetMapping(PREFIX + "/simple-list")
|
|
||||||
@Operation(summary = "获得部门精简信息列表")
|
|
||||||
CommonResult<List<DeptSimpleRespDTO>> getSimpleDeptList();
|
|
||||||
|
|
||||||
@GetMapping(PREFIX + "/simple-company-list")
|
|
||||||
@Operation(summary = "获得公司精简信息列表")
|
|
||||||
CommonResult<List<DeptSimpleRespDTO>> getSimpleCompanyList();
|
|
||||||
|
|
||||||
@GetMapping(PREFIX + "/all-company-list")
|
|
||||||
@Operation(summary = "获得所有公司精简信息列表")
|
|
||||||
CommonResult<List<DeptSimpleRespDTO>> getAllCompanyList();
|
|
||||||
|
|
||||||
@GetMapping(PREFIX + "/get")
|
|
||||||
@Operation(summary = "获得部门信息")
|
|
||||||
@Parameter(name = "id", description = "部门编号", example = "1024", required = true)
|
|
||||||
CommonResult<DeptRespDTO> getDept(@RequestParam("id") Long id);
|
|
||||||
|
|
||||||
@GetMapping(PREFIX + "/list")
|
|
||||||
@Operation(summary = "获得部门信息数组")
|
|
||||||
@Parameter(name = "ids", description = "部门编号数组", example = "1,2", required = true)
|
|
||||||
CommonResult<List<DeptRespDTO>> getDeptList(@RequestParam("ids") Collection<Long> ids);
|
|
||||||
|
|
||||||
@GetMapping(PREFIX + "/valid")
|
|
||||||
@Operation(summary = "校验部门是否合法")
|
|
||||||
@Parameter(name = "ids", description = "部门编号数组", example = "1,2", required = true)
|
|
||||||
CommonResult<Boolean> validateDeptList(@RequestParam("ids") Collection<Long> ids);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获得指定编号的部门 Map
|
|
||||||
*
|
|
||||||
* @param ids 部门编号数组
|
|
||||||
* @return 部门 Map
|
|
||||||
*/
|
|
||||||
default Map<Long, DeptRespDTO> getDeptMap(Collection<Long> ids) {
|
|
||||||
List<DeptRespDTO> list = getDeptList(ids).getCheckedData();
|
|
||||||
return CollectionUtils.convertMap(list, DeptRespDTO::getId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping(PREFIX + "/list-child")
|
|
||||||
@Operation(summary = "获得指定部门的所有子部门")
|
|
||||||
@Parameter(name = "id", description = "部门编号", example = "1024", required = true)
|
|
||||||
CommonResult<List<DeptRespDTO>> getChildDeptList(@RequestParam("id") Long id);
|
|
||||||
|
|
||||||
@GetMapping(PREFIX + "/company-dept-info")
|
|
||||||
@Operation(summary = "获得指定用户的公司部门信息")
|
|
||||||
@Parameter(name = "userId", description = "用户编号", example = "1", required = true)
|
|
||||||
CommonResult<Set<CompanyDeptInfoRespDTO>> getCompanyDeptInfoListByUserId(@RequestParam("userId") Long userId);
|
|
||||||
|
|
||||||
// ========== 数据同步专用接口 ==========
|
|
||||||
|
|
||||||
@PostMapping(PREFIX + "/sync")
|
|
||||||
@Operation(summary = "同步部门")
|
|
||||||
CommonResult<Boolean> syncDept(@RequestBody DeptSaveReqDTO syncReqDTO);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ import jakarta.annotation.Resource;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
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.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;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@Validated
|
||||||
|
public class EspApiImpl implements EspApi {
|
||||||
|
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IEspService deptService;
|
||||||
|
@Override
|
||||||
|
public CommonResult<List<EspDto>> pushMsg(DeptSaveReqDTO syncReqDTO)
|
||||||
|
{
|
||||||
|
return CommonResult.success(deptService.pushMsg(syncReqDTO));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -25,4 +25,7 @@ public class EspSaveRespVo extends DeptExternalCodeBaseVO {
|
|||||||
@Schema(description = "最后更新时间")
|
@Schema(description = "最后更新时间")
|
||||||
private LocalDateTime updateTime;
|
private LocalDateTime updateTime;
|
||||||
|
|
||||||
|
@Schema(description = "是否发送消息")
|
||||||
|
private Integer isSendMsg;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,4 +55,9 @@ public class DeptPushMsgDO extends TenantBaseDO {
|
|||||||
*/
|
*/
|
||||||
private String remark;
|
private String remark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否发送消息
|
||||||
|
*/
|
||||||
|
private Integer isSendMsg;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,10 +3,12 @@ package com.zt.plat.module.system.dal.mysql.dept;
|
|||||||
import com.zt.plat.framework.common.pojo.PageResult;
|
import com.zt.plat.framework.common.pojo.PageResult;
|
||||||
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
|
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
|
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.controller.admin.dept.vo.depexternalcode.EspPageReqVO;
|
||||||
import com.zt.plat.module.system.controller.admin.dept.vo.depexternalcode.EspSaveRespVo;
|
|
||||||
import com.zt.plat.module.system.dal.dataobject.dept.DeptPushMsgDO;
|
import com.zt.plat.module.system.dal.dataobject.dept.DeptPushMsgDO;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import org.apache.ibatis.annotations.Select;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
/**
|
/**
|
||||||
* 部门推送消息接口Mapper
|
* 部门推送消息接口Mapper
|
||||||
@@ -54,4 +56,10 @@ public interface EspMapper extends BaseMapperX<DeptPushMsgDO> {
|
|||||||
return selectList(DeptPushMsgDO::getSystemCode, 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\n" +
|
||||||
|
"FROM \n" +
|
||||||
|
"\t\tSYSTEM_DEPT_PUSH_MSG\n" +
|
||||||
|
"WHERE\n" +
|
||||||
|
" IS_SEND_MSG = '0' AND DELETED = '0' ")
|
||||||
|
List<DeptPushMsgDO> selectpushMsg(@Param("syncReqDTO") DeptSaveReqDTO syncReqDTO);
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,10 +1,11 @@
|
|||||||
package com.zt.plat.module.system.service.dept;
|
package com.zt.plat.module.system.service.dept;
|
||||||
|
|
||||||
import com.zt.plat.framework.common.pojo.PageResult;
|
import com.zt.plat.framework.common.pojo.PageResult;
|
||||||
|
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.controller.admin.dept.vo.depexternalcode.EspPageReqVO;
|
import com.zt.plat.module.system.controller.admin.dept.vo.depexternalcode.EspPageReqVO;
|
||||||
import com.zt.plat.module.system.controller.admin.dept.vo.depexternalcode.EspSaveRespVo;
|
import com.zt.plat.module.system.controller.admin.dept.vo.depexternalcode.EspSaveRespVo;
|
||||||
import com.zt.plat.module.system.dal.dataobject.dept.DeptPushMsgDO;
|
import com.zt.plat.module.system.dal.dataobject.dept.DeptPushMsgDO;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -27,7 +28,6 @@ public interface IEspService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除映射关系
|
* 删除映射关系
|
||||||
*
|
|
||||||
* @param id 记录编号
|
* @param id 记录编号
|
||||||
*/
|
*/
|
||||||
void deleteDeptPushMsg(Long id);
|
void deleteDeptPushMsg(Long id);
|
||||||
@@ -47,33 +47,11 @@ public interface IEspService {
|
|||||||
*/
|
*/
|
||||||
List<DeptPushMsgDO> getPushMsgByDeptId(Long deptId);
|
List<DeptPushMsgDO> getPushMsgByDeptId(Long deptId);
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据部门与外部系统保存/更新映射(存在则更新,不存在则创建)
|
|
||||||
* @param deptId 本系统部门 ID
|
|
||||||
* @param systemCode 外部系统标识
|
|
||||||
* @param externalDeptCode 外部系统组织编码
|
|
||||||
* @param externalDeptName 外部系统组织名称(可选)
|
|
||||||
* @param status 状态,默认启用
|
|
||||||
* @return 映射记录 ID
|
|
||||||
*/
|
|
||||||
/* Long getDeptPushMsgDetails(Long deptId, String systemCode, String externalDeptCode, String externalDeptName,
|
|
||||||
Integer status);*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据部门删除全部外部编码映射
|
* 推送部门数据到外部系统
|
||||||
*
|
* @param syncReqDTO 同步请求
|
||||||
* @param deptId 部门编号
|
|
||||||
*/
|
*/
|
||||||
//void deleteDeptExternalCodesByDeptId(Long deptId);
|
List<EspDto> pushMsg(DeptSaveReqDTO syncReqDTO);
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据外部系统与外部组织编码查询映射
|
|
||||||
*/
|
|
||||||
//DeptExternalCodeDO getBySystemCodeAndExternalCode(String systemCode, String externalDeptCode);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据外部系统与部门编号查询映射
|
|
||||||
*/
|
|
||||||
//DeptExternalCodeDO getBySystemCodeAndDeptId(String systemCode, Long deptId);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user