增加:企业签署合同相关内容

This commit is contained in:
wuhui_zzw 2024-07-05 18:06:50 +08:00
parent 529fd0252d
commit 8495d80622
7 changed files with 113 additions and 7 deletions

View File

@ -9,6 +9,8 @@ use FddCloud\client\Client;
use FddCloud\client\ServiceClient; use FddCloud\client\ServiceClient;
use think\exception\ValidateException; use think\exception\ValidateException;
use think\facade\Cache; use think\facade\Cache;
use think\facade\Route;
use think\facade\Route as Url;
class ContractDao extends BaseDao{ class ContractDao extends BaseDao{
@ -194,6 +196,20 @@ class ContractDao extends BaseDao{
'autoFillFinalize' => true, 'autoFillFinalize' => true,
// 参与方列表 参与方信息 // 参与方列表 参与方信息
'actors' => [ 'actors' => [
[
'actor' => [
// 参与方标识。在同一个签署任务中,参与方标识唯一,不允许重复;例如:甲方、乙方、丙方
'actorId' => '甲方',
// 参与方主体类型: corp: 企业person: 个人
'actorType' => 'corp',
// 参与方具体名称。长度最大128个字符。
'actorName' => '万马奔鸿数易科技有限公司',
// 参与方权限 fill填写sign签署cc抄送
'permissions' => ['fill','sign'],
// 参与方主体在应用上的OpenIdopenCorpId/openUserId
'actorOpenId' => $config['open_corp_id'],
],
],
[ [
'actor' => [ 'actor' => [
// 参与方标识。在同一个签署任务中,参与方标识唯一,不允许重复;例如:甲方、乙方、丙方 // 参与方标识。在同一个签署任务中,参与方标识唯一,不允许重复;例如:甲方、乙方、丙方
@ -250,6 +266,39 @@ class ContractDao extends BaseDao{
throw new ValidateException($result['msg']); throw new ValidateException($result['msg']);
} }
} }
/**
* Common: 法大大 - 接口请求 - 获取企业签署链接
* Author: wu-hui
* Time: 2024/07/05 17:52
* @param array $authInfo
* @return array|mixed
*/
public function enterpriseActorGetUrl(array $authInfo){
$link = get_file_link('/admin/marketing/contract/list');
$config = app()->make(ContractRepository::class)->getConfig();
$bizContent = [
// 签署任务ID
'signTaskId' => $authInfo['sign_task_id'],
// 参与方标识。在同一个签署任务中,参与方标识唯一,不允许重复;例如:甲方、乙方、丙方
'actorId' => '甲方',
// 应用系统中唯一确定登录用户身份的标识
'actorOpenId' => $config['open_corp_id'],
// 重定向地址,系统判断在非小程序环境下会跳转至该地址。
'redirectUrl' => $link,
// 小程序的重定向地址(微信和支付宝)
// 'redirectMiniAppUrl' => '',
];
$result = $this->requestApi($bizContent, '/sign-task/actor/get-url');
if($result['code'] == 100000){
return $result['data'] ?? [];
}else{
throw new ValidateException($result['msg']);
}
}
/** /**
* Common: 法大大 - 接口请求 - 获取签署文档下载地址 * Common: 法大大 - 接口请求 - 获取签署文档下载地址
* Author: wu-hui * Author: wu-hui

View File

@ -110,8 +110,8 @@ class ContractRepository extends BaseRepository{
foreach($templateList as $tempKey => $tempItem){ foreach($templateList as $tempKey => $tempItem){
$currentInfo = $config['template_list'][$tempKey] ?? []; $currentInfo = $config['template_list'][$tempKey] ?? [];
if($currentInfo) $config['template_list'][$tempKey] = $currentInfo; if($currentInfo) $config['template_list'][$tempKey] = (array)$currentInfo;
else $config['template_list'][$tempKey] = $tempItem; else $config['template_list'][$tempKey] = (array)$tempItem;
} }
return $config; return $config;
@ -183,6 +183,20 @@ class ContractRepository extends BaseRepository{
$authInfo = $this->getSearchModel(['id' => $id])->findOrEmpty()->toArray(); $authInfo = $this->getSearchModel(['id' => $id])->findOrEmpty()->toArray();
return $this->dao->ownerGetDownloadUrl((array)$authInfo); return $this->dao->ownerGetDownloadUrl((array)$authInfo);
} }
/**
* Common: 获取企业签署链接
* Author: wu-hui
* Time: 2024/07/05 17:52
* @param $id
* @return array|mixed
*/
public function enterpriseSignInfo($id){
$authInfo = $this->getSearchModel(['id' => $id])->findOrEmpty()->toArray();
return $this->dao->enterpriseActorGetUrl((array)$authInfo);
}
/** /**
@ -214,6 +228,12 @@ class ContractRepository extends BaseRepository{
'rejected_reason' => $bizContent['fillRejectReason'] 'rejected_reason' => $bizContent['fillRejectReason']
],['sign_task_id' => $bizContent['signTaskId']]); ],['sign_task_id' => $bizContent['signTaskId']]);
} }
if($bizContent['actorId'] == '甲方'){
(new Contract())->update([
'enterprise_status' => 2,
'enterprise_rejected_reason' => $bizContent['fillRejectReason']
],['sign_task_id' => $bizContent['signTaskId']]);
}
} }
/** /**
* Common: 异步通知 - 合同签署成功 * Common: 异步通知 - 合同签署成功
@ -227,6 +247,11 @@ class ContractRepository extends BaseRepository{
'sign_status' => 1, 'sign_status' => 1,
],['sign_task_id' => $bizContent['signTaskId']]); ],['sign_task_id' => $bizContent['signTaskId']]);
} }
if($bizContent['actorId'] == '甲方'){
(new Contract())->update([
'enterprise_status' => 1,
],['sign_task_id' => $bizContent['signTaskId']]);
}
} }

View File

@ -73,6 +73,18 @@ class Contract extends BaseController{
return app('json')->success($result); return app('json')->success($result);
} }
/**
* Common: 获取企业签署链接
* Author: wu-hui
* Time: 2024/07/05 17:53
* @param $id
* @return mixed
*/
public function signInfo($id){
$result = $this->repository->enterpriseSignInfo($id);
return app('json')->success($result);
}
} }

View File

@ -669,7 +669,7 @@ class Common extends BaseController
$bizContent = $params['bizContent'] ?? []; $bizContent = $params['bizContent'] ?? [];
$bizContent = json_decode($bizContent, true) ?? []; $bizContent = json_decode($bizContent, true) ?? [];
$notifyEvent = (string)request()->header('X-FASC-Event'); $notifyEvent = (string)request()->header('X-FASC-Event');
// Log::info('法大大 - 异步通知:'.var_export(['header'=>$notifyEvent,'bizContent'=>$bizContent],TRUE)); Log::info('法大大 - 异步通知:'.var_export(['header'=>$notifyEvent,'bizContent'=>$bizContent],TRUE));
// 根据类型和结果进行对应的操作 // 根据类型和结果进行对应的操作
switch($notifyEvent){ switch($notifyEvent){
// 个人授权异步通知 // 个人授权异步通知

View File

@ -51,5 +51,27 @@ class Contract extends BaseController{
return app('json')->success($info); return app('json')->success($info);
} }
/**
* Common: 法大大 - 重新发起合同签署
* Author: wu-hui
* Time: 2024/07/05 16:55
* @return mixed
*/
public function againSign(){
$id = $this->request->param('id', 0);
// 清除信息
(new \app\common\model\common\Contract())->update([
'sign_status' => 0,
'sign_task_id' => null,
'sign_task_subject' => null,
'sign_template_id' => null,
'rejected_reason' => null,
],['id' => $id]);
$info = $this->repository->getSignInfo((int)$id);
return app('json')->success($info);
}
} }

View File

@ -565,6 +565,7 @@ Route::group(function () {
Route::get('get_config','getConfig')->name('systemMarketingContractConfigGet'); Route::get('get_config','getConfig')->name('systemMarketingContractConfigGet');
Route::post('set_config','setConfig')->name('systemMarketingContractConfigSet'); Route::post('set_config','setConfig')->name('systemMarketingContractConfigSet');
Route::get('download/:id','downloadInfo')->name('systemMarketingContractDownloadInfo'); Route::get('download/:id','downloadInfo')->name('systemMarketingContractDownloadInfo');
Route::get('sign_info/:id','signInfo')->name('systemMarketingContractSignInfo');
})->prefix('admin.common.Contract/'); })->prefix('admin.common.Contract/');

View File

@ -496,10 +496,7 @@ Route::group('api/', function () {
Route::group('contract', function () { Route::group('contract', function () {
Route::get('auth_info', 'authInfo');// 获取个人授权信息 Route::get('auth_info', 'authInfo');// 获取个人授权信息
Route::get('get_sign_info', 'getSignInfo');// 获取合同签署信息 Route::get('get_sign_info', 'getSignInfo');// 获取合同签署信息
Route::get('again_sign', 'againSign');// 重新发起合同签署
})->prefix('api.common.Contract/'); })->prefix('api.common.Contract/');