update
This commit is contained in:
parent
2c2b7af5c3
commit
308348f883
app
adminapi
controller/financial
lists/financial
logic/financial
validate/financial
common/model/financial
@ -0,0 +1,108 @@
|
||||
<?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\controller\financial;
|
||||
|
||||
|
||||
use app\adminapi\controller\BaseAdminController;
|
||||
use app\adminapi\lists\financial\FinancialPerformanceMoneyRecoveryLists;
|
||||
use app\adminapi\logic\financial\FinancialPerformanceMoneyRecoveryLogic;
|
||||
use app\adminapi\validate\financial\FinancialPerformanceMoneyRecoveryValidate;
|
||||
|
||||
|
||||
/**
|
||||
* 财务管理--履约金回收控制器
|
||||
* Class FinancialPerformanceMoneyRecoveryController
|
||||
* @package app\adminapi\controller\financial
|
||||
*/
|
||||
class FinancialPerformanceMoneyRecoveryController extends BaseAdminController
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取财务管理--履约金回收列表
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2024/04/15 09:33
|
||||
*/
|
||||
public function lists()
|
||||
{
|
||||
return $this->dataLists(new FinancialPerformanceMoneyRecoveryLists());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加财务管理--履约金回收
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2024/04/15 09:33
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
$params = (new FinancialPerformanceMoneyRecoveryValidate())->post()->goCheck('add');
|
||||
$result = FinancialPerformanceMoneyRecoveryLogic::add($params);
|
||||
if (true === $result) {
|
||||
return $this->success('添加成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(FinancialPerformanceMoneyRecoveryLogic::getError());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑财务管理--履约金回收
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2024/04/15 09:33
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
$params = (new FinancialPerformanceMoneyRecoveryValidate())->post()->goCheck('edit');
|
||||
$result = FinancialPerformanceMoneyRecoveryLogic::edit($params);
|
||||
if (true === $result) {
|
||||
return $this->success('编辑成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(FinancialPerformanceMoneyRecoveryLogic::getError());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除财务管理--履约金回收
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2024/04/15 09:33
|
||||
*/
|
||||
public function delete()
|
||||
{
|
||||
$params = (new FinancialPerformanceMoneyRecoveryValidate())->post()->goCheck('delete');
|
||||
FinancialPerformanceMoneyRecoveryLogic::delete($params);
|
||||
return $this->success('删除成功', [], 1, 1);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取财务管理--履约金回收详情
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2024/04/15 09:33
|
||||
*/
|
||||
public function detail()
|
||||
{
|
||||
$params = (new FinancialPerformanceMoneyRecoveryValidate())->goCheck('detail');
|
||||
$result = FinancialPerformanceMoneyRecoveryLogic::detail($params);
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,93 @@
|
||||
<?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\lists\financial;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\auth\Admin;
|
||||
use app\common\model\dept\Dept;
|
||||
use app\common\model\financial\FinancialPerformanceMoneyRecovery;
|
||||
use app\common\model\marketing\MarketingContract;
|
||||
use app\common\model\marketing\MarketingCustom;
|
||||
|
||||
|
||||
/**
|
||||
* 财务管理--履约金回收列表
|
||||
* Class FinancialPerformanceMoneyRecoveryLists
|
||||
* @package app\adminapi\listsfinancial
|
||||
*/
|
||||
class FinancialPerformanceMoneyRecoveryLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2024/04/15 09:33
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['contract_id'],
|
||||
'%like%' => ['create_user'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取财务管理--履约金回收列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2024/04/15 09:33
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
return FinancialPerformanceMoneyRecovery::withoutField('create_time,update_time,delete_time')->where($this->searchWhere)
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()->each(function ($data) {
|
||||
$contract = MarketingContract::field('contract_name,part_a,signed_amount,performance_money,performance_money_expiration_time,signed_dept,project_manager')->where('id', $data['contract_id'])->findOrEmpty();
|
||||
$part_a = MarketingCustom::field('name')->where('id', $contract['part_a'])->findOrEmpty();
|
||||
$signed_dept = Dept::field('name')->where('id', $contract['signed_dept'])->findOrEmpty();
|
||||
$project_manager = Admin::field('name')->where('id', $contract['project_manager'])->findOrEmpty();
|
||||
$data['contract_name'] = $contract?->contract_name;
|
||||
$data['part_a'] = $part_a?->name;
|
||||
$data['signed_amount'] = $contract?->signed_amount;
|
||||
$data['performance_money'] = $contract?->performance_money;
|
||||
$data['performance_money_expiration_time'] = $contract?->performance_money_expiration_time;
|
||||
$data['signed_dept'] = $signed_dept?->name;
|
||||
$data['project_manager'] = $project_manager?->name;
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取财务管理--履约金回收数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2024/04/15 09:33
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return FinancialPerformanceMoneyRecovery::where($this->searchWhere)->count();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,127 @@
|
||||
<?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\financial;
|
||||
|
||||
|
||||
use app\common\logic\BaseLogic;
|
||||
use app\common\model\financial\FinancialPerformanceMoneyRecovery;
|
||||
use app\common\model\marketing\MarketingContract;
|
||||
use app\common\model\marketing\MarketingCustom;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
/**
|
||||
* 财务管理--履约金回收逻辑
|
||||
* Class FinancialPerformanceMoneyRecoveryLogic
|
||||
* @package app\adminapi\logic\financial
|
||||
*/
|
||||
class FinancialPerformanceMoneyRecoveryLogic extends BaseLogic
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加财务管理--履约金回收
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2024/04/15 09:33
|
||||
*/
|
||||
public static function add(array $params): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
FinancialPerformanceMoneyRecovery::create([
|
||||
'contract_id' => $params['contract_id'],
|
||||
'recovery_date' => !empty($params['recovery_date']) ? strtotime($params['recovery_date']) : 0,
|
||||
'recovery_amount' => $params['recovery_amount'],
|
||||
'not_recovery_amount' => $params['not_recovery_amount'] ?? 0,
|
||||
'recovery_desc' => $params['recovery_desc'] ?? '',
|
||||
'create_user' => $params['create_user'],
|
||||
'create_time' => !empty($params['create_time']) ? strtotime($params['create_time']) : time(),
|
||||
]);
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑财务管理--履约金回收
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2024/04/15 09:33
|
||||
*/
|
||||
public static function edit(array $params): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
FinancialPerformanceMoneyRecovery::where('id', $params['id'])->update([
|
||||
'contract_id' => $params['contract_id'],
|
||||
'recovery_date' => !empty($params['recovery_date']) ? strtotime($params['recovery_date']) : 0,
|
||||
'recovery_amount' => $params['recovery_amount'],
|
||||
'not_recovery_amount' => $params['not_recovery_amount'] ?? 0,
|
||||
'recovery_desc' => $params['recovery_desc'] ?? '',
|
||||
'create_user' => $params['create_user'],
|
||||
'create_time' => !empty($params['create_time']) ? strtotime($params['create_time']) : time(),
|
||||
]);
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除财务管理--履约金回收
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2024/04/15 09:33
|
||||
*/
|
||||
public static function delete(array $params): bool
|
||||
{
|
||||
return FinancialPerformanceMoneyRecovery::destroy($params['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取财务管理--履约金回收详情
|
||||
* @param $params
|
||||
* @return array
|
||||
* @author likeadmin
|
||||
* @date 2024/04/15 09:33
|
||||
*/
|
||||
public static function detail($params): array
|
||||
{
|
||||
$data = FinancialPerformanceMoneyRecovery::withoutField('create_time,update_time,delete_time')->findOrEmpty($params['id']);
|
||||
$contract = MarketingContract::field('contract_name,contract_code,part_a,signed_amount,performance_money,performance_money_expiration_time')->where('id', $data['contract_id'])->findOrEmpty();
|
||||
$part_a = MarketingCustom::field('name')->where('id', $contract['part_a'])->findOrEmpty();
|
||||
$data['contract_name'] = $contract?->contract_name;
|
||||
$data['contract_code'] = $contract?->contract_code;
|
||||
$data['part_a'] = $part_a?->name;
|
||||
$data['signed_amount'] = $contract?->signed_amount;
|
||||
$data['performance_money'] = $contract?->performance_money;
|
||||
$data['performance_money_expiration_time'] = $contract?->performance_money_expiration_time;
|
||||
return $data->toArray();
|
||||
}
|
||||
}
|
@ -0,0 +1,121 @@
|
||||
<?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\validate\financial;
|
||||
|
||||
|
||||
use app\common\model\financial\FinancialPerformanceMoneyRecovery;
|
||||
use app\common\model\marketing\MarketingContract;
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* 财务管理--履约金回收验证器
|
||||
* Class FinancialPerformanceMoneyRecoveryValidate
|
||||
* @package app\adminapi\validate\financial
|
||||
*/
|
||||
class FinancialPerformanceMoneyRecoveryValidate extends BaseValidate
|
||||
{
|
||||
|
||||
/**
|
||||
* 设置校验规则
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require|checkData',
|
||||
'contract_id' => 'require|checkContract',
|
||||
'recovery_date' => 'require|dateFormat:Y-m-d',
|
||||
'recovery_amount' => 'require|float|egt:0',
|
||||
'not_recovery_amount' => 'float|egt:0',
|
||||
'create_user' => 'require',
|
||||
'create_time' => 'require|dateFormat:Y-m-d H:i:s',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 参数描述
|
||||
* @var string[]
|
||||
*/
|
||||
protected $field = [
|
||||
'id' => 'id',
|
||||
'contract_id' => '合同id',
|
||||
'recovery_date' => '回收日期',
|
||||
'recovery_amount' => '回收金额',
|
||||
'not_recovery_amount' => '未收金额',
|
||||
'recovery_desc' => '说明',
|
||||
'create_user' => '录入人',
|
||||
'create_time' => '录入时间',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加场景
|
||||
* @return FinancialPerformanceMoneyRecoveryValidate
|
||||
* @author likeadmin
|
||||
* @date 2024/04/15 09:33
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->only(['contract_id', 'recovery_date', 'recovery_amount', 'not_recovery_amount', 'recovery_desc', 'create_user', 'create_time']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑场景
|
||||
* @return FinancialPerformanceMoneyRecoveryValidate
|
||||
* @author likeadmin
|
||||
* @date 2024/04/15 09:33
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->only(['id', 'contract_id', 'recovery_date', 'recovery_amount', 'not_recovery_amount', 'recovery_desc', 'create_user', 'create_time']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return FinancialPerformanceMoneyRecoveryValidate
|
||||
* @author likeadmin
|
||||
* @date 2024/04/15 09:33
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id'])->remove('id', 'checkData');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 详情场景
|
||||
* @return FinancialPerformanceMoneyRecoveryValidate
|
||||
* @author likeadmin
|
||||
* @date 2024/04/15 09:33
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
public function checkData($value): bool|string
|
||||
{
|
||||
$data = FinancialPerformanceMoneyRecovery::where('id', $value)->findOrEmpty();
|
||||
return $data->isEmpty() ? '数据不存在' : true;
|
||||
}
|
||||
|
||||
public function checkContract($value): bool|string
|
||||
{
|
||||
$data = MarketingContract::where('id', $value)->where('contract_type', 0)->findOrEmpty();
|
||||
return $data->isEmpty() ? '合同数据不存在' : true;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
<?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\common\model\financial;
|
||||
|
||||
|
||||
use app\common\model\BaseModel;
|
||||
use think\model\concern\SoftDelete;
|
||||
|
||||
|
||||
/**
|
||||
* 财务管理--履约金回收模型
|
||||
* Class FinancialPerformanceMoneyRecovery
|
||||
* @package app\common\model\financial
|
||||
*/
|
||||
class FinancialPerformanceMoneyRecovery extends BaseModel
|
||||
{
|
||||
use SoftDelete;
|
||||
|
||||
protected $name = 'financial_performance_money_recovery';
|
||||
protected $deleteTime = 'delete_time';
|
||||
|
||||
public function getRecoveryDateAttr($value): string
|
||||
{
|
||||
return !empty($value) ? date('Y-m-d', $value) : '';
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user