|
@@ -2,6 +2,7 @@
|
|
|
|
|
|
|
|
namespace App\Service;
|
|
namespace App\Service;
|
|
|
|
|
|
|
|
|
|
+use App\Model\Draft;
|
|
|
use App\Model\Employee;
|
|
use App\Model\Employee;
|
|
|
use App\Model\SysMenu;
|
|
use App\Model\SysMenu;
|
|
|
use App\Model\WorkFlowInstances;
|
|
use App\Model\WorkFlowInstances;
|
|
@@ -295,16 +296,43 @@ class WorkFlowService extends Service
|
|
|
list($status, $msg, $result) = $this->approve($data, $user);
|
|
list($status, $msg, $result) = $this->approve($data, $user);
|
|
|
if(! $status) return [false, $msg];
|
|
if(! $status) return [false, $msg];
|
|
|
|
|
|
|
|
- $instance_id = $msg;
|
|
|
|
|
- if($result == 1){
|
|
|
|
|
-
|
|
|
|
|
- }elseif ($result == 2){
|
|
|
|
|
-
|
|
|
|
|
|
|
+ if($result == 1 || $result == 2){
|
|
|
|
|
+ $instance_id = $msg;
|
|
|
|
|
+ $this->businessSettle($result, $instance_id);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return [true, ''];
|
|
return [true, ''];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ public function businessSettle($result, $instance_id){
|
|
|
|
|
+ $w = WorkFlowInstances::where('id', $instance_id)->first();
|
|
|
|
|
+ if(empty($w)) return;
|
|
|
|
|
+ $w = $w->toArray();
|
|
|
|
|
+
|
|
|
|
|
+ if($result == 1){
|
|
|
|
|
+ $draft = Draft::where('del_time',0)
|
|
|
|
|
+ ->where('document_type', $w['document_type'])
|
|
|
|
|
+ ->where('document_id', $w['document_id'])
|
|
|
|
|
+ ->where('top_depart_id', $w['top_depart_id'])
|
|
|
|
|
+ ->latest()
|
|
|
|
|
+ ->first();
|
|
|
|
|
+ if(! empty($draft)){
|
|
|
|
|
+ $draft = $draft->toArray();
|
|
|
|
|
+ if($draft['opt_type'] == 1){
|
|
|
|
|
+ //调用编辑接口 覆盖数据
|
|
|
|
|
+ if($draft['document_type'] == 'item'){
|
|
|
|
|
+ (new ItemService())->itemEditSave($draft['content'], $draft['user']);
|
|
|
|
|
+ }
|
|
|
|
|
+ }else{
|
|
|
|
|
+ //单纯更新某个字段
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }else{
|
|
|
|
|
+ //审核状态标记改回去
|
|
|
|
|
+ DB::table($w['document_type'])->where('id', $w['document_id'])->update(['approval_state' => 0]);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* @param int $nodeInstanceId 节点实例ID
|
|
* @param int $nodeInstanceId 节点实例ID
|
|
|
* @param int $status 结果:2-通过,3-驳回
|
|
* @param int $status 结果:2-通过,3-驳回
|