|
|
|
@ -2,6 +2,8 @@ package com.logpm.distribution.receiver.log;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
|
import cn.hutool.json.JSONUtil; |
|
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
|
import com.alibaba.fastjson.TypeReference; |
|
|
|
|
import com.logpm.distribution.entity.DistributionPlanLogEntity; |
|
|
|
|
import com.logpm.distribution.service.IDistributionPlanLogService; |
|
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
@ -10,7 +12,6 @@ import org.springblade.common.constant.DistributionTypeConstant;
|
|
|
|
|
import org.springblade.common.constant.broadcast.FanoutConstants; |
|
|
|
|
import org.springblade.common.enums.BizOperationEnums; |
|
|
|
|
import org.springblade.common.model.NodeFanoutMsg; |
|
|
|
|
import org.springblade.common.model.PackageData; |
|
|
|
|
import org.springblade.common.model.ReservationVO; |
|
|
|
|
import org.springframework.amqp.core.ExchangeTypes; |
|
|
|
|
import org.springframework.amqp.rabbit.annotation.Exchange; |
|
|
|
@ -19,8 +20,6 @@ import org.springframework.amqp.rabbit.annotation.QueueBinding;
|
|
|
|
|
import org.springframework.amqp.rabbit.annotation.RabbitListener; |
|
|
|
|
import org.springframework.stereotype.Component; |
|
|
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
@Slf4j |
|
|
|
|
@Component |
|
|
|
|
@AllArgsConstructor |
|
|
|
@ -37,22 +36,23 @@ public class ReservationLogListener {
|
|
|
|
|
if (StrUtil.isEmpty(msg)) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
NodeFanoutMsg<ReservationVO> bean = JSONUtil.toBean(msg, NodeFanoutMsg.class); |
|
|
|
|
NodeFanoutMsg<ReservationVO> bean = JSONObject.parseObject(msg, new TypeReference<NodeFanoutMsg<ReservationVO>>(){}); |
|
|
|
|
if (bean == null) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
BizOperationEnums bizOperation = bean.getBizOperation(); |
|
|
|
|
if(bizOperation.equals(BizOperationEnums.ADD)){ |
|
|
|
|
// addLog(bean);
|
|
|
|
|
addLog(bean); |
|
|
|
|
}else if (bizOperation.equals(BizOperationEnums.MODIFY)){ |
|
|
|
|
|
|
|
|
|
log.warn("修改预约信息未记录日志"); |
|
|
|
|
updataLog(bean); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void addLog(NodeFanoutMsg<ReservationVO> bean) { |
|
|
|
|
|
|
|
|
|
log.info(" bean: {}",bean.getMain().toString()); |
|
|
|
|
ReservationVO main = bean.getMain(); |
|
|
|
|
if (main == null) { |
|
|
|
|
return; |
|
|
|
@ -77,5 +77,18 @@ public class ReservationLogListener {
|
|
|
|
|
distributionPlanLogService.save(distributionPlanLogEntity); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void updataLog(NodeFanoutMsg<ReservationVO> bean) { |
|
|
|
|
|
|
|
|
|
ReservationVO main = bean.getMain(); |
|
|
|
|
if (main == null) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
log.info(" 这里对日志记录的处理存在问题 bean: {}",bean.getMain()); |
|
|
|
|
// todo 这里对日志记录的处理存在问题
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|