TestCommand.php 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. <?php
  2. namespace App\Console\Commands;
  3. use App\Mail\ExampleEmail;
  4. use App\Models\Factoring;
  5. use App\Models\FactoringContract;
  6. use App\Models\FactoringContractFile;
  7. use App\Models\FactoringProperty;
  8. use App\Models\Firm;
  9. use App\Models\IndentNum;
  10. use App\Models\Member;
  11. use App\Models\MemberSeal;
  12. use App\Models\SignContract;
  13. use App\Models\SignMember;
  14. use App\Models\SignRecord;
  15. use App\Models\SignSeal;
  16. use App\Models\SignSealAuth;
  17. use App\Servers\ESign\comm\EsignLogHelper;
  18. use App\Servers\ESign\ESignContractServer;
  19. use App\Servers\ESign\ESignFirmServer;
  20. use App\Servers\ESign\ESignServer;
  21. use App\Servers\Financing\ContractServer;
  22. use App\Servers\Financing\FinancingServer;
  23. use App\Servers\Firm\FirmServer;
  24. use App\Servers\System\EmailServer;
  25. use App\Servers\System\JobServer;
  26. use App\Servers\System\RedisDataServer;
  27. use App\Servers\System\SmsServer;
  28. use App\Servers\Wps\ExcelServer;
  29. use App\Servers\Wps\PdfServer;
  30. use App\Servers\Wps\WordServer;
  31. use App\Servers\Wps\WpsServer;
  32. use Illuminate\Console\Command;
  33. use Illuminate\Support\Facades\Log;
  34. use Illuminate\Support\Facades\Storage;
  35. class TestCommand extends Command
  36. {
  37. /**
  38. * The name and signature of the console command.
  39. *
  40. * @var string
  41. */
  42. protected $signature = 'test';
  43. /**
  44. * The console command description.
  45. *
  46. * @var string
  47. */
  48. protected $description = '测试命令';
  49. /**
  50. * Create a new command instance.
  51. *
  52. * @return void
  53. */
  54. public function __construct()
  55. {
  56. parent::__construct();
  57. }
  58. /**
  59. * Execute the console command.
  60. *
  61. * @return int
  62. */
  63. public function handle()
  64. {
  65. // $result = ESignContractServer::creatServer()->downloadFileUrl('2160ab8b01b4444384e48d4e72135584');
  66. // dd($result);
  67. // [{"keyword":"甲方:重庆振合网商业管理有限公司(公章)","auth_type":"ORG","id_no":"f09ba6fd02ed416690800c539ec4488a"},{"keyword":"乙方(盖章):","auth_type":"PSN","id_no":"337834e20a344e8b83c5fe115d230578"}]
  68. $json = '{"action":"SIGN_MISSON_COMPLETE","timestamp":1776392658818,"signFlowId":"c512c5e8e0404611a4d990db18870f6d","signOrder":1,"operateTime":1776392658000,"signResult":2,"resultDescription":"签署完成","operator":{"psnId":"69b1cd62aa0f481bb6dc12d76c26afc1","psnAccount":{"accountMobile":"15923811472"}}}';
  69. $data = json_decode($json,true);
  70. if ($data['action'] == 'SIGN_MISSON_COMPLETE'){
  71. // file_put_contents('sign_misson_complete.txt', json_encode($data));
  72. //合同签署
  73. $signFlowStatus = $data['signResult'];
  74. $signFlowId = $data['signFlowId'];
  75. $organization = isset($data['organization']) ? $data['organization'] : '';
  76. $operator = $data['operator'];
  77. if (!empty($signFlowId)){
  78. $sign = SignContract::where('flow_id',$signFlowId)->first();
  79. $sign_id = $sign->{'id'};
  80. var_dump($operator);
  81. var_dump($organization);
  82. dd($sign_id);
  83. if (!empty($operator)){
  84. $psnId = $operator['psnId'];
  85. SignRecord::where('sign_id',$sign_id)->where('authType','PSN')->where('id_no',$psnId)->update(['status'=>$signFlowStatus]);
  86. }
  87. if (!empty($organization)){
  88. $orgId = $organization['orgId'];
  89. SignRecord::where('sign_id',$sign_id)->where('authType','ORG')->where('id_no',$orgId)->update(['status'=>$signFlowStatus]);
  90. }
  91. }
  92. }
  93. dd(111);
  94. // $file_id = '0a1feb9ddf3f4da198ec0bb7d0c3225a';
  95. // $file_status = ESignContractServer::creatServer()->getFileStatus($file_id);
  96. // dd($file_status);
  97. // $psnId= 'd1bca85014164a88b896159c799223f9';
  98. // JobServer::creatServer()->createMemberSealJob($psnId);
  99. // //获取企业内部使用签章列表
  100. //// ESignServer::creatServer()->internalAuthInfo(1,$psnId);
  101. //// ESignServer::creatServer()->psnsealListInfo(1,$psnId);
  102. //// ESignServer::creatServer()->createOrgsealsbyTemplate(1,$psnId);
  103. // dd(11111);
  104. // //查询是否有合同章
  105. // $sealItem=MemberSeal::where('m_id',1)->first();
  106. // if(empty($sealItem)){
  107. // //无合同印章执行创建流程
  108. // ESignServer::creatServer()->createOrgsealsbyTemplate(1,$psnId);
  109. // }
  110. // dd(11111);
  111. // JobServer::creatServer()->createMemberSealJob($psnId);
  112. // dd(111);
  113. // dd(11111);
  114. // $file_path = 'storage/contract/测试.docx';
  115. $file_path = 'storage/contract/20250521/测试模板.docx';
  116. $json = '{"name": "江雨","text":"测试一下","phone":"13012341234"}';
  117. $file = WordServer::creatServer()->replaceWordText($file_path,'123.docx',$json);
  118. dd($file);
  119. // ESignContractServer::creatServer()->setContractContract(111,11);
  120. // dd(111);
  121. $content='尊敬的,您有待认证信息,点击认证 ';
  122. $r = SmsServer::creatServer()->sendContent('18323851679',$content);
  123. dd($r);
  124. $Res = ESignServer::creatServer()->personsidentityinfo(1,18323851679,'江雨',500221200002194310);
  125. dd($Res);
  126. }
  127. }