|
@@ -2,15 +2,48 @@
|
|
|
|
|
|
namespace App\Services\File\BIM\Glendale;
|
|
|
|
|
|
+use App\Models\Enums\BimFileConvertStatus;
|
|
|
use App\Services\File\BIM\Contacts\BIMContact;
|
|
|
use Illuminate\Http\UploadedFile;
|
|
|
+use Illuminate\Support\Facades\Auth;
|
|
|
+use Illuminate\Support\Facades\Storage;
|
|
|
+use Ramsey\Uuid\Uuid;
|
|
|
|
|
|
class Glendale implements BIMContact
|
|
|
{
|
|
|
|
|
|
public function uploadFile(UploadedFile $file, array $params = [])
|
|
|
{
|
|
|
- // TODO: Implement uploadFile() method.
|
|
|
+ /*dump([
|
|
|
+ 'name' => $file->getClientOriginalName(),
|
|
|
+ 'initiatingUser' => Auth::user()->name,
|
|
|
+ 'uniqueCode' => Uuid::uuid4(),
|
|
|
+ 'priority' => 205,
|
|
|
+ 'isCAD' => $params['is_cad'],
|
|
|
+ 'modelDownloadUrl' => Storage::url($params['pathname'])
|
|
|
+ ]);*/
|
|
|
+
|
|
|
+ $uploadFormData = [
|
|
|
+ ['name' => 'file', 'contents' => fopen($file, 'r')]
|
|
|
+ ];
|
|
|
+
|
|
|
+ $result = Client::getInstance()->post('/api/app/model/transcode-file', [
|
|
|
+ 'query_params' => [
|
|
|
+ 'input' => json_encode([
|
|
|
+ 'name' => $file->getClientOriginalName(),
|
|
|
+ 'initiatingUser' => Auth::user()->name,
|
|
|
+ 'uniqueCode' => Uuid::uuid4(),
|
|
|
+ 'priority' => 205,
|
|
|
+ 'isCAD' => $params['is_cad'],
|
|
|
+ 'modelDownloadUrl' => $params['pathname'],
|
|
|
+ "configJson" => ExtensionModelConfig::getConfigOption($params['extension']),
|
|
|
+ ])
|
|
|
+ ],
|
|
|
+ //'multipart' => $uploadFormData,
|
|
|
+ ]);
|
|
|
+
|
|
|
+ dump($result);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
public function downloadSourceFile()
|
|
@@ -20,12 +53,40 @@ class Glendale implements BIMContact
|
|
|
|
|
|
public function findConvertStatus(string $dataSetId)
|
|
|
{
|
|
|
- // TODO: Implement findConvertStatus() method.
|
|
|
+ $result = Client::getInstance()->post('/api/app/model/query-model-info', [
|
|
|
+ 'query_params' => [
|
|
|
+ 'LightweightName' => $dataSetId
|
|
|
+ ]
|
|
|
+ ]);
|
|
|
+
|
|
|
+ $getStatus = function($status) {
|
|
|
+ if ($status >= 1 && $status <= 99) {
|
|
|
+ return BimFileConvertStatus::CONVERTING->value;
|
|
|
+ }
|
|
|
+
|
|
|
+ if ($status <= 0) {
|
|
|
+ return BimFileConvertStatus::FAILED_TO_ADD_QUEUE->value;
|
|
|
+ }
|
|
|
+
|
|
|
+ return BimFileConvertStatus::IN_QUEUE->value;
|
|
|
+ };
|
|
|
+
|
|
|
+ return match ($result['data']['status']) {
|
|
|
+ 0, 1, 101 => BimFileConvertStatus::IN_QUEUE->value,
|
|
|
+ 100 => BimFileConvertStatus::DONE->value,
|
|
|
+ default => $getStatus($result['data']['status'])
|
|
|
+ };
|
|
|
}
|
|
|
|
|
|
public function viewDataSetModel(array $dataSetIDS)
|
|
|
{
|
|
|
- // TODO: Implement viewDataSetModel() method.
|
|
|
+ $result = Client::getInstance()->get('/api/app/model/model-SourceFileurl', [
|
|
|
+ 'LightweightName' => $dataSetIDS[0]
|
|
|
+ ]);
|
|
|
+
|
|
|
+ return [
|
|
|
+ 'datas' => $result['datas']
|
|
|
+ ];
|
|
|
}
|
|
|
|
|
|
public function addToConvertQueue(string $dataSetId): array
|