diff --git a/app/Dicts.php b/app/Dicts.php index 7af6f0cd..1240a55c 100644 --- a/app/Dicts.php +++ b/app/Dicts.php @@ -30,6 +30,7 @@ class Dicts extends Repository 'logistics' => ['sf' => '顺丰速运', 'sto' => '申通快递','yto' => '圆通速递', 'zto' => '中通快递', 'best' => '百世快递', 'yunda' => '韵达快递', 'ttkd'=> '天天快递', 'ems' => 'EMS邮政特快专递'], 'export_status' => ['准备中', '写入中', '保存中', '已完成', '导出失败', '文件丢失'], 'shares' => ['未知', '纵向共享', '横向共享'], + 'business_type' => ['对私', '对公'], ]; public function __construct() diff --git a/app/Domains/Real/Commands/Sync/AddedOrderSync.php b/app/Domains/Real/Commands/Sync/AddedOrderSync.php index 90bc5a7e..99f7c25d 100644 --- a/app/Domains/Real/Commands/Sync/AddedOrderSync.php +++ b/app/Domains/Real/Commands/Sync/AddedOrderSync.php @@ -20,6 +20,8 @@ class AddedOrderSync extends Command protected $chunks = 1000; + protected $business_type = ['3875569' => 0, '9632627' => 1]; + protected $types; protected $tables = [ @@ -123,6 +125,7 @@ class AddedOrderSync extends Command $select = [ 'sn', + 'account_no', 'status', 'custom_no as company_id', 'transaction_no', @@ -133,6 +136,7 @@ class AddedOrderSync extends Command $orders = DB::connection('real')->table('jxc_custom_order')->select($select)->whereIn('status', [3, 7, 8]) ->whereIn('custom_no', $this->companies->keys()) + ->whereIn('account_no', array_keys($this->business_type)) ->where('create_time', '>=', $starttime->timestamp) ->where('create_time', '<=', $endtime->timestamp) ->orderBy('create_time')->get()->collect()->toArray(); @@ -140,12 +144,14 @@ class AddedOrderSync extends Command $array = []; foreach ($orders as $item) { + $item['business_type'] = $this->business_type[$item['account_no']]; $item['company_id'] = $this->companies[$item['company_id']]['id'] ?? 0; $item['pay_channel'] = CommonService::transformerPayChannel($item['pay_channel']); $item['order_at'] = date('Y-m-d H:i:s', $item['order_at']); $item['created_at'] = $item['order_at']; $item['updated_at'] = ($item['updated_at'] == '0000-00-00 00:00:00') ? $item['order_at'] : $item['updated_at']; $item['deleted_at'] = $item['status'] === 3 ? null : $item['updated_at']; + unset($item['account_no']); unset($item['status']); $array[] = $item; } diff --git a/app/Domains/Real/Http/Controllers/OrderController.php b/app/Domains/Real/Http/Controllers/OrderController.php index 45af773a..6dae1cb1 100644 --- a/app/Domains/Real/Http/Controllers/OrderController.php +++ b/app/Domains/Real/Http/Controllers/OrderController.php @@ -40,6 +40,8 @@ class OrderController extends Controller return $item->only([ 'id', 'sn', + 'business_type', + 'business_type_name', 'company_id', 'package_id', 'carrier_operator', diff --git a/app/Domains/Real/Services/OrderService.php b/app/Domains/Real/Services/OrderService.php index 41c4629e..01b5cb02 100644 --- a/app/Domains/Real/Services/OrderService.php +++ b/app/Domains/Real/Services/OrderService.php @@ -39,6 +39,7 @@ class OrderService extends Service $limit = $conditions['limit'] ?? 10; $carrierOperators = app(Dicts::class)->get('carrier_operator'); + $businessTypes = app(Dicts::class)->get('business_type'); $res = $this->orderRepository->withConditions($conditions)->applyConditions()->paginate($limit); @@ -52,7 +53,8 @@ class OrderService extends Service ->groupBy('order_id')->get()->keyBy('order_id')->toArray(); } - $res->map(function ($item) use ($carrierOperators, $cards) { + $res->map(function ($item) use ($carrierOperators, $businessTypes, $cards) { + $item->business_type_name = $businessTypes[$item->business_type] ?? ''; $item->pay_channel_name = CommonService::namePayChannel($item->pay_channel); $item->company_name = CommonService::company($item->company_id)['name']; $item->package = CommonService::package($item->package_id); @@ -121,6 +123,7 @@ class OrderService extends Service $item['company_name'] = !$item['company_id'] ? '' : $companyService->load($item['company_id'])['name'] ?? ''; $item['package_name'] = !$item['package_id'] ? '' : $packageService->load($item['package_id'])['name'] ?? ''; + $item['package_sn'] = !$item['package_id'] ? '' : $packageService->load($item['package_id'])['sn'] ?? ''; } return array_values(array_sort($cards, function ($value) { diff --git a/database/migrations/2019_04_16_110601_add_business_type_to_real_orders.php b/database/migrations/2019_04_16_110601_add_business_type_to_real_orders.php new file mode 100644 index 00000000..b64c37f1 --- /dev/null +++ b/database/migrations/2019_04_16_110601_add_business_type_to_real_orders.php @@ -0,0 +1,32 @@ +tinyInteger('business_type')->unsigned()->default(0)->comment('业务类型(0:对私 1:对公)')->after('type'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('real_orders', function (Blueprint $table) { + $table->dropColumn('business_type'); + }); + } +} diff --git a/frontend/src/views/layout/index.vue b/frontend/src/views/layout/index.vue index 69d07381..515923c1 100644 --- a/frontend/src/views/layout/index.vue +++ b/frontend/src/views/layout/index.vue @@ -5,8 +5,8 @@