‘liusuyi’
2024-04-13 55a4112533c958492078a5a94c90667e6cf5969c
ard-work/src/main/java/com/ruoyi/plan/controller/ArdEplanController.java
@@ -64,12 +64,7 @@
    {
        startPage();
        List<ArdEplan> list = ardEplanService.selectArdEplanList(ardEplan);
        List<Map<String,Object>> result = new ArrayList();
        for(ArdEplan para : list){
            Map<String,Object> map = new HashMap();
            map.put("id",para.getId());
            map.put("name",para.getName());
            map.put("time",para.getTime());
            String info = para.getInfo();
            String[] infoArr = info.split(";");
            List<Map<String,String>> infoList = new ArrayList();
@@ -81,20 +76,16 @@
                infoMap.put("text",str.split(",")[3]);
                infoList.add(infoMap);
            }
            map.put("obj",infoList);
            map.put("userId",para.getUserId());
            map.put("deptId",para.getDeptId());
            map.put("createBy",para.getCreateBy());
            result.add(map);
            para.setInfoList(infoList);
        }
        return getDataTable(result);
        return getDataTable(list);
    }
    /**
     * 导出应急预案列表
     */
    @PreAuthorize("@ss.hasPermi('plan:eplan:export')")
    /*@PreAuthorize("@ss.hasPermi('plan:eplan:export')")
    @Log(title = "应急预案", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ArdEplan ardEplan)
@@ -102,16 +93,42 @@
        List<ArdEplan> list = ardEplanService.selectArdEplanList(ardEplan);
        ExcelUtil<ArdEplan> util = new ExcelUtil<ArdEplan>(ArdEplan.class);
        util.exportExcel(response, list, "应急预案数据");
    }
    }*/
    /**
     * 获取应急预案详细信息
     */
    @PreAuthorize("@ss.hasPermi('plan:eplan:query')")
    /*@PreAuthorize("@ss.hasPermi('plan:eplan:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return success(ardEplanService.selectArdEplanById(id));
    }*/
    @PreAuthorize("@ss.hasPermi('plan:eplan:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        ArdEplan result = ardEplanService.selectArdEplanById(id);
        Map<String,Object> map = new HashMap();
        map.put("id",result.getId());
        map.put("name",result.getName());
        map.put("time",result.getTime());
        String info = result.getInfo();
        String[] infoArr = info.split(";");
        List<Map<String,String>> infoList = new ArrayList();
        for(String str : infoArr){
            Map<String,String> infoMap = new HashMap();
            infoMap.put("longitude",str.split(",")[0]);
            infoMap.put("latitude",str.split(",")[1]);
            infoMap.put("altitude",str.split(",")[2]);
            infoMap.put("text",str.split(",")[3]);
            infoList.add(infoMap);
        }
        map.put("obj",infoList);
        map.put("userId",result.getUserId());
        map.put("deptId",result.getDeptId());
        map.put("createBy",result.getCreateBy());
        return success(map);
    }
    /**
@@ -174,6 +191,10 @@
    @PutMapping
    public AjaxResult edit(@RequestBody Map<String,Object> para)
    {
        ArdEplan result = ardEplanService.selectArdEplanById((String) para.get("id"));
        if(!result.getDeptId().equals(String.valueOf((Integer) para.get("deptId")))){
            return toAjax(0);//非本部门预案无法更改
        }
        ArdEplan ardEplan = new ArdEplan();
        ardEplan.setId((String) para.get("id"));
        ardEplan.setName((String) para.get("name"));
@@ -209,6 +230,12 @@
   @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        ArdEplan result = ardEplanService.selectArdEplanById(ids[0]);
        String userId = SecurityUtils.getUserId();
        SysUser sysUser = userService.selectUserById(userId);
        if(!result.getDeptId().equals(String.valueOf(sysUser.getDeptId()))){
            return toAjax(0);//非本部门预案无法删除
        }
        return toAjax(ardEplanService.deleteArdEplanByIds(ids));
    }
}