engineering/app/adminapi/logic/WorkbenchLogic.php

215 lines
9.1 KiB
PHP
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\logic;
use app\common\logic\BaseLogic;
use app\common\model\cost_project\CostProject;
use app\common\model\financial\FinancialBidMargin;
use app\common\model\financial\FinancialBidMarginRecovery;
use app\common\model\financial\FinancialBorrowMoney;
use app\common\model\financial\FinancialInvoice;
use app\common\model\financial\FinancialPerformanceMoneyApply;
use app\common\model\financial\FinancialPerformanceMoneyRecovery;
use app\common\model\financial\FinancialRefund;
use app\common\model\financial\FinancialRepayment;
use app\common\model\financial\FinancialSettlement;
use app\common\model\financial\FinancialUsingFunds;
use app\common\model\marketing\MarketingContract;
use app\common\service\ConfigService;
use app\common\service\FileService;
/**
* 工作台
* Class WorkbenchLogic
* @package app\adminapi\logic
*/
class WorkbenchLogic extends BaseLogic
{
/**
* @notes 工作套
* @param $adminInfo
* @return array
* @author 段誉
* @date 2021/12/29 15:58
*/
public static function index($where, $time)
{
$data = [];
$datearr = explode('-', $time);
$time = TimeConvert(['start_time' => $datearr[0], 'end_time' => $datearr[1]]);
$marketingContract = new MarketingContract();
$costProject = new CostProject();
$financialInvoice = new FinancialInvoice();
$financialRefund = new FinancialRefund();
$financialSettlement = new FinancialSettlement();
$financialBidMargin = new FinancialBidMargin();
$financialBidMarginRecovery = new FinancialBidMarginRecovery();
$financialPerformanceMoneyApply = new FinancialPerformanceMoneyApply();
$financialPerformanceMoneyRecovery = new FinancialPerformanceMoneyRecovery();
$financialUsingFunds = new FinancialUsingFunds();
$financialBorrowMoney = new FinancialBorrowMoney();
$financialRepayment = new FinancialRepayment();
$where_1 = [
['review_status', '=', 1],
['contract_type', '=', 0],
['status', '=', 0]
];
$total_apply_amount = $marketingContract->statistics_count($where_1, $time, 'sum', '');
$apply_amount_value = $marketingContract->statistics_count($where_1, $time, 'group', 'create_time');
$data[] = [
'title' => '待立项项目',
'desc' => '',
'total_money' => $total_apply_amount,
'value' => $apply_amount_value['y'] ?? 0,
'type' => 1,
];
$total_apply_amount = $marketingContract->statistics_count(['status' => 1], $time, 'sum', '');
$apply_amount_value = $marketingContract->statistics_count(['status' => 1], $time, 'group', 'create_time');
$data[] = [
'title' => '已立项项目',
'desc' => '',
'total_money' => $total_apply_amount,
'value' => $apply_amount_value['y'] ?? 0,
'type' => 1,
];
//开票金额
$total_apply_amount = $financialInvoice->ContractFinancialMoney([], $time, 'sum', '', 'apply_amount');
$apply_amount_value = $financialInvoice->ContractFinancialMoney([], $time, 'group', 'create_time', 'apply_amount');
$data[] = [
'title' => '开票金额',
'desc' => '',
'total_money' => $total_apply_amount,
'value' => $apply_amount_value['y'] ?? 0,
'type' => 1,
];
//回款金额
$total_amount = $financialRefund->statistics([], $time, 'sum', '', 'amount');
$amount_value = $financialRefund->statistics($where, $time, 'group', 'create_time', 'amount');
$data[] = [
'title' => '回款金额',
'desc' => '',
'total_money' => $total_amount,
'value' => $amount_value['y'] ?? 0,
'type' => 1,
];
//结算金额
$total_amount = $financialSettlement->statistics([], $time, 'sum', '', 'amount');
$amount_value = $financialSettlement->statistics([], $time, 'group', 'create_time', 'amount');
$data[] = [
'title' => '结算金额',
'desc' => '',
'total_money' => $total_amount,
'value' => $amount_value['y'] ?? 0,
'type' => 1,
];
//投资金额
$total_apply_amount = $costProject->statistics([], $time, 'sum', '', 'invest');
$apply_amount_value = $costProject->statistics([], $time, 'group', 'create_time', 'invest');
$data[] = [
'title' => '投资金额',
'desc' => '',
'total_money' => $total_apply_amount,
'value' => $apply_amount_value['y'] ?? 0,
'type' => 1,
];
//签约金额
$total_apply_amount = $marketingContract->statistics([], $time, 'sum', '', 'signed_amount');
$apply_amount_value = $marketingContract->statistics([], $time, 'group', 'create_time', 'signed_amount');
$data[] = [
'title' => '签约金额',
'desc' => '',
'total_money' => $total_apply_amount,
'value' => $apply_amount_value['y'] ?? 0,
'type' => 1,
];
//保证金申请
$total_bid_margin = $financialBidMargin->statistics([], $time, 'sum', '', 'bid_margin');
$bid_margin_value = $financialBidMargin->statistics([], $time, 'group', 'create_time', 'bid_margin');
$data[] = [
'title' => '保证金申请',
'desc' => '',
'total_money' => $total_bid_margin,
'value' => $bid_margin_value['y']??[],
'type' => 1,
];
//保证金回收
$total_pay_amount = $financialBidMarginRecovery->statistics([], $time, 'sum', '', 'pay_amount');
$pay_amount_value = $financialBidMarginRecovery->statistics([], $time, 'group', 'create_time', 'pay_amount');
$data[] = [
'title' => '保证金回收',
'desc' => '',
'total_money' => $total_pay_amount,
'value' => $pay_amount_value['y']??[],
'type' => 1,
];
//履约申请
$apply_amount = $financialPerformanceMoneyApply->statistics([], $time, 'sum', '', 'apply_amount');
$apply_amount_value = $financialPerformanceMoneyApply->statistics([], $time, 'group', 'create_time', 'apply_amount');
$data[] = [
'title' => '履约申请',
'desc' => '',
'total_money' => $apply_amount,
'value' => $apply_amount_value['y']??[],
'type' => 1,
];
//履约回收
$recovery_amount = $financialPerformanceMoneyRecovery->statistics([], $time, 'sum', '', 'recovery_amount');
$recovery_amount_value = $financialPerformanceMoneyRecovery->statistics([], $time, 'group', 'create_time', 'recovery_amount');
$data[] = [
'title' => '履约回收',
'desc' => '',
'total_money' => $recovery_amount,
'value' => $recovery_amount_value['y']??[],
'type' => 1,
];
//用款
$has_pay_amount = $financialUsingFunds->statistics([], $time, 'sum', '', 'has_pay_amount');
$has_pay_amount_value = $financialUsingFunds->statistics([], $time, 'group', 'create_time', 'has_pay_amount');
$data[] = [
'title' => '用款',
'desc' => '',
'total_money' => $has_pay_amount,
'value' => $has_pay_amount_value['y']??[],
'type' => 1,
];
//借款
$amount = $financialBorrowMoney->statistics([], $time, 'sum', '', 'amount');
$amount_value = $financialBorrowMoney->statistics([], $time, 'group', 'create_time', 'amount');
$data[] = [
'title' => '借款',
'desc' => '',
'total_money' => $amount,
'value' => $amount_value['y']??[],
'type' => 1,
];
//还款
$amount = $financialRepayment->statistics([], $time, 'sum', '', 'amount');
$amount_value = $financialRepayment->statistics([], $time, 'group', 'create_time', 'amount');
$data[] = [
'title' => '还款',
'desc' => '',
'total_money' => $amount,
'value' => $amount_value['y']??[],
'type' => 1,
];
return $data;
}
}