aijinhui
2023-10-06 1f712d545d8cfd4e9dac74d22a67ebf599df1577
ard-work/src/main/java/com/ruoyi/plan/controller/ArdEplanController.java
@@ -107,11 +107,37 @@
    /**
     * 获取应急预案详细信息
     */
    @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 +200,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 +239,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));
    }
}