八项作业受限空间台账

pull/4/head
chenxinying 2024-01-31 08:43:55 +08:00
parent 3d57c00c43
commit 1e2bbfa4be
5 changed files with 715 additions and 0 deletions

View File

@ -0,0 +1,244 @@
package com.zcloud.controller.eightwork;
import com.zcloud.controller.base.BaseController;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import com.zcloud.logs.LogAnno;
import com.zcloud.service.eightwork.LimitSpaceService;
import com.zcloud.util.DateUtil;
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 java.util.*;
/**
*
* luoxiaobao
* 2021-04-02
* www.zcloudchina.com
*/
@Controller
@RequestMapping("/app/limitspace")
public class AppLimitSpaceController extends BaseController {
@Autowired
private LimitSpaceService limitspaceService;
/**
* @param
* @throws Exception
*/
@RequestMapping(value="/add")
@ResponseBody
@LogAnno(menuType= "手机",menuServer= "有限空间台账",instructionsOperate = "有限空间台账",instructionsType = "新增")
public Object add() throws Exception{
Map<String,Object> map = new HashMap<String,Object>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
pd.put("LIMITSPACE_ID", this.get32UUID()); //主键
pd.put("CREATOR",pd.get("USER")); //添加人
pd.put("CREATTIME", DateUtil.date2Str(new Date())); //创建时间
pd.put("OPERATOR", pd.get("USER")); //修改人
pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间
pd.put("ISDELETE", "0"); //是否删除
limitspaceService.save(pd);
map.put("result", errInfo);
return map;
}
/**
* @param out
* @throws Exception
*/
@RequestMapping(value="/delete")
@RequiresPermissions("limitspace:del")
@ResponseBody
@LogAnno(menuType= "手机",menuServer= "有限空间台账",instructionsOperate = "有限空间台账",instructionsType = "删除")
public Object delete() throws Exception{
Map<String,String> map = new HashMap<String,String>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
pd.put("OPERATOR", Jurisdiction.getUsername()); //修改人
pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间
limitspaceService.delete(pd);
map.put("result", errInfo); //返回结果
return map;
}
/**
* @param
* @throws Exception
*/
@RequestMapping(value="/edit")
@ResponseBody
@LogAnno(menuType= "手机",menuServer= "有限空间台账",instructionsOperate = "有限空间台账",instructionsType = "修改")
public Object edit() throws Exception{
Map<String,Object> map = new HashMap<String,Object>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
pd.put("OPERATOR", pd.get("USER")); //修改人
pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间
limitspaceService.edit(pd);
map.put("result", errInfo);
return map;
}
/**
* @param page
* @throws Exception
*/
@RequestMapping(value="/list")
@ResponseBody
@LogAnno(menuType= "手机",menuServer= "有限空间台账",instructionsOperate = "有限空间台账",instructionsType = "列表")
public Object list(Page page) throws Exception{
Map<String,Object> map = new HashMap<String,Object>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
String KEYWORDS = pd.getString("KEYWORDS"); //关键词检索条件
if(Tools.notEmpty(KEYWORDS))pd.put("KEYWORDS", KEYWORDS.trim());
page.setPd(pd);
List<PageData> varList = limitspaceService.list(page); //列出LimitSpace列表
map.put("varList", varList);
map.put("page", page);
map.put("result", errInfo);
return map;
}
/**
* @param
* @throws Exception
*/
@RequestMapping(value="/goEdit")
@ResponseBody
@LogAnno(menuType= "手机",menuServer= "有限空间台账",instructionsOperate = "有限空间台账",instructionsType = "去修改页面获取数据")
public Object goEdit() throws Exception{
Map<String,Object> map = new HashMap<String,Object>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
pd = limitspaceService.findById(pd); //根据ID读取
map.put("pd", pd);
map.put("result", errInfo);
return map;
}
/**
* @param
* @throws Exception
*/
@RequestMapping(value="/listAllSpace")
@ResponseBody
@LogAnno(menuType= "手机",menuServer= "有限空间台账",instructionsOperate = "有限空间台账",instructionsType = "查询本公司所有有限空间")
public Object listAllSpace() throws Exception{
Map<String,Object> map = new HashMap<String,Object>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
List<PageData> varList = limitspaceService.listAll(pd); //根据ID读取
map.put("varList", varList);
map.put("result", errInfo);
return map;
}
/**
* @param
* @throws Exception
*/
@RequestMapping(value="/deleteAll")
@RequiresPermissions("limitspace:del")
@ResponseBody
@LogAnno(menuType= "手机",menuServer= "有限空间台账",instructionsOperate = "有限空间台账",instructionsType = "批量删除")
public Object deleteAll() throws Exception{
Map<String,Object> map = new HashMap<String,Object>();
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(",");
pd.put("ArrayDATA_IDS", ArrayDATA_IDS);
pd.put("OPERATOR", Jurisdiction.getUsername()); //修改人
pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间
//limitspaceService.deleteAll(pd);
errInfo = "success";
}else{
errInfo = "error";
}
map.put("result", errInfo); //返回结果
return map;
}
/**excel
* @param
* @throws Exception
*/
@RequestMapping(value="/excel")
@RequiresPermissions("toExcel")
@LogAnno(menuType= "手机",menuServer= "有限空间台账",instructionsOperate = "有限空间台账",instructionsType = "导出到excel")
public ModelAndView exportExcel() throws Exception{
ModelAndView mv = new ModelAndView();
PageData pd = new PageData();
pd = this.getPageData();
Map<String,Object> dataMap = new HashMap<String,Object>();
List<String> titles = new ArrayList<String>();
titles.add("编号"); //1
titles.add("有限空间名称"); //2
titles.add("有限空间类型"); //3
titles.add("位置及范围"); //4
titles.add("主要危险及有害因素"); //5
titles.add("风险等级"); //6
titles.add("本有限空间最多作业人数"); //7
titles.add("是否有应急指导书 0无 1有"); //8
titles.add("备注"); //9
titles.add("填报人"); //10
titles.add("主要负责人"); //11
titles.add("填报时间"); //12
titles.add("企业ID"); //13
titles.add("添加人"); //14
titles.add("添加时间"); //15
titles.add("修改人"); //16
titles.add("修改时间"); //17
titles.add("是否删除 1-是 0-否"); //18
dataMap.put("titles", titles);
List<PageData> varOList = limitspaceService.listAll(pd);
List<PageData> varList = new ArrayList<PageData>();
for(int i=0;i<varOList.size();i++){
PageData vpd = new PageData();
vpd.put("var1", varOList.get(i).getString("NUMBER")); //1
vpd.put("var2", varOList.get(i).getString("NAME")); //2
vpd.put("var3", varOList.get(i).getString("LIMITSPACETYPE")); //3
vpd.put("var4", varOList.get(i).getString("POSITIONSCOPE")); //4
vpd.put("var5", varOList.get(i).getString("PRIMARYHAZARD")); //5
vpd.put("var6", varOList.get(i).getString("RISKGRADE")); //6
vpd.put("var7", varOList.get(i).getString("MAXPERSON")); //7
vpd.put("var8", varOList.get(i).getString("HASINSTRUCTOR")); //8
vpd.put("var9", varOList.get(i).getString("DESCR")); //9
vpd.put("var10", varOList.get(i).getString("INFORMANT")); //10
vpd.put("var11", varOList.get(i).getString("PRINCIPAL")); //11
vpd.put("var12", varOList.get(i).getString("COMPILETIME")); //12
vpd.put("var13", varOList.get(i).getString("CORPINFO_ID")); //13
vpd.put("var14", varOList.get(i).getString("CREATOR")); //14
vpd.put("var15", varOList.get(i).getString("CREATTIME")); //15
vpd.put("var16", varOList.get(i).getString("OPERATOR")); //16
vpd.put("var17", varOList.get(i).getString("OPERATTIME")); //17
vpd.put("var18", varOList.get(i).getString("ISDELETE")); //18
varList.add(vpd);
}
dataMap.put("varList", varList);
ObjectExcelView erv = new ObjectExcelView();
mv = new ModelAndView(erv,dataMap);
return mv;
}
}

