Commit 1ebc9df0 by 杨树贤

导出重名供应商

parent 43b95860
......@@ -25,6 +25,7 @@ use App\Model\UserInfoModel;
use Carbon\Carbon;
use GuzzleHttp\Client;
use GuzzleHttp\RequestOptions;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Redis;
use Maatwebsite\Excel\Facades\Excel;
......@@ -631,4 +632,31 @@ class DataService
]);
}
public static function exportNameInvalid()
{
$suppliers = DB::connection('web')->select('SELECT *, count(*) FROM lie_supplier_channel WHERE is_type=0 and group_code != "" GROUP BY supplier_name having count(*) > 1');
foreach ($suppliers as $supplier) {
}
Excel::create('重名供应商导出', function ($excel) use ($suppliers) {
$header = [
'供应商名字',
'供应商编码',
'集团编码',
];
$excelData = [];
foreach ($suppliers as $supplier) {
$excelData[] = [
$supplier['supplier_name'],
$supplier['supplier_code'],
$supplier['group_code'],
];
}
array_unshift($excelData, $header);
$excel->sheet('sheet1', function ($sheet) use ($excelData) {
$sheet->fromArray($excelData);
});
})->export('csv');
}
}
......@@ -84,6 +84,7 @@ Route::group(['middleware' => ['external'], 'namespace' => 'Sync'], function ()
});
Route::match(['get', 'post'], '/test', function () {
\App\Http\Services\DataService::exportNameInvalid();
//\App\Http\Services\SupplierAddressService::initUnitedAddress();
//\App\Http\Services\DataService::checkSupplierBandAccount();
//(new CompanyService())->checkSupplierCompanyAndAddress(11042);
......
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