300 lines
11 KiB
Java
300 lines
11 KiB
Java
|
package com.zcloud.controller.firemanager;
|
|||
|
|
|||
|
import com.alibaba.fastjson.JSON;
|
|||
|
import com.zcloud.aspect.DockAnnotation;
|
|||
|
import com.zcloud.controller.base.BaseController;
|
|||
|
import com.zcloud.entity.Page;
|
|||
|
import com.zcloud.entity.PageData;
|
|||
|
import com.zcloud.entity.system.Department;
|
|||
|
import com.zcloud.service.bus.ImgFilesService;
|
|||
|
import com.zcloud.service.firemanager.FirePointService;
|
|||
|
import com.zcloud.service.system.DepartmentService;
|
|||
|
import com.zcloud.service.system.UsersService;
|
|||
|
import com.zcloud.util.DateUtil;
|
|||
|
import com.zcloud.util.InitPageDataUtil;
|
|||
|
import com.zcloud.util.Jurisdiction;
|
|||
|
import com.zcloud.util.logAop.LogOperation;
|
|||
|
import net.sf.json.JSONArray;
|
|||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|||
|
import org.springframework.beans.factory.annotation.Autowired;
|
|||
|
import org.springframework.stereotype.Controller;
|
|||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|||
|
import org.springframework.web.bind.annotation.RequestParam;
|
|||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|||
|
import org.springframework.web.multipart.MultipartFile;
|
|||
|
|
|||
|
import java.util.*;
|
|||
|
|
|||
|
/**
|
|||
|
* 说明:消防点位管理
|
|||
|
* 作者:wangxuan
|
|||
|
* 官网:www.zcloudchina.com
|
|||
|
*/
|
|||
|
@Controller
|
|||
|
@RequestMapping("/firePoint")
|
|||
|
public class FirePointController extends BaseController {
|
|||
|
@Autowired
|
|||
|
private FirePointService firePointService;
|
|||
|
|
|||
|
@Autowired
|
|||
|
private InitPageDataUtil initPageDataUtil;
|
|||
|
@Autowired
|
|||
|
private ImgFilesService imgFilesService;
|
|||
|
@Autowired
|
|||
|
private DepartmentService departmentService;
|
|||
|
@Autowired
|
|||
|
private UsersService usersService;
|
|||
|
|
|||
|
|
|||
|
/**
|
|||
|
* 定位
|
|||
|
*
|
|||
|
* @param
|
|||
|
* @throws Exception
|
|||
|
*/
|
|||
|
@RequestMapping(value = "/getFirePointCheckPhotos")
|
|||
|
@ResponseBody
|
|||
|
public Object getFirePointCheckPhotos() throws Exception {
|
|||
|
Map<String, Object> map = new HashMap<String, Object>();
|
|||
|
String errInfo = "success";
|
|||
|
PageData pd = this.getPageData();
|
|||
|
List<PageData> checkImages = firePointService.getFirePointCheckPhotos(pd);
|
|||
|
if (checkImages != null && checkImages.size() > 0) {
|
|||
|
checkImages.forEach(item -> {
|
|||
|
String[] checkImagesItems = item.getString("FILEPATHLIST").split("@@");
|
|||
|
item.put("FILEPATH_LIST", checkImagesItems);
|
|||
|
});
|
|||
|
}
|
|||
|
map.put("imgList", checkImages);
|
|||
|
map.put("result", errInfo);
|
|||
|
return map;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
/**
|
|||
|
* @Description: 消防点位列表
|
|||
|
* @Author: dearLin
|
|||
|
* @Date: 2023/2/9
|
|||
|
* @Param: [com.zcloud.entity.Page] [page]
|
|||
|
* @Return: java.lang.Object
|
|||
|
*/
|
|||
|
@RequestMapping(value = "/list")
|
|||
|
@ResponseBody
|
|||
|
public Object page(Page page) {
|
|||
|
//查询条件
|
|||
|
// 区域名称(关键字查询)、编码(关键字查询)
|
|||
|
//Object keywords = pageData.get("KEYWORDS");
|
|||
|
//企业ID
|
|||
|
Map<String, Object> map = new HashMap<String, Object>();
|
|||
|
String errInfo = "success";
|
|||
|
PageData pd = new PageData();
|
|||
|
pd = this.getPageData();
|
|||
|
//获取当前人的公司id
|
|||
|
pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID());
|
|||
|
page.setPd(pd);
|
|||
|
//消防区域名称与编码是否要加索引?
|
|||
|
List<PageData> varList = firePointService.list(page);
|
|||
|
map.put("varList", varList);
|
|||
|
map.put("page", page);
|
|||
|
map.put("result", errInfo);
|
|||
|
return map;
|
|||
|
}
|
|||
|
|
|||
|
/**
|
|||
|
* 定位
|
|||
|
*
|
|||
|
* @param
|
|||
|
* @throws Exception
|
|||
|
*/
|
|||
|
@RequestMapping(value = "/savePosition")
|
|||
|
@ResponseBody
|
|||
|
public Object savePosition() throws Exception {
|
|||
|
Map<String, Object> map = new HashMap<String, Object>();
|
|||
|
String errInfo = "success";
|
|||
|
PageData pd = new PageData();
|
|||
|
pd = this.getPageData();
|
|||
|
firePointService.savePosition(pd);
|
|||
|
map.put("result", errInfo);
|
|||
|
return map;
|
|||
|
}
|
|||
|
|
|||
|
/**
|
|||
|
* @Description: 消防点位单个信息
|
|||
|
* @Author: dearLin
|
|||
|
* @Date: 2023/2/9/
|
|||
|
* @Return: java.lang.Object
|
|||
|
*/
|
|||
|
@RequestMapping("/getFirPointInfo")
|
|||
|
@ResponseBody
|
|||
|
public Object info() throws Exception {
|
|||
|
Map<String, Object> map = new HashMap<String, Object>();
|
|||
|
String errInfo = "success";
|
|||
|
PageData pd = getPageData();
|
|||
|
pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID());
|
|||
|
PageData resdata = firePointService.findById(pd);
|
|||
|
PageData imgPage = new PageData();
|
|||
|
imgPage.put("FOREIGN_KEY",pd.getString("FIRE_POINT_ID"));
|
|||
|
List<PageData> dataList = imgFilesService.listAll(imgPage);
|
|||
|
map.put("res", resdata);
|
|||
|
map.put("imgList", dataList);
|
|||
|
map.put("result", errInfo);
|
|||
|
return map;
|
|||
|
}
|
|||
|
|
|||
|
/**
|
|||
|
* @Description: 修改消防点位信息
|
|||
|
* @Author: dearLin
|
|||
|
* @Date: 2023/2/9/
|
|||
|
* @Return: java.lang.Object
|
|||
|
*/
|
|||
|
@LogOperation(value = "修改消防风险点位成功", exceptionInformation = "修改消防风险点位失败", isUpdate = true, updateId = "FIRE_POINT_ID")
|
|||
|
@RequestMapping("/updFireRegionById")
|
|||
|
@ResponseBody
|
|||
|
@DockAnnotation
|
|||
|
public Object updFirePointById(@RequestParam(value = "files",required = false) MultipartFile[] files) {
|
|||
|
Map<String, Object> map = new HashMap<String, Object>();
|
|||
|
String errInfo = "success";
|
|||
|
PageData pd = getPageData();
|
|||
|
pd.put("OPERATOR", Jurisdiction.getUsername());
|
|||
|
pd.put("OPERATTIME", DateUtil.date2Str(new Date()));
|
|||
|
firePointService.updFirePointById(files,pd);
|
|||
|
map.put("result", errInfo);
|
|||
|
map.put("dockData",JSON.toJSONString(pd));
|
|||
|
return map;
|
|||
|
}
|
|||
|
|
|||
|
/**
|
|||
|
* @Description: 删除消防点位
|
|||
|
* @Author: dearLin
|
|||
|
* @Date: 2023/2/9/
|
|||
|
* @Return: java.lang.Object
|
|||
|
*/
|
|||
|
@LogOperation(value = "删除消防风险点位成功", exceptionInformation = "删除消防风险点位失败", isDelete = true)
|
|||
|
@RequestMapping("/delFirePointByIds")
|
|||
|
@ResponseBody
|
|||
|
public Object delFireRegionByIds() {
|
|||
|
Map<String, Object> map = new HashMap<String, Object>();
|
|||
|
String errInfo = "success";
|
|||
|
PageData pd = getPageData();
|
|||
|
pd.put("OPERATOR", Jurisdiction.getUsername());
|
|||
|
pd.put("OPERATTIME", DateUtil.date2Str(new Date()));
|
|||
|
if (firePointService.delFirePointByIds(pd)) {
|
|||
|
map.put("result", errInfo);
|
|||
|
} else {
|
|||
|
map.put("result", "error");
|
|||
|
map.put("msg", "有设备在使用此点位禁止删除");
|
|||
|
}
|
|||
|
return map;
|
|||
|
}
|
|||
|
|
|||
|
@RequestMapping("/removeFirePointByIds")
|
|||
|
@ResponseBody
|
|||
|
@DockAnnotation
|
|||
|
public Object removeFirePointByIds() {
|
|||
|
Map<String, Object> map = new HashMap<String, Object>();
|
|||
|
String errInfo = "success";
|
|||
|
PageData pd = getPageData();
|
|||
|
pd.put("OPERATOR", Jurisdiction.getUsername());
|
|||
|
pd.put("OPERATTIME", DateUtil.date2Str(new Date()));
|
|||
|
firePointService.removeFirePointByIds(pd);
|
|||
|
map.put("result", errInfo);
|
|||
|
map.put("dockData",JSON.toJSONString(pd));
|
|||
|
return map;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
/**
|
|||
|
* @Description: 保存点位信息
|
|||
|
* @Author: dearLin
|
|||
|
* @Date: 2023/2/9/
|
|||
|
* @Return: java.lang.Object
|
|||
|
*/
|
|||
|
@LogOperation(value = "新增消防风险点位成功", exceptionInformation = "新增消防风险点位失败")
|
|||
|
@RequestMapping(value = "/savePointInfo")
|
|||
|
@ResponseBody
|
|||
|
@DockAnnotation(isAdd = true)
|
|||
|
public Object saveInfo(@RequestParam(value = "files",required = false) MultipartFile[] files) {
|
|||
|
Map<String, Object> map = new HashMap<String, Object>();
|
|||
|
String errInfo = "success";
|
|||
|
PageData pd = getPageData();
|
|||
|
String uuid = this.get32UUID();
|
|||
|
pd.put("FIRE_POINT_ID", uuid);
|
|||
|
PageData initData = initPageDataUtil.initSave(pd);
|
|||
|
pd.put("initData", JSON.toJSONString(initData));
|
|||
|
pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID());
|
|||
|
firePointService.savePointInfo(pd);
|
|||
|
imgFilesService.uploadPicture(files,"118",pd.getString("FIRE_POINT_ID"));
|
|||
|
map.put("result", errInfo);
|
|||
|
map.put("dockData", JSON.toJSONString(pd));
|
|||
|
return map;
|
|||
|
}
|
|||
|
|
|||
|
//-----------负责部门与负责人接口---------------//
|
|||
|
|
|||
|
/**
|
|||
|
* @Description: 获取当前公司下的所有部门
|
|||
|
* @Author: dearLin
|
|||
|
* @Date: 2023/2/10/010 10:43
|
|||
|
* @Param: [] []
|
|||
|
* @Return: java.lang.Object
|
|||
|
*/
|
|||
|
@RequestMapping(value = "/getDepartmentId")
|
|||
|
@ResponseBody
|
|||
|
public Object getDepartmentId() throws Exception {
|
|||
|
Map<String, Object> map = new HashMap<String, Object>();
|
|||
|
String errInfo = "success";
|
|||
|
PageData pd;
|
|||
|
pd = this.getPageData();
|
|||
|
String url = pd.get("url") == null ? "department_list.html?DEPARTMENT_ID=" : pd.getString("url");
|
|||
|
List<Department> zdepartmentPdList = new ArrayList<Department>();
|
|||
|
PageData dept = new PageData();
|
|||
|
dept.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID());
|
|||
|
dept = this.departmentService.findByCorpId(dept);
|
|||
|
|
|||
|
Department depar = new Department();
|
|||
|
depar.setDEPARTMENT_ID(dept.getString("DEPARTMENT_ID"));
|
|||
|
depar.setPARENT_ID(dept.getString("PARENT_ID"));
|
|||
|
depar.setBIANMA(dept.getString("LEVEL"));
|
|||
|
depar.setNAME(dept.getString("NAME"));
|
|||
|
depar.setTreeurl(url + depar.getDEPARTMENT_ID());
|
|||
|
depar.setSubDepartment(departmentService.listAllDepartment(depar.getDEPARTMENT_ID(), url));
|
|||
|
depar.setTarget("treeFrame");
|
|||
|
depar.setIcon("../../../assets/images/user.gif");
|
|||
|
zdepartmentPdList.add(depar);
|
|||
|
JSONArray arr = JSONArray.fromObject(zdepartmentPdList);
|
|||
|
String json = arr.toString();
|
|||
|
json = json.replaceAll("DEPARTMENT_ID", "id").replaceAll("PARENT_ID", "pId").replaceAll("NAME", "name").replaceAll("subDepartment", "nodes").replaceAll("hasDepartment", "checked").replaceAll("treeurl", "url").replaceAll("BIANMA", "LEVEL");
|
|||
|
|
|||
|
map.put("USER_ID", Jurisdiction.getUSER_ID());
|
|||
|
map.put("zTreeNodes", json);
|
|||
|
map.put("result", errInfo);
|
|||
|
|
|||
|
return map;
|
|||
|
}
|
|||
|
|
|||
|
/**
|
|||
|
* @Description: 获取当前部门下的所有员工
|
|||
|
* @Author: dearLin
|
|||
|
* @Date: 2023/2/10/010 10:43
|
|||
|
* @Param: [] []
|
|||
|
* @Return: java.lang.Object
|
|||
|
*/
|
|||
|
@RequestMapping(value = "/getDepartmentPeople")
|
|||
|
@ResponseBody
|
|||
|
public Object getDepartmentPeople(Page page) throws Exception {
|
|||
|
Map<String, Object> map = new HashMap<String, Object>();
|
|||
|
String errInfo = "success";
|
|||
|
PageData pd = new PageData();
|
|||
|
pd = this.getPageData();
|
|||
|
List<PageData> userList = usersService.getDepartmentId(pd.getString("DEPARTMENT_ID"));
|
|||
|
//列出用户列表
|
|||
|
pd.put("ROLE_ID", "1");
|
|||
|
map.put("userList", userList);
|
|||
|
map.put("page", page);
|
|||
|
map.put("pd", pd);
|
|||
|
map.put("result", errInfo);
|
|||
|
return map;
|
|||
|
}
|
|||
|
|
|||
|
}
|