TVideoManagerController.java 5.81 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159
package com.zehong.web.controller.video;

import com.zehong.common.annotation.Log;
import com.zehong.common.core.controller.BaseController;
import com.zehong.common.core.domain.AjaxResult;
import com.zehong.common.core.page.TableDataInfo;
import com.zehong.common.enums.BusinessType;
import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.system.domain.TEnterpriseInfo;
import com.zehong.system.domain.TVideoManager;
import com.zehong.system.domain.vo.EnterpriseVideoTreeNode;
import com.zehong.system.service.ITEnterpriseInfoService;
import com.zehong.system.service.ITVideoManagerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.List;

/**
 * 视频管理Controller
 * 
 * @author zehong
 * @date 2022-02-15
 */
@RestController
@RequestMapping("/system/manager")
public class TVideoManagerController extends BaseController
{
    @Autowired
    private ITVideoManagerService tVideoManagerService;

    @Autowired
    private ITEnterpriseInfoService itEmployedPeopleInfoService;

    /**
     * 查询视频管理列表
     */
    @PreAuthorize("@ss.hasPermi('system:manager:list')")
    @GetMapping("/list")
    public TableDataInfo list(TVideoManager tVideoManager)
    {
        startPage();
        List<TVideoManager> list = tVideoManagerService.selectTVideoManagerList(tVideoManager);
        return getDataTable(list);
    }

    /**
     * 导出视频管理列表
     */
    @PreAuthorize("@ss.hasPermi('system:manager:export')")
    @Log(title = "视频管理", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(TVideoManager tVideoManager)
    {
        List<TVideoManager> list = tVideoManagerService.selectTVideoManagerList(tVideoManager);
        ExcelUtil<TVideoManager> util = new ExcelUtil<TVideoManager>(TVideoManager.class);
        return util.exportExcel(list, "视频管理数据");
    }

    /**
     * 获取视频tree
     * @param tVideoManager
     * @return
     */
    @GetMapping("/getVideoTree")
    public AjaxResult getVideoTree(TVideoManager tVideoManager){

        List<EnterpriseVideoTreeNode> enterpriseVideoList = new ArrayList<>();


        //I级树
        EnterpriseVideoTreeNode enterpriseVideoFirst = new EnterpriseVideoTreeNode();
        List<EnterpriseVideoTreeNode> enterpriseVideoFirstChildrnList = new ArrayList<>();
        enterpriseVideoFirst.setVideoName("视频监控");
        enterpriseVideoFirst.setLevel("1");


        List<TEnterpriseInfo> tEnterpriseInfos = itEmployedPeopleInfoService.selectTEnterpriseInfoList(new TEnterpriseInfo());
        /*TEnterpriseInfo cg=new TEnterpriseInfo();
        cg.setEnterpriseId(new Long(0));
        cg.setEnterpriseName("城管视频");
        tEnterpriseInfos.add(cg);
        TEnterpriseInfo gd=new TEnterpriseInfo();
        gd.setEnterpriseId(new Long(999));
        gd.setEnterpriseName("高点");
        tEnterpriseInfos.add(gd);*/

        for(TEnterpriseInfo tEnterpriseInfo : tEnterpriseInfos){

            //II级树
            EnterpriseVideoTreeNode enterpriseVideoSecond= new EnterpriseVideoTreeNode();
            List<EnterpriseVideoTreeNode> enterpriseVideoSecondChildrenList = new ArrayList<>();
            enterpriseVideoSecond.setVideoName(tEnterpriseInfo.getEnterpriseName());
            enterpriseVideoSecond.setLevel("2");


            tVideoManager.setBeyondEnterpriseId(tEnterpriseInfo.getEnterpriseId());
            List<TVideoManager> tVideoManagers = tVideoManagerService.selectTVideoManagerList(tVideoManager);
            for(TVideoManager manager : tVideoManagers){
                //III级树
                EnterpriseVideoTreeNode enterpriseVideoThird= new EnterpriseVideoTreeNode();
                enterpriseVideoThird.setVideoName(manager.getVideoName());
                enterpriseVideoThird.setResourceId(manager.getResourceId());
                enterpriseVideoThird.setLevel("3");
                enterpriseVideoSecondChildrenList.add(enterpriseVideoThird);
            }
            enterpriseVideoSecond.setChildrenVideo(enterpriseVideoSecondChildrenList);
            enterpriseVideoFirstChildrnList.add(enterpriseVideoSecond);
        }
        enterpriseVideoFirst.setChildrenVideo(enterpriseVideoFirstChildrnList);
        enterpriseVideoList.add(enterpriseVideoFirst);
        return AjaxResult.success(enterpriseVideoList);
    }

    /**
     * 获取视频管理详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:manager:query')")
    @GetMapping(value = "/{videoManagerId}")
    public AjaxResult getInfo(@PathVariable("videoManagerId") Long videoManagerId)
    {
        return AjaxResult.success(tVideoManagerService.selectTVideoManagerById(videoManagerId));
    }

    /**
     * 新增视频管理
     */
    @PreAuthorize("@ss.hasPermi('system:manager:add')")
    @Log(title = "视频管理", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TVideoManager tVideoManager)
    {
        return toAjax(tVideoManagerService.insertTVideoManager(tVideoManager));
    }

    /**
     * 修改视频管理
     */
    @PreAuthorize("@ss.hasPermi('system:manager:edit')")
    @Log(title = "视频管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TVideoManager tVideoManager)
    {
        return toAjax(tVideoManagerService.updateTVideoManager(tVideoManager));
    }

    /**
     * 删除视频管理
     */
    @PreAuthorize("@ss.hasPermi('system:manager:remove')")
    @Log(title = "视频管理", businessType = BusinessType.DELETE)
	@DeleteMapping("/{videoManagerIds}")
    public AjaxResult remove(@PathVariable Long[] videoManagerIds)
    {
        return toAjax(tVideoManagerService.deleteTVideoManagerByIds(videoManagerIds));
    }
}