Home > Back-end >  Urgent urgent
Urgent urgent

Time:01-22

CodePudding user response:

Didn't do a null value judgment, the attribute is null,

CodePudding user response:

reference 1st floor icoolno1 response:
didn't do a null value judgment, have the attribute is null,
 public void the receive (UserAudioProgress audioProgress) {
The log. The debug (" received audio process message: "+ audioProgress);

//1. Statistics update play amount
String playKey=CommonConstants. CacheKey. REDIS_COUNT_AUDIO_PLAY + audioProgress. GetBizId () + ":"
+ audioProgress. GetCreateUserId ();

/*
* if the user does not have played today the audio, then store the key, and set the expiry time for 23:59:59 today, and returns null, update the playback volume if there is a value that has been statistics stored value must be of type string, or it will go wrong
*/
String playVal=redisService. GetAndSet (playKey, "1", DateUtil endOfDay (new Date ()));
If (StrUtil isBlank (playVal)) {
//play amount + 1
AudioInfoService. UpdatePlayNum (audioProgress getBizId ());
}

//2. Keep learning progress
//query whether the existing users watch the progress of the audio
QueryWrapper 've=new QueryWrapper<> (a);
've. Eq (" BIZ_ID ", audioProgress getBizId ());
've. Eq (" CREATE_USER_ID, "audioProgress getCreateUserId ());
UserAudioProgress oldEntity=userAudioProgressService. GetOne ('ve);

Boolean notNull=ObjectUtil. IsNotNull (oldEntity);
Boolean hasNewProgress=true;//there is new progress
If (notNull) {
/*
* if the schedule has been in existence, judge progress size, progress is greater than the saved data to continue to insert audio progress, prevent due to server hang up before was not consumed or other network information pollution data, at the same time also can ensure that data idempotence
*/
OldEntity. SetPreEndTime (audioProgress getPreEndTime ());
OldEntity. SetModifyUserId (audioProgress getCreateUserId ());
OldEntity. SetModifyDate (new Date ());
HasNewProgress=audioProgress. GetTotalTime () & gt; OldEntity. GetTotalTime ();
If (hasNewProgress) {
OldEntity. SetTotalTime (audioProgress getTotalTime ());
OldEntity. SetProgress (audioProgress getProgress ());
}
If (oldEntity. GetProgress (.) doubleValue () & gt;=CommonConstants. STANDARD_PROGRESS) {
OldEntity. SetIsFinish (SysParamsEnum. STATUS_YES. GetCode ());
}
UserAudioProgressService. Update (oldEntity,
New QueryWrapper (a). Eq (" UUID, "oldEntity. GetUuid ()));

} else {
If (audioProgress. GetProgress (.) doubleValue () & gt;=CommonConstants. STANDARD_PROGRESS) {
AudioProgress. SetIsFinish (SysParamsEnum. STATUS_YES. GetCode ());
}
//if no progress is the first time to watch, save progress
UserAudioProgressService. Save (audioProgress);
}
//3. Record the user history
AudioInfo AudioInfo=userHistory (notNull? OldEntity: audioProgress);

//4. Record the user credits
//have to update the new schedule credits
If (hasNewProgress) {
SaveCredit (audioProgress audioInfo);
}
}

Who can help me take a look at where there is no empty value judgment

CodePudding user response:

In this code you, which part is for processing of MQ of sending and receiving (that is, to locate to deliver letters receiving processing position)?
Feel like your method is called framework in the reflection of the way, when sending receiving treatment, your side can't normal received the message, so the framework automatically convert your message type (similar to convert restfulTemplate response) is thrown a null pointer exception
You can use the try catch to track screening, it would be something wrong with block processing


CodePudding user response:

Depends on the upper receives the message code, estimates that place wrong, causing the method invocation is not successful,
  • Related