real_company_id
This commit is contained in:
parent
86e7f25166
commit
24d92d01e5
@ -32,6 +32,7 @@ class MongoSync extends Command
|
|||||||
|
|
||||||
if ($total) {
|
if ($total) {
|
||||||
Artisan::call('real:sync-bloc');
|
Artisan::call('real:sync-bloc');
|
||||||
|
Artisan::call('real:sync-company');
|
||||||
}
|
}
|
||||||
|
|
||||||
$page = 2;
|
$page = 2;
|
||||||
|
@ -14,6 +14,7 @@ use Dipper\Foundation\Bus\Dispatchable;
|
|||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
use App\Domains\Card\Repositories\BlocRepository;
|
use App\Domains\Card\Repositories\BlocRepository;
|
||||||
use App\Domains\Card\Repositories\CardRepository;
|
use App\Domains\Card\Repositories\CardRepository;
|
||||||
|
use App\Domains\Real\Repositories\CompanyRepository;
|
||||||
use App\Domains\Virtual\Repositories\OrderCardPartitionRepository;
|
use App\Domains\Virtual\Repositories\OrderCardPartitionRepository;
|
||||||
|
|
||||||
class MongoSyncJob implements ShouldQueue
|
class MongoSyncJob implements ShouldQueue
|
||||||
@ -60,6 +61,7 @@ class MongoSyncJob implements ShouldQueue
|
|||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$companies = app(CompanyRepository::class)->withTrashed()->get()->keyBy('sn');
|
||||||
$blocs = app(BlocRepository::class)->withTrashed()->get()->pluck('id', 'sn')->toArray();
|
$blocs = app(BlocRepository::class)->withTrashed()->get()->pluck('id', 'sn')->toArray();
|
||||||
|
|
||||||
$values = [];
|
$values = [];
|
||||||
@ -80,7 +82,7 @@ class MongoSyncJob implements ShouldQueue
|
|||||||
'carrier_operator' => self::$carrierOperators[$value['oType']] ?? 255,
|
'carrier_operator' => self::$carrierOperators[$value['oType']] ?? 255,
|
||||||
'activated_at' => $activated_at,
|
'activated_at' => $activated_at,
|
||||||
'virtual_activated_at' => $activated_at,
|
'virtual_activated_at' => $activated_at,
|
||||||
'order_status' => intval(!empty($value['bNo'])),
|
'real_company_id' => empty($value['bNo']) ? -1 : ($companies[empty($value['bNo'])]['id'] ?? 0),
|
||||||
'created_at' => $value['sDate'] ? $value['sDate']->toDateTime()->format('Y-m-d H:i:s') : null,
|
'created_at' => $value['sDate'] ? $value['sDate']->toDateTime()->format('Y-m-d H:i:s') : null,
|
||||||
'updated_at' => date('Y-m-d H:i:s'),
|
'updated_at' => date('Y-m-d H:i:s'),
|
||||||
];
|
];
|
||||||
@ -93,7 +95,7 @@ class MongoSyncJob implements ShouldQueue
|
|||||||
$sql .= ' on conflict (sim) do update set
|
$sql .= ' on conflict (sim) do update set
|
||||||
activated_at=excluded.activated_at,
|
activated_at=excluded.activated_at,
|
||||||
virtual_activated_at=COALESCE(cards.virtual_activated_at, excluded.activated_at),
|
virtual_activated_at=COALESCE(cards.virtual_activated_at, excluded.activated_at),
|
||||||
order_status=excluded.order_status';
|
real_company_id=excluded.real_company_id';
|
||||||
|
|
||||||
$builder->connection->insert($sql, Arr::flatten($values, 1));
|
$builder->connection->insert($sql, Arr::flatten($values, 1));
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ class OrderService extends Service
|
|||||||
|
|
||||||
$orderIds = $cards->pluck('virtual_order_id')->unique()->toArray();
|
$orderIds = $cards->pluck('virtual_order_id')->unique()->toArray();
|
||||||
|
|
||||||
$virtualOrders = app(VirtualOrderRepository::class)
|
$virtualOrders = app(VirtualOrderRepository::class)->withTrashed()
|
||||||
->withConditions(['id' => $orderIds])->get()->keyBy('id');
|
->withConditions(['id' => $orderIds])->get()->keyBy('id');
|
||||||
|
|
||||||
$cards->map(function ($item) use ($virtualOrders) {
|
$cards->map(function ($item) use ($virtualOrders) {
|
||||||
|
@ -26,7 +26,7 @@ class CreateCardsTable extends Migration
|
|||||||
$table->timestamp('activated_at')->nullable()->comment('激活时间');
|
$table->timestamp('activated_at')->nullable()->comment('激活时间');
|
||||||
$table->timestamp('virtual_activated_at')->nullable()->comment('虚拟激活时间');
|
$table->timestamp('virtual_activated_at')->nullable()->comment('虚拟激活时间');
|
||||||
$table->tinyInteger('type')->unsigned()->default(0)->comment('类型(0:真实卡 1:虚拟卡 2:未知卡)');
|
$table->tinyInteger('type')->unsigned()->default(0)->comment('类型(0:真实卡 1:虚拟卡 2:未知卡)');
|
||||||
$table->tinyInteger('order_status')->unsigned()->default(0)->comment('订单状态 0:正常 1:退货');
|
$table->integer('real_company_id')->unsigned()->default(0)->comment("企业ID");
|
||||||
$table->timestamp('cancelled_at')->nullable()->comment('注销时间');
|
$table->timestamp('cancelled_at')->nullable()->comment('注销时间');
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ export default {
|
|||||||
{
|
{
|
||||||
title: "订单编号",
|
title: "订单编号",
|
||||||
key: "sn",
|
key: "sn",
|
||||||
width: 165
|
width: 210
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -155,6 +155,7 @@ export default {
|
|||||||
title: "所需卡量",
|
title: "所需卡量",
|
||||||
key: "",
|
key: "",
|
||||||
width: 150,
|
width: 150,
|
||||||
|
fixed: 'right',
|
||||||
render: (h, context) => {
|
render: (h, context) => {
|
||||||
let select = this.selected.find(item => {
|
let select = this.selected.find(item => {
|
||||||
return item.id === context.row.id;
|
return item.id === context.row.id;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user