HrController.php 4.0 KB
<?php

namespace App\Http\Controllers\Aside\Manage;
use App\Enums\Common\Code;
use App\Http\Controllers\Aside\BaseController;
use App\Http\Requests\Aside\Manage\ManagerHrRequest;
use App\Models\Geo\GeoConf;
use App\Models\Manage\ManageHr;
use App\Http\Logic\Aside\Manage\HrLogic;

class HrController extends BaseController
{
    /**
     * @remark :获取列表
     * @name   :list
     * @author :lyh
     * @method :post
     * @time   :2023/7/24 11:56
     */
    public function list(ManageHr $manageHr)
    {
        $lists = $manageHr->lists($this->map,$this->page,$this->row,['id','sort']);
        if(!empty($lists) && !empty($lists['list'])){
            foreach ($lists['list'] as $k => $v){
                $v['photo_gallery_link'] = json_decode($v['photo_gallery']);
                $v['id_card_gallery_link'] = json_decode($v['id_card_gallery']);
                $v['certificate_gallery_link'] = json_decode($v['certificate_gallery']);
                $lists['list'][$k] = $v;
            }
        }
        $this->response('success', Code::SUCCESS, $lists);
    }

    /**
     * @remark :获取列表数据
     * @name   :getManagerList
     * @author :lyh
     * @method :post
     * @time   :2025/6/7 9:22
     */
    public function getManagerList(){
        $manageHrModel = new ManageHr();
        $lists = $manageHrModel->lists($this->map,$this->page,$this->row);
        $this->response('success', Code::SUCCESS, $lists);
    }

    /**
     * @remark :获取详情
     * @name   :info
     * @author :lyh
     * @method :post
     * @time   :2023/9/6 10:04
     */
    public function info(HrLogic $logic){
        $info = $logic->getHrInfo();
        $info['photo_gallery_link'] = $info['photo_gallery'];
        $info['id_card_gallery_link'] = $info['id_card_gallery'];
        $info['certificate_gallery_link'] = $info['certificate_gallery'];
        $this->response('success',Code::SUCCESS,$info);
    }

    /**
     * @remark :保存数据
     * @name   :save
     * @author :lyh
     * @method :post
     * @time   :2023/9/6 10:05
     */
    public function save(ManagerHrRequest $request,HrLogic $logic){
        $request->validated();
        $logic->hrSave();
        $this->response('success');
    }

    /**
     * @remark :获取所有搜索参数
     * @name   :deptList
     * @author :lyh
     * @method :post
     * @time   :2023/7/22 17:17
     */
    public function getSearchParamsList(HrLogic $hrLogic){
        $list = $hrLogic->getSearchParams();
        $this->response('success',Code::SUCCESS,$list);
    }

    /**
     * @param HrLogic $hrLogic
     * @return \Illuminate\Http\JsonResponse
     */
    public function getHrList(HrLogic $hrLogic)
    {
        $page_size = intval(request()->input('page_size', 15));
        $list = $hrLogic->getHrListForV5($page_size);
        $result = [];
        foreach ($list as $v) {
            $result[] = [
                'name' => $v->name,
                'id_card' => $v->id_card,
                'mobile' => $v->mobile,
                'dept_title' => $v->dept_title = $v->dept ? $v->dept->title : '',
                'position_title' => $v->position = $v->position ? $v->position->name : '',
                'status' => $v->status,
            ];
        }
        $this->response('success',Code::SUCCESS, $result);
    }

    /**
     * @remark :修改排序
     * @name   :sort
     * @author :lyh
     * @method :post
     * @time   :2023/12/7 9:12
     */
    public function sort(HrLogic $hrLogic){
        $this->request->validate([
            'id'=>'required'
        ],[
            'id.required' => 'ID不能为空'
        ]);
        $hrLogic->setSort();
        $this->response('success');
    }

    /**
     * @remark :获取geo项目负责人
     * @name   :getGeoManagerList
     * @author :lyh
     * @method :post
     * @time   :2025/11/7 14:31
     */
    public function getGeoManagerList()
    {
        $geoConfModel = new GeoConf();
        $geo_manage_list = $geoConfModel->geoManage();
        $this->response('success',Code::SUCCESS,$geo_manage_list);
    }
}