123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315 |
- <?php
- namespace app\api\controller\v1;
- use app\api\controller\Base;
- use app\hander\HelpHander;
- use think\Db;
- class UserInfo extends Base
- {
- // 新增
- public function save(){
- model('User')->add();
- HelpHander::success([],'操作成功');
- }
- // 编辑
- public function update(){
- model('User')->add();
- HelpHander::success([],'操作成功');
- }
- // 调整薪资
- public function changeSalary(){
- $data = [
- 'company_id' => input('companyId/d',0),
- 'remark' => input('remark','','trim'),
- 'type' => input('type/d',0),
- 'pwlevel' => input('pwlevel/d',0),
- 'psid' => input('psid/d',0),
- 'imgs' => input('imgs','','trim')
- ];
- $id = input('id/d',0);
- if($id <= 0){
- HelpHander::error('参数错误');
- }
- model('UserInfo')->changeSalary($data, $id, $this->userId, $this->orgId);
- HelpHander::success([],'修改成功');
- }
- // 详情
- public function detail(){
- $id = input('id/d',0);
- $ret = model('User')->info($id);
- HelpHander::success($ret);
- }
- // 列表
- public function queryUserInfoList(){
- $page = input('page/d',1);
- $size = input('size/d',10);
- $name = input('name','','trim');
- $code = input('code','','trim');
- $phone = input('phone','','trim');
- $ret = model('User')->lists($page,$size,$this->orgId,$name,$code,$phone);
- HelpHander::success($ret);
- }
- // 修改状态
- public function updateEnable(){
- $id = input('id/d',0);
- $enable = input('enable/d',0);
- model('User')->changeStatus($id,$enable);
- HelpHander::success([],'操作成功');
- }
- // 人员档案列表
- public function lists(){
- $ret = model('UserInfo')->lists($this->orgId);
- HelpHander::success($ret);
- }
- // 人员请假统计列表
- public function listsholiday(){
- $ret = model('UserInfo')->listsholiday($this->orgId);
- HelpHander::success($ret);
- }
- // 花名册列表
- public function roster(){
- $ret = model('UserInfo')->rosterLists($this->orgId);
- HelpHander::success($ret);
- }
- // 人员薪资岗位列表
- public function lists2(){
- $ret = model('UserInfo')->lists2($this->orgId);
- HelpHander::success($ret);
- }
- // 人员档案导出列表
- public function exportLists(){
- $ret = model('UserInfo')->exportLists($this->orgId);
- HelpHander::success($ret);
- }
- // 请假报表导出列表
- public function exportHolidayLists(){
- $ret = model('UserInfo')->exportHolidayLists($this->orgId);
- HelpHander::success($ret);
- }
- // 花名册导出列表
- public function exportRosterLists(){
- $ret = model('UserInfo')->exportRosterLists($this->orgId);
- HelpHander::success($ret);
- }
- // 详情
- public function info(){
- $id = input('id/d',0);
- $ret = model('UserInfo')->info($id);
- HelpHander::success($ret);
- }
- // 我的详情
- public function myinfo(){
- $userinfo = Db::name('user_info')->where('user_id',$this->userId)->find();
- if(!$userinfo){
- HelpHander::error('数据不存在');
- }
- $ret = model('UserInfo')->info($userinfo['id']);
- HelpHander::success($ret);
- }
- // 修改基本信息
- public function edit(){
- $data = [
- 'id' => input('id/d',0),
- 'name' => input('name','','trim'),
- 'email' => input('email','','trim'),
- 'img' => input('img','','trim'),
- // 'gender' => input('gender/d',1),
- 'nation' => input('nation','','trim'),
- 'native_place' => input('nativePlace','','trim'),
- // 'birthday' => input('birthday','','trim'),
- 'id_card' => input('idCard','','trim'),
- 'education' => input('education','','trim'),
- 'profession' => input('profession','','trim'),
- 'dang_date' => input('dangDate','','trim'),
- 'work_date' => input('workDate','','trim'),
- 'cur_job_date' => input('curJobDate','','trim'),
- 'profession_position' => input('professionPosition','','trim'),
- 'assess_date' => input('assessDate','','trim'),
- 'qualification' => input('qualification','','trim'),
- 'lb_date' => input('lbDate','','trim'),
- 'in_shape' => input('inShape','','trim'),
- 'level_job_date' => input('levelJobDate','','trim'),
- 'join_time' => input('joinTime','','trim'),
- 'political' => input('political','','trim'),
- 'degree' => input('degree','','trim'),
- 'is_working' => input('isWorking/d',0),
- 'company_id' => input('companyId/d',0),
- 'marital' => input('marital','','trim'),
- 'remark1' => input('remark1','','trim'),
- 'remark2' => input('remark2','','trim'),
- 'remark3' => input('remark3','','trim'),
- 'remark4' => input('remark4','','trim'),
- 'remark5' => input('remark5','','trim'),
- 'job' => input('job','','trim'),
- 'job_date' => input('jobDate','','trim'),
- 'position' => input('position','','trim'),
- 'sorts' => input('sorts/d',200),
- ];
- if(empty($data['name'])){
- HelpHander::error('姓名不能为空');
- }
- if(empty($data['id'])){
- HelpHander::error('参数错误');
- }
- if(!$data['join_time']){
- unset($data['join_time']);
- }
- $id = $data['id'];
- unset($data['id']);
- model('UserInfo')->edit($data,$id);
- HelpHander::success([],'修改成功');
- }
- // 用户岗位调整记录
- public function jobLogList(){
- $page = input('page/d',1);
- $size = input('size/d',10);
- $uid = input('uid/d',0);
- $ret = model('UserJob')->jobLogList($page,$size,$this->orgId,$uid);
- HelpHander::success($ret);
- }
- // 用户薪资调整记录
- public function salaryLogList(){
- $page = input('page/d',1);
- $size = input('size/d',10);
- $uid = input('uid/d',0);
- $ret = model('UserInfo')->salaryLogList($page,$size,$this->orgId,$uid);
- HelpHander::success($ret);
- }
- // 调整用户岗位
- public function changeJob(){
- $data = [
- 'uid' => input('uid/d',0),
- 'jobId' => input('jobId/d',0),
- 'type' => input('type/d',1),
- 'remark' => input('remark','','trim'),
- 'imgs' => input('imgs','','trim'),
- ];
- model('UserJob')->changeJob($data,$this->userId,$this->orgId);
- HelpHander::success([],'调整岗位成功');
- }
- // 办理离职/退休
- public function departure(){
- $data = [
- 'user_id' => input('uid/d',0),
- 'is_work' => input('isWork/d',0),
- 'out_time' => input('outTime','','trim'),
- 'out_reason' => input('outReason','','trim')
- ];
- model('UserInfo')->departure($data,$this->userId,$this->orgId);
- HelpHander::success([],'办理成功');
- }
- // 重新入职
- public function back(){
- $data = [
- 'user_id' => input('uid/d',0),
- 'is_work' => input('isWork/d',0),
- 'join_time' => input('joinTime','','trim')
- ];
- model('UserInfo')->back($data,$this->userId,$this->orgId);
- HelpHander::success([],'办理成功');
- }
- // 调整薪级
- public function changePay(){
- $id = input('id/d',0); // user_info的id
- if($id <= 0){
- HelpHander::error('参数错误');
- }
- $info = Db::name('user_info')->where('id',$id)->find();
- if(!$info){
- HelpHander::error('记录不存在');
- }
- $data = [
- 'company_id' => $info['company_id'],
- 'remark' => input('remark','快速调整','trim'),
- 'type' => $info['type'],
- 'pwlevel' => input('pwlevel/d',0),
- 'psid' => $info['psid'],
- 'imgs' => ''
- ];
- model('UserInfo')->changeSalary($data, $id, $this->userId, $this->orgId);
- HelpHander::success([],'修改成功');
- }
- // 调整发工资类型
- public function changePayType(){
- $id = input('id/d',0); // user_info的id
- if($id <= 0){
- HelpHander::error('参数错误');
- }
- $info = Db::name('user_info')->where('id',$id)->find();
- if(!$info){
- HelpHander::error('记录不存在');
- }
- $payType = input('payType/d',0);
- if($info['pay_type'] == $payType){
- HelpHander::error('未作出任何调整');
- }
- if($info['company_id'] == 1 && in_array($payType,[2,4])){
- HelpHander::error('修改失败');
- }
- if($info['company_id'] == 2 && in_array($payType,[1,3,5])){
- HelpHander::error('修改失败');
- }
- $ret = Db::name('user_info')->where('id',$id)->setField('pay_type',$payType);
- if(!$ret){
- HelpHander::error('修改失败');
- }
- HelpHander::success([],'修改成功');
- }
- // 薪级普调
- public function changePayBatch(){
- $companyId = input('companyId/d',0);
- if($companyId <= 0){
- HelpHander::error('没有薪级的用户无法普调');
- }
- model('UserInfo')->changePayBatch($companyId, $this->userId, $this->orgId);
- HelpHander::success([],'操作成功');
- }
- // 修改基础绩效或子女统筹
- public function changeFixed(){
- $id = input('id/d',0);
- $money = input('money/f',0);
- $type = input('type/d',0);
- model('UserInfo')->changeFixed($id, $money, $type);
- HelpHander::success([],'操作成功');
- }
- // 修改花名册排序
- public function changeSortsFixed(){
- $id = input('id/d',0);
- $sorts2 = input('sorts2/d',0);
- model('UserInfo')->changeSortsFixed($id, $sorts2);
- HelpHander::success([],'操作成功');
- }
- }
|