mirror of
https://github.com/hpd840321/starRiverProperty.git
synced 2026-06-09 08:20:31 +08:00
fix: P0+P2+P3 — CpOrgDevieKit, ValidateManager, OrganizationServiceImpl clean
P0: CpOrgDevieKitServiceImpl (54→0) - Fixed 10 $\$ artifacts with correct variable names - Typed 7 raw Collection/List/Set declarations - Removed (Object) casts from redisTemplate calls P2: CpImageStorePersonValidateManager (36→0) - Added RedisCallback cast for execute() ambiguity - Typed Map.Entry for-each with proper generics - Fixed ternary type mismatch (List<Object>→SyncPersonLocal) - Typed waitAddValidateList as List<GroupPersonRef> P3: OrganizationServiceImpl (32→0) - Typed 7 raw List declarations (refDTOS, data, organizations, etc) - Fixed ArrayList<> vs List<> assignment - Typed passableArea/officeArea streams
This commit is contained in:
@@ -0,0 +1,262 @@
|
|||||||
|
# Component-Org Service 编译错误分类 (200 errors, 8 files)
|
||||||
|
|
||||||
|
**日期**: 2026-05-05
|
||||||
|
**构建**: `mvn compile -DskipTests -s ../maven-cw-elevator-application/.mvn/settings.xml`
|
||||||
|
**JDK**: 1.8.0_482 | **Spring Boot**: 1.5.22 | **CFR 反编译**: 0.152
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 错误总览
|
||||||
|
|
||||||
|
| 类别 | 数量 | 根因 | 自动修复难度 |
|
||||||
|
|------|------|------|-------------|
|
||||||
|
| No-symbol (找不到符号) | 78 | `$$$` ast-grep 残留 + raw stream 调用 + 方法歧义 | ⭐⭐ 中 |
|
||||||
|
| Object→cast | 76 | raw List/Map 失去泛型 | ⭐⭐⭐ 高 |
|
||||||
|
| Type-mismatch | 22 | 类型声明与使用不匹配 | ⭐⭐ 中 |
|
||||||
|
| Ambiguous (方法歧义) | 16 | redisTemplate.execute() 歧义 | ⭐ 低 |
|
||||||
|
| Type-inf (类型推断) | 6 | 空集合初始化泛型推断 | ⭐ 低 |
|
||||||
|
|
||||||
|
**总计**: 200 errors in 8 files
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 1. No-symbol (78 errors)
|
||||||
|
|
||||||
|
### 1.1 `$$$` ast-grep 残留 (36 errors)
|
||||||
|
|
||||||
|
**涉及文件**: CpOrgDevieKitServiceImpl (32), OrganizationUnitTypeServiceImpl (12), AreaTypeServiceImpl (2)
|
||||||
|
|
||||||
|
**根因**: `ast_grep_replace` 将 `return CloudwalkResult.success(X)` 改为 `return (CloudwalkResult) CloudwalkResult.success($$$)` 时, `$$$` 捕获参数但 rewrite 时 `$$$` 在 `success()` 括号内丢失了 X — X 变量覆盖了 `$$$` 变量名。
|
||||||
|
|
||||||
|
**源代码模式**:
|
||||||
|
```java
|
||||||
|
// 改写前 (ast-grep)
|
||||||
|
return CloudwalkResult.success(updateGroupResult);
|
||||||
|
// 改写后 (异常)
|
||||||
|
return (CloudwalkResult) CloudwalkResult.success($$$);
|
||||||
|
```
|
||||||
|
|
||||||
|
**修复方案**: 逐行恢复原始表达式。
|
||||||
|
|
||||||
|
**影响方法**:
|
||||||
|
- CpOrgDevieKitServiceImpl: `onUpdateGroupRequest(L117)`, `onUpdateFeatureRequest(L127/L140/L166)`, `onUpdatePictureRequest(L176/L189/L215)`, `onUpdatePersonRequest(L235/L255/L310)`, `handlePersonValidDate(L522/L530)`
|
||||||
|
- OrganizationUnitTypeServiceImpl: `page(L76)`, `getList(L110)`, `defaultInitOrgType(L121/L145)`, `initParkOrg(L188/L227)`
|
||||||
|
- AreaTypeServiceImpl: `add(L104)`
|
||||||
|
|
||||||
|
### 1.2 raw stream `.map()` 调用 Object 方法 (12 errors)
|
||||||
|
|
||||||
|
**涉及文件**: OrganizationServiceImpl.detail(L814,L815,L824,L843), CpImageStorePersonManager(L110,L357,L365,L386)
|
||||||
|
|
||||||
|
**根因**: raw List 的 `.stream()` 返回 `Stream<Object>`, 对 Object 调用 `.getAreaId()` / `.getImageStoreId()` 找不到方法。
|
||||||
|
|
||||||
|
**源代码模式**:
|
||||||
|
```java
|
||||||
|
// refDTOS 是 raw List, stream() 是 Stream<Object>
|
||||||
|
List officeArea = refDTOS.stream()
|
||||||
|
.filter(it -> it.getRefType() == 0) // Object 没有 getRefType()
|
||||||
|
.map(o -> o.getAreaId()) // Object 没有 getAreaId()
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
```
|
||||||
|
|
||||||
|
**修复方案**: 在 stream 前添加 `(List<OrganizationAreaRefDTO>)` 转换,或定义变量时指定泛型。
|
||||||
|
|
||||||
|
### 1.3 redisTemplate.delete(Object) (2 errors)
|
||||||
|
|
||||||
|
**涉及文件**: CpOrgDevieKitServiceImpl.unlockSyncLog(L593)
|
||||||
|
|
||||||
|
**根因**: `redisTemplate.delete(Object)` — RedisTemplate 的 `delete()` 签名是 `delete(K key)` 泛型, 传入 Object 无法匹配。
|
||||||
|
|
||||||
|
**修复方案**: 删除 `(Object)` 转型, 直接传 key: `this.redisTemplate.delete(key);`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 2. Object→cast (76 errors)
|
||||||
|
|
||||||
|
### 2.1 for-each over raw Collection (30+ errors)
|
||||||
|
|
||||||
|
**涉及文件**: CpImageStorePersonSynManager, CpImageStorePersonValidateManager, CpOrgDevieKitServiceImpl
|
||||||
|
|
||||||
|
**根因**: raw List/Map 遍历时 Iterator 返回 Object, 无法赋值给具体类型。
|
||||||
|
|
||||||
|
**源代码模式**:
|
||||||
|
```java
|
||||||
|
// removeMap 是 raw Map
|
||||||
|
for (Map.Entry entry : removeMap.entrySet()) { ... }
|
||||||
|
// 修复:
|
||||||
|
for (Map.Entry<Long, Set<SyncPersonLocal>> entry : removeMap.entrySet()) { ... }
|
||||||
|
|
||||||
|
// personInfoDataDatas 是 raw Collection
|
||||||
|
for (DeviceImageUpdateFeautreResult deviceUpdatePersonResult : personInfoDataDatas) { ... }
|
||||||
|
// 修复: 声明 personInfoDataDatas 为 Collection<DeviceImageUpdateFeautreResult>
|
||||||
|
```
|
||||||
|
|
||||||
|
**修复方案**: 找到 raw Collection 的声明位置, 添加泛型类型参数。如果变量有多态使用, 则添加 `(Collection<Type>)` 转换。
|
||||||
|
|
||||||
|
### 2.2 redisTemplate.keys() 返回 raw Set (8 errors)
|
||||||
|
|
||||||
|
**涉及文件**: CpImageStorePersonSynManager.checkHandleSynTaskException(L489,L492,L499,L502)
|
||||||
|
|
||||||
|
**根因**: `redisTemplate.keys(pattern)` 返回 `Set<K>`, 但声明为 raw `Set`, 后续 `.replaceFirst()` 等方法在 Object 上找不到。
|
||||||
|
|
||||||
|
**源代码模式**:
|
||||||
|
```java
|
||||||
|
Set synQueueHeadDataKeys = this.redisTemplate.keys(...);
|
||||||
|
String imageStoreId = synQueueHeadDataKey.replaceFirst(SYN_QUEUE_HEAD_DATA, "");
|
||||||
|
```
|
||||||
|
|
||||||
|
**修复方案**: 声明为 `Set<String>`:
|
||||||
|
```java
|
||||||
|
Set<String> synQueueHeadDataKeys = this.redisTemplate.keys(...);
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2.3 Map.get() 返回 Object (8 errors)
|
||||||
|
|
||||||
|
**涉及文件**: CpImageStorePersonManager(L316,L336), OrganizationUnitTypeServiceImpl(L59)
|
||||||
|
|
||||||
|
**根因**: raw Map 的 `get()` 返回 Object, 无法调用 `.setPersonId()` 或赋值给 Integer。
|
||||||
|
|
||||||
|
**修复方案**: 声明 Map 为 `Map<K, V>` 泛型, 或在 get() 结果上添加强制转型。
|
||||||
|
|
||||||
|
### 2.4 stream().collect() 返回 Object (10 errors)
|
||||||
|
|
||||||
|
**涉及文件**: OrganizationServiceImpl.saveAreaDetails(L963,L970,L974,L981)
|
||||||
|
|
||||||
|
**根因**: raw List 的 stream 操作, collect 返回 Object 无法赋值给具体类型。
|
||||||
|
|
||||||
|
**修复方案**: 在 stream 前添加 `(List<String>)` 转换:
|
||||||
|
```java
|
||||||
|
List passableList = ((List<String>)passableArea).stream().map(...).collect(Collectors.toList());
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 3. Type-mismatch (22 errors)
|
||||||
|
|
||||||
|
### 3.1 `String` → `Set<String>` 转型 (8 errors)
|
||||||
|
|
||||||
|
**涉及文件**: CpImageStorePersonSynManager(L489,L492,L499,L502)
|
||||||
|
|
||||||
|
**根因**: 代码写了 `(java.lang.String)` 转型但实际类型是 `Set`:
|
||||||
|
```java
|
||||||
|
Set synQueueHeadDataKeys = (java.lang.String) this.redisTemplate.keys(...);
|
||||||
|
```
|
||||||
|
|
||||||
|
**修复方案**: 修改转型为目标类型:
|
||||||
|
```java
|
||||||
|
Set<String> synQueueHeadDataKeys = this.redisTemplate.keys(...);
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3.2 三元表达式类型不一致 (4 errors)
|
||||||
|
|
||||||
|
**涉及文件**: CpImageStorePersonValidateManager(L150, L453)
|
||||||
|
|
||||||
|
**根因**:
|
||||||
|
```java
|
||||||
|
List<Object> syncPersonDtoList = StringUtils.isNotBlank(dataSet)
|
||||||
|
? JsonUtils.toObjList(dataSet, SyncPersonLocal.class)
|
||||||
|
: new ArrayList<>(); // inferred as ArrayList<Object>
|
||||||
|
```
|
||||||
|
|
||||||
|
`JsonUtils.toObjList()` 返回 `List<SyncPersonLocal>`, `new ArrayList<>()` 推断为 `ArrayList<Object>`, 三元运算符的两个分支类型不一致。
|
||||||
|
|
||||||
|
**修复方案**: 指定 ArrayList 的泛型:
|
||||||
|
```java
|
||||||
|
: new ArrayList<SyncPersonLocal>()
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3.3 `ArrayList<String>` vs `List<String>` (2 errors)
|
||||||
|
|
||||||
|
**涉及文件**: OrganizationServiceImpl.getList(L552)
|
||||||
|
|
||||||
|
**根因**: `ids` 声明为 `ArrayList<String>` 但 `param.getIds()` 返回 `List<String>`, 不能直接赋值。
|
||||||
|
|
||||||
|
**修复方案**:
|
||||||
|
```java
|
||||||
|
ids = new ArrayList<>(param.getIds()); // 或
|
||||||
|
ids.clear(); ids.addAll(param.getIds());
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3.4 `List<Object>` vs `List<String>` (2 errors)
|
||||||
|
|
||||||
|
**涉及文件**: OrganizationServiceImpl.detail(L826)
|
||||||
|
|
||||||
|
**根因**: zoneIds 声明为 `List<Object>` 但 `result.setZoneIds()` 接受 `List<String>`。
|
||||||
|
|
||||||
|
**修复方案**:
|
||||||
|
```java
|
||||||
|
result.setZoneIds((List<String>)(List<?>) zoneIds); // 双重转型绕过泛型检查
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3.5 `List<List<T>>` vs `List<List>` (2 errors)
|
||||||
|
|
||||||
|
**涉及文件**: CpImageStorePersonTxHandler.handleImageStorePersonDelete(L201)
|
||||||
|
|
||||||
|
**根因**: `Lists.partition()` 返回 `List<List<T>>` 但赋值给 `List<List>`。
|
||||||
|
|
||||||
|
**修复方案**:
|
||||||
|
```java
|
||||||
|
List<List<String>> partition = Lists.partition(changePersonIds, delBatchSize);
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 4. Ambiguous (16 errors) - redisTemplate.execute() 歧义
|
||||||
|
|
||||||
|
**涉及文件**: CpImageStorePersonSynManager (12), CpImageStorePersonValidateManager (4)
|
||||||
|
|
||||||
|
**根因**: `RedisTemplate<K,V>.execute()` 有两个重载:
|
||||||
|
- `execute(RedisCallback<T> callback)`
|
||||||
|
- `execute(SessionCallback<T> callback)`
|
||||||
|
|
||||||
|
lambda `connection -> connection.eval(...)` 同时匹配 RedisCallback 和 SessionCallback。
|
||||||
|
|
||||||
|
**源代码**:
|
||||||
|
```java
|
||||||
|
this.redisTemplate.execute(connection -> (Long)connection.eval(lua, keys, args))
|
||||||
|
```
|
||||||
|
|
||||||
|
**修复方案**: 添加 lambda 参数类型或转型:
|
||||||
|
```java
|
||||||
|
this.redisTemplate.execute((RedisCallback<Long>) connection -> connection.eval(lua, keys, args))
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 5. Type-inf (6 errors) - 类型推断失败
|
||||||
|
|
||||||
|
### 5.1 Sets.newHashSet() 泛型推断 (2 errors)
|
||||||
|
|
||||||
|
**涉及文件**: CpImageStorePersonTxHandler.deletePersonFromImageStores(L221)
|
||||||
|
|
||||||
|
**根因**: `Sets.newHashSet((Object[])new String[]{imageId})` — 重建数组丢失类型。
|
||||||
|
|
||||||
|
**修复方案**:
|
||||||
|
```java
|
||||||
|
Sets.newHashSet(imageId) // 或
|
||||||
|
Sets.<String>newHashSet(new String[]{imageId})
|
||||||
|
```
|
||||||
|
|
||||||
|
### 5.2 Map infer from stream (4 errors)
|
||||||
|
|
||||||
|
**涉及文件**: CpImageStorePersonSynManager.handleImageStoreIncrementSyn(L417,L418)
|
||||||
|
|
||||||
|
**根因**: `.collect(Collectors.groupingBy(...))` 的结果赋值给 `Map<String, List<GroupPersonRef>>` 但 stream 是 raw。
|
||||||
|
|
||||||
|
**修复方案**: 先转型 source 再 stream。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 每文件修复优先级
|
||||||
|
|
||||||
|
| 文件 | 错误数 | 主要类别 | 修复复杂度 | 预估时间 |
|
||||||
|
|------|-------|---------|-----------|---------|
|
||||||
|
| CpOrgDevieKitServiceImpl | 54 | $$ (32), Obj→cast (20) | ⭐⭐ | 30 min |
|
||||||
|
| CpImageStorePersonSynManager | 38 | Obj→cast (10), Ambiguous (12) | ⭐⭐ | 25 min |
|
||||||
|
| OrganizationServiceImpl | 32 | No-sym (14), Obj→cast (14) | ⭐⭐ | 20 min |
|
||||||
|
| CpImageStorePersonValidateManager | 28 | Obj→cast (12), Type-mis (8) | ⭐⭐ | 20 min |
|
||||||
|
| CpImageStorePersonManager | 16 | No-sym (8), Obj→cast (8) | ⭐⭐ | 15 min |
|
||||||
|
| OrganizationUnitTypeServiceImpl | 14 | $$ (12), Obj→cast (2) | ⭐ | 10 min |
|
||||||
|
| AreaTypeServiceImpl | 10 | $$ (2), Obj→cast (8) | ⭐ | 10 min |
|
||||||
|
| CpImageStorePersonTxHandler | 8 | Type-mis (2), No-sym (2) | ⭐ | 5 min |
|
||||||
|
|
||||||
|
**总预估**: 约 2 小时逐行修复。
|
||||||
+19
-18
@@ -28,6 +28,7 @@ import java.util.Optional;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
import org.springframework.data.redis.core.RedisCallback;
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.quartz.Scheduler;
|
import org.quartz.Scheduler;
|
||||||
@@ -99,7 +100,7 @@ public class CpImageStorePersonValidateManager {
|
|||||||
iterator.remove();
|
iterator.remove();
|
||||||
}
|
}
|
||||||
Scheduler scheduler = this.taskExecClient.getScheduler(this.quartzTaskProperties.getSchedulerName());
|
Scheduler scheduler = this.taskExecClient.getScheduler(this.quartzTaskProperties.getSchedulerName());
|
||||||
for (Map.Entry entry : removeMap.entrySet()) {
|
for (Map.Entry<Long, Set<SyncPersonLocal>> entry : ((Map<Long, Set<SyncPersonLocal>>) (Map) removeMap).entrySet()) {
|
||||||
Long l = (Long)entry.getKey();
|
Long l = (Long)entry.getKey();
|
||||||
lockValue = SnowFlake.nextId();
|
lockValue = SnowFlake.nextId();
|
||||||
try {
|
try {
|
||||||
@@ -109,7 +110,7 @@ public class CpImageStorePersonValidateManager {
|
|||||||
Trigger trigger = scheduler.getTrigger(triggerKey);
|
Trigger trigger = scheduler.getTrigger(triggerKey);
|
||||||
if (trigger == null || !StringUtils.isNotBlank((CharSequence)(dataSet = trigger.getJobDataMap().getString("VALIDATE_TRIGGER_KEY")))) continue;
|
if (trigger == null || !StringUtils.isNotBlank((CharSequence)(dataSet = trigger.getJobDataMap().getString("VALIDATE_TRIGGER_KEY")))) continue;
|
||||||
List<SyncPersonLocal> syncPersonDTOS = JsonUtils.toObjList(dataSet, SyncPersonLocal.class);
|
List<SyncPersonLocal> syncPersonDTOS = JsonUtils.toObjList(dataSet, SyncPersonLocal.class);
|
||||||
syncPersonDTOS = CpImageStorePersonValidateManager.removeAll(syncPersonDTOS, (Set)entry.getValue());
|
syncPersonDTOS = CpImageStorePersonValidateManager.removeAll(syncPersonDTOS, entry.getValue());
|
||||||
if (addMap.containsKey(l)) {
|
if (addMap.containsKey(l)) {
|
||||||
Set keyAddSet = (Set)addMap.get(l);
|
Set keyAddSet = (Set)addMap.get(l);
|
||||||
syncPersonDTOS = CpImageStorePersonValidateManager.addAll(syncPersonDTOS, keyAddSet);
|
syncPersonDTOS = CpImageStorePersonValidateManager.addAll(syncPersonDTOS, keyAddSet);
|
||||||
@@ -131,7 +132,7 @@ public class CpImageStorePersonValidateManager {
|
|||||||
this.validateJobGroupUnLock(l, lockValue);
|
this.validateJobGroupUnLock(l, lockValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (Map.Entry entry : addMap.entrySet()) {
|
for (Map.Entry<Long, Set<SyncPersonLocal>> entry : ((Map<Long, Set<SyncPersonLocal>>) (Map) addMap).entrySet()) {
|
||||||
if (((Set)entry.getValue()).isEmpty()) continue;
|
if (((Set)entry.getValue()).isEmpty()) continue;
|
||||||
Long l = (Long)entry.getKey();
|
Long l = (Long)entry.getKey();
|
||||||
lockValue = SnowFlake.nextId();
|
lockValue = SnowFlake.nextId();
|
||||||
@@ -147,8 +148,8 @@ public class CpImageStorePersonValidateManager {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
String dataSet = trigger.getJobDataMap().getString("VALIDATE_TRIGGER_KEY");
|
String dataSet = trigger.getJobDataMap().getString("VALIDATE_TRIGGER_KEY");
|
||||||
List<Object> syncPersonDtoList = StringUtils.isNotBlank((CharSequence)dataSet) ? JsonUtils.toObjList(dataSet, SyncPersonLocal.class) : Lists.newArrayList();
|
List<SyncPersonLocal> syncPersonDtoList = StringUtils.isNotBlank((CharSequence)dataSet) ? JsonUtils.toObjList(dataSet, SyncPersonLocal.class) : new ArrayList<>();
|
||||||
syncPersonDtoList = CpImageStorePersonValidateManager.addAll(syncPersonDtoList, (Set)entry.getValue());
|
syncPersonDtoList = CpImageStorePersonValidateManager.addAll(syncPersonDtoList, entry.getValue());
|
||||||
trigger.getJobDataMap().put("VALIDATE_TRIGGER_KEY", JsonUtils.toJson(syncPersonDtoList));
|
trigger.getJobDataMap().put("VALIDATE_TRIGGER_KEY", JsonUtils.toJson(syncPersonDtoList));
|
||||||
scheduler.rescheduleJob(triggerKey, trigger);
|
scheduler.rescheduleJob(triggerKey, trigger);
|
||||||
continue;
|
continue;
|
||||||
@@ -166,9 +167,9 @@ public class CpImageStorePersonValidateManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.updateExpiryDateStatus(currentTime, syncPersonList);
|
this.updateExpiryDateStatus(currentTime, syncPersonList);
|
||||||
Map<String, List<SyncPersonDTO>> deleteImageMap = (java.util.Map<java.lang.String,java.util.List<cn.cloudwalk.data.organization.dto.SyncPersonDTO>>) deleteSet.parallelStream().collect(Collectors.groupingBy(SyncPersonDTO::getImageStoreId));
|
Map<String, List<SyncPersonDTO>> deleteImageMap = (Map<String, List<SyncPersonDTO>>) (Map) deleteSet.parallelStream().collect(Collectors.groupingBy(SyncPersonDTO::getImageStoreId));
|
||||||
for (Map.Entry entry : deleteImageMap.entrySet()) {
|
for (Map.Entry<String, List<SyncPersonDTO>> entry : deleteImageMap.entrySet()) {
|
||||||
Set<String> keySet = ((List)entry.getValue()).parallelStream().map(s -> s.getImageId()).collect(Collectors.toSet());
|
Set<String> keySet = entry.getValue().parallelStream().map(s -> s.getImageId()).collect(Collectors.toSet());
|
||||||
this.cpImageStorePersonTxHandler.handleImageStoreImageChange((String)entry.getKey(), keySet, false);
|
this.cpImageStorePersonTxHandler.handleImageStoreImageChange((String)entry.getKey(), keySet, false);
|
||||||
}
|
}
|
||||||
Map<String, List<SyncPersonDTO>> addImageMap = (java.util.Map<java.lang.String,java.util.List<cn.cloudwalk.data.organization.dto.SyncPersonDTO>>) addSet.parallelStream().collect(Collectors.groupingBy(SyncPersonDTO::getImageStoreId));
|
Map<String, List<SyncPersonDTO>> addImageMap = (java.util.Map<java.lang.String,java.util.List<cn.cloudwalk.data.organization.dto.SyncPersonDTO>>) addSet.parallelStream().collect(Collectors.groupingBy(SyncPersonDTO::getImageStoreId));
|
||||||
@@ -204,7 +205,7 @@ public class CpImageStorePersonValidateManager {
|
|||||||
String lockKey = "validate_job_group_lock:" + key;
|
String lockKey = "validate_job_group_lock:" + key;
|
||||||
while (true) {
|
while (true) {
|
||||||
Long lockResult;
|
Long lockResult;
|
||||||
if (0L == (lockResult = (Long)this.redisTemplate.execute(connection -> (Long)connection.eval(this.lockValidateJobRedisScript.getScriptAsString().getBytes(), ReturnType.INTEGER, 0, (byte[][])new byte[][]{lockKey.getBytes(), String.valueOf(lockValue).getBytes(), this.lockValidateJobGroupSecond.getBytes()})))) {
|
if (0L == (lockResult = (Long)this.redisTemplate.execute((RedisCallback) connection -> (Long)connection.eval(this.lockValidateJobRedisScript.getScriptAsString().getBytes(), ReturnType.INTEGER, 0, (byte[][])new byte[][]{lockKey.getBytes(), String.valueOf(lockValue).getBytes(), this.lockValidateJobGroupSecond.getBytes()})))) {
|
||||||
log.info("CpImageStorePersonValidateManager validateJobGroupLock success:{}", (Object)key);
|
log.info("CpImageStorePersonValidateManager validateJobGroupLock success:{}", (Object)key);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -230,7 +231,7 @@ public class CpImageStorePersonValidateManager {
|
|||||||
private boolean validateJobGroupUnLock(Long key, Long lockValue) {
|
private boolean validateJobGroupUnLock(Long key, Long lockValue) {
|
||||||
log.info("CpImageStorePersonValidateManager validateJobGroupUnLock:{},{}", (Object)key, (Object)lockValue);
|
log.info("CpImageStorePersonValidateManager validateJobGroupUnLock:{},{}", (Object)key, (Object)lockValue);
|
||||||
String lockKey = "validate_job_group_lock:" + key;
|
String lockKey = "validate_job_group_lock:" + key;
|
||||||
Long lockResult = (Long)this.redisTemplate.execute(connection -> (Long)connection.eval(this.unlockValidateJobRedisScript.getScriptAsString().getBytes(), ReturnType.INTEGER, 0, (byte[][])new byte[][]{lockKey.getBytes(), String.valueOf(lockValue).getBytes()}));
|
Long lockResult = (Long)this.redisTemplate.execute((RedisCallback) connection -> (Long)connection.eval(this.unlockValidateJobRedisScript.getScriptAsString().getBytes(), ReturnType.INTEGER, 0, (byte[][])new byte[][]{lockKey.getBytes(), String.valueOf(lockValue).getBytes()}));
|
||||||
if (0L == lockResult) {
|
if (0L == lockResult) {
|
||||||
log.info("CpImageStorePersonValidateManager validateJobGroupUnLock success:{},{}", (Object)key, (Object)lockValue);
|
log.info("CpImageStorePersonValidateManager validateJobGroupUnLock success:{},{}", (Object)key, (Object)lockValue);
|
||||||
return true;
|
return true;
|
||||||
@@ -413,7 +414,7 @@ public class CpImageStorePersonValidateManager {
|
|||||||
queryGroupPersonDTO.setEndTime(delayTime);
|
queryGroupPersonDTO.setEndTime(delayTime);
|
||||||
queryGroupPersonDTO.setExpiryBeginDateStatus(Integer.valueOf(0));
|
queryGroupPersonDTO.setExpiryBeginDateStatus(Integer.valueOf(0));
|
||||||
queryGroupPersonDTO.setExpiryEndDateStatus(Integer.valueOf(0));
|
queryGroupPersonDTO.setExpiryEndDateStatus(Integer.valueOf(0));
|
||||||
List waitAddValidateList = this.groupPersonRefMapper.queryByExpiryDateStatus(queryGroupPersonDTO);
|
List<GroupPersonRef> waitAddValidateList = this.groupPersonRefMapper.queryByExpiryDateStatus(queryGroupPersonDTO);
|
||||||
if (CollectionUtils.isEmpty((Collection)waitAddValidateList)) {
|
if (CollectionUtils.isEmpty((Collection)waitAddValidateList)) {
|
||||||
log.debug("[{}-{}]时间范围内没有需要添加的trigger", (Object)queryGroupPersonDTO.getStartTime(), (Object)queryGroupPersonDTO.getEndTime());
|
log.debug("[{}-{}]时间范围内没有需要添加的trigger", (Object)queryGroupPersonDTO.getStartTime(), (Object)queryGroupPersonDTO.getEndTime());
|
||||||
}
|
}
|
||||||
@@ -422,7 +423,7 @@ public class CpImageStorePersonValidateManager {
|
|||||||
ConcurrentHashSet deleteSet = new ConcurrentHashSet();
|
ConcurrentHashSet deleteSet = new ConcurrentHashSet();
|
||||||
HashSet changeGroupIdSet = Sets.newHashSet();
|
HashSet changeGroupIdSet = Sets.newHashSet();
|
||||||
ArrayList syncPersonList = Lists.newArrayListWithCapacity((int)waitAddValidateList.size());
|
ArrayList syncPersonList = Lists.newArrayListWithCapacity((int)waitAddValidateList.size());
|
||||||
waitAddValidateList = (java.util.List) waitAddValidateList.stream().sorted(Comparator.comparing(GroupPersonRef::getExpiryBeginDate)).collect(Collectors.toList());
|
waitAddValidateList = (List) waitAddValidateList.stream().sorted(Comparator.comparing(GroupPersonRef::getExpiryBeginDate)).collect(Collectors.toList());
|
||||||
waitAddValidateList.stream().forEach(arg_0 -> this.lambda$delayAddValidateTrigger$24(changeGroupIdSet, syncPersonList, currentTime, (Set)addSet, delayTime, addMap, (Set)deleteSet, arg_0));
|
waitAddValidateList.stream().forEach(arg_0 -> this.lambda$delayAddValidateTrigger$24(changeGroupIdSet, syncPersonList, currentTime, (Set)addSet, delayTime, addMap, (Set)deleteSet, arg_0));
|
||||||
Iterator iterator = addSet.iterator();
|
Iterator iterator = addSet.iterator();
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
@@ -436,7 +437,7 @@ public class CpImageStorePersonValidateManager {
|
|||||||
iterator.remove();
|
iterator.remove();
|
||||||
}
|
}
|
||||||
Scheduler scheduler = this.taskExecClient.getScheduler(this.quartzTaskProperties.getSchedulerName());
|
Scheduler scheduler = this.taskExecClient.getScheduler(this.quartzTaskProperties.getSchedulerName());
|
||||||
for (Map.Entry entry : addMap.entrySet()) {
|
for (Map.Entry<Long, Set<SyncPersonLocal>> entry : ((Map<Long, Set<SyncPersonLocal>>) (Map) addMap).entrySet()) {
|
||||||
if (((Set)entry.getValue()).isEmpty()) continue;
|
if (((Set)entry.getValue()).isEmpty()) continue;
|
||||||
Long l = (Long)entry.getKey();
|
Long l = (Long)entry.getKey();
|
||||||
Long lockValue = SnowFlake.nextId();
|
Long lockValue = SnowFlake.nextId();
|
||||||
@@ -450,8 +451,8 @@ public class CpImageStorePersonValidateManager {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
String dataSet = trigger.getJobDataMap().getString("VALIDATE_TRIGGER_KEY");
|
String dataSet = trigger.getJobDataMap().getString("VALIDATE_TRIGGER_KEY");
|
||||||
List<Object> syncPersonDtoList = StringUtils.isNotBlank((CharSequence)dataSet) ? JsonUtils.toObjList(dataSet, SyncPersonLocal.class) : Lists.newArrayList();
|
List<SyncPersonLocal> syncPersonDtoList = StringUtils.isNotBlank((CharSequence)dataSet) ? JsonUtils.toObjList(dataSet, SyncPersonLocal.class) : new ArrayList<>();
|
||||||
syncPersonDtoList = CpImageStorePersonValidateManager.addAll(syncPersonDtoList, (Set)entry.getValue());
|
syncPersonDtoList = CpImageStorePersonValidateManager.addAll(syncPersonDtoList, entry.getValue());
|
||||||
trigger.getJobDataMap().put("VALIDATE_TRIGGER_KEY", JsonUtils.toJson(syncPersonDtoList));
|
trigger.getJobDataMap().put("VALIDATE_TRIGGER_KEY", JsonUtils.toJson(syncPersonDtoList));
|
||||||
scheduler.rescheduleJob(triggerKey, trigger);
|
scheduler.rescheduleJob(triggerKey, trigger);
|
||||||
continue;
|
continue;
|
||||||
@@ -469,9 +470,9 @@ public class CpImageStorePersonValidateManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.updateExpiryDateStatus(currentTime, syncPersonList);
|
this.updateExpiryDateStatus(currentTime, syncPersonList);
|
||||||
Map<String, List<SyncPersonDTO>> deleteImageMap = (java.util.Map<java.lang.String,java.util.List<cn.cloudwalk.data.organization.dto.SyncPersonDTO>>) deleteSet.parallelStream().collect(Collectors.groupingBy(SyncPersonDTO::getImageStoreId));
|
Map<String, List<SyncPersonDTO>> deleteImageMap = (Map<String, List<SyncPersonDTO>>) (Map) deleteSet.parallelStream().collect(Collectors.groupingBy(SyncPersonDTO::getImageStoreId));
|
||||||
for (Map.Entry entry : deleteImageMap.entrySet()) {
|
for (Map.Entry<String, List<SyncPersonDTO>> entry : deleteImageMap.entrySet()) {
|
||||||
Set<String> keySet = ((List)entry.getValue()).parallelStream().map(s -> s.getImageId()).collect(Collectors.toSet());
|
Set<String> keySet = entry.getValue().parallelStream().map(s -> s.getImageId()).collect(Collectors.toSet());
|
||||||
this.cpImageStorePersonTxHandler.handleImageStoreImageChange((String)entry.getKey(), keySet, false);
|
this.cpImageStorePersonTxHandler.handleImageStoreImageChange((String)entry.getKey(), keySet, false);
|
||||||
}
|
}
|
||||||
Map<String, List<SyncPersonDTO>> addImageMap = (java.util.Map<java.lang.String,java.util.List<cn.cloudwalk.data.organization.dto.SyncPersonDTO>>) addSet.parallelStream().collect(Collectors.groupingBy(SyncPersonDTO::getImageStoreId));
|
Map<String, List<SyncPersonDTO>> addImageMap = (java.util.Map<java.lang.String,java.util.List<cn.cloudwalk.data.organization.dto.SyncPersonDTO>>) addSet.parallelStream().collect(Collectors.groupingBy(SyncPersonDTO::getImageStoreId));
|
||||||
|
|||||||
+21
-21
@@ -114,7 +114,7 @@ implements CpOrgDevieKitService {
|
|||||||
UpdateGroupResult updateGroupResult = new UpdateGroupResult();
|
UpdateGroupResult updateGroupResult = new UpdateGroupResult();
|
||||||
BeanCopyUtils.copyProperties((Object)updateGroupParam, (Object)updateGroupResult);
|
BeanCopyUtils.copyProperties((Object)updateGroupParam, (Object)updateGroupResult);
|
||||||
updateGroupResult.setGroups(groups);
|
updateGroupResult.setGroups(groups);
|
||||||
return (CloudwalkResult) CloudwalkResult.success($$$);
|
return (CloudwalkResult) CloudwalkResult.success(updateGroupResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
public CloudwalkResult<UpdateFeatureResult> onUpdateFeatureRequest(UpdateFeatureParam updateFeatureParam, CloudwalkCallContext cloudwalkCallContext) throws ServiceException {
|
public CloudwalkResult<UpdateFeatureResult> onUpdateFeatureRequest(UpdateFeatureParam updateFeatureParam, CloudwalkCallContext cloudwalkCallContext) throws ServiceException {
|
||||||
@@ -124,7 +124,7 @@ implements CpOrgDevieKitService {
|
|||||||
AtomicDeviceGetResult device = this.checkAndGetDeviceByCode(updateFeatureParam.getDeviceId(), cloudwalkCallContext);
|
AtomicDeviceGetResult device = this.checkAndGetDeviceByCode(updateFeatureParam.getDeviceId(), cloudwalkCallContext);
|
||||||
boolean checkBoolean = this.checkDeviceImageStoreIdRefExist(updateFeatureParam.getGroupId(), device.getId(), cloudwalkCallContext);
|
boolean checkBoolean = this.checkDeviceImageStoreIdRefExist(updateFeatureParam.getGroupId(), device.getId(), cloudwalkCallContext);
|
||||||
if (!checkBoolean) {
|
if (!checkBoolean) {
|
||||||
return (CloudwalkResult) CloudwalkResult.success($$$);
|
return (CloudwalkResult) CloudwalkResult.success(updateFeatureResult);
|
||||||
}
|
}
|
||||||
DeviceImageUpdateFeatureQuery updatePersonQuery = new DeviceImageUpdateFeatureQuery();
|
DeviceImageUpdateFeatureQuery updatePersonQuery = new DeviceImageUpdateFeatureQuery();
|
||||||
updatePersonQuery.setImageStoreId(updateFeatureParam.getGroupId());
|
updatePersonQuery.setImageStoreId(updateFeatureParam.getGroupId());
|
||||||
@@ -137,7 +137,7 @@ implements CpOrgDevieKitService {
|
|||||||
}
|
}
|
||||||
if (!(updatePersonInfo = this.cpDeviceImagePersonService.getDeviceImageUpdateFeatureInfo(updatePersonQuery, cloudwalkCallContext)).isSuccess()) {
|
if (!(updatePersonInfo = this.cpDeviceImagePersonService.getDeviceImageUpdateFeatureInfo(updatePersonQuery, cloudwalkCallContext)).isSuccess()) {
|
||||||
this.logger.warn("get feature info error,device:{}, imageStore:{}", (Object)updateFeatureParam.getDeviceId(), (Object)updateFeatureParam.getGroupId());
|
this.logger.warn("get feature info error,device:{}, imageStore:{}", (Object)updateFeatureParam.getDeviceId(), (Object)updateFeatureParam.getGroupId());
|
||||||
return (CloudwalkResult) CloudwalkResult.success($$$);
|
return (CloudwalkResult) CloudwalkResult.success(updateFeatureResult);
|
||||||
}
|
}
|
||||||
CloudwalkPageAble personInfoData = (CloudwalkPageAble)updatePersonInfo.getData();
|
CloudwalkPageAble personInfoData = (CloudwalkPageAble)updatePersonInfo.getData();
|
||||||
updateFeatureResult.setCurrentPage(Integer.valueOf((int)personInfoData.getCurrentPage()));
|
updateFeatureResult.setCurrentPage(Integer.valueOf((int)personInfoData.getCurrentPage()));
|
||||||
@@ -145,7 +145,7 @@ implements CpOrgDevieKitService {
|
|||||||
updateFeatureResult.setPagePize(Integer.valueOf((int)personInfoData.getPageSize()));
|
updateFeatureResult.setPagePize(Integer.valueOf((int)personInfoData.getPageSize()));
|
||||||
updateFeatureResult.setTotalPages(Integer.valueOf((int)personInfoData.getTotalPages()));
|
updateFeatureResult.setTotalPages(Integer.valueOf((int)personInfoData.getTotalPages()));
|
||||||
ArrayList<UpdateFeatureResult.FeatureData> featureDatas = new ArrayList<UpdateFeatureResult.FeatureData>();
|
ArrayList<UpdateFeatureResult.FeatureData> featureDatas = new ArrayList<UpdateFeatureResult.FeatureData>();
|
||||||
Collection personInfoDataDatas = personInfoData.getDatas();
|
Collection<DeviceImageUpdateFeautreResult> personInfoDataDatas = personInfoData.getDatas();
|
||||||
for (DeviceImageUpdateFeautreResult deviceUpdatePersonResult : personInfoDataDatas) {
|
for (DeviceImageUpdateFeautreResult deviceUpdatePersonResult : personInfoDataDatas) {
|
||||||
UpdateFeatureResult.FeatureData featureData = new UpdateFeatureResult.FeatureData();
|
UpdateFeatureResult.FeatureData featureData = new UpdateFeatureResult.FeatureData();
|
||||||
featureData.setFaceId(deviceUpdatePersonResult.getFaceId());
|
featureData.setFaceId(deviceUpdatePersonResult.getFaceId());
|
||||||
@@ -163,7 +163,7 @@ implements CpOrgDevieKitService {
|
|||||||
} else {
|
} else {
|
||||||
updateFeatureResult.setEndFlag(EndFlagEnum.NO_END.getCode());
|
updateFeatureResult.setEndFlag(EndFlagEnum.NO_END.getCode());
|
||||||
}
|
}
|
||||||
return (CloudwalkResult) CloudwalkResult.success($$$);
|
return (CloudwalkResult) CloudwalkResult.success(updateFeatureResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
public CloudwalkResult<UpdatePictureResult> onUpdatePictureRequest(UpdatePictureParam updatePictureParam, CloudwalkCallContext cloudwalkCallContext) throws ServiceException {
|
public CloudwalkResult<UpdatePictureResult> onUpdatePictureRequest(UpdatePictureParam updatePictureParam, CloudwalkCallContext cloudwalkCallContext) throws ServiceException {
|
||||||
@@ -173,7 +173,7 @@ implements CpOrgDevieKitService {
|
|||||||
AtomicDeviceGetResult device = this.checkAndGetDeviceByCode(updatePictureParam.getDeviceId(), cloudwalkCallContext);
|
AtomicDeviceGetResult device = this.checkAndGetDeviceByCode(updatePictureParam.getDeviceId(), cloudwalkCallContext);
|
||||||
boolean checkBoolean = this.checkDeviceImageStoreIdRefExist(updatePictureParam.getGroupId(), device.getId(), cloudwalkCallContext);
|
boolean checkBoolean = this.checkDeviceImageStoreIdRefExist(updatePictureParam.getGroupId(), device.getId(), cloudwalkCallContext);
|
||||||
if (!checkBoolean) {
|
if (!checkBoolean) {
|
||||||
return (CloudwalkResult) CloudwalkResult.success($$$);
|
return (CloudwalkResult) CloudwalkResult.success(updatePictureResult);
|
||||||
}
|
}
|
||||||
DeviceImageUpdatePersonQuery updatePersonQuery = new DeviceImageUpdatePersonQuery();
|
DeviceImageUpdatePersonQuery updatePersonQuery = new DeviceImageUpdatePersonQuery();
|
||||||
updatePersonQuery.setImageStoreId(updatePictureParam.getGroupId());
|
updatePersonQuery.setImageStoreId(updatePictureParam.getGroupId());
|
||||||
@@ -186,14 +186,14 @@ implements CpOrgDevieKitService {
|
|||||||
}
|
}
|
||||||
if (!(updatePersonInfo = this.cpDeviceImagePersonService.getDeviceImageUpdatePersonInfo(updatePersonQuery, cloudwalkCallContext)).isSuccess()) {
|
if (!(updatePersonInfo = this.cpDeviceImagePersonService.getDeviceImageUpdatePersonInfo(updatePersonQuery, cloudwalkCallContext)).isSuccess()) {
|
||||||
this.logger.warn("get picture info error,device:{}, imageStore:{}", (Object)updatePictureParam.getDeviceId(), (Object)updatePictureParam.getGroupId());
|
this.logger.warn("get picture info error,device:{}, imageStore:{}", (Object)updatePictureParam.getDeviceId(), (Object)updatePictureParam.getGroupId());
|
||||||
return (CloudwalkResult) CloudwalkResult.success($$$);
|
return (CloudwalkResult) CloudwalkResult.success(updatePictureResult);
|
||||||
}
|
}
|
||||||
CloudwalkPageAble personInfoData = (CloudwalkPageAble)updatePersonInfo.getData();
|
CloudwalkPageAble personInfoData = (CloudwalkPageAble)updatePersonInfo.getData();
|
||||||
updatePictureParam.setCurrentPage(Integer.valueOf((int)personInfoData.getCurrentPage()));
|
updatePictureParam.setCurrentPage(Integer.valueOf((int)personInfoData.getCurrentPage()));
|
||||||
updatePictureParam.setGroupId(updatePictureParam.getGroupId());
|
updatePictureParam.setGroupId(updatePictureParam.getGroupId());
|
||||||
updatePictureParam.setPageSize(Integer.valueOf((int)personInfoData.getPageSize()));
|
updatePictureParam.setPageSize(Integer.valueOf((int)personInfoData.getPageSize()));
|
||||||
ArrayList<UpdatePictureResult.ImageData> personDatas = new ArrayList<UpdatePictureResult.ImageData>();
|
ArrayList<UpdatePictureResult.ImageData> personDatas = new ArrayList<UpdatePictureResult.ImageData>();
|
||||||
Collection personInfoDataDatas = personInfoData.getDatas();
|
Collection<DeviceImageUpdatePersonResult> personInfoDataDatas = personInfoData.getDatas();
|
||||||
for (DeviceImageUpdatePersonResult deviceUpdatePersonResult : personInfoDataDatas) {
|
for (DeviceImageUpdatePersonResult deviceUpdatePersonResult : personInfoDataDatas) {
|
||||||
UpdatePictureResult.ImageData imageData = new UpdatePictureResult.ImageData();
|
UpdatePictureResult.ImageData imageData = new UpdatePictureResult.ImageData();
|
||||||
imageData.setFaceId(deviceUpdatePersonResult.getImageId());
|
imageData.setFaceId(deviceUpdatePersonResult.getImageId());
|
||||||
@@ -212,7 +212,7 @@ implements CpOrgDevieKitService {
|
|||||||
updatePictureResult.setEndFlag(EndFlagEnum.NO_END.getCode());
|
updatePictureResult.setEndFlag(EndFlagEnum.NO_END.getCode());
|
||||||
}
|
}
|
||||||
BeanCopyUtils.copyProperties((Object)updatePictureParam, (Object)updatePictureResult);
|
BeanCopyUtils.copyProperties((Object)updatePictureParam, (Object)updatePictureResult);
|
||||||
return (CloudwalkResult) CloudwalkResult.success($$$);
|
return (CloudwalkResult) CloudwalkResult.success(updatePictureResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
public CloudwalkResult<UpdatePersonResult> onUpdatePersonRequest(UpdatePersonParam updatePersonParam, CloudwalkCallContext cloudwalkCallContext) throws ServiceException {
|
public CloudwalkResult<UpdatePersonResult> onUpdatePersonRequest(UpdatePersonParam updatePersonParam, CloudwalkCallContext cloudwalkCallContext) throws ServiceException {
|
||||||
@@ -232,7 +232,7 @@ implements CpOrgDevieKitService {
|
|||||||
List deviceImageStoreList = this.deviceImageStoreMapper.select(query);
|
List deviceImageStoreList = this.deviceImageStoreMapper.select(query);
|
||||||
if (!CollectionUtils.isEmpty((Collection)deviceImageStoreList) && (deviceImageStore = (DeviceImageStore)deviceImageStoreList.get(0)).getType() == 2 && null != deviceImageStore.getFinishPullTime()) {
|
if (!CollectionUtils.isEmpty((Collection)deviceImageStoreList) && (deviceImageStore = (DeviceImageStore)deviceImageStoreList.get(0)).getType() == 2 && null != deviceImageStore.getFinishPullTime()) {
|
||||||
updatePersonResult.setEndFlag(EndFlagEnum.END.getCode());
|
updatePersonResult.setEndFlag(EndFlagEnum.END.getCode());
|
||||||
return (CloudwalkResult) CloudwalkResult.success($$$);
|
return (CloudwalkResult) CloudwalkResult.success(updatePersonResult);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DeviceImageUpdatePersonQuery updatePersonQuery = new DeviceImageUpdatePersonQuery();
|
DeviceImageUpdatePersonQuery updatePersonQuery = new DeviceImageUpdatePersonQuery();
|
||||||
@@ -252,7 +252,7 @@ implements CpOrgDevieKitService {
|
|||||||
this.logger.info("20113 getDeviceUpdatePersonInfo,spend time {} millis", (Object)(t2 - t1));
|
this.logger.info("20113 getDeviceUpdatePersonInfo,spend time {} millis", (Object)(t2 - t1));
|
||||||
if (!updatePersonInfo.isSuccess()) {
|
if (!updatePersonInfo.isSuccess()) {
|
||||||
this.logger.warn("get person info error,device:{}, imageStore:{}", (Object)updatePersonParam.getDeviceId(), (Object)updatePersonParam.getGroupId());
|
this.logger.warn("get person info error,device:{}, imageStore:{}", (Object)updatePersonParam.getDeviceId(), (Object)updatePersonParam.getGroupId());
|
||||||
return (CloudwalkResult) CloudwalkResult.success($$$);
|
return (CloudwalkResult) CloudwalkResult.success(updatePersonResult);
|
||||||
}
|
}
|
||||||
CloudwalkPageAble personInfoData = (CloudwalkPageAble)updatePersonInfo.getData();
|
CloudwalkPageAble personInfoData = (CloudwalkPageAble)updatePersonInfo.getData();
|
||||||
updatePersonResult.setCurrentPage(Integer.valueOf((int)personInfoData.getCurrentPage()));
|
updatePersonResult.setCurrentPage(Integer.valueOf((int)personInfoData.getCurrentPage()));
|
||||||
@@ -260,7 +260,7 @@ implements CpOrgDevieKitService {
|
|||||||
updatePersonResult.setTotalPages(Integer.valueOf((int)personInfoData.getTotalPages()));
|
updatePersonResult.setTotalPages(Integer.valueOf((int)personInfoData.getTotalPages()));
|
||||||
updatePersonResult.setPagePize(Integer.valueOf((int)personInfoData.getPageSize()));
|
updatePersonResult.setPagePize(Integer.valueOf((int)personInfoData.getPageSize()));
|
||||||
ArrayList<UpdatePersonResult.PersonData> personData = new ArrayList<UpdatePersonResult.PersonData>();
|
ArrayList<UpdatePersonResult.PersonData> personData = new ArrayList<UpdatePersonResult.PersonData>();
|
||||||
Collection personInfoDataDatas = personInfoData.getDatas();
|
Collection<DeviceImageUpdatePersonResult> personInfoDataDatas = personInfoData.getDatas();
|
||||||
for (DeviceImageUpdatePersonResult deviceUpdatePersonResult : personInfoDataDatas) {
|
for (DeviceImageUpdatePersonResult deviceUpdatePersonResult : personInfoDataDatas) {
|
||||||
UpdatePersonResult.PersonData personDataTemp = new UpdatePersonResult.PersonData();
|
UpdatePersonResult.PersonData personDataTemp = new UpdatePersonResult.PersonData();
|
||||||
personDataTemp.setUserId(deviceUpdatePersonResult.getPersonId());
|
personDataTemp.setUserId(deviceUpdatePersonResult.getPersonId());
|
||||||
@@ -307,7 +307,7 @@ implements CpOrgDevieKitService {
|
|||||||
} else {
|
} else {
|
||||||
updatePersonResult.setEndFlag(EndFlagEnum.NO_END.getCode());
|
updatePersonResult.setEndFlag(EndFlagEnum.NO_END.getCode());
|
||||||
}
|
}
|
||||||
return (CloudwalkResult) CloudwalkResult.success($$$);
|
return (CloudwalkResult) CloudwalkResult.success(updatePersonResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addSyncLogForFeatureUpdate(String deviceId, String groupId, List<UpdateFeatureResult.FeatureData> featureDatas) {
|
private void addSyncLogForFeatureUpdate(String deviceId, String groupId, List<UpdateFeatureResult.FeatureData> featureDatas) {
|
||||||
@@ -484,7 +484,7 @@ implements CpOrgDevieKitService {
|
|||||||
this.logger.debug("设备code[{}]支持多图库", (Object)updatePersonParam.getDeviceId());
|
this.logger.debug("设备code[{}]支持多图库", (Object)updatePersonParam.getDeviceId());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
List imageStoreIds = Optional.ofNullable(this.deviceImageStoreMapper.findImageStoreIds(device.getId(), Short.valueOf((short)1))).orElse(new ArrayList());
|
List<String> imageStoreIds = Optional.ofNullable(this.deviceImageStoreMapper.findImageStoreIds(device.getId(), Short.valueOf((short)1))).orElse(new ArrayList());
|
||||||
imageStoreIds = imageStoreIds.stream().filter(id -> !id.equals(updatePersonParam.getGroupId())).collect(Collectors.toList());
|
imageStoreIds = imageStoreIds.stream().filter(id -> !id.equals(updatePersonParam.getGroupId())).collect(Collectors.toList());
|
||||||
DevicePersonSyncLogDTO dto = new DevicePersonSyncLogDTO();
|
DevicePersonSyncLogDTO dto = new DevicePersonSyncLogDTO();
|
||||||
dto.setDeviceId(device.getId());
|
dto.setDeviceId(device.getId());
|
||||||
@@ -518,7 +518,7 @@ implements CpOrgDevieKitService {
|
|||||||
QueryGroupPersonDTO queryGroupPersonDTO = new QueryGroupPersonDTO();
|
QueryGroupPersonDTO queryGroupPersonDTO = new QueryGroupPersonDTO();
|
||||||
queryGroupPersonDTO.setPersonId(personInfo.getUserId());
|
queryGroupPersonDTO.setPersonId(personInfo.getUserId());
|
||||||
queryGroupPersonDTO.setImageStoreIds((Collection)dto.getImageStoreIds());
|
queryGroupPersonDTO.setImageStoreIds((Collection)dto.getImageStoreIds());
|
||||||
List otherGroupPersons = Optional.ofNullable(this.groupPersonRefMapper.query(queryGroupPersonDTO)).orElse(new ArrayList());
|
List<GroupPersonRef> otherGroupPersons = Optional.ofNullable(this.groupPersonRefMapper.query(queryGroupPersonDTO)).orElse(new ArrayList());
|
||||||
otherGroupPersons = otherGroupPersons.stream().filter(groupPersonRef -> -1 != groupPersonRef.getStatus() || DelStatusEnum.DELETED.getCode().shortValue() != groupPersonRef.getIsDel().shortValue()).collect(Collectors.toList());
|
otherGroupPersons = otherGroupPersons.stream().filter(groupPersonRef -> -1 != groupPersonRef.getStatus() || DelStatusEnum.DELETED.getCode().shortValue() != groupPersonRef.getIsDel().shortValue()).collect(Collectors.toList());
|
||||||
if (CollectionUtils.isEmpty(otherGroupPersons)) {
|
if (CollectionUtils.isEmpty(otherGroupPersons)) {
|
||||||
this.logger.warn("设备[{}]人员[{}]未关联其他图库", (Object)dto.getDeviceId(), (Object)dto.getPersonId());
|
this.logger.warn("设备[{}]人员[{}]未关联其他图库", (Object)dto.getDeviceId(), (Object)dto.getPersonId());
|
||||||
@@ -537,7 +537,7 @@ implements CpOrgDevieKitService {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.logger.debug("设备[{}]支持有效期", (Object)dto.getDeviceId());
|
this.logger.debug("设备[{}]支持有效期", (Object)dto.getDeviceId());
|
||||||
HashSet validDateCronSet = new HashSet();
|
HashSet<String> validDateCronSet = new HashSet();
|
||||||
JSONObject jsonObject = JSONObject.parseObject((String)personInfo.getReserveInfo());
|
JSONObject jsonObject = JSONObject.parseObject((String)personInfo.getReserveInfo());
|
||||||
JSONArray jsonArray = jsonObject.getJSONArray("passCrons");
|
JSONArray jsonArray = jsonObject.getJSONArray("passCrons");
|
||||||
if (null != jsonArray && jsonArray.size() > 0) {
|
if (null != jsonArray && jsonArray.size() > 0) {
|
||||||
@@ -579,18 +579,18 @@ implements CpOrgDevieKitService {
|
|||||||
private synchronized boolean lockSyncLog(String deviceId, String imageStoreId, String personId) {
|
private synchronized boolean lockSyncLog(String deviceId, String imageStoreId, String personId) {
|
||||||
String value = deviceId + "_" + imageStoreId + "_" + personId;
|
String value = deviceId + "_" + imageStoreId + "_" + personId;
|
||||||
String key = SYNC_LOG_KEY + value;
|
String key = SYNC_LOG_KEY + value;
|
||||||
if (this.redisTemplate.hasKey((Object)key).booleanValue()) {
|
if (this.redisTemplate.hasKey(key).booleanValue()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
this.redisTemplate.opsForValue().set((Object)key, (Object)value, this.syncLogExpireTime, TimeUnit.SECONDS);
|
this.redisTemplate.opsForValue().set(key, value, this.syncLogExpireTime, TimeUnit.SECONDS);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private synchronized boolean unlockSyncLog(String deviceId, String imageStoreId, String personId) {
|
private synchronized boolean unlockSyncLog(String deviceId, String imageStoreId, String personId) {
|
||||||
String value = deviceId + "_" + imageStoreId + "_" + personId;
|
String value = deviceId + "_" + imageStoreId + "_" + personId;
|
||||||
String key = SYNC_LOG_KEY + value;
|
String key = SYNC_LOG_KEY + value;
|
||||||
if (this.redisTemplate.hasKey((Object)key).booleanValue()) {
|
if (this.redisTemplate.hasKey(key).booleanValue()) {
|
||||||
this.redisTemplate.delete((Object)key);
|
this.redisTemplate.delete(key);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -642,7 +642,7 @@ implements CpOrgDevieKitService {
|
|||||||
throw new ServiceException(personRefs.getCode(), personRefs.getMessage());
|
throw new ServiceException(personRefs.getCode(), personRefs.getMessage());
|
||||||
}
|
}
|
||||||
HashMap<String, Long> personRefMap = new HashMap<String, Long>();
|
HashMap<String, Long> personRefMap = new HashMap<String, Long>();
|
||||||
List personRefsData = (List)personRefs.getData();
|
List<DeviceImagePersonRefResult> personRefsData = (List)personRefs.getData();
|
||||||
for (DeviceImagePersonRefResult deviceImagePersonRefResult : personRefsData) {
|
for (DeviceImagePersonRefResult deviceImagePersonRefResult : personRefsData) {
|
||||||
personRefMap.put(deviceImagePersonRefResult.getImageStoreId(), deviceImagePersonRefResult.getImageLastUpdateTime());
|
personRefMap.put(deviceImagePersonRefResult.getImageStoreId(), deviceImagePersonRefResult.getImageLastUpdateTime());
|
||||||
}
|
}
|
||||||
|
|||||||
+11
-11
@@ -287,7 +287,7 @@ implements OrganizationService {
|
|||||||
|
|
||||||
private UserQueryResult getByUserId(String userId, CloudwalkCallContext context) throws ServiceException {
|
private UserQueryResult getByUserId(String userId, CloudwalkCallContext context) throws ServiceException {
|
||||||
UserGetsParam param = new UserGetsParam();
|
UserGetsParam param = new UserGetsParam();
|
||||||
param.setIds((List)Lists.newArrayList((Object[])new String[]{userId}));
|
param.setIds((List)Lists.newArrayList(userId));
|
||||||
CloudwalkResult userList = this.userService.gets(param, context);
|
CloudwalkResult userList = this.userService.gets(param, context);
|
||||||
if (userList.isSuccess() && !CollectionUtils.isEmpty((Collection)((Collection)userList.getData()))) {
|
if (userList.isSuccess() && !CollectionUtils.isEmpty((Collection)((Collection)userList.getData()))) {
|
||||||
return (UserQueryResult)((List)userList.getData()).get(0);
|
return (UserQueryResult)((List)userList.getData()).get(0);
|
||||||
@@ -337,7 +337,7 @@ implements OrganizationService {
|
|||||||
if (StringUtils.isBlank((CharSequence)param.getParentId())) {
|
if (StringUtils.isBlank((CharSequence)param.getParentId())) {
|
||||||
List allOrg = this.imgStoreOrganizationMapper.getAllOrg(businessId);
|
List allOrg = this.imgStoreOrganizationMapper.getAllOrg(businessId);
|
||||||
res = BeanCopyUtils.copy((Collection)allOrg, TreeOrganizationResult.class);
|
res = BeanCopyUtils.copy((Collection)allOrg, TreeOrganizationResult.class);
|
||||||
res = (java.util.List) res.stream().filter(ToolUtil.distinctByKey(TreeOrganizationResult::getId)).collect(Collectors.toList());
|
res = (List) res.stream().filter(ToolUtil.distinctByKey(TreeOrganizationResult::getId)).collect(Collectors.toList());
|
||||||
} else {
|
} else {
|
||||||
res = this.getTreeByParentId(param.getParentId(), businessId);
|
res = this.getTreeByParentId(param.getParentId(), businessId);
|
||||||
}
|
}
|
||||||
@@ -549,7 +549,7 @@ implements OrganizationService {
|
|||||||
getsOrganizationDTO.setBusinessId(businessId);
|
getsOrganizationDTO.setBusinessId(businessId);
|
||||||
getsOrganizationDTO.setIsDel(Short.valueOf((short)0));
|
getsOrganizationDTO.setIsDel(Short.valueOf((short)0));
|
||||||
if (!CollectionUtils.isEmpty(orgIds)) {
|
if (!CollectionUtils.isEmpty(orgIds)) {
|
||||||
ids = param.getIds();
|
ids = new ArrayList<>(param.getIds());
|
||||||
if (!CollectionUtils.isEmpty((Collection)ids)) {
|
if (!CollectionUtils.isEmpty((Collection)ids)) {
|
||||||
orgIds.retainAll(ids);
|
orgIds.retainAll(ids);
|
||||||
if (CollectionUtils.isEmpty(orgIds)) {
|
if (CollectionUtils.isEmpty(orgIds)) {
|
||||||
@@ -810,7 +810,7 @@ implements OrganizationService {
|
|||||||
extendResult.setDetail(extendDetail);
|
extendResult.setDetail(extendDetail);
|
||||||
}
|
}
|
||||||
result.setExtend(extendResult);
|
result.setExtend(extendResult);
|
||||||
List refDTOS = Optional.ofNullable(this.organizationAreaRefMapper.listByOrgId(orgId, businessId)).orElse(Collections.emptyList());
|
List<OrganizationAreaRefDTO> refDTOS = Optional.ofNullable(this.organizationAreaRefMapper.listByOrgId(orgId, businessId)).orElse(Collections.emptyList());
|
||||||
List officeArea = refDTOS.stream().filter(it -> it.getRefType() == 0).map(o -> o.getAreaId()).collect(Collectors.toList());
|
List officeArea = refDTOS.stream().filter(it -> it.getRefType() == 0).map(o -> o.getAreaId()).collect(Collectors.toList());
|
||||||
List passableArea = refDTOS.stream().filter(it -> it.getRefType() == 1).map(o -> o.getAreaId()).collect(Collectors.toList());
|
List passableArea = refDTOS.stream().filter(it -> it.getRefType() == 1).map(o -> o.getAreaId()).collect(Collectors.toList());
|
||||||
result.setPassableArea(passableArea);
|
result.setPassableArea(passableArea);
|
||||||
@@ -818,9 +818,9 @@ implements OrganizationService {
|
|||||||
QueryZoneUnitParam queryZoneUnitParam = new QueryZoneUnitParam();
|
QueryZoneUnitParam queryZoneUnitParam = new QueryZoneUnitParam();
|
||||||
queryZoneUnitParam.setUnitIds(Collections.singletonList(organization.getId()));
|
queryZoneUnitParam.setUnitIds(Collections.singletonList(organization.getId()));
|
||||||
CloudwalkResult<List<ZoneUnitResultDTO>> zoneDetail = this.zoneFeignClient.findZoneDetailByUnitIds(queryZoneUnitParam);
|
CloudwalkResult<List<ZoneUnitResultDTO>> zoneDetail = this.zoneFeignClient.findZoneDetailByUnitIds(queryZoneUnitParam);
|
||||||
List<Object> zoneIds = new ArrayList();
|
List<String> zoneIds = new ArrayList();
|
||||||
if ("00000000".equals(zoneDetail.getCode())) {
|
if ("00000000".equals(zoneDetail.getCode())) {
|
||||||
List data = (List)zoneDetail.getData();
|
List<ZoneUnitResultDTO> data = (List)zoneDetail.getData();
|
||||||
zoneIds = data.stream().map(z -> z.getZoneId()).collect(Collectors.toList());
|
zoneIds = data.stream().map(z -> z.getZoneId()).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
result.setZoneIds(zoneIds);
|
result.setZoneIds(zoneIds);
|
||||||
@@ -837,10 +837,10 @@ implements OrganizationService {
|
|||||||
if (param.getId() != null) {
|
if (param.getId() != null) {
|
||||||
ids.add(param.getId());
|
ids.add(param.getId());
|
||||||
} else {
|
} else {
|
||||||
ids = param.getIds();
|
ids = new ArrayList<>(param.getIds());
|
||||||
}
|
}
|
||||||
List organizations = Optional.ofNullable(this.imgStoreOrganizationMapper.listNames(ids, businessId)).orElse(Collections.emptyList());
|
List<Organization> organizations = Optional.ofNullable(this.imgStoreOrganizationMapper.listNames(ids, businessId)).orElse(Collections.emptyList());
|
||||||
Map<String, String> collect = (java.util.Map<java.lang.String,java.lang.String>) organizations.stream().collect(Collectors.toMap(it -> it.getId(), v -> v.getName()));
|
Map<String, String> collect = (Map) organizations.stream().collect(Collectors.toMap(it -> it.getId(), v -> v.getName()));
|
||||||
return (CloudwalkResult)CloudwalkResult.success(collect);
|
return (CloudwalkResult)CloudwalkResult.success(collect);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -954,7 +954,7 @@ implements OrganizationService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void saveAreaDetails(EditOrganizationParam param, String businessId) {
|
private void saveAreaDetails(EditOrganizationParam param, String businessId) {
|
||||||
List passableArea = param.getPassableArea();
|
List<String> passableArea = param.getPassableArea();
|
||||||
String organizationId = param.getId();
|
String organizationId = param.getId();
|
||||||
boolean type = true;
|
boolean type = true;
|
||||||
this.organizationAreaRefMapper.deleteAllByOrgId(organizationId, businessId);
|
this.organizationAreaRefMapper.deleteAllByOrgId(organizationId, businessId);
|
||||||
@@ -968,7 +968,7 @@ implements OrganizationService {
|
|||||||
refDTO.setCreateTime(Long.valueOf(System.currentTimeMillis()));
|
refDTO.setCreateTime(Long.valueOf(System.currentTimeMillis()));
|
||||||
return refDTO;
|
return refDTO;
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
List officeArea = param.getOfficeArea();
|
List<String> officeArea = param.getOfficeArea();
|
||||||
List officeList = officeArea.stream().map(areaId -> {
|
List officeList = officeArea.stream().map(areaId -> {
|
||||||
OrganizationAreaRefDTO refDTO = new OrganizationAreaRefDTO();
|
OrganizationAreaRefDTO refDTO = new OrganizationAreaRefDTO();
|
||||||
refDTO.setAreaId(areaId);
|
refDTO.setAreaId(areaId);
|
||||||
|
|||||||
Reference in New Issue
Block a user