补招逻辑修改,手动补招和前端采用websokcet通讯
This commit is contained in:
@@ -1,9 +1,14 @@
|
||||
package com.njcn.message.messagedto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
|
||||
import com.njcn.middle.rocket.domain.BaseMessage;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
@@ -14,11 +19,22 @@ import java.io.Serializable;
|
||||
*/
|
||||
@Data
|
||||
public class TopicReplyDTO extends BaseMessage implements Serializable {
|
||||
//消息id
|
||||
//消息id guid="12345"是补招回复结果
|
||||
private String guid;
|
||||
|
||||
private String step;
|
||||
|
||||
//guid="12345"是补招回复结果
|
||||
private String result;
|
||||
|
||||
private String lineIndex;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
|
||||
private LocalDateTime recallStartDate;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
|
||||
private LocalDateTime recallEndDate;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -64,19 +64,19 @@ public class DeviceRunFlagDataConsumer extends EnhanceConsumerMessageHandler<Dev
|
||||
*/
|
||||
@Override
|
||||
public boolean filter(DevComFlagDTO message) {
|
||||
String keyStatus = redisUtil.getStringByKey(AppRedisKey.RMQ_CONSUME_KEY.concat(message.getKey()));
|
||||
if (Objects.isNull(keyStatus) || keyStatus.equalsIgnoreCase(MessageStatus.FAIL)) {
|
||||
redisUtil.saveByKeyWithExpire(RedisKeyPrefix.DEVICE_RUN_FLAG.concat(message.getKey()), MessageStatus.BEING_PROCESSED, 30L);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
// String keyStatus = redisUtil.getStringByKey(AppRedisKey.RMQ_CONSUME_KEY.concat(message.getKey()));
|
||||
// if (Objects.isNull(keyStatus) || keyStatus.equalsIgnoreCase(MessageStatus.FAIL)) {
|
||||
// redisUtil.saveByKeyWithExpire(RedisKeyPrefix.DEVICE_RUN_FLAG.concat(message.getKey()), MessageStatus.BEING_PROCESSED, 30L);
|
||||
// return false;
|
||||
// }
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* 消费成功,缓存到redis72小时,避免重复消费
|
||||
*/
|
||||
@Override
|
||||
protected void consumeSuccess(DevComFlagDTO message) {
|
||||
redisUtil.saveByKeyWithExpire(RedisKeyPrefix.DEVICE_RUN_FLAG.concat(message.getKey()), MessageStatus.SUCCESS, 5*60L);
|
||||
// redisUtil.saveByKeyWithExpire(RedisKeyPrefix.DEVICE_RUN_FLAG.concat(message.getKey()), MessageStatus.SUCCESS, 5*60L);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ public class RealTimeDataConsumer extends EnhanceConsumerMessageHandler<MessageD
|
||||
*/
|
||||
@Override
|
||||
protected void consumeSuccess(MessageDataDTO message) {
|
||||
redisUtil.saveByKeyWithExpire(RedisKeyPrefix.REAL_TIME_DATA.concat(message.getKey()), MessageStatus.SUCCESS, 5*60L);
|
||||
// redisUtil.saveByKeyWithExpire(RedisKeyPrefix.REAL_TIME_DATA.concat(message.getKey()), MessageStatus.SUCCESS, 5*60L);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
package com.njcn.message.consumer;
|
||||
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.njcn.message.constant.MessageStatus;
|
||||
import com.njcn.message.messagedto.TopicReplyDTO;
|
||||
import com.njcn.message.constant.RedisKeyPrefix;
|
||||
import com.njcn.middle.rocket.constant.EnhanceMessageConstant;
|
||||
import com.njcn.middle.rocket.handler.EnhanceConsumerMessageHandler;
|
||||
import com.njcn.redis.pojo.enums.AppRedisKey;
|
||||
import com.njcn.redis.pojo.enums.RedisKeyEnum;
|
||||
import com.njcn.redis.utils.RedisUtil;
|
||||
import com.njcn.stat.api.MessAnalysisFeignClient;
|
||||
@@ -76,14 +76,20 @@ public class TopicReplyConsumer extends EnhanceConsumerMessageHandler<TopicReply
|
||||
*/
|
||||
@Override
|
||||
protected void consumeSuccess(TopicReplyDTO message) {
|
||||
redisUtil.saveByKeyWithExpire(RedisKeyPrefix.TOPIC_REPLY.concat(message.getKey()), MessageStatus.SUCCESS, RedisKeyEnum.ROCKET_MQ_KEY.getTime());
|
||||
// redisUtil.saveByKeyWithExpire(RedisKeyPrefix.TOPIC_REPLY.concat(message.getKey()), MessageStatus.SUCCESS, RedisKeyEnum.ROCKET_MQ_KEY.getTime());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void handleMessage(TopicReplyDTO message) {
|
||||
//业务处理
|
||||
redisUtil.saveByKeyWithExpire(RedisKeyPrefix.TOPIC_REPLY.concat(message.getGuid()),JSONObject.toJSONString(message),60*60L);
|
||||
//“12345”补招回复
|
||||
if(Objects.equals(message.getGuid(),"12345")){
|
||||
redisUtil.saveByKeyWithExpire(RedisKeyPrefix.TOPIC_REPLY.concat(message.getLineIndex().concat(message.getRecallStartDate().toLocalDate().format(DatePattern.NORM_DATE_FORMATTER))),JSONObject.toJSONString(message),60*60L);
|
||||
}else {
|
||||
//业务处理
|
||||
redisUtil.saveByKeyWithExpire(RedisKeyPrefix.TOPIC_REPLY.concat(message.getGuid()),JSONObject.toJSONString(message),60*60L);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user