续费订单旧系统数据特殊处理
This commit is contained in:
parent
10c505a4a2
commit
d29c1d6fc5
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domains\Stats\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domains\Stats\Services;
|
||||
|
||||
use App\Dicts;
|
||||
|
@ -54,13 +54,12 @@ class OrderService extends Service
|
||||
DB::raw("array_to_string(array_agg(id), ',') as order_id"),
|
||||
'company_id',
|
||||
'package_id',
|
||||
'unit_price',
|
||||
'pay_channel',
|
||||
DB::raw('SUM(custom_price) as custom_price'),
|
||||
];
|
||||
|
||||
$orders = $this->orderRepository->select($select)->withConditions($conditions)->applyConditions()
|
||||
->groupBy(['company_id', 'package_id', 'unit_price', 'pay_channel'])->paginate($conditions['limit']);
|
||||
->groupBy(['company_id', 'package_id', 'pay_channel'])->paginate($conditions['limit']);
|
||||
|
||||
$order_ids = [];
|
||||
$groups = [];
|
||||
@ -81,11 +80,15 @@ class OrderService extends Service
|
||||
$values = implode(',', $groups);
|
||||
$join = DB::raw("(VALUES $values) as t(gid, o_id)");
|
||||
|
||||
$members = collect();
|
||||
|
||||
if (!empty($groups)) {
|
||||
$members = $repository->join($join, 'o_id', '=', 'order_id')->select([
|
||||
'gid',
|
||||
DB::raw('SUM(counts) as counts'),
|
||||
DB::raw('COUNT(distinct sim) as members'),
|
||||
])->withConditions(['order_id' => $order_ids])->groupBy('gid')->get();
|
||||
}
|
||||
|
||||
$orders->map(function ($item) use ($companies, $packages, $members) {
|
||||
$item->company_name = $companies[$item->company_id];
|
||||
@ -94,13 +97,59 @@ class OrderService extends Service
|
||||
$item->members = $members[$item->gid]['members'] ?? 0;
|
||||
$item->counts = $members[$item->gid]['counts'] ?? 0;
|
||||
|
||||
$item->custom_price = sprintf('%.02f', $item->unit_price * $item->counts / 100);
|
||||
$item->unit_price = sprintf('%.02f', $item->unit_price / 100);
|
||||
$item->custom_price = sprintf('%.02f', $item->custom_price / 100);
|
||||
|
||||
$item->pay_channel_name = CommonService::namePayChannel($item->pay_channel);
|
||||
|
||||
// 为兼容旧系统的错误做的处理
|
||||
$this->oldDataCount($item);
|
||||
});
|
||||
|
||||
return $orders;
|
||||
return $orders->where('counts', '<>', 0)->values();
|
||||
}
|
||||
|
||||
// 为兼容旧系统的错误做的处理
|
||||
private function oldDataCount(&$item)
|
||||
{
|
||||
$data = [
|
||||
3389 => ['members' => 1, 'counts' => 1, 'custom_price' => 60], // 福建省福信富通网络科技股份有限公司微信支付Y02 2016
|
||||
3768 => ['members' => -8, 'counts' => -4, 'custom_price' => -120], // 深圳市美凯欣科技有限公司银行转账Y02 2016
|
||||
4454 => ['members' => -3, 'counts' => 0, 'custom_price' => 0], // 深圳市美凯欣科技有限公司银行转账Y02 2016
|
||||
5170 => ['members' => -10, 'counts' => -10, 'custom_price' => -500], // 深圳市美凯欣科技有限公司银行转账Y02 2016
|
||||
9181 => ['members' => 1, 'counts' => 1, 'custom_price' => 36], // 福建省福信富通网络科技股份有限公司微信支付Y02 2017-06
|
||||
12049 => ['members' => 19, 'counts' => 19, 'custom_price' => 1140], // 福建省福信富通网络科技股份有限公司微信支付Y02 2017-08
|
||||
13329 => ['members' => 3, 'counts' => 3, 'custom_price' => 180], // 福建省福信富通网络科技股份有限公司微信支付Y02 2017-09
|
||||
14345 => ['members' => -18, 'counts' => -18, 'custom_price' => -1056], // 福建省福信富通网络科技股份有限公司微信支付Y02 2017-10
|
||||
15061 => ['members' => -6, 'counts' => -6, 'custom_price' => -360], // 福建省福信富通网络科技股份有限公司微信支付Y02 2017-11
|
||||
6519 => ['members' => -1, 'counts' => -1, 'custom_price' => -8], // 深圳市和佳艺物联网有限公司支付宝Y01 2017
|
||||
8069 => ['members' => -1, 'counts' => -1, 'custom_price' => -6], // 深圳市和佳艺物联网有限公司支付宝Y01 2017
|
||||
15889 => ['members' => 1, 'counts' => 1, 'custom_price' => 8], // 深圳市和佳艺物联网有限公司支付宝Y01
|
||||
6732 => ['members' => -1, 'counts' => -1, 'custom_price' => -8], // 深圳市路科科技有限公司支付宝Y01
|
||||
5944 => ['members' => -4, 'counts' => -4, 'custom_price' => -180], // 深圳市路科科技有限公司支付宝Y01
|
||||
5944 => ['members' => -4, 'counts' => -4, 'custom_price' => -180], // 深圳市路科科技有限公司支付宝Y01
|
||||
6456 => ['members' => -1, 'counts' => -1, 'custom_price' => -30], // 深圳市路科科技有限公司支付宝Y01
|
||||
7819 => ['members' => -1, 'counts' => -1, 'custom_price' => -8], // 深圳市美凯欣科技有限公司支付宝Y02
|
||||
6456 => ['members' => -1, 'counts' => -1, 'custom_price' => -30], // 深圳市美凯欣科技有限公司银行转账Y02
|
||||
8203 => ['members' => -3, 'counts' => -3, 'custom_price' => -54], // 深圳市美凯欣科技有限公司银行转账Y02
|
||||
9272 => ['members' => -21, 'counts' => -16, 'custom_price' => -820], // 深圳市美凯欣科技有限公司银行转账Y02
|
||||
11070 => ['members' => 3, 'counts' => 4, 'custom_price' => 120], // 深圳市美凯欣科技有限公司银行转账Y02
|
||||
12357 => ['members' => 14, 'counts' => 14, 'custom_price' => 785.5], // 深圳市美凯欣科技有限公司银行转账Y02
|
||||
13390 => ['members' => 11, 'counts' => 11, 'custom_price' => 530], // 深圳市美凯欣科技有限公司银行转账Y02
|
||||
14432 => ['members' => 3, 'counts' => 3, 'custom_price' => 150], // 深圳市美凯欣科技有限公司银行转账Y02
|
||||
16358 => ['members' => 3, 'counts' => 3, 'custom_price' => 64.5], // 深圳市美凯欣科技有限公司银行转账Y02
|
||||
7734 => ['members' => -1, 'counts' => -1, 'custom_price' => -50], // 深圳思畅智能系统有限公司银行转账Y02
|
||||
];
|
||||
|
||||
$o_ids = str_to_array($item->order_id);
|
||||
|
||||
foreach ($o_ids as $id) {
|
||||
if (in_array($id, array_keys($data))) {
|
||||
$item->members = $item->members + $data[$id]['members'] ?? 0;
|
||||
$item->counts = $item->counts + $data[$id]['counts'] ?? 0;
|
||||
$item->custom_price = $item->custom_price + $data[$id]['custom_price'] ?? 0;
|
||||
$item->custom_price = sprintf('%.02f', $item->custom_price);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -270,7 +270,8 @@ if (!function_exists('single_case')) {
|
||||
*/
|
||||
function single_case($str)
|
||||
{
|
||||
$arr = array('0' => '0', '1' => '1', '2' => '2', '3' => '3', '4' => '4',
|
||||
$arr = array(
|
||||
'0' => '0', '1' => '1', '2' => '2', '3' => '3', '4' => '4',
|
||||
'5' => '5', '6' => '6', '7' => '7', '8' => '8', '9' => '9',
|
||||
'A' => 'A', 'B' => 'B', 'C' => 'C', 'D' => 'D', 'E' => 'E',
|
||||
'F' => 'F', 'G' => 'G', 'H' => 'H', 'I' => 'I', 'J' => 'J',
|
||||
@ -291,7 +292,8 @@ if (!function_exists('single_case')) {
|
||||
':' => ':', '。' => '.', '、' => ',', ',' => '.', '、' => '.',
|
||||
';' => ',', '?' => '?', '!' => '!', '…' => '-', '‖' => '|',
|
||||
'”' => '"', '’' => '`', '‘' => '`', '|' => '|', '〃' => '"',
|
||||
' ' => ' ');
|
||||
' ' => ' '
|
||||
);
|
||||
|
||||
return strtr($str, $arr);
|
||||
}
|
||||
|
@ -21,7 +21,6 @@
|
||||
|
||||
<Row type="flex" justify="center" class="umar-t15" v-if="steps[current] && steps[current]['datePicker']">
|
||||
<DatePicker
|
||||
:editable="false"
|
||||
placeholder="请选择时间"
|
||||
placement="bottom-start"
|
||||
type="month"
|
||||
|
@ -23,7 +23,6 @@
|
||||
v-if="steps[current] && steps[current]['datePicker']"
|
||||
>
|
||||
<DatePicker
|
||||
:editable="false"
|
||||
placeholder="请选择时间"
|
||||
placement="bottom-start"
|
||||
type="month"
|
||||
|
@ -42,7 +42,6 @@
|
||||
|
||||
<li class="handle-item w-250">
|
||||
<DatePicker
|
||||
:editable="false"
|
||||
placeholder="请选择时间"
|
||||
placement="bottom-start"
|
||||
type="daterange"
|
||||
|
@ -21,7 +21,6 @@
|
||||
|
||||
<Row type="flex" justify="center" class="umar-t15" v-if="steps[current] && steps[current]['datePicker']">
|
||||
<DatePicker
|
||||
:editable="false"
|
||||
placeholder="请选择时间"
|
||||
placement="bottom-start"
|
||||
type="month"
|
||||
|
@ -47,7 +47,6 @@
|
||||
|
||||
<li class="handle-item w-350">
|
||||
<DatePicker
|
||||
:editable="false"
|
||||
placeholder="请选择时间"
|
||||
placement="bottom-start"
|
||||
type="daterange"
|
||||
|
@ -43,7 +43,6 @@
|
||||
|
||||
<li class="handle-item w-250">
|
||||
<DatePicker
|
||||
:editable="false"
|
||||
placeholder="请选择时间"
|
||||
placement="bottom-start"
|
||||
type="daterange"
|
||||
|
@ -69,7 +69,6 @@
|
||||
<ul class="handle-wraper">
|
||||
<li class="handle-item w-250">
|
||||
<DatePicker
|
||||
:editable="false"
|
||||
placeholder="请选择时间"
|
||||
placement="bottom-start"
|
||||
type="month"
|
||||
|
@ -68,7 +68,6 @@
|
||||
<ul class="handle-wraper">
|
||||
<li class="handle-item w-250">
|
||||
<DatePicker
|
||||
:editable="false"
|
||||
placeholder="请选择时间"
|
||||
placement="bottom-start"
|
||||
type="daterange"
|
||||
|
@ -34,23 +34,19 @@ export default {
|
||||
},
|
||||
columns: [{
|
||||
title: '企业名称',
|
||||
key: 'company_name'
|
||||
key: 'company_name',
|
||||
minWidth: 210
|
||||
},
|
||||
{
|
||||
title: '套餐名称',
|
||||
key: 'package_name',
|
||||
width: 150
|
||||
minWidth: 150
|
||||
},
|
||||
{
|
||||
title: '支付方式',
|
||||
key: 'pay_channel_name',
|
||||
width: 120
|
||||
},
|
||||
{
|
||||
title: '单价',
|
||||
key: 'unit_price',
|
||||
width: 120
|
||||
},
|
||||
{
|
||||
title: '人数',
|
||||
key: 'members',
|
||||
@ -69,7 +65,7 @@ export default {
|
||||
{
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
width: 170,
|
||||
minWidth: 180,
|
||||
render: (h, {
|
||||
row,
|
||||
column,
|
||||
|
@ -32,7 +32,6 @@
|
||||
|
||||
<li class="handle-item">
|
||||
<DatePicker
|
||||
:editable="false"
|
||||
placeholder="开始时间"
|
||||
placement="bottom-start"
|
||||
type="month"
|
||||
@ -44,7 +43,6 @@
|
||||
|
||||
<li class="handle-item">
|
||||
<DatePicker
|
||||
:editable="false"
|
||||
placeholder="结束时间"
|
||||
placement="bottom-start"
|
||||
type="month"
|
||||
|
@ -65,7 +65,6 @@
|
||||
|
||||
<li class="handle-item w-250">
|
||||
<DatePicker
|
||||
:editable="false"
|
||||
placeholder="激活时间"
|
||||
placement="bottom-start"
|
||||
type="daterange"
|
||||
@ -100,7 +99,6 @@
|
||||
|
||||
<li class="handle-item w-250">
|
||||
<DatePicker
|
||||
:editable="false"
|
||||
placeholder="创建时间"
|
||||
placement="bottom-start"
|
||||
type="daterange"
|
||||
|
@ -68,7 +68,6 @@
|
||||
|
||||
<li class="handle-item w-250">
|
||||
<DatePicker
|
||||
:editable="false"
|
||||
placeholder="请选择时间"
|
||||
placement="bottom-start"
|
||||
type="month"
|
||||
|
@ -49,7 +49,6 @@
|
||||
|
||||
<li class="handle-item w-200">
|
||||
<DatePicker
|
||||
:editable="false"
|
||||
placeholder="请选择时间"
|
||||
placement="bottom-start"
|
||||
type="daterange"
|
||||
|
@ -87,7 +87,6 @@
|
||||
|
||||
<li class="handle-item w-250">
|
||||
<DatePicker
|
||||
:editable="false"
|
||||
placeholder="请选择时间"
|
||||
placement="bottom-start"
|
||||
type="daterange"
|
||||
|
@ -18,7 +18,6 @@
|
||||
<div class="ui-list-content">
|
||||
<p>
|
||||
<DatePicker
|
||||
:editable="false"
|
||||
placeholder="退货时间"
|
||||
placement="bottom-start"
|
||||
type="date"
|
||||
|
@ -40,7 +40,6 @@
|
||||
|
||||
<li class="handle-item w-250">
|
||||
<DatePicker
|
||||
:editable="false"
|
||||
placeholder="订单时间"
|
||||
placement="bottom-start"
|
||||
type="daterange"
|
||||
@ -92,7 +91,6 @@
|
||||
|
||||
<li class="handle-item w-250">
|
||||
<DatePicker
|
||||
:editable="false"
|
||||
placeholder="退货时间"
|
||||
placement="bottom-start"
|
||||
type="daterange"
|
||||
|
2
public/css/chunk-27c12854.1756c258.css
Normal file
2
public/css/chunk-27c12854.1756c258.css
Normal file
File diff suppressed because one or more lines are too long
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Create The Application
|
||||
|
1
public/js/app.34dc3d8c.js
Normal file
1
public/js/app.34dc3d8c.js
Normal file
File diff suppressed because one or more lines are too long
14
public/js/chunk-27c12854.f9bc5661.js
Normal file
14
public/js/chunk-27c12854.f9bc5661.js
Normal file
File diff suppressed because one or more lines are too long
@ -1 +1 @@
|
||||
<!DOCTYPE html><html><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1"><link rel=icon href=\favicon.ico><script src=\config.js></script><title></title><link href=/css/chunk-05d31f73.1ad3b9ab.css rel=prefetch><link href=/css/chunk-6ea47298.6166dab5.css rel=prefetch><link href=/js/chunk-00ae0766.d130b440.js rel=prefetch><link href=/js/chunk-05d31f73.406014ff.js rel=prefetch><link href=/js/chunk-07a274ec.55e1b3b0.js rel=prefetch><link href=/js/chunk-6ea47298.b6a301d0.js rel=prefetch><link href=/css/app.be09e36f.css rel=preload as=style><link href=/css/chunk-vendors.3c3b2e85.css rel=preload as=style><link href=/js/app.7d8543b1.js rel=preload as=script><link href=/js/chunk-vendors.f1169dcc.js rel=preload as=script><link href=/css/chunk-vendors.3c3b2e85.css rel=stylesheet><link href=/css/app.be09e36f.css rel=stylesheet></head><body><noscript><strong>很抱歉,如果没有启用JavaScript,程序不能正常工作,若要继续使用请启用它。</strong></noscript><div id=app></div><script src=/js/chunk-vendors.f1169dcc.js></script><script src=/js/app.7d8543b1.js></script></body></html>
|
||||
<!DOCTYPE html><html><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1"><link rel=icon href=\favicon.ico><script src=\config.js></script><title></title><link href=/css/chunk-27c12854.1756c258.css rel=prefetch><link href=/css/chunk-6ea47298.6166dab5.css rel=prefetch><link href=/js/chunk-00ae0766.d130b440.js rel=prefetch><link href=/js/chunk-07a274ec.55e1b3b0.js rel=prefetch><link href=/js/chunk-27c12854.f9bc5661.js rel=prefetch><link href=/js/chunk-6ea47298.b6a301d0.js rel=prefetch><link href=/css/app.be09e36f.css rel=preload as=style><link href=/css/chunk-vendors.3c3b2e85.css rel=preload as=style><link href=/js/app.34dc3d8c.js rel=preload as=script><link href=/js/chunk-vendors.f1169dcc.js rel=preload as=script><link href=/css/chunk-vendors.3c3b2e85.css rel=stylesheet><link href=/css/app.be09e36f.css rel=stylesheet></head><body><noscript><strong>很抱歉,如果没有启用JavaScript,程序不能正常工作,若要继续使用请启用它。</strong></noscript><div id=app></div><script src=/js/chunk-vendors.f1169dcc.js></script><script src=/js/app.34dc3d8c.js></script></body></html>
|
Loading…
x
Reference in New Issue
Block a user