开发运行环境:
神舟笔记本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。
如有转载,敬请注明原创作者与出处,谢谢。