View File

@ -0,0 +1,59 @@
package com.zcloud.mapper.datasource.eightwork;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import java.util.List;
/**
*
* luoxiaobao
* 2021-04-02
* www.zcloudchina.com
*/
public interface LimitSpaceMapper {
/**
* @param pd
* @throws Exception
*/
void save(PageData pd);
/**
* @param pd
* @throws Exception
*/
void delete(PageData pd);
/**
* @param pd
* @throws Exception
*/
void edit(PageData pd);
/**
* @param page
* @throws Exception
*/
List<PageData> datalistPage(Page page);
/**()
* @param pd
* @throws Exception
*/
List<PageData> listAll(PageData pd);
/**id
* @param pd
* @throws Exception
*/
PageData findById(PageData pd);
/**
* @param ArrayDATA_IDS
* @throws Exception
*/
void deleteAll(PageData pd);
}

View File

@ -0,0 +1,59 @@
package com.zcloud.service.eightwork;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import java.util.List;
/**
*
* luoxiaobao
* 2021-04-02
* www.zcloudchina.com
*/
public interface LimitSpaceService {
/**
* @param pd
* @throws Exception
*/
public void save(PageData pd)throws Exception;
/**
* @param pd
* @throws Exception
*/
public void delete(PageData pd)throws Exception;
/**
* @param pd
* @throws Exception
*/
public void edit(PageData pd)throws Exception;
/**
* @param page
* @throws Exception
*/
public List<PageData> list(Page page)throws Exception;
/**()
* @param pd
* @throws Exception
*/
public List<PageData> listAll(PageData pd)throws Exception;
/**id
* @param pd
* @throws Exception
*/
public PageData findById(PageData pd)throws Exception;
/**
* @param ArrayDATA_IDS
* @throws Exception
*/
public void deleteAll(PageData pd)throws Exception;
}

