|
@@ -9,7 +9,6 @@ use App\Models\BimFile;
|
|
|
use App\Models\Enums\BimFileConvertStatus;
|
|
|
use App\Models\Enums\BimFileModelType;
|
|
|
use Illuminate\Http\UploadedFile;
|
|
|
-use Illuminate\Support\Facades\Log;
|
|
|
|
|
|
class Glendale extends BIMAbstract
|
|
|
{
|
|
@@ -370,6 +369,58 @@ class Glendale extends BIMAbstract
|
|
|
return $components;
|
|
|
}
|
|
|
|
|
|
+ public function getAttributes(string $lightweightName, array $attributeIds)
|
|
|
+ {
|
|
|
+ try {
|
|
|
+ $res = Client::getInstance()->get('api/app/model/property-data-by-externalid', [
|
|
|
+ 'LightweightName' => $lightweightName,
|
|
|
+ 'ExternalId' => implode(',', $attributeIds),
|
|
|
+ ]);
|
|
|
+ } catch (\Throwable $th) {
|
|
|
+ return [];
|
|
|
+ }
|
|
|
+
|
|
|
+ return $res['datas'] ?? [];
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取有修改过的构件ID数组
|
|
|
+ * @param array $conponentIds
|
|
|
+ * @param array $attributes
|
|
|
+ * @param array $newAttributes
|
|
|
+ * @return array
|
|
|
+ */
|
|
|
+ public function getUpdatedComponentIds(array $conponentIds, array $attributes, array $newAttributes): array
|
|
|
+ {
|
|
|
+ $updatedIds = [];
|
|
|
+ $attributes = collect($attributes);
|
|
|
+ $newAttributes = collect($newAttributes);
|
|
|
+ $attributesGroup = $attributes->groupBy('externalId');
|
|
|
+ $newAttributesGroup = $newAttributes->groupBy('externalId');
|
|
|
+
|
|
|
+ foreach ($conponentIds as $conponentId) {
|
|
|
+ $conponents = $attributesGroup[$conponentId];
|
|
|
+ $newConponents = $newAttributesGroup[$conponentId];
|
|
|
+ if (!$conponents || !$newConponents) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ if ($conponents->count() != $newConponents->count()) {
|
|
|
+ $updatedIds[] = $conponentId;
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ $a = array_values($conponents->sortBy('id')->toArray());
|
|
|
+ $b = array_values($newConponents->sortBy('id')->toArray());
|
|
|
+
|
|
|
+ if (!array_are_equal($a, $b, ['id', 'externalId', 'propertyTypeName', 'propertySetName', 'propertySetName', 'value', 'groupname'])) {
|
|
|
+ $updatedIds[] = $conponentId;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return $updatedIds;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 把引擎数据同步过来
|
|
|
* @param string $lightweightName
|