diff --git a/src/main/java/com/glxp/api/controller/trace/TestController.java b/src/main/java/com/glxp/api/controller/trace/TestController.java index 59a6c45..bc003b7 100644 --- a/src/main/java/com/glxp/api/controller/trace/TestController.java +++ b/src/main/java/com/glxp/api/controller/trace/TestController.java @@ -1,13 +1,16 @@ package com.glxp.api.controller.trace; import cn.hutool.core.lang.UUID; +import com.alibaba.fastjson.JSON; import com.glxp.api.common.res.BaseResponse; import com.glxp.api.common.util.ResultVOUtils; import com.glxp.api.config.rabbit.TopicRabbitConfig; +import com.glxp.api.entity.trace.MqTraceMessage; import com.glxp.api.util.DateUtil; import lombok.RequiredArgsConstructor; import org.springframework.amqp.rabbit.core.RabbitTemplate; import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; diff --git a/src/main/java/com/glxp/api/controller/trace/TraceOrderController.java b/src/main/java/com/glxp/api/controller/trace/TraceOrderController.java index 1c90894..ede4752 100644 --- a/src/main/java/com/glxp/api/controller/trace/TraceOrderController.java +++ b/src/main/java/com/glxp/api/controller/trace/TraceOrderController.java @@ -80,6 +80,7 @@ public class TraceOrderController extends BaseController { TraceTaskNoticeService traceTaskNoticeService; //客户端单据信息上传接口 + @ApiOperation(value = "客户端单据信息上传接口",response = BaseResponse.class) @AuthRuleAnnotation("udi/trace/inout/order/upload") @PostMapping("udi/trace/inout/order/upload") public BaseResponse uploadInoutOrder(@RequestBody TraceOrderUploadRequest traceOrderUploadRequest, BindingResult bindingResult) { diff --git a/src/main/java/com/glxp/api/controller/trace/UdiTraceController.java b/src/main/java/com/glxp/api/controller/trace/UdiTraceController.java index 6ccbeff..151ef63 100644 --- a/src/main/java/com/glxp/api/controller/trace/UdiTraceController.java +++ b/src/main/java/com/glxp/api/controller/trace/UdiTraceController.java @@ -1,13 +1,16 @@ package com.glxp.api.controller.trace; import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.lang.UUID; import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.StrUtil; +import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.glxp.api.annotation.AuthRuleAnnotation; import com.glxp.api.common.enums.ResultEnum; import com.glxp.api.common.res.BaseResponse; import com.glxp.api.common.util.ResultVOUtils; +import com.glxp.api.config.rabbit.TopicRabbitConfig; import com.glxp.api.constant.Constant; import com.glxp.api.controller.BaseController; import com.glxp.api.entity.basic.UdiEntity; @@ -24,11 +27,14 @@ import com.glxp.api.service.basic.BasicUdiRelService; import com.glxp.api.service.sup.UserCompanyService; import com.glxp.api.service.system.SystemParamConfigService; import com.glxp.api.service.trace.*; +import com.glxp.api.util.DateUtil; import com.glxp.api.util.GennerOrderUtils; import com.glxp.api.util.udi.FilterUdiUtils; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.springframework.amqp.rabbit.core.RabbitTemplate; import org.springframework.beans.BeanUtils; import org.springframework.transaction.annotation.Transactional; import org.springframework.validation.BindingResult; @@ -40,12 +46,15 @@ import springfox.documentation.annotations.ApiIgnore; import javax.annotation.Resource; import java.util.Date; +import java.util.HashMap; import java.util.List; +import java.util.Map; @Api(tags = "UDI追溯相关接口") @ApiIgnore @RestController @Slf4j +@RequiredArgsConstructor public class UdiTraceController extends BaseController { @@ -74,7 +83,15 @@ public class UdiTraceController extends BaseController { SystemParamConfigService systemParamConfigService; @Resource RabbitPushService rabbitPushService; + @Resource + private final RabbitTemplate rabbitTemplate; + @GetMapping("/udi/trace/source/sendUDI") + public BaseResponse sendUdi(@RequestBody TraceRecordRequest traceRecordRequest) { + String messageJson = JSON.toJSONString(traceRecordRequest); + rabbitTemplate.convertAndSend("trace.topic.exchange", TopicRabbitConfig.common, messageJson); + return ResultVOUtils.success("发送成功"); + } /** * 源头追溯查询