View File

@ -0,0 +1,83 @@
package com.zcloud.service.eightwork.impl;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import com.zcloud.mapper.datasource.eightwork.LimitSpaceMapper;
import com.zcloud.service.eightwork.LimitSpaceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
*
* luoxiaobao
* 2021-04-02
* www.zcloudchina.com
*/
@Service
@Transactional //开启事物
public class LimitSpaceServiceImpl implements LimitSpaceService {
@Autowired
private LimitSpaceMapper limitspaceMapper;
/**
* @param pd
* @throws Exception
*/
public void save(PageData pd)throws Exception{
limitspaceMapper.save(pd);
}
/**
* @param pd
* @throws Exception
*/
public void delete(PageData pd)throws Exception{
limitspaceMapper.delete(pd);
}
/**
* @param pd
* @throws Exception
*/
public void edit(PageData pd)throws Exception{
limitspaceMapper.edit(pd);
}
/**
* @param page
* @throws Exception
*/
public List<PageData> list(Page page)throws Exception{
return limitspaceMapper.datalistPage(page);
}
/**()
* @param pd
* @throws Exception
*/
public List<PageData> listAll(PageData pd)throws Exception{
return limitspaceMapper.listAll(pd);
}
/**id
* @param pd
* @throws Exception
*/
public PageData findById(PageData pd)throws Exception{
return limitspaceMapper.findById(pd);
}
/**
* @param ArrayDATA_IDS
* @throws Exception
*/
public void deleteAll(PageData pd)throws Exception{
limitspaceMapper.deleteAll(pd);
}
}

View File

