1. 程式人生 > >Thinkphp5開發OA辦公系統之招聘申請

Thinkphp5開發OA辦公系統之招聘申請

開發執行環境:

神舟筆記本K650D-G6D1 i5-6400 GTX950M

Windows 10 專業版

Nginx 或 Apache Web 伺服器軟體

MySQL5.7.x 資料庫

PHP7.1.0

PHPStrom 2017

PowerDesigner 16.5

Axure RP8

原型設計圖(招聘申請)

資料庫表(招聘申請):招聘申請ID,申請日期,崗位,崗位編制人數,到崗時間,隸屬部門,在崗人數,招聘人數,招聘原因,招聘原因其它,職責說明,任職資格說明,學歷,學科知識,職能等級,綜合能力,語言能力,計算機水平,工作經驗,性別,年齡,其它,新增時間,編輯時間,新增人,編輯人,是否刪除。

招聘申請表SQL程式碼:

create table zy_recruit_apply
(
 apply_id int not null auto_increment comment '招聘申請ID',
 apply_date int not null default 0 comment '申請日期',
 post char(50) not null default '' comment '崗位',
 post_count smallint not null default 0 comment '崗位編制人數',
 arrival_time int not null default 0 comment '到崗時間',
 org_dpm_id int not null default 0 comment '隸屬部門',
 on_post_count smallint not null default 0 comment '在崗人數',
 recruit_count smallint not null default 0 comment '招聘人數',
 recruit_reason char(100) not null default '' comment '招聘原因:0-其它 1-儲備人才 2-兼職 3-離職補充 4-擴大編制 (多選用 "," 分隔)',
 recruit_reason_other char(100) not null default '' comment '招聘原因其它:記錄招聘原因-其它選項的說明',
 duty_explain text comment '職責說明',
 post_explain varchar(500) not null default '' comment '任職資格說明',
 education char(50) not null default '' comment '學歷',
 subject_knowledge char(200) not null default '' comment '學科知識',
 function_level char(255) not null default '' comment '職能等級',
 composite_ability char(255) not null default '' comment '綜合能力',
 language_ability char(255) not null default '' comment '語言能力',
 computer_level char(255) not null default '' comment '計算機水平',
 work_experience char(255) not null default '' comment '工作經驗',
 sex tinyint not null default 0 comment '性別:0 不限 1 男 2 女',
 age char(50) not null default '' comment '年齡',
 other char(255) not null default '' comment '其它',
 add_time int not null default 0 comment '新增時間',
 edit_time int not null default 0 comment '編輯時間',
 add_uid int not null default 0 comment '新增人',
 edit_uid int not null default 0 comment '編輯人',
 is_del tinyint not null default 0 comment '是否刪除:0否 1是',
 primary key (apply_id)
);
alter table zy_recruit_apply comment '招聘申請';

招聘申請表單介面:

PHP實現程式碼:

public function add(){
 $orgDpmLogic = new OrgDepartmentLogic();
 $listTree = $orgDpmLogic->listOrderTree(0);
 $this->assign('listTree',$listTree);
 $recruitReason = config('recruit_reason');
 $this->assign('recruitReason',$recruitReason);
 $this->assign('sex',[0=>'不限',1=>'男',2=>'女']);
 //審批模板型別 - 1 招聘申請
 $templateType = 1;
 $approvalTypeLogic = new ApprovalTypeLogic();
 $approvalType = $approvalTypeLogic->getRecordByTemplateType($templateType);
 if(!$approvalType){
 $this->error('審批模板不存在!');
 exit;
 }
 //獲取招聘申請流程
 $approvalFlowLogic = new ApprovalFlowLogic();
 $approvalFlowList = $approvalFlowLogic->getRecordList($approvalType['type_id']);
 $this->assign('approvalType',$approvalType);
 $this->assign('approvalFlowList',$approvalFlowList);
 return $this->fetch();
}
public function add_save(){
 $result = new Result();
 if($this->request->isPost() == false){
 $result->msg = '新增失敗:非法操作!';
 $result->success = false;
 return $result;
 }
 $postData = $this->request->post();
 $result = $this->addEditEmptyCheck($postData);
 if(!$result->success) return $result;
 $postData['apply_date'] = strtotime($postData['apply_date']);
 $postData['arrival_time'] = strtotime($postData['arrival_time']);
 if(isset($postData['recruit_reason']) && count($postData['recruit_reason'])){
 $postData['recruit_reason'] = implode(',',$postData['recruit_reason']);
 }else{
 $postData['recruit_reason'] = '';
 }
 $uid = $this->userId;
 $time = time();
 $postData['add_time'] = $time;
 $postData['add_uid'] = $uid;
 $postData['edit_time'] = $time;
 $postData['edit_uid'] = $uid;
 $detail = $postData['detail'];
 unset($postData['detail']);
 $typeId = $postData['type_id'];
 unset($postData['type_id']);
 $result = $this->logic->addRecruitApply($postData);
 //發起審批
 if($result->success){
 $approval = array();
 $approval['type_id'] = $typeId;
 $approval['title'] = '招聘申請-'.date('YmdHis',time());
 $approval['approval_status'] = 0;
 $approval['initiate_uid'] = $this->userId;
 $approval['source_id'] = $result->data;
 $detailList = array();
 foreach($detail['approval_uid'] as $k=>$v){
 $data = array();
 $data['approval_id'] = 0;
 $data['approval_uid'] = $v;
 $data['flow_id'] = $detail['flow_id'][$k];
 $data['approval_weight'] = $detail['approval_weight'][$k];
 array_push($detailList,$data);
 }
 $approvalLogic = new ApprovalLogic();
 $approvalLogic->startApproval($approval,$detailList);
 }
 return $result;
}

這是Controller層的程式碼,業務實現邏輯都放到了Logic業務邏輯層實現。

原創作者:ACRM保險師,kjuQ-kjuQ:282130106。

如有轉載,敬請註明原創作者與出處,謝謝。