spdm消息通知
This commit is contained in:
@@ -61,6 +61,11 @@
|
||||
<artifactId>honeycom-user-api</artifactId>
|
||||
<version>5.4.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.honeycombis</groupId>
|
||||
<artifactId>honeycom-msg-api</artifactId>
|
||||
<version>5.4.0</version>
|
||||
</dependency>
|
||||
<!--必备: 操作数据源相关-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.honeycombis</groupId>-->
|
||||
|
||||
@@ -21,8 +21,6 @@ package com.honeycombis.honeycom.spdm.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.json.JSON;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.alibaba.cloud.commons.lang.StringUtils;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2018-2025, honeycom All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the pig4cloud.com developer nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
* Author: honeycom
|
||||
*
|
||||
*/
|
||||
|
||||
package com.honeycombis.honeycom.spdm.controller;
|
||||
|
||||
import com.honeycombis.honeycom.common.core.util.R;
|
||||
import com.honeycombis.honeycom.msg.api.dto.MessageOpenApiDTO;
|
||||
import com.honeycombis.honeycom.spdm.dto.*;
|
||||
import com.honeycombis.honeycom.spdm.feign.RemoteMsgServiceFeign;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequestMapping("/spdm-msg")
|
||||
@Tag(description = "spdm", name = "提供给SPDM的流程模块")
|
||||
@Slf4j
|
||||
public class SpdmMsgController {
|
||||
|
||||
@Resource
|
||||
private RemoteMsgServiceFeign remoteMsgServiceFeign;
|
||||
|
||||
@Operation(summary = "发起流程")
|
||||
@PostMapping(value = "/sendMessage")
|
||||
public R sendMessage(@RequestBody MessageDto messageDto) {
|
||||
MessageOpenApiDTO messageOpenApiDTO = new MessageOpenApiDTO();
|
||||
messageOpenApiDTO.setTitle(messageDto.getTitle());
|
||||
messageOpenApiDTO.setContent(messageDto.getContent());
|
||||
messageOpenApiDTO.setStaffCode(messageDto.getUserId());
|
||||
messageOpenApiDTO.setTenantCode(messageDto.getTenantId());
|
||||
return remoteMsgServiceFeign.pushMessage(messageOpenApiDTO, messageDto.getTenantId());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.honeycombis.honeycom.spdm.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class MessageDto {
|
||||
@Schema(description = "租户代码")
|
||||
private String tenantId;
|
||||
|
||||
@Schema(description = "员工工号")
|
||||
private String userId;
|
||||
|
||||
@Schema(description = "消息标题")
|
||||
private String title;
|
||||
|
||||
@Schema(description = "消息内容")
|
||||
private String content;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.honeycombis.honeycom.spdm.feign;
|
||||
|
||||
import com.honeycombis.honeycom.common.core.constant.CommonConstants;
|
||||
import com.honeycombis.honeycom.common.core.constant.ServiceNameConstants;
|
||||
import com.honeycombis.honeycom.common.core.util.R;
|
||||
import com.honeycombis.honeycom.common.feign.config.FeignConfig;
|
||||
import com.honeycombis.honeycom.msg.api.dto.MessageOpenApiDTO;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
@FeignClient(contextId = "remoteMsgService", value = ServiceNameConstants.MSG_SERVICE, configuration = FeignConfig.class)
|
||||
public interface RemoteMsgServiceFeign {
|
||||
|
||||
@PostMapping(value = "/openapi/push")
|
||||
R<Object> pushMessage(@RequestBody MessageOpenApiDTO dto, @RequestHeader(CommonConstants.TENANT_ID) String tenantId);
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user