@ -0,0 +1,270 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zcloud.mapper.datasource.eightwork.LimitSpaceMapper">
<!--表名 -->
<sql id="tableName">
BUS_LIMITSPACE
</sql>
<!--数据字典表名 -->
<sql id="dicTableName">
SYS_DICTIONARIES
</sql>
<!-- 字段 -->
<sql id="Field">
f.NUMBER,
f.NAME,
f.LIMITSPACETYPE,
f.POSITIONSCOPE,
f.PRIMARYHAZARD,
f.RISKGRADE,
f.MAXPERSON,
f.HASINSTRUCTOR,
f.DESCR,
f.INFORMANT,
f.PRINCIPAL,
f.COMPILETIME,
f.CORPINFO_ID,
f.CREATOR,
f.CREATTIME,
f.OPERATOR,
f.OPERATTIME,
f.ISDELETE,
f.LIMITSPACE_ID
</sql>
<!-- 字段用于新增 -->
<sql id="Field2">
NUMBER,
NAME,
LIMITSPACETYPE,
POSITIONSCOPE,
PRIMARYHAZARD,
RISKGRADE,
MAXPERSON,
HASINSTRUCTOR,
DESCR,
INFORMANT,
PRINCIPAL,
COMPILETIME,
CORPINFO_ID,
CREATOR,
CREATTIME,
OPERATOR,
OPERATTIME,
ISDELETE,
LIMITSPACE_ID
</sql>
<!-- 字段值 -->
<sql id="FieldValue">
#{NUMBER},
#{NAME},
#{LIMITSPACETYPE},
#{POSITIONSCOPE},
#{PRIMARYHAZARD},
#{RISKGRADE},
#{MAXPERSON},
#{HASINSTRUCTOR},
#{DESCR},
#{INFORMANT},
#{PRINCIPAL},
#{COMPILETIME},
#{CORPINFO_ID},
#{CREATOR},
#{CREATTIME},
#{OPERATOR},
#{OPERATTIME},
#{ISDELETE},
#{LIMITSPACE_ID}
</sql>
<!-- 新增-->
<insert id="save" parameterType="pd">
insert into
<include refid="tableName"></include>
(
<include refid="Field2"></include>
) values (
<include refid="FieldValue"></include>
)
</insert>
<!-- 删除-->
<delete id="delete" parameterType="pd">
update
<include refid="tableName"></include>
set
ISDELETE = '1',
OPERATOR = #{OPERATOR},
OPERATTIME = #{OPERATTIME}
where
LIMITSPACE_ID = #{LIMITSPACE_ID}
</delete>
<!-- 修改 -->
<update id="edit" parameterType="pd">
update
<include refid="tableName"></include>
set
NUMBER = #{NUMBER},
NAME = #{NAME},
LIMITSPACETYPE = #{LIMITSPACETYPE},
POSITIONSCOPE = #{POSITIONSCOPE},
PRIMARYHAZARD = #{PRIMARYHAZARD},
RISKGRADE = #{RISKGRADE},
MAXPERSON = #{MAXPERSON},
HASINSTRUCTOR = #{HASINSTRUCTOR},
DESCR = #{DESCR},
INFORMANT = #{INFORMANT},
PRINCIPAL = #{PRINCIPAL},
COMPILETIME = #{COMPILETIME},
OPERATOR = #{OPERATOR},
OPERATTIME = #{OPERATTIME},
LIMITSPACE_ID = LIMITSPACE_ID
where
LIMITSPACE_ID = #{LIMITSPACE_ID}
</update>
<!-- 通过ID获取数据 -->
<select id="findById" parameterType="pd" resultType="pd">
select
f.NUMBER,
f.NAME,
f.LIMITSPACETYPE,
f.POSITIONSCOPE,
f.PRIMARYHAZARD,
f.RISKGRADE,
f.MAXPERSON,
f.HASINSTRUCTOR,
f.DESCR,
f.INFORMANT,
f.PRINCIPAL,
f.COMPILETIME,
f.CORPINFO_ID,
f.CREATOR,
f.CREATTIME,
f.OPERATOR,
f.OPERATTIME,
f.ISDELETE,
f.LIMITSPACE_ID,
lst.NAME LIMITSPACETYPENAME,
rg.NAME RISKGRADENAME,
i.NAME INFORMANTNAME,
p.NAME PRINCIPALNAME
from
<include refid="tableName"></include> f
left join sys_dictionaries lst on f.LIMITSPACETYPE = lst.BIANMA and lst.YNDEL = 'no'
left join sys_dictionaries rg on f.RISKGRADE = rg.BIANMA and rg.YNDEL = 'no'
left join sys_user i on i.USER_ID = f.INFORMANT
left join sys_user p on p.USER_ID = f.PRINCIPAL
where
f.LIMITSPACE_ID = #{LIMITSPACE_ID}
</select>
<!-- 列表 -->
<select id="datalistPage" parameterType="page" resultType="pd">
select
<include refid="Field"></include>,
lst.NAME LIMITSPACETYPENAME,
rg.NAME RISKGRADENAME,
i.NAME INFORMANTNAME,
p.NAME PRINCIPALNAME
from
<include refid="tableName"></include> f
left join sys_dictionaries lst on f.LIMITSPACETYPE = lst.BIANMA and lst.YNDEL = 'no'
left join sys_dictionaries rg on f.RISKGRADE = rg.BIANMA and rg.YNDEL = 'no'
left join sys_user i on i.USER_ID = f.INFORMANT
left join sys_user p on p.USER_ID = f.PRINCIPAL
where f.ISDELETE = '0'
and f.CORPINFO_ID = #{pd.CORPINFO_ID}
<if test="pd.KEYWORDS != null and pd.KEYWORDS != ''"><!-- 关键词检索 -->
and
(
f.NAME LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%')
or
f.NUMBER LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%')
)
</if>
<choose>
<when test='pd.ISMAIN != null and pd.ISMAIN != "" and pd.ISMAIN == "1"'>
<if test="pd.DEPT_IDS != null and pd.DEPT_IDS != ''">
and
i.DEPARTMENT_ID in
<foreach item="item" index="index"
collection="pd.DEPT_IDS" open="(" separator="," close=")">
'${item}'
</foreach>
</if>
</when>
<otherwise>
<choose>
<when test='pd.ISSUPERVISE != null and pd.ISSUPERVISE != "" and pd.ISSUPERVISE == "1"'>
<choose>
<when test="pd.DEPT_IDS != null and pd.DEPT_IDS != ''">
and
i.DEPARTMENT_ID in
<foreach item="item" index="index"
collection="pd.DEPT_IDS" open="(" separator="," close=")">
'${item}'
</foreach>
</when>
<otherwise>
and
i.DEPARTMENT_ID in (
select
SUB_DEPARTMENT_ID
from
oa_supervision_department osd
where
osd.SUP_DEPARTMENT_ID = #{pd.DEPARTMENT_ID}
and osd.ISDELETE = '0'
and osd.CORPINFO_ID = #{pd.CORPINFO_ID}
)
</otherwise>
</choose>
</when>
<when test="pd.DEPARTMENT_ID != null and pd.DEPARTMENT_ID != ''">
and i.DEPARTMENT_ID=#{pd.DEPARTMENT_ID}
</when>
<otherwise>
</otherwise>
</choose>
</otherwise>
</choose>
ORDER BY f.COMPILETIME DESC
</select>
<!-- 列表(全部) -->
<select id="listAll" parameterType="pd" resultType="pd">
select
<include refid="Field"></include>
from
<include refid="tableName"></include> f
WHERE
f.ISDELETE = '0'
<if test="CORPINFO_ID != null and CORPINFO_ID != ''"><!-- 关键词检索 -->
and f.CORPINFO_ID = #{CORPINFO_ID}
</if>
order by f.OPERATTIME desc
</select>
<!-- 批量删除 -->
<delete id="deleteAll" parameterType="pd">
update
<include refid="tableName"></include>
set
ISDELETE = '1',
OPERATOR = #{OPERATOR},
OPERATTIME = #{OPERATTIME}
where
LIMITSPACE_ID in
<foreach item="item" index="index" collection="ArrayDATA_IDS" open="(" separator="," close=")">
#{item}
</foreach>
</delete>
</mapper>