package com.zcloud.controller.gf; import com.zcloud.controller.base.BaseController; import com.zcloud.entity.Page; import com.zcloud.entity.PageData; import com.zcloud.service.gf.GFConfinedSpaceAcceptUserService; import com.zcloud.service.gf.GFConfinedSpaceGasService; import com.zcloud.service.gf.GFConfinedSpaceGasWHService; import com.zcloud.service.gf.GFConfinedSpaceService; import com.zcloud.util.Jurisdiction; import com.zcloud.util.ObjectExcelView; import com.zcloud.util.Tools; 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.ResponseBody; import org.springframework.web.servlet.ModelAndView; import javax.annotation.Resource; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; /** * 说明:有限空间作业 * 作者:luoxiaobao * 时间:2021-09-13 * 官网:www.zcloudchina.com */ @Controller @RequestMapping("/gfConfinedSpace") public class GFConfinedSpaceController extends BaseController { @Resource private GFConfinedSpaceService GFconfinedspaceService; @Autowired private GFConfinedSpaceGasService GFconfinedspaceGasService; @Resource private GFConfinedSpaceGasWHService GFconfinedspacegaswhService; @Autowired private GFConfinedSpaceService confinedspaceService; @Autowired private GFConfinedSpaceAcceptUserService confinedspaceacceptuserService; /**新增 * @param * @throws Exception */ @RequestMapping(value="/add") @RequiresPermissions("confinedspace:add") @ResponseBody public Object add() throws Exception{ Map map = new HashMap(); String errInfo = "success"; PageData pd = new PageData(); pd = this.getPageData(); pd.put("CONFINEDSPACE_ID", this.get32UUID()); //主键 GFconfinedspaceService.save(pd); map.put("result", errInfo); return map; } /**删除 * @param * @throws Exception */ @RequestMapping(value="/delete") @RequiresPermissions("confinedspace:del") @ResponseBody public Object delete() throws Exception{ Map map = new HashMap(); String errInfo = "success"; PageData pd = new PageData(); pd = this.getPageData(); GFconfinedspaceService.delete(pd); map.put("result", errInfo); //返回结果 return map; } /**修改 * @param * @throws Exception */ @RequestMapping(value="/edit") @RequiresPermissions("confinedspace:edit") @ResponseBody public Object edit() throws Exception{ Map map = new HashMap(); String errInfo = "success"; PageData pd = new PageData(); pd = this.getPageData(); GFconfinedspaceService.edit(pd); map.put("result", errInfo); return map; } /**列表 * @param page * @throws Exception */ @RequestMapping(value="/list") @RequiresPermissions("confinedspace:list") @ResponseBody public Object list(Page page) throws Exception{ Map map = new HashMap(); String errInfo = "success"; PageData pd = new PageData(); pd = this.getPageData(); String KEYWORDS = pd.getString("KEYWORDS"); //关键词检索条件 if(Tools.notEmpty(KEYWORDS))pd.put("KEYWORDS", KEYWORDS.trim()); pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); //企业ID pd.put("ISMAIN", Jurisdiction.getIS_MAIN()); pd.put("ISSUPERVISE", Jurisdiction.getISSUPERVISE()); pd.put("DEPARTMENT_ID", Jurisdiction.getDEPARTMENT_ID()); String DEPTIDS = pd.getString("DEPTIDS"); if(Tools.notEmpty(DEPTIDS)) { String DEPT_IDS[] = DEPTIDS.split(","); pd.put("DEPT_IDS", DEPT_IDS); } page.setPd(pd); List varList = GFconfinedspaceService.list(page); //列出ConfinedSpace列表 map.put("varList", varList); map.put("page", page); map.put("result", errInfo); return map; } /**去修改页面获取数据 * @param * @throws Exception */ @RequestMapping(value="/goEdit") @ResponseBody public Object goEdit() throws Exception{ Map map = new HashMap(); String errInfo = "success"; PageData pd = new PageData(); pd = this.getPageData(); pd = GFconfinedspaceService.findById(pd); //根据ID读取 map.put("pd", pd); map.put("measuresList", GFconfinedspaceService.listAllMeasures(pd)); map.put("imgList",confinedspaceacceptuserService.findByIds(pd)); map.put("imgList1",confinedspaceacceptuserService.findById(pd)); map.put("gasList", GFconfinedspaceGasService.listAll(pd)); map.put("gas", GFconfinedspacegaswhService.findById(pd)); map.put("result", errInfo); return map; } /**批量删除 * @param * @throws Exception */ @RequestMapping(value="/deleteAll") @RequiresPermissions("confinedspace:del") @ResponseBody public Object deleteAll() throws Exception{ Map map = new HashMap(); String errInfo = "success"; PageData pd = new PageData(); pd = this.getPageData(); String DATA_IDS = pd.getString("DATA_IDS"); if(Tools.notEmpty(DATA_IDS)){ String ArrayDATA_IDS[] = DATA_IDS.split(","); GFconfinedspaceService.deleteAll(ArrayDATA_IDS); errInfo = "success"; }else{ errInfo = "error"; } map.put("result", errInfo); //返回结果 return map; } /**导出到excel * @param * @throws Exception */ @RequestMapping(value="/excel") @RequiresPermissions("toExcel") public ModelAndView exportExcel() throws Exception{ ModelAndView mv = new ModelAndView(); PageData pd = new PageData(); pd = this.getPageData(); Map dataMap = new HashMap(); List titles = new ArrayList(); titles.add("所属企业"); //1 titles.add("删除标志"); //2 titles.add("创建时间"); //3 titles.add("添加人"); //4 titles.add("修改时间"); //5 titles.add("修改人"); //6 titles.add("编号"); //7 titles.add("作业内容"); //8 titles.add("工作开始时间"); //9 titles.add("工作结束时间"); //10 titles.add("确认单位"); //11 titles.add("确认单位人"); //12 titles.add("确认单位签字"); //13 titles.add("确认单位签字时间"); //14 titles.add("审核部门"); //15 titles.add("审核人"); //16 titles.add("审核签字"); //17 titles.add("审核签字时间"); //18 titles.add("审批部门"); //19 titles.add("审批部门人"); //20 titles.add("审批部门签字"); //21 titles.add("审批部门签字时间"); //22 titles.add("状态"); //23 titles.add("确认意见"); //24 titles.add("审核意见"); //25 titles.add("审批意见"); //26 titles.add("其他防护措施"); //27 titles.add("验收部门"); //28 titles.add("验收人"); //29 titles.add("验收签字"); //30 titles.add("验收签字时间"); //31 titles.add("验收意见"); //32 titles.add("申请部门"); //33 titles.add("申请人"); //34 titles.add("所属企业"); //35 titles.add("名称"); //36 titles.add("作业人"); //37 titles.add("特殊作业"); //38 titles.add("风险辨识"); //39 titles.add("介质名称"); //40 titles.add("教育人"); //41 titles.add("分析部门"); //42 titles.add("分析人"); //43 titles.add("监护人部门"); //44 titles.add("监护人"); //45 titles.add("监护人签字"); //46 titles.add("监护人签字时间"); //47 titles.add("监护人意见"); //48 dataMap.put("titles", titles); List varOList = GFconfinedspaceService.listAll(pd); List varList = new ArrayList(); for(int i=0;i map = new HashMap(); String errInfo = "success"; PageData pd = new PageData(); pd = this.getPageData(); pd.put("CORPINFO_ID",Jurisdiction.getCORPINFO_ID()); List eightlist = GFconfinedspaceService.listAllForDiagnosis(pd); map.put("eightlist", eightlist); if(pd!=null) { errInfo = "success"; }else { errInfo = "faild"; } map.put("result", errInfo); return map; } }