Commit 1173a10a by 杨树贤

供应商sku上传时间展示

parent ae00cdbd
......@@ -6,6 +6,7 @@ namespace App\Http\Services;
use App\Http\Controllers\Filter\SkuListFilter;
use App\Model\IntracodeModel;
use App\Model\RedisModel;
use App\Model\SkuUploadLogModel;
use Illuminate\Support\Facades\DB;
use PhpAmqpLib\Connection\AMQPStreamConnection;
use PhpAmqpLib\Message\AMQPMessage;
......@@ -212,4 +213,28 @@ class SkuService
}
return true;
}
//获取第一次上传sku时间和最后一次上传sku时间
public static function getUploadTimeBySupplierCodes($supplierCodes = [], $type = 'first')
{
$supplierCodeInSql = implode(',', $supplierCodes);
if ($type == 'last') {
$rawSql = 'SELECT supplier_code,create_time FROM (SELECT supplier_code,max(create_time) AS create_time FROM lie_sku_upload_log GROUP BY supplier_code) AS temp WHERE supplier_code IN ( ? )';
} else {
$rawSql = 'SELECT supplier_code,create_time FROM (SELECT supplier_code,min(create_time) AS create_time FROM lie_sku_upload_log GROUP BY supplier_code) AS temp WHERE supplier_code IN ( ? )';
}
$data = DB::connection('spu')
->select($rawSql, [$supplierCodeInSql]);
$result = [];
foreach ($supplierCodes as $supplierCode) {
$result[$supplierCode] = 0;
foreach ($data as $item) {
if ($item['supplier_code'] == $supplierCode) {
$result[$supplierCode] = $item['create_time'];
}
}
}
return $result;
}
}
\ No newline at end of file
......@@ -6,6 +6,7 @@ namespace App\Http\Transformers;
use App\Http\Services\AdminUserService;
use App\Http\Services\DepartmentService;
use App\Http\Services\SkuService;
use App\Http\Services\SupplierPayTypeService;
use App\Http\Services\SupplierService;
use App\Http\Services\SupplierSkuAuditRulerService;
......@@ -28,6 +29,11 @@ class SupplierTransformer
$viewCheckService = new ViewCheckService();
$viewData = $viewCheckService->checkSupplierView($supplierIds);
$adminUserService = new AdminUserService();
//获取基石上传记录情况,展示第一次上传时间和最后一次上传时间
$firstUploadSkuTimes = SkuService::getUploadTimeBySupplierCodes(array_column($list, 'supplier_code'),'first');
$lastUploadSkuTimes = SkuService::getUploadTimeBySupplierCodes(array_column($list, 'supplier_code'),'last');
foreach ($list as &$supplier) {
$supplier['viewed'] = array_get($viewData, $supplier['supplier_id'], false);
$supplier = $this->getStockupType($supplier);
......@@ -57,6 +63,9 @@ class SupplierTransformer
$supplier['create_name'] = array_get($userInfo, 'name');
}
$supplier['first_upload_sku_time'] = date('Y-m-d H:i:s', $firstUploadSkuTimes[$supplier['supplier_code']]);
$supplier['last_upload_sku_time'] = date('Y-m-d H:i:s', $lastUploadSkuTimes[$supplier['supplier_code']]);
//获取最新修改人以及下级审核员
$logModel = new LogModel();
$log = $logModel->where('supplier_id', $supplier['supplier_id'])
......
......@@ -166,10 +166,11 @@
{field: 'create_name', title: '创建人', align: 'center', width: 70},
{field: 'update_time', title: '最近修改时间', align: 'center', width: 145},
{field: 'supplier_type_name', title: '供应商类别', align: 'center', width: 110},
{field: 'create_time', title: '创建时间', align: 'center', width: 145},
{field: 'first_upload_sku_time', title: '首次上传sku时间', align: 'center', width: 145},
{field: 'last_upload_sku_time', title: '最新上传sku时间', align: 'center', width: 145},
];
cols.push(
{field: 'create_time', title: '创建时间', align: 'center', width: 145},
);
table.render({
elem: '#list'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment