mirror of
https://github.com/hpd840321/starRiverProperty.git
synced 2026-06-09 08:20:31 +08:00
fix: P1 partial — CpImageStorePersonSynManager 38→10
Fixed:
- RedisCallback cast on 6 execute() calls
- Set cast to Set<String> in checkHandleSynTaskException (4 locations)
- Removed (Object) from hasKey call
- Fixed Lists.newArrayList((Object[])new String[]{x}) → Lists.newArrayList(x) (2 locations)
- Added RedisCallback import
Remaining: 10 errors — lambda effectively-final violations (Java 8)
This commit is contained in:
+15
-14
@@ -31,6 +31,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import org.springframework.data.redis.core.RedisCallback;
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.Resource;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@@ -229,7 +230,7 @@ extends AbstractImagStoreService {
|
||||
try {
|
||||
this.logger.info("CpImageStorePersonSynManager handleGroupPersonSynTask lockHandleSynTaskRes : 加锁消费图库{}成功", (Object)imageStoreId);
|
||||
String synQueueHeadDataKey = SYN_QUEUE_HEAD_DATA + imageStoreId;
|
||||
if (this.redisTemplate.hasKey((Object)synQueueHeadDataKey).booleanValue()) {
|
||||
if (this.redisTemplate.hasKey(synQueueHeadDataKey).booleanValue()) {
|
||||
this.logger.warn("CpImageStorePersonSynManager handleGroupPersonSynTask synQueueHeadDataKey : 已存在同步任务队首数据{}", (Object)synQueueHeadDataKey);
|
||||
this.groupPersonSyn(imageStoreId, synQueueHeadDataKey);
|
||||
} else {
|
||||
@@ -414,10 +415,10 @@ extends AbstractImagStoreService {
|
||||
ImgStorePerson personExpiryDate;
|
||||
List associatedPersonExpiryDateAfterUpdate;
|
||||
this.logger.info("CpImageStorePersonSynManager handleImageStoreIncrementSyn 单人员更新注册照:{},{}", (Object)synData.getPersonId(), (Object)synData.getOldImageId());
|
||||
Map<String, GroupPersonRef> associatedPersonResultsAfterUpdate2 = this.cpImageStorePersonManager.getGroupPersonRefByPersons(waitSyncImageStore.getId(), Lists.newArrayList((Object[])new String[]{synData.getPersonId()}));
|
||||
Map<String, GroupPersonRef> associatedPersonResultsBeforeUpdate = this.cpImageStorePersonManager.getOldAssociatedPersonIds(waitSyncImageStore.getId(), Lists.newArrayList((Object[])new String[]{synData.getPersonId()}));
|
||||
Map<String, GroupPersonRef> associatedPersonResultsAfterUpdate2 = this.cpImageStorePersonManager.getGroupPersonRefByPersons(waitSyncImageStore.getId(), Lists.newArrayList(synData.getPersonId()));
|
||||
Map<String, GroupPersonRef> associatedPersonResultsBeforeUpdate = this.cpImageStorePersonManager.getOldAssociatedPersonIds(waitSyncImageStore.getId(), Lists.newArrayList(synData.getPersonId()));
|
||||
GroupPersonRef refAfterUpdate = associatedPersonResultsAfterUpdate2.get(synData.getPersonId());
|
||||
if (refAfterUpdate != null && CollectionUtil.isNotEmpty((Collection)(associatedPersonExpiryDateAfterUpdate = this.imgStorePersonMapper.selectExpiryDateByIds((List)Lists.newArrayList((Object[])new String[]{synData.getPersonId()})))) && ((personExpiryDate = (ImgStorePerson)associatedPersonExpiryDateAfterUpdate.get(0)).getExpiryBeginDate() != null || personExpiryDate.getExpiryEndDate() != null)) {
|
||||
if (refAfterUpdate != null && CollectionUtil.isNotEmpty((Collection)(associatedPersonExpiryDateAfterUpdate = this.imgStorePersonMapper.selectExpiryDateByIds((List)Lists.newArrayList(synData.getPersonId())))) && ((personExpiryDate = (ImgStorePerson)associatedPersonExpiryDateAfterUpdate.get(0)).getExpiryBeginDate() != null || personExpiryDate.getExpiryEndDate() != null)) {
|
||||
refAfterUpdate.setExpiryBeginDate(personExpiryDate.getExpiryBeginDate());
|
||||
refAfterUpdate.setExpiryEndDate(personExpiryDate.getExpiryEndDate());
|
||||
refAfterUpdate.setStatus(Short.valueOf(this.checkGroupPersonStatus(personExpiryDate.getExpiryBeginDate(), personExpiryDate.getExpiryEndDate())));
|
||||
@@ -461,45 +462,45 @@ extends AbstractImagStoreService {
|
||||
|
||||
public Long addWaitSynTask(String imageStoreId, String jsonData) {
|
||||
this.logger.info("addWaitSynTask - 图库待同步任务队列队尾新增任务 imageStoreId:{}; jsonData: {}", (Object)imageStoreId, (Object)jsonData);
|
||||
return (Long)this.redisTemplate.execute(connection -> (Long)connection.eval(this.addWaitSynTaskRedisScript.getScriptAsString().getBytes(), ReturnType.INTEGER, 0, (byte[][])new byte[][]{imageStoreId.getBytes(), jsonData.getBytes()}));
|
||||
return (Long)this.redisTemplate.execute((RedisCallback) connection -> (Long)connection.eval(this.addWaitSynTaskRedisScript.getScriptAsString().getBytes(), ReturnType.INTEGER, 0, (byte[][])new byte[][]{imageStoreId.getBytes(), jsonData.getBytes()}));
|
||||
}
|
||||
|
||||
public Long lockHandleSynTask(String imageStoreId) {
|
||||
return (Long)this.redisTemplate.execute(connection -> (Long)connection.eval(this.lockHandleSynTaskRedisScript.getScriptAsString().getBytes(), ReturnType.INTEGER, 0, (byte[][])new byte[][]{imageStoreId.getBytes(), this.serverInstanceId.getBytes(), this.lockHandleSynTaskSecond.getBytes()}));
|
||||
return (Long)this.redisTemplate.execute((RedisCallback) connection -> (Long)connection.eval(this.lockHandleSynTaskRedisScript.getScriptAsString().getBytes(), ReturnType.INTEGER, 0, (byte[][])new byte[][]{imageStoreId.getBytes(), this.serverInstanceId.getBytes(), this.lockHandleSynTaskSecond.getBytes()}));
|
||||
}
|
||||
|
||||
public Long lockHeadSynTask(String imageStoreId) {
|
||||
return (Long)this.redisTemplate.execute(connection -> (Long)connection.eval(this.lockHeadSynTaskRedisScript.getScriptAsString().getBytes(), ReturnType.INTEGER, 1, (byte[][])new byte[][]{imageStoreId.getBytes(), imageStoreId.getBytes(), this.serverInstanceId.getBytes(), String.valueOf(this.taskIsAllThreshold).getBytes()}));
|
||||
return (Long)this.redisTemplate.execute((RedisCallback) connection -> (Long)connection.eval(this.lockHeadSynTaskRedisScript.getScriptAsString().getBytes(), ReturnType.INTEGER, 1, (byte[][])new byte[][]{imageStoreId.getBytes(), imageStoreId.getBytes(), this.serverInstanceId.getBytes(), String.valueOf(this.taskIsAllThreshold).getBytes()}));
|
||||
}
|
||||
|
||||
public Long handleSuccessSynTask(String imageStoreId) {
|
||||
return (Long)this.redisTemplate.execute(connection -> (Long)connection.eval(this.handleSuccessSynTaskRedisScript.getScriptAsString().getBytes(), ReturnType.INTEGER, 0, (byte[][])new byte[][]{imageStoreId.getBytes(), this.serverInstanceId.getBytes()}));
|
||||
return (Long)this.redisTemplate.execute((RedisCallback) connection -> (Long)connection.eval(this.handleSuccessSynTaskRedisScript.getScriptAsString().getBytes(), ReturnType.INTEGER, 0, (byte[][])new byte[][]{imageStoreId.getBytes(), this.serverInstanceId.getBytes()}));
|
||||
}
|
||||
|
||||
public Long handleFailSynTask(String imageStoreId) {
|
||||
return (Long)this.redisTemplate.execute(connection -> (Long)connection.eval(this.handleFailSynTaskRedisScript.getScriptAsString().getBytes(), ReturnType.INTEGER, 0, (byte[][])new byte[][]{imageStoreId.getBytes(), this.serverInstanceId.getBytes()}));
|
||||
return (Long)this.redisTemplate.execute((RedisCallback) connection -> (Long)connection.eval(this.handleFailSynTaskRedisScript.getScriptAsString().getBytes(), ReturnType.INTEGER, 0, (byte[][])new byte[][]{imageStoreId.getBytes(), this.serverInstanceId.getBytes()}));
|
||||
}
|
||||
|
||||
public void refreshHandleSynTaskLockExpireTime() {
|
||||
byte[] res = (byte[])this.redisTemplate.execute(connection -> (byte[])connection.eval(this.refreshHandleSynTaskRedisScript.getScriptAsString().getBytes(), ReturnType.VALUE, 0, (byte[][])new byte[][]{this.serverInstanceId.getBytes(), this.lockHandleSynTaskSecond.getBytes()}));
|
||||
byte[] res = (byte[])this.redisTemplate.execute((RedisCallback) connection -> (byte[])connection.eval(this.refreshHandleSynTaskRedisScript.getScriptAsString().getBytes(), ReturnType.VALUE, 0, (byte[][])new byte[][]{this.serverInstanceId.getBytes(), this.lockHandleSynTaskSecond.getBytes()}));
|
||||
this.logger.info("CpImageStorePersonSynManager refreshHandleSynTaskLockExpireTime : {}", (Object)new String(res));
|
||||
}
|
||||
|
||||
public void checkHandleSynTaskException() {
|
||||
Set synQueueHeadDataKeys = (java.lang.String) this.redisTemplate.keys((Object)"group_person_syn_queue_head_data:*");
|
||||
Set<String> synQueueHeadDataKeys = this.redisTemplate.keys("group_person_syn_queue_head_data:*");
|
||||
synQueueHeadDataKeys.forEach(synQueueHeadDataKey -> {
|
||||
String imageStoreId = synQueueHeadDataKey.replaceFirst(SYN_QUEUE_HEAD_DATA, "");
|
||||
Set lockKeys = (java.lang.String) this.redisTemplate.keys((Object)(imageStoreId + ":*"));
|
||||
Set<String> lockKeys = this.redisTemplate.keys(imageStoreId + ":*");
|
||||
if (Collections3.isEmpty((Collection)lockKeys)) {
|
||||
this.logger.info("CpImageStorePersonSynManager checkHandleSynTaskException 消费加锁");
|
||||
this.handleFailSynTask(imageStoreId);
|
||||
this.handleGroupPersonSynTask(imageStoreId);
|
||||
}
|
||||
});
|
||||
Set waitSynTaskKeys = (java.lang.String) this.redisTemplate.keys((Object)"group_person_wait_syn_task:*");
|
||||
Set<String> waitSynTaskKeys = this.redisTemplate.keys("group_person_wait_syn_task:*");
|
||||
waitSynTaskKeys.forEach(waitSynTaskKey -> {
|
||||
String imageStoreId = waitSynTaskKey.replaceFirst(WAIT_SYN_TASK_KEY, "");
|
||||
Set lockKeys = (java.lang.String) this.redisTemplate.keys((Object)(imageStoreId + ":*"));
|
||||
Set<String> lockKeys = this.redisTemplate.keys(imageStoreId + ":*");
|
||||
if (Collections3.isEmpty((Collection)lockKeys)) {
|
||||
this.logger.info("CpImageStorePersonSynManager checkHandleSynTaskException 未消费");
|
||||
this.handleFailSynTask(imageStoreId);
|
||||
|
||||
Reference in New Issue
Block a user