新增分包合同模块

This commit is contained in:
yaooo 2023-12-12 17:16:39 +08:00
parent c7822db2b1
commit bebb338b10
5 changed files with 76 additions and 78 deletions

View File

@ -16,14 +16,14 @@
namespace app\adminapi\controller\contract;
use app\adminapi\controller\BaseAdminController;
use app\adminapi\lists\contract\SubcontractingContractLists;
use app\adminapi\logic\contract\SubcontractingContractLogic;
use app\adminapi\controller\BaseAdminController;
use app\adminapi\lists\contract\SubcontractingContractLists;
use app\adminapi\logic\contract\SubcontractingContractLogic;
use app\adminapi\validate\contract\SubcontractingContractValidate;
/**
* 分包合同控制器
* SubcontractingContract控制器
* Class SubcontractingContractController
* @package app\adminapi\controller\contract
*/
@ -32,10 +32,10 @@ class SubcontractingContractController extends BaseAdminController
/**
* @notes 获取分包合同列表
* @notes 获取列表
* @return \think\response\Json
* @author likeadmin
* @date 2023/12/09 14:08
* @date 2023/12/12 17:15
*/
public function lists()
{
@ -44,10 +44,10 @@ class SubcontractingContractController extends BaseAdminController
/**
* @notes 添加分包合同
* @notes 添加
* @return \think\response\Json
* @author likeadmin
* @date 2023/12/09 14:08
* @date 2023/12/12 17:15
*/
public function add()
{
@ -61,10 +61,10 @@ class SubcontractingContractController extends BaseAdminController
/**
* @notes 编辑分包合同
* @notes 编辑
* @return \think\response\Json
* @author likeadmin
* @date 2023/12/09 14:08
* @date 2023/12/12 17:15
*/
public function edit()
{
@ -78,10 +78,10 @@ class SubcontractingContractController extends BaseAdminController
/**
* @notes 删除分包合同
* @notes 删除
* @return \think\response\Json
* @author likeadmin
* @date 2023/12/09 14:08
* @date 2023/12/12 17:15
*/
public function delete()
{
@ -92,10 +92,10 @@ class SubcontractingContractController extends BaseAdminController
/**
* @notes 获取分包合同详情
* @notes 获取详情
* @return \think\response\Json
* @author likeadmin
* @date 2023/12/09 14:08
* @date 2023/12/12 17:15
*/
public function detail()
{

View File

@ -21,7 +21,7 @@ use app\common\lists\ListsSearchInterface;
/**
* 分包合同列表
* SubcontractingContract列表
* Class SubcontractingContractLists
* @package app\adminapi\listscontract
*/
@ -33,29 +33,29 @@ class SubcontractingContractLists extends BaseAdminDataLists implements ListsSea
* @notes 设置搜索条件
* @return \string[][]
* @author likeadmin
* @date 2023/12/09 14:08
* @date 2023/12/12 17:15
*/
public function setSearch(): array
{
return [
'=' => ['department_id', 'contract_name'],
'=' => ['project_id', 'contract_no', 'contract_name', 'supplier_id', 'contract_type'],
];
}
/**
* @notes 获取分包合同列表
* @notes 获取列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author likeadmin
* @date 2023/12/09 14:08
* @date 2023/12/12 17:15
*/
public function lists(): array
{
return SubcontractingContract::where($this->searchWhere)
->field(['id', 'org_id', 'department_id', 'project_id', 'contract_no', 'contract_name', 'supplier_id', 'contract_type', 'signing_date', 'pay_type', 'account_period', 'amount', 'amount_daxie', 'tax_rate', 'amount_excluding_tax', 'retention_money', 'retention_money_rate'])
->field(['*'])
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select()
@ -64,10 +64,10 @@ class SubcontractingContractLists extends BaseAdminDataLists implements ListsSea
/**
* @notes 获取分包合同数量
* @notes 获取数量
* @return int
* @author likeadmin
* @date 2023/12/09 14:08
* @date 2023/12/12 17:15
*/
public function count(): int
{

View File

@ -21,7 +21,7 @@ use think\facade\Db;
/**
* 分包合同逻辑
* SubcontractingContract逻辑
* Class SubcontractingContractLogic
* @package app\adminapi\logic\contract
*/
@ -30,35 +30,34 @@ class SubcontractingContractLogic extends BaseLogic
/**
* @notes 添加分包合同
* @notes 添加
* @param array $params
* @return bool
* @author likeadmin
* @date 2023/12/09 14:08
* @date 2023/12/12 17:15
*/
public static function add(array $params): bool
{
Db::startTrans();
try {
SubcontractingContract::create([
'org_id' => $params['org_id'],
'department_id' => $params['department_id'],
'project_id' => $params['project_id'],
'contract_no' => $params['contract_no'],
'contract_name' => $params['contract_name'],
'supplier_id' => $params['supplier_id'],
'contract_type' => $params['contract_type'],
'signing_date' => $params['signing_date'],
'pay_type' => $params['pay_type'],
'account_period' => $params['account_period'],
'amount' => $params['amount'],
'amount_daxie' => $params['amount_daxie'],
'tax_rate' => $params['tax_rate'],
'amount_excluding_tax' => $params['amount_excluding_tax'],
'retention_money' => $params['retention_money'],
'retention_money_rate' => $params['retention_money_rate'],
'remark' => $params['remark'],
'annex' => $params['annex']
'project_id' => $params['project_id'],
'approve_id' => $params['approve_id'],
'contract_no' => $params['contract_no'],
'contract_name' => $params['contract_name'],
'supplier_id' => $params['supplier_id'],
'contract_type' => $params['contract_type'],
'signing_date' => $params['signing_date'],
'pay_type' => $params['pay_type'],
'account_period' => $params['account_period'],
'amount' => $params['amount'],
'amount_daxie' => $params['amount_daxie'],
'tax_rate' => $params['tax_rate'],
'amount_excluding_tax' => $params['amount_excluding_tax'],
'retention_money_rate' => $params['retention_money_rate'],
'retention_money' => $params['retention_money'],
'remark' => $params['remark'],
'annex' => $params['annex'],
]);
Db::commit();
@ -72,35 +71,34 @@ class SubcontractingContractLogic extends BaseLogic
/**
* @notes 编辑分包合同
* @notes 编辑
* @param array $params
* @return bool
* @author likeadmin
* @date 2023/12/09 14:08
* @date 2023/12/12 17:15
*/
public static function edit(array $params): bool
{
Db::startTrans();
try {
SubcontractingContract::where('id', $params['id'])->update([
'org_id' => $params['org_id'],
'department_id' => $params['department_id'],
'project_id' => $params['project_id'],
'contract_no' => $params['contract_no'],
'contract_name' => $params['contract_name'],
'supplier_id' => $params['supplier_id'],
'contract_type' => $params['contract_type'],
'signing_date' => $params['signing_date'],
'pay_type' => $params['pay_type'],
'account_period' => $params['account_period'],
'amount' => $params['amount'],
'amount_daxie' => $params['amount_daxie'],
'tax_rate' => $params['tax_rate'],
'amount_excluding_tax' => $params['amount_excluding_tax'],
'retention_money' => $params['retention_money'],
'retention_money_rate' => $params['retention_money_rate'],
'remark' => $params['remark'],
'annex' => $params['annex']
'project_id' => $params['project_id'],
'approve_id' => $params['approve_id'],
'contract_no' => $params['contract_no'],
'contract_name' => $params['contract_name'],
'supplier_id' => $params['supplier_id'],
'contract_type' => $params['contract_type'],
'signing_date' => $params['signing_date'],
'pay_type' => $params['pay_type'],
'account_period' => $params['account_period'],
'amount' => $params['amount'],
'amount_daxie' => $params['amount_daxie'],
'tax_rate' => $params['tax_rate'],
'amount_excluding_tax' => $params['amount_excluding_tax'],
'retention_money_rate' => $params['retention_money_rate'],
'retention_money' => $params['retention_money'],
'remark' => $params['remark'],
'annex' => $params['annex'],
]);
Db::commit();
@ -114,11 +112,11 @@ class SubcontractingContractLogic extends BaseLogic
/**
* @notes 删除分包合同
* @notes 删除
* @param array $params
* @return bool
* @author likeadmin
* @date 2023/12/09 14:08
* @date 2023/12/12 17:15
*/
public static function delete(array $params): bool
{
@ -127,11 +125,11 @@ class SubcontractingContractLogic extends BaseLogic
/**
* @notes 获取分包合同详情
* @notes 获取详情
* @param $params
* @return array
* @author likeadmin
* @date 2023/12/09 14:08
* @date 2023/12/12 17:15
*/
public static function detail($params): array
{

View File

@ -19,7 +19,7 @@ use app\common\validate\BaseValidate;
/**
* 分包合同验证器
* SubcontractingContract验证器
* Class SubcontractingContractValidate
* @package app\adminapi\validate\contract
*/
@ -31,7 +31,7 @@ class SubcontractingContractValidate extends BaseValidate
* @var string[]
*/
protected $rule = [
'id' => 'require',
'id' => 'require',
];
@ -40,7 +40,7 @@ class SubcontractingContractValidate extends BaseValidate
* @var string[]
*/
protected $field = [
'id' => 'id',
'id' => 'id',
];
@ -48,7 +48,7 @@ class SubcontractingContractValidate extends BaseValidate
* @notes 添加场景
* @return SubcontractingContractValidate
* @author likeadmin
* @date 2023/12/09 14:08
* @date 2023/12/12 17:15
*/
public function sceneAdd()
{
@ -60,7 +60,7 @@ class SubcontractingContractValidate extends BaseValidate
* @notes 编辑场景
* @return SubcontractingContractValidate
* @author likeadmin
* @date 2023/12/09 14:08
* @date 2023/12/12 17:15
*/
public function sceneEdit()
{
@ -72,7 +72,7 @@ class SubcontractingContractValidate extends BaseValidate
* @notes 删除场景
* @return SubcontractingContractValidate
* @author likeadmin
* @date 2023/12/09 14:08
* @date 2023/12/12 17:15
*/
public function sceneDelete()
{
@ -84,7 +84,7 @@ class SubcontractingContractValidate extends BaseValidate
* @notes 详情场景
* @return SubcontractingContractValidate
* @author likeadmin
* @date 2023/12/09 14:08
* @date 2023/12/12 17:15
*/
public function sceneDetail()
{

View File

@ -16,19 +16,19 @@ namespace app\common\model\contract;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
/**
* 分包合同模型
* SubcontractingContract模型
* Class SubcontractingContract
* @package app\common\model\contract
*/
class SubcontractingContract extends BaseModel
{
use SoftDelete;
protected $name = 'subcontracting_contract';
protected $deleteTime = 'delete_time';
}