八项作业受限空间流程

pull/4/head
chenxinying 2024-01-31 08:44:48 +08:00
parent 1e2bbfa4be
commit ee7ecdaa0a
18 changed files with 2535 additions and 0 deletions

View File

@ -0,0 +1,156 @@
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.ConfinedSpaceGasWHService;
import com.zcloud.util.DateUtil;
import com.zcloud.util.Tools;
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 java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
*
* luoxiaobao
* 2022-08-11
* www.zcloudchina.com
*/
@Controller
@RequestMapping("/app/confinedspacegaswh")
public class AppConfinedSpaceGasWHController extends BaseController {
@Autowired
private ConfinedSpaceGasWHService confinedspacegaswhService;
/**
* @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();
PageData pd2 = new PageData();
pd2 = confinedspacegaswhService.findById(pd);
if(pd2 != null && pd2.size()>0){
confinedspacegaswhService.edit(pd);
}else{
pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间
pd.put("CONFINEDSPACEGASWH_ID", this.get32UUID()); //主键
confinedspacegaswhService.save(pd);
}
map.put("result", errInfo);
return map;
}
/**
* @param out
* @throws Exception
*/
@RequestMapping(value="/delete")
@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();
confinedspacegaswhService.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("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间
confinedspacegaswhService.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 = confinedspacegaswhService.list(page); //列出ConfinedSpaceGasWH列表
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 = confinedspacegaswhService.findById(pd); //根据ID读取
map.put("pd", pd);
map.put("result", errInfo);
return map;
}
/**
* @param
* @throws Exception
*/
@RequestMapping(value="/deleteAll")
@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(",");
confinedspacegaswhService.deleteAll(ArrayDATA_IDS);
errInfo = "success";
}else{
errInfo = "error";
}
map.put("result", errInfo); //返回结果
return map;
}
}

View File

@ -0,0 +1,282 @@
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.ConfinedSpaceGasService;
import com.zcloud.service.eightwork.ConfinedspaceService;
import com.zcloud.util.Tools;
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.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartRequest;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
*
* www.zcloudchina.com
*/
@Controller
@RequestMapping("/app/confinedspace")
public class AppConfinedspaceController extends BaseController {
@Autowired
private ConfinedspaceService confinedspaceService;
@Autowired
private ConfinedSpaceGasService confinedspaceGasService;
/**
*
* @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();
confinedspaceService.save(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();
confinedspaceService.edit(pd);
map.put("result", errInfo);
return map;
}
/**
*
* @throws Exception
*/
@RequestMapping(value = "/delete")
@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();
confinedspaceService.delete(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 = confinedspaceService.list(page); //列出confinedspace列表
map.put("varList", varList);
map.put("page", page);
map.put("result", errInfo);
return map;
}
@RequestMapping("/findById")
@ResponseBody
@LogAnno(menuType= "手机",menuServer= "受限作业",instructionsOperate = "受限作业",instructionsType = "获取详情")
public Object findById() throws Exception {
Map<String,Object> map = new HashMap<>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
pd = confinedspaceService.findById(pd);
map.put("result",errInfo);
map.put("pd",pd);
return map;
}
@RequestMapping("/listSignFinished")
@ResponseBody
public Object listSignFinished() throws Exception {
Map<String,Object> map = new HashMap<>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
PageData signs = confinedspaceService.listSignFinished(pd);
map.put("result",errInfo);
map.put("signs",signs);
return map;
}
@RequestMapping("/nextStep")
@ResponseBody
@LogAnno(menuType= "手机",menuServer= "受限作业",instructionsOperate = "受限作业",instructionsType = "通过")
public Object nextStep(MultipartRequest request) throws Exception {
Map<String,Object> map = new HashMap<>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
List<MultipartFile> fileList = new ArrayList<MultipartFile>();
String SIGNTIME[] = pd.getString("SIGNTIME").split(",");
for (int i = 0; i < SIGNTIME.length; i++) {
fileList.add(request.getFile("file" + i));
}
confinedspaceService.nextStep(pd, fileList.toArray(new MultipartFile[fileList.size()]));
map.put("result",errInfo);
return map;
}
@RequestMapping("/checkWorkCount")
@ResponseBody
public Object checkWorkCount() throws Exception{
Map<String,Object> map = new HashMap<>();
String errorInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
map.put("count",confinedspaceService.checkWorkCount(pd));
map.put("result",errorInfo);
return map;
}
@RequestMapping("/listAllMeasures")
@ResponseBody
public Object listAllMeasures() throws Exception {
Map<String,Object> map = new HashMap<>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
List<PageData> measuresList = confinedspaceService.listAllMeasures();
map.put("result",errInfo);
map.put("measuresList",measuresList);
return map;
}
@RequestMapping("/listAllMeasuresForSign")
@ResponseBody
public Object listAllMeasuresForSign() throws Exception {
Map<String,Object> map = new HashMap<>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
List<PageData> measuresForSignList = confinedspaceService.listAllMeasuresForSign(pd);
map.put("result",errInfo);
map.put("measuresForSignList",measuresForSignList);
return map;
}
@RequestMapping("/listSignFinishMeasures")
@ResponseBody
public Object listSignFinishMeasures() throws Exception {
Map<String,Object> map = new HashMap<>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
List<PageData> finishMeasuresList = confinedspaceService.listSignFinishMeasures(pd);
map.put("result",errInfo);
map.put("finishMeasuresList",finishMeasuresList);
return map;
}
/**
* @param
* @throws Exception
*/
@RequestMapping(value="/gas/save")
@ResponseBody
@LogAnno(menuType= "手机",menuServer= "受限作业",instructionsOperate = "受限作业",instructionsType = "保存气体检测")
public Object gasSave(MultipartRequest request) throws Exception{
Map<String,Object> map = new HashMap<String,Object>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
List<MultipartFile> fileList = new ArrayList<MultipartFile>();
String SIGNTIME[] = pd.getString("SIGNTIME").split(",");
for (int i = 0; i < SIGNTIME.length; i++) {
fileList.add(request.getFile("file" + i));
}
confinedspaceService.saveGas(pd,fileList.toArray(new MultipartFile[fileList.size()]));
map.put("result", errInfo);
return map;
}
/**
* @param
* @throws Exception
*/
@RequestMapping(value="/gas/list")
@ResponseBody
@LogAnno(menuType= "手机",menuServer= "受限作业",instructionsOperate = "受限作业",instructionsType = "去修改页面获取数据")
public Object gasList() throws Exception{
Map<String,Object> map = new HashMap<String,Object>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
List<PageData> varList = confinedspaceGasService.listAll(pd); //列出confinedspace列表
map.put("varList", varList);
map.put("result", errInfo);
return map;
}
/**
* @param
* @throws Exception
*/
@RequestMapping(value="/gas/delete")
@ResponseBody
@LogAnno(menuType= "手机",menuServer= "受限作业",instructionsOperate = "受限作业",instructionsType = "去修改页面获取数据")
public Object gasDel() throws Exception{
Map<String,String> map = new HashMap<String,String>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
confinedspaceGasService.delete(pd);
map.put("result", errInfo); //返回结果
return map;
}
/**
* @param
* @throws Exception
*/
@RequestMapping(value="/getFlowList")
@ResponseBody
@LogAnno(menuType= "手机",menuServer= "受限作业",instructionsOperate = "受限作业",instructionsType = "获取受限作业流程")
public Object getFlowList() throws Exception{
Map<String,Object> map = new HashMap<String,Object>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
List<PageData> flowList = confinedspaceService.getFlowList(pd);
map.put("flowList", flowList);
map.put("result", errInfo); //返回结果
return map;
}
}

View File

@ -0,0 +1,62 @@
package com.zcloud.mapper.datasource.eightwork;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import java.util.List;
/**
*
* luoxiaobao
* 2021-09-13
* www.zcloudchina.com
*/
public interface ConfinedSpaceGasMapper {
/**
* @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);
PageData gasEdit(PageData pd);
/**
* @param ArrayDATA_IDS
* @throws Exception
*/
void deleteAll(String[] ArrayDATA_IDS);
}

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
* 2022-08-11
* www.zcloudchina.com
*/
public interface ConfinedSpaceGasWHMapper {
/**
* @param pd
* @throws Exception
*/
void save(PageData pd);
/**
* @param pd
* @throws Exception
*/
void delete(PageData pd);
/**
* @param pd
* @throws Exception
*/
void edit(PageData pd);
void edittime(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(String[] ArrayDATA_IDS);
}

View File

@ -0,0 +1,27 @@
package com.zcloud.mapper.datasource.eightwork;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import java.util.List;
/**
* @author fangjiakai
* @date 2024/01/17 11:31
*/
public interface ConfinedspaceMapper {
PageData getCode(PageData pd);
PageData findById(PageData pd);
void save(PageData pd);
void delete(PageData pd);
void edit(PageData pd);
void editGasTime(PageData pd);
void editStep(PageData pd);
List<PageData> datalistPage(Page page);
List<PageData> listAllMeasures();
List<PageData> checkWorkCount(PageData pd);
List<PageData> getFlowList(PageData pd);
}

View File

@ -0,0 +1,37 @@
package com.zcloud.mapper.datasource.eightwork;
import com.zcloud.entity.PageData;
import java.util.List;
/**
* @author fangjiakai
* @date 2024/01/17 11:31
*/
public interface ConfinedspaceSignMapper {
/**
* @param pd
* @throws Exception
*/
void save(PageData pd);
void saveBatch(List<PageData> signers);
/**
* @param pd
* @throws Exception
*/
void edit(PageData pd);
/**ID
* @throws Exception
*/
List<PageData> listById(PageData pd);
List<PageData> listAll(PageData sign);
/**ID
* @throws Exception
*/
List<PageData> checkUnsigned(PageData sign);
}

View File

@ -0,0 +1,57 @@
package com.zcloud.mapper.datasource.eightwork;
import com.zcloud.entity.PageData;
import java.util.List;
/**
*
* luoxiaobao
* 2021-09-18
* www.zcloudchina.com
*/
public interface ConfinedspaceToMeasuresMapper {
/**
* @param pd
* @throws Exception
*/
void save(PageData pd);
void saveBatch(List<PageData> signers);
/**
* @param pd
* @throws Exception
*/
void delete(PageData pd);
/**
* @param pd
* @throws Exception
*/
void edit(PageData pd);
/**()
* @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(String[] ArrayDATA_IDS);
List<PageData> listAllMeasuresForSign(PageData pd);
List<PageData> listSignFinishMeasures(PageData pd);
}

View File

@ -0,0 +1,60 @@
package com.zcloud.service.eightwork;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import java.util.List;
/**
*
* luoxiaobao
* 2021-09-13
* www.zcloudchina.com
*/
public interface ConfinedSpaceGasService {
/**
* @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;
public PageData gasEdit(PageData pd)throws Exception;
/**
* @param ArrayDATA_IDS
* @throws Exception
*/
public void deleteAll(String[] ArrayDATA_IDS)throws Exception;
}

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
* 2022-08-11
* www.zcloudchina.com
*/
public interface ConfinedSpaceGasWHService {
/**
* @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;
public void edittime(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(String[] ArrayDATA_IDS)throws Exception;
}

View File

@ -0,0 +1,42 @@
package com.zcloud.service.eightwork;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
/**
* @author fangjiakai
* @date 2024/01/17 11:29
*/
public interface ConfinedspaceService {
void save(PageData pd)throws Exception;
void edit(PageData pd)throws Exception;
void delete(PageData pd)throws Exception;
List<PageData> list(Page page) throws Exception;
void nextStep(PageData pd, MultipartFile[] files) throws Exception;
PageData findById(PageData pd) throws Exception;
PageData listSignFinished(PageData pd) throws Exception;
PageData checkWorkCount(PageData pd);
//获取所有措施(bus_Confinedspace_measures)
List<PageData> listAllMeasures() throws Exception;
//
// //获取需要签字的措施(bus_Confinedspacetomeasures)
List<PageData> listAllMeasuresForSign(PageData pd) throws Exception;
//
// //获取所有签字完成的措施(bus_Confinedspacetomeasures)
List<PageData> listSignFinishMeasures(PageData pd) throws Exception;
void saveGas(PageData pd,MultipartFile[] files) throws Exception;
List<PageData> getFlowList(PageData pd)throws Exception;
}

View File

@ -0,0 +1,89 @@
package com.zcloud.service.eightwork.impl;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import com.zcloud.mapper.datasource.eightwork.ConfinedSpaceGasMapper;
import com.zcloud.service.eightwork.ConfinedSpaceGasService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
*
* luoxiaobao
* 2021-09-13
* www.zcloudchina.com
*/
@Service
@Transactional //开启事物
public class ConfinedSpaceGasServiceImpl implements ConfinedSpaceGasService {
@Autowired
private ConfinedSpaceGasMapper confinedspacegasMapper;
/**
* @param pd
* @throws Exception
*/
public void save(PageData pd)throws Exception{
confinedspacegasMapper.save(pd);
}
/**
* @param pd
* @throws Exception
*/
public void delete(PageData pd)throws Exception{
confinedspacegasMapper.delete(pd);
}
/**
* @param pd
* @throws Exception
*/
public void edit(PageData pd)throws Exception{
confinedspacegasMapper.edit(pd);
}
/**
* @param page
* @throws Exception
*/
public List<PageData> list(Page page)throws Exception{
return confinedspacegasMapper.datalistPage(page);
}
/**()
* @param pd
* @throws Exception
*/
public List<PageData> listAll(PageData pd)throws Exception{
return confinedspacegasMapper.listAll(pd);
}
/**id
* @param pd
* @throws Exception
*/
public PageData findById(PageData pd)throws Exception{
return confinedspacegasMapper.findById(pd);
}
public PageData gasEdit(PageData pd)throws Exception{
return confinedspacegasMapper.gasEdit(pd);
}
/**
* @param ArrayDATA_IDS
* @throws Exception
*/
public void deleteAll(String[] ArrayDATA_IDS)throws Exception{
confinedspacegasMapper.deleteAll(ArrayDATA_IDS);
}
}

View File

@ -0,0 +1,87 @@
package com.zcloud.service.eightwork.impl;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import com.zcloud.mapper.datasource.eightwork.ConfinedSpaceGasWHMapper;
import com.zcloud.service.eightwork.ConfinedSpaceGasWHService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
*
* luoxiaobao
* 2022-08-11
* www.zcloudchina.com
*/
@Service
@Transactional //开启事物
public class ConfinedSpaceGasWHServiceImpl implements ConfinedSpaceGasWHService {
@Autowired
private ConfinedSpaceGasWHMapper confinedspacegaswhMapper;
/**
* @param pd
* @throws Exception
*/
public void save(PageData pd)throws Exception{
confinedspacegaswhMapper.save(pd);
}
/**
* @param pd
* @throws Exception
*/
public void delete(PageData pd)throws Exception{
confinedspacegaswhMapper.delete(pd);
}
/**
* @param pd
* @throws Exception
*/
public void edit(PageData pd)throws Exception{
confinedspacegaswhMapper.edit(pd);
}
public void edittime(PageData pd)throws Exception{
confinedspacegaswhMapper.edittime(pd);
}
/**
* @param page
* @throws Exception
*/
public List<PageData> list(Page page)throws Exception{
return confinedspacegaswhMapper.datalistPage(page);
}
/**()
* @param pd
* @throws Exception
*/
public List<PageData> listAll(PageData pd)throws Exception{
return confinedspacegaswhMapper.listAll(pd);
}
/**id
* @param pd
* @throws Exception
*/
public PageData findById(PageData pd)throws Exception{
return confinedspacegaswhMapper.findById(pd);
}
/**
* @param ArrayDATA_IDS
* @throws Exception
*/
public void deleteAll(String[] ArrayDATA_IDS)throws Exception{
confinedspacegaswhMapper.deleteAll(ArrayDATA_IDS);
}
}

View File

@ -0,0 +1,396 @@
package com.zcloud.service.eightwork.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import com.zcloud.mapper.datasource.eightwork.*;
import com.zcloud.service.eightwork.ConfinedspaceService;
import com.zcloud.util.Const;
import com.zcloud.util.DateUtil;
import com.zcloud.util.Smb;
import com.zcloud.util.UuidUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import java.text.DecimalFormat;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author fangjiakai
* @date 2024/01/17 11:30
*/
@Service
@Transactional //开启事物
public class ConfinedspaceServiceImpl implements ConfinedspaceService {
@Autowired
private ConfinedspaceMapper confinedspaceMapper;
@Autowired
private EightWorkTaskFlowMapper eightWorkTaskFlowMapper;
@Autowired
private EightWorkFlowLogMapper eightWorkFlowLogMapper;
@Autowired
private ConfinedspaceSignMapper confinedspaceSignMapper;
@Autowired
private ConfinedspaceToMeasuresMapper confinedspaceToMeasuresMapper;
@Autowired
private ConfinedSpaceGasMapper confinedspacegasMapper;
@Autowired
private Smb smb;
private final String primary_key = "CONFINEDSPACE_ID";
private final String work_type = "CONFINEDSPACE";
@Override
@Transactional
public void save(PageData pd) throws Exception {
PageData pd2 = new PageData();
Calendar calendar = Calendar.getInstance();
DecimalFormat dft=new DecimalFormat("00");
int year = calendar.get(Calendar.YEAR);
String month = dft.format(calendar.get(Calendar.MONTH) + 1);
String day = dft.format(calendar.get(Calendar.DAY_OF_MONTH));
pd2.put("CREATDATE",year + "-" + month + "-" + day);
pd2.put("CORPINFO_ID",pd.get("CORPINFO_ID"));
pd2 = confinedspaceMapper.getCode(pd2); //根据ID读取
String code = "SX" + year + month + day + dft.format((Integer.parseInt(pd2.get("code").toString()) + 1));
pd.put("CHECK_NO", code);
pd.put(primary_key, UuidUtil.get32UUID()); //主键
pd.put("CREATTIME", DateUtil.date2Str(new Date())); //添加时间
pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间
pd.put("ISDELETE", "0"); //是否删除 1-是 0-否
confinedspaceMapper.save(pd);
if (pd.get("APPLY_STATUS").equals("1")) {
PageData flow = getStep(pd.get("TASK_ID"),"1");
saveLog(pd,pd.getString("CREATOR"),"1");
saveNextSigner(pd,flow);
}
}
@Override
@Transactional
public void edit(PageData pd) throws Exception {
pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间
confinedspaceMapper.edit(pd);
if (pd.get("APPLY_STATUS").equals("1")) {
pd.put("STEP_ID", 1);
confinedspaceMapper.editStep(pd);
PageData flow = getStep(pd.get("TASK_ID"),"1");
saveLog(pd,pd.getString("CREATOR"),"1");
saveNextSigner(pd,flow);
}
}
@Override
public void delete(PageData pd) throws Exception {
confinedspaceMapper.delete(pd);
}
@Override
public List<PageData> list(Page page) throws Exception {
return confinedspaceMapper.datalistPage(page);
}
/*
*
*/
@Override
@Transactional
public void nextStep(PageData pd, MultipartFile[] files) throws Exception {
PageData work = this.findById(pd);
work.putAll(pd);
List<String> filePaths = new ArrayList<>();
for (int i = 0; i < files.length; i++) {
//保存签名文件
String ffile = DateUtil.getDays();
String fileName = UuidUtil.get32UUID() + files[i].getOriginalFilename().substring(files[i].getOriginalFilename().lastIndexOf("."));
smb.sshSftp(files[i], fileName, Const.FILEPATHFILE + work.getString("CORPINFO_ID") + "/" + ffile);
filePaths.add(Const.FILEPATHFILE + work.getString("CORPINFO_ID") + "/" + ffile + "/" + fileName);
}
PageData flow = getStep(work.get("TASK_ID"), work.get("STEP_ID"));
work.put("STEP_ID", flow.get("NEXT_STEP_ID"));
//保存签名信息
PageData sign = new PageData();
if(work.getString("IMG_PATH") != ""){
sign.put("IMG_PATH", work.get("IMG_PATH"));
}
sign.put(primary_key, work.get(primary_key));
sign.put("STEP_ID", work.get("STEP_ID"));
sign.put("SIGN_USER_ID", work.get("USER_ID"));
sign.put("SIGN_TIME", work.getString("SIGNTIME"));
sign.put("SIGN_PATH", String.join(",",filePaths));
sign.put("DESCR", work.get("DESCR"));
confinedspaceSignMapper.edit(sign);
if (work.get("MEASURES") != null && !work.get("MEASURES").equals("")) { //安全措施确认步骤
saveMeasures(work);
}
List<PageData> unsignedList = confinedspaceSignMapper.checkUnsigned(sign);//当前步骤未签名人列表
if((unsignedList == null || unsignedList.size() == 0) && pd.getString("APPLY_STATUS").equals("1")){//如果没有未签人 则跳转下一步
confinedspaceMapper.editStep(work);
PageData currentflow = getStep(work.get("TASK_ID"), work.get("STEP_ID"));
//保存日志
saveLog(work,work.getString("USER_ID"),"1");
if("99".equals(currentflow.getString("NEXT_STEP_ID"))){
return;
}
if (work.get("PREPARERS") != null && !work.get("PREPARERS").equals("")) { //如果是设置安全措施确认人步骤
savePreparers(work,currentflow);
}
saveNextSigner(work,currentflow);
}else if(pd.getString("APPLY_STATUS").equals("-1")){
//保存日志
saveLog(work,work.getString("USER_ID"),"-1");
work.put("STEP_ID",-1);
confinedspaceMapper.editStep(work);
}
}
@Override
public PageData findById(PageData pd) throws Exception {
PageData pageData = confinedspaceMapper.findById(pd);
return pageData;
}
@Override
public PageData listSignFinished(PageData pd) throws Exception {
Map<String,List<PageData>> rmap = new HashMap<>();
List<PageData> varList = confinedspaceSignMapper.listAll(pd);
if (varList != null && !varList.isEmpty()) {
varList.stream().forEach(item -> {
PageData sign = new PageData();
sign.put("SIGN_PATH", item.getString("SIGN_PATH").split(","));
sign.put("SIGN_TIME", item.getString("SIGN_TIME").split(","));
if(item.getString("IMG_PATH") != null || "".equals(item.getString("IMG_PATH"))){
sign.put("IMG_PATH", item.getString("IMG_PATH").split(","));
}
sign.put("DESCR", item.getString("DESCR") != null ? item.getString("DESCR") : "无");
if(rmap.containsKey(item.getString("CODE"))){
rmap.get(item.getString("CODE")).add(sign);
}else{
List<PageData> signs = new ArrayList<>();
signs.add(sign);
rmap.put(item.getString("CODE"),signs);
}
});
}
PageData rpd = new PageData();
if (rmap != null && !rmap.isEmpty()) {
rpd.putAll(rmap);
}
return rpd;
}
@Override
public PageData checkWorkCount(PageData pd) {
PageData rpd = new PageData();
List<PageData> varList = confinedspaceMapper.checkWorkCount(pd);
if (varList != null && !varList.isEmpty()) {
Map<String, String> newMap = varList.stream()
.collect(Collectors.toMap(map -> map.getString("CODE"), map -> map.getString("COUNT")));
rpd.putAll(newMap);
}
return rpd;
}
@Override
public List<PageData> listAllMeasures() throws Exception {
return confinedspaceMapper.listAllMeasures();
}
@Override
public List<PageData> listAllMeasuresForSign(PageData pd) throws Exception {
return confinedspaceToMeasuresMapper.listAllMeasuresForSign(pd);
}
@Override
public List<PageData> listSignFinishMeasures(PageData pd) throws Exception {
return confinedspaceToMeasuresMapper.listSignFinishMeasures(pd);
}
@Override
@Transactional
public void saveGas(PageData pd, MultipartFile[] files) throws Exception {
PageData work = confinedspaceMapper.findById(pd);
List<String> filePaths = new ArrayList<>();
for (int i = 0; i < files.length; i++) {
//保存签名文件
String ffile = DateUtil.getDays();
String fileName = UuidUtil.get32UUID() + files[i].getOriginalFilename().substring(files[i].getOriginalFilename().lastIndexOf("."));
smb.sshSftp(files[i], fileName, Const.FILEPATHFILE + work.getString("CORPINFO_ID") + "/" + ffile);
filePaths.add(Const.FILEPATHFILE + work.getString("CORPINFO_ID") + "/" + ffile + "/" + fileName);
}
pd.put("CONFINEDSPACEGAS_ID", UuidUtil.get32UUID()); //主键
pd.put("ISDELETE", "0"); //是否删除 1-是 0-否
pd.put("SIGN_PATH", String.join(",",filePaths));
confinedspacegasMapper.save(pd);
confinedspaceMapper.editGasTime(pd);//修改最后一次气体检测时间
PageData flow = getStep(work.get("TASK_ID"), work.get("STEP_ID"));
if (pd.get("APPLY_STATUS").equals("1")) { //如果通过
if(flow.get("NEXT_STEP_ID") != null && flow.getString("NEXT_STEP_ID").equals("2")) {//如果为气体检测步骤,则保存日志并跳转下一步
PageData sign = new PageData();
sign.put(primary_key, work.get(primary_key));
sign.put("STEP_ID", 2);
sign.put("SIGN_USER_ID", pd.get("USER_ID"));
sign.put("SIGN_TIME", DateUtil.date2Str(new Date()));
sign.put("SIGN_PATH", String.join(",", filePaths));
sign.put("DESCR", pd.get("DESCR"));
confinedspaceSignMapper.edit(sign);
work.put("STEP_ID", flow.get("NEXT_STEP_ID"));
confinedspaceMapper.editStep(work);
//保存日志
saveLog(work, work.getString("USER_ID"), "1");
//预存下一步
PageData currentflow = getStep(work.get("TASK_ID"), work.get("STEP_ID"));
saveNextSigner(work, currentflow);
}
}else if(pd.getString("APPLY_STATUS").equals("-1")){
PageData sign = new PageData();
sign.put(primary_key, work.get(primary_key));
sign.put("STEP_ID", 2);
sign.put("SIGN_USER_ID", pd.get("USER_ID"));
sign.put("SIGN_TIME", DateUtil.date2Str(new Date()));
sign.put("SIGN_PATH", String.join(",", filePaths));
sign.put("DESCR", pd.get("DESCR"));
confinedspaceSignMapper.edit(sign);
//保存日志
work.put("STEP_ID", flow.get("NEXT_STEP_ID"));
saveLog(work,pd.getString("USER_ID"),"-2");
work.put("STEP_ID",-1);
confinedspaceMapper.editStep(work);
}
}
@Override
public List<PageData> getFlowList(PageData pd) throws Exception {
pd=findById(pd);
return confinedspaceMapper.getFlowList(pd);
}
private void saveNextSigner(PageData pd,PageData flow) throws Exception {
pd.put("STEP_ID",flow.get("NEXT_STEP_ID"));
if(pd.get(flow.get("NEXT_ACTOR_FIELD")) == null || pd.get(flow.get("NEXT_ACTOR_FIELD")).equals("")){
return;
}
//提前保存下一步签字人
List<PageData> signers = new ArrayList<>();
PageData signer = new PageData();
signer.put("CONFINEDSPACE_SIGN_ID", UuidUtil.get32UUID()); // 主键
signer.put(primary_key, pd.get(primary_key));
signer.put("CORPINFO_ID", pd.get("CORPINFO_ID"));
signer.put("SIGN_USER_ID", pd.get(flow.get("NEXT_ACTOR_FIELD")));
signer.put("STEP_ID", flow.get("NEXT_STEP_ID"));
signers.add(signer);
confinedspaceSignMapper.saveBatch(signers);
}
private void saveMeasures(PageData pd) {
List<JSONObject> list = (List<JSONObject>) JSON.parse(pd.get("MEASURES").toString());
for (JSONObject json : list) {
PageData measure = new PageData();
measure.put("CONFINEDSPACETOMEASURES_ID",json.get("CONFINEDSPACETOMEASURES_ID"));
measure.put("STATUS", json.get("STATUS"));
measure.put("ANSWER1", json.get("ANSWER1"));
measure.put("ANSWER2", json.get("ANSWER2"));
measure.put("ANSWER3", json.get("ANSWER3"));
measure.put("ANSWER4", json.get("ANSWER4"));
measure.put("SIGN_PATH", json.get("SIGN_PATH"));
measure.put("SIGN_TIME", json.get("SIGN_TIME"));
measure.put("IMG_PATH", json.get("IMG_PATH"));
confinedspaceToMeasuresMapper.edit(measure);
}
}
private void savePreparers(PageData pd,PageData flow) {
List<PageData> signers = new ArrayList<>();
List<JSONObject> list = (List<JSONObject>) JSON.parse(pd.get("PREPARERS").toString());
for (JSONObject json : list) {
PageData preparer = new PageData();
preparer.put("CONFINEDSPACETOMEASURES_ID", UuidUtil.get32UUID()); // 主键
preparer.put("CONFINEDSPACE_ID", pd.get("CONFINEDSPACE_ID"));
preparer.put("BUS_CONFINEDSPACE_MEASURES_ID", json.get("BUS_CONFINEDSPACE_MEASURES_ID"));
preparer.put("CONFIRM_ID", json.get("USER_ID"));
signers.add(preparer);
}
if(signers.size() > 0){
confinedspaceToMeasuresMapper.saveBatch(signers);
//获取所有需要签名人
List<String> fieldList = signers.stream()
.map(map -> map.getString("CONFIRM_ID"))
.collect(Collectors.toList());
Set<String > fieldSet = new HashSet<>(fieldList); //去重
List<String> uniqueList = new ArrayList<>(fieldSet);
List<PageData> nextSigners = new ArrayList<>();
uniqueList.forEach(item -> { // 保存下一步需要签名的人
PageData signer = new PageData();
signer.put("CONFINEDSPACE_SIGN_ID", UuidUtil.get32UUID()); // 主键
signer.put(primary_key, pd.get(primary_key));
signer.put("CORPINFO_ID", pd.get("CORPINFO_ID"));
signer.put("SIGN_USER_ID", item);
signer.put("STEP_ID", flow.get("NEXT_STEP_ID"));
nextSigners.add(signer);
});
confinedspaceSignMapper.saveBatch(nextSigners);
}
}
private PageData getStep(Object TASK_ID, Object STEP_ID) throws Exception {
PageData flow = new PageData();
flow.put("TASK_ID", TASK_ID);
flow.put("STEP_ID", STEP_ID);
flow = eightWorkTaskFlowMapper.getStep(flow);
return flow;
}
private void saveLog(PageData pd,String act_user,String status) throws Exception {
PageData log = new PageData();
log.put("LOG_ID", UuidUtil.get32UUID());
log.put("WORK_ID", pd.get(primary_key));
log.put("TASK_ID", pd.get("TASK_ID"));
log.put("STEP_ID", pd.get("STEP_ID"));
log.put("CORPINFO_ID", pd.get("CORPINFO_ID"));
log.put("CHECK_NO", pd.get("CHECK_NO"));
log.put("ACT_USER", act_user);
log.put("ACT_TIME", DateUtil.date2Str(new Date()));
log.put("STATUS", status);
log.put("WORK_TYPE",work_type);
eightWorkFlowLogMapper.save(log);
}
// private void saveNext(PageData pd,PageData flow) throws Exception {
// PageData log = new PageData();
// log.put("LOG_ID", UuidUtil.get32UUID());
// log.put("WORK_ID", pd.get(primary_key));
// log.put("TASK_ID", pd.get("TASK_ID"));
// log.put("STEP_ID", flow.get("NEXT_STEP_ID"));
// log.put("STATUS", "0");
// eightWorkFlowLogMapper.save(log);
// }
}

View File

@ -0,0 +1,174 @@
<?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.ConfinedSpaceGasMapper">
<!--表名 -->
<sql id="tableName">
BUS_CONFINEDSPACEGAS
</sql>
<!--数据字典表名 -->
<sql id="dicTableName">
SYS_DICTIONARIES
</sql>
<!-- 字段 -->
<sql id="Field">
f.CONFINEDSPACE_ID,
f.ANALYZE_TIME,
f.ANALYZE_PLACE,
f.ANALYZE_USER,
f.HARMFUL_MATERIALS,
f.COMBUSTIBLE_GAS,
f.OXYGEN_CONTENT,
f.ISDELETE,
f.DATA1,
f.DATA2,
f.DATA3,
f.DATA4,
f.CONFINEDSPACEGAS_ID,
f.SIGN_PATH
</sql>
<!-- 字段用于新增 -->
<sql id="Field2">
CONFINEDSPACE_ID,
ANALYZE_TIME,
ANALYZE_PLACE,
ANALYZE_USER,
HARMFUL_MATERIALS,
COMBUSTIBLE_GAS,
OXYGEN_CONTENT,
ISDELETE,
DATA1,
DATA2,
DATA3,
DATA4,
CONFINEDSPACEGAS_ID,
SIGN_PATH
</sql>
<!-- 字段值 -->
<sql id="FieldValue">
#{CONFINEDSPACE_ID},
#{ANALYZE_TIME},
#{ANALYZE_PLACE},
#{ANALYZE_USER},
#{HARMFUL_MATERIALS},
#{COMBUSTIBLE_GAS},
#{OXYGEN_CONTENT},
#{ISDELETE},
#{DATA1},
#{DATA2},
#{DATA3},
#{DATA4},
#{CONFINEDSPACEGAS_ID},
#{SIGN_PATH}
</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'
where
CONFINEDSPACEGAS_ID = #{CONFINEDSPACEGAS_ID}
</delete>
<!-- 修改 -->
<update id="edit" parameterType="pd">
update
<include refid="tableName"></include>
set
CONFINEDSPACE_ID = #{CONFINEDSPACE_ID},
ANALYZE_TIME = #{ANALYZE_TIME},
ANALYZE_PLACE = #{ANALYZE_PLACE},
ANALYZE_USER = #{ANALYZE_USER},
HARMFUL_MATERIALS = #{HARMFUL_MATERIALS},
COMBUSTIBLE_GAS = #{COMBUSTIBLE_GAS},
OXYGEN_CONTENT = #{OXYGEN_CONTENT},
ISDELETE = #{ISDELETE},
DATA1 = #{DATA1},
DATA2 = #{DATA2},
DATA3 = #{DATA3},
DATA4 = #{DATA4},
CONFINEDSPACEGAS_ID = CONFINEDSPACEGAS_ID,
SIGN_PATH = #{SIGN_PATH}
where
CONFINEDSPACEGAS_ID = #{CONFINEDSPACEGAS_ID}
</update>
<!-- 通过ID获取数据 -->
<select id="findById" parameterType="pd" resultType="pd">
select
<include refid="Field"></include>
from
<include refid="tableName"></include> f
where f.CONFINEDSPACE_ID = #{CONFINEDSPACE_ID}
</select>
<!-- 列表 -->
<select id="datalistPage" parameterType="page" resultType="pd">
select
<include refid="Field"></include>
from
<include refid="tableName"></include> f
where f.ISDELETE = '0'
<if test="pd.KEYWORDS != null and pd.KEYWORDS != ''"><!-- 关键词检索 -->
<!-- and-->
<!-- (-->
<!-- &lt;!&ndash; 根据需求自己加检索条件-->
<!-- 字段1 LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%')-->
<!-- or-->
<!-- 字段2 LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%')-->
<!-- &ndash;&gt;-->
<!-- )-->
</if>
ORDER BY f.ANALYZE_TIME desc
</select>
<!-- 列表(全部) -->
<select id="listAll" parameterType="pd" resultType="pd">
select
<include refid="Field"></include>
from
<include refid="tableName"></include> f
where f.ISDELETE = '0' and f.CONFINEDSPACE_ID = #{CONFINEDSPACE_ID}
ORDER BY f.ANALYZE_TIME desc
</select>
<select id="gasEdit" parameterType="pd" resultType="pd">
select
<include refid="Field"></include>
from
<include refid="tableName"></include> f
where
f.CONFINEDSPACEGAS_ID = #{CONFINEDSPACEGAS_ID}
</select>
<!-- 批量删除 -->
<delete id="deleteAll" parameterType="String">
update
<include refid="tableName"></include>
set
ISDELETE = '1'
where
CONFINEDSPACEGAS_ID in
<foreach item="item" index="index" collection="ArrayDATA_IDS" open="(" separator="," close=")">
#{item}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,161 @@
<?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.ConfinedSpaceGasWHMapper">
<!--表名 -->
<sql id="tableName">
BUS_CONFINEDSPACEGASWH
</sql>
<!--数据字典表名 -->
<sql id="dicTableName">
SYS_DICTIONARIES
</sql>
<!-- 字段 -->
<sql id="Field">
f.CONFINEDSPACE_ID,
f.GAS_NAME1,
f.GAS_STANDARD1,
f.GAS_NAME2,
f.GAS_STANDARD2,
f.GAS_NAME3,
f.GAS_STANDARD3,
f.GAS_NAME4,
f.GAS_STANDARD4,
f.CONFINEDSPACEGASWH_ID,
f.OPERATTIME
</sql>
<!-- 字段用于新增 -->
<sql id="Field2">
CONFINEDSPACE_ID,
GAS_NAME1,
GAS_STANDARD1,
GAS_NAME2,
GAS_STANDARD2,
GAS_NAME3,
GAS_STANDARD3,
GAS_NAME4,
GAS_STANDARD4,
CONFINEDSPACEGASWH_ID,
OPERATTIME
</sql>
<!-- 字段值 -->
<sql id="FieldValue">
#{CONFINEDSPACE_ID},
#{GAS_NAME1},
#{GAS_STANDARD1},
#{GAS_NAME2},
#{GAS_STANDARD2},
#{GAS_NAME3},
#{GAS_STANDARD3},
#{GAS_NAME4},
#{GAS_STANDARD4},
#{CONFINEDSPACEGASWH_ID},
#{OPERATTIME}
</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'
where
CONFINEDSPACEGASWH_ID = #{CONFINEDSPACEGASWH_ID}
</delete>
<!-- 修改 -->
<update id="edit" parameterType="pd">
update
<include refid="tableName"></include>
set
CONFINEDSPACE_ID = #{CONFINEDSPACE_ID},
GAS_NAME1 = #{GAS_NAME1},
GAS_STANDARD1 = #{GAS_STANDARD1},
GAS_NAME2 = #{GAS_NAME2},
GAS_STANDARD2 = #{GAS_STANDARD2},
GAS_NAME3 = #{GAS_NAME3},
GAS_STANDARD3 = #{GAS_STANDARD3},
GAS_NAME4 = #{GAS_NAME4},
GAS_STANDARD4 = #{GAS_STANDARD4},
CONFINEDSPACEGASWH_ID = CONFINEDSPACEGASWH_ID,
OPERATTIME = #{OPERATTIME}
where
CONFINEDSPACEGASWH_ID = #{CONFINEDSPACEGASWH_ID}
</update>
<!-- 修改 -->
<update id="edittime" parameterType="pd">
update
<include refid="tableName"></include>
set
OPERATTIME = #{OPERATTIME}
where
CONFINEDSPACE_ID = #{CONFINEDSPACE_ID}
</update>
<!-- 通过ID获取数据 -->
<select id="findById" parameterType="pd" resultType="pd">
select
<include refid="Field"></include>
from
<include refid="tableName"></include> f
where
f.CONFINEDSPACE_ID = #{CONFINEDSPACE_ID}
</select>
<!-- 列表 -->
<select id="datalistPage" parameterType="page" resultType="pd">
select
<include refid="Field"></include>
from
<include refid="tableName"></include> f
where f.ISDELETE = '0'
<if test="pd.KEYWORDS != null and pd.KEYWORDS != ''"><!-- 关键词检索 -->
and
(
<!-- 根据需求自己加检索条件
字段1 LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%')
or
字段2 LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%')
-->
)
</if>
</select>
<!-- 列表(全部) -->
<select id="listAll" parameterType="pd" resultType="pd">
select
<include refid="Field"></include>
from
<include refid="tableName"></include> f
</select>
<!-- 批量删除 -->
<delete id="deleteAll" parameterType="String">
update
<include refid="tableName"></include>
set
ISDELETE = '1'
where
CONFINEDSPACEGASWH_ID in
<foreach item="item" index="index" collection="ArrayDATA_IDS" open="(" separator="," close=")">
#{item}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,493 @@
<?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.ConfinedspaceMapper">
<!--表名 -->
<sql id="tableName">
BUS_CONFINEDSPACE
</sql>
<!-- 字段 -->
<sql id="Field">
f.CONFINEDSPACE_ID,
f.CORPINFO_ID,
f.TASK_ID,
f.STEP_ID,
f.ISDELETE,
f.CREATTIME,
f.CREATOR,
f.OPERATTIME,
f.OPERATOR,
f.CHECK_NO,
f.WORK_CONTENT,
f.APPLY_DEPARTMENT_ID,
f.APPLY_USER_ID,
f.WORK_START_DATE,
f.WORK_END_DATE,
f.WORK_USER_ID,
f.SPECIAL_WORK,
f.RISK_IDENTIFICATION,
f.ANALYZE_DEPARTMENT_ID,
f.ANALYZE_USER_ID,
f.CONFESS_DEPARTMENT_ID,
f.CONFESS_USER_ID,
f.ACCEPT_CONFESS_DEPARTMENT_ID,
f.ACCEPT_CONFESS_USER_ID,
f.GUARDIAN_DEPARTMENT_ID,
f.GUARDIAN_USER_ID,
f.CONFIRM_DEPARTMENT_ID,
f.CONFIRM_USER_ID,
f.LEADER_DEPARTMENT_ID,
f.LEADER_USER_ID,
f.ACCEPT_DEPARTMENT_ID,
f.ACCEPT_USER_ID,
f.ANALYZE_TIME,
f.WORK_START_DEPARTMENT_ID,
f.WORK_START_USER_ID,
f.WORK_END_DEPARTMENT_ID,
f.WORK_END_USER_ID,
f.ACCEPT_TIME,
f.PLS_ID,
f.PLS_NAME,
f.MEDIUM_NAME,
f.LIMITSPACE_ID,
f.WORK_USER_DEPARTMENT_ID,
f.LONGITUDE,
f.LATITUDE
</sql>
<!-- 字段用于新增 -->
<sql id="Field2">
CONFINEDSPACE_ID,
CORPINFO_ID,
TASK_ID,
STEP_ID,
ISDELETE,
CREATTIME,
CREATOR,
OPERATTIME,
OPERATOR,
CHECK_NO,
WORK_CONTENT,
APPLY_DEPARTMENT_ID,
APPLY_USER_ID,
WORK_START_DATE,
WORK_END_DATE,
WORK_USER_ID,
SPECIAL_WORK,
RISK_IDENTIFICATION,
ANALYZE_DEPARTMENT_ID,
ANALYZE_USER_ID,
CONFESS_DEPARTMENT_ID,
CONFESS_USER_ID,
ACCEPT_CONFESS_DEPARTMENT_ID,
ACCEPT_CONFESS_USER_ID,
GUARDIAN_DEPARTMENT_ID,
GUARDIAN_USER_ID,
CONFIRM_DEPARTMENT_ID,
CONFIRM_USER_ID,
LEADER_DEPARTMENT_ID,
LEADER_USER_ID,
ACCEPT_DEPARTMENT_ID,
ACCEPT_USER_ID,
ANALYZE_TIME,
WORK_START_DEPARTMENT_ID,
WORK_START_USER_ID,
WORK_END_DEPARTMENT_ID,
WORK_END_USER_ID,
ACCEPT_TIME,
PLS_ID,
PLS_NAME,
MEDIUM_NAME,
LIMITSPACE_ID,
WORK_USER_DEPARTMENT_ID,
LONGITUDE,
LATITUDE
</sql>
<!-- 字段值 -->
<sql id="FieldValue">
#{CONFINEDSPACE_ID},
#{CORPINFO_ID},
#{TASK_ID},
#{STEP_ID},
#{ISDELETE},
#{CREATTIME},
#{CREATOR},
#{OPERATTIME},
#{OPERATOR},
#{CHECK_NO},
#{WORK_CONTENT},
#{APPLY_DEPARTMENT_ID},
#{APPLY_USER_ID},
#{WORK_START_DATE},
#{WORK_END_DATE},
#{WORK_USER_ID},
#{SPECIAL_WORK},
#{RISK_IDENTIFICATION},
#{ANALYZE_DEPARTMENT_ID},
#{ANALYZE_USER_ID},
#{CONFESS_DEPARTMENT_ID},
#{CONFESS_USER_ID},
#{ACCEPT_CONFESS_DEPARTMENT_ID},
#{ACCEPT_CONFESS_USER_ID},
#{GUARDIAN_DEPARTMENT_ID},
#{GUARDIAN_USER_ID},
#{CONFIRM_DEPARTMENT_ID},
#{CONFIRM_USER_ID},
#{LEADER_DEPARTMENT_ID},
#{LEADER_USER_ID},
#{ACCEPT_DEPARTMENT_ID},
#{ACCEPT_USER_ID},
#{ANALYZE_TIME},
#{WORK_START_DEPARTMENT_ID},
#{WORK_START_USER_ID},
#{WORK_END_DEPARTMENT_ID},
#{WORK_END_USER_ID},
#{ACCEPT_TIME},
#{PLS_ID},
#{PLS_NAME},
#{MEDIUM_NAME},
#{LIMITSPACE_ID},
#{WORK_USER_DEPARTMENT_ID},
#{LONGITUDE},
#{LATITUDE}
</sql>
<!-- 获取编码 -->
<select id="getCode" parameterType="pd" resultType="pd">
SELECT
COUNT(1) as code
FROM <include refid="tableName"></include> f
WHERE f.CORPINFO_ID = #{CORPINFO_ID}
and f.CREATTIME LIKE CONCAT(#{CREATDATE},'%')
</select>
<!-- 新增-->
<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'
where
CONFINEDSPACE_ID = #{CONFINEDSPACE_ID}
</delete>
<!-- 修改 -->
<update id="edit" parameterType="pd">
update
<include refid="tableName"></include>
set
CONFINEDSPACE_ID = #{CONFINEDSPACE_ID},
CORPINFO_ID = #{CORPINFO_ID},
TASK_ID = #{TASK_ID},
OPERATTIME = #{OPERATTIME},
OPERATOR = #{OPERATOR},
CHECK_NO = #{CHECK_NO},
WORK_CONTENT = #{WORK_CONTENT},
APPLY_DEPARTMENT_ID = #{APPLY_DEPARTMENT_ID},
APPLY_USER_ID = #{APPLY_USER_ID},
WORK_START_DATE = #{WORK_START_DATE},
WORK_END_DATE = #{WORK_END_DATE},
WORK_USER_ID = #{WORK_USER_ID},
SPECIAL_WORK = #{SPECIAL_WORK},
RISK_IDENTIFICATION = #{RISK_IDENTIFICATION},
ANALYZE_DEPARTMENT_ID = #{ANALYZE_DEPARTMENT_ID},
ANALYZE_USER_ID = #{ANALYZE_USER_ID},
CONFESS_DEPARTMENT_ID = #{CONFESS_DEPARTMENT_ID},
CONFESS_USER_ID = #{CONFESS_USER_ID},
ACCEPT_CONFESS_DEPARTMENT_ID = #{ACCEPT_CONFESS_DEPARTMENT_ID},
ACCEPT_CONFESS_USER_ID = #{ACCEPT_CONFESS_USER_ID},
GUARDIAN_DEPARTMENT_ID = #{GUARDIAN_DEPARTMENT_ID},
GUARDIAN_USER_ID = #{GUARDIAN_USER_ID},
CONFIRM_DEPARTMENT_ID = #{CONFIRM_DEPARTMENT_ID},
CONFIRM_USER_ID = #{CONFIRM_USER_ID},
LEADER_DEPARTMENT_ID = #{LEADER_DEPARTMENT_ID},
LEADER_USER_ID = #{LEADER_USER_ID},
ACCEPT_DEPARTMENT_ID = #{ACCEPT_DEPARTMENT_ID},
ACCEPT_USER_ID = #{ACCEPT_USER_ID},
ANALYZE_TIME=#{ANALYZE_TIME},
WORK_START_DEPARTMENT_ID=#{WORK_START_DEPARTMENT_ID},
WORK_START_USER_ID=#{WORK_START_USER_ID},
WORK_END_DEPARTMENT_ID=#{WORK_END_DEPARTMENT_ID},
WORK_END_USER_ID=#{WORK_END_USER_ID},
ACCEPT_TIME = #{ACCEPT_TIME},
PLS_ID = #{PLS_ID},
PLS_NAME = #{PLS_NAME},
MEDIUM_NAME = #{MEDIUM_NAME},
LIMITSPACE_ID = #{LIMITSPACE_ID},
WORK_USER_DEPARTMENT_ID =#{WORK_USER_DEPARTMENT_ID},
LONGITUDE =#{LONGITUDE},
LATITUDE =#{LATITUDE}
where
CONFINEDSPACE_ID = #{CONFINEDSPACE_ID}
</update>
<update id="editGasTime" parameterType="pd">
update
<include refid="tableName"></include>
set
ANALYZE_TIME = #{ANALYZE_TIME}
where
CONFINEDSPACE_ID = #{CONFINEDSPACE_ID}
</update>
<select id="findById" parameterType="pd" resultType="pd">
SELECT
<include refid="Field"></include>,
appo.`NAME` as APPLY_DEPARTMENT_NAME,
appu.`NAME` as APPLY_USER_NAME,
f.WORK_START_DATE,
f.WORK_END_DATE,
f.WORK_USER_ID,
f.SPECIAL_WORK,
f.RISK_IDENTIFICATION,
woro.`NAME` as WORK_USER_DEPARTMENT_NAME,
woru.`NAME` as WORK_USER_NAME,
anao.`NAME` as ANALYZE_DEPARTMENT_NAME,
anau.`NAME` as ANALYZE_USER_NAME,
cono.`NAME` as CONFESS_DEPARTMENT_NAME,
conu.`NAME` as CONFESS_USER_NAME,
acco.`NAME` as ACCEPT_CONFESS_DEPARTMENT_NAME,
accu.`NAME` as ACCEPT_CONFESS_USER_NAME,
guao.`NAME` as GUARDIAN_DEPARTMENT_NAME,
guau.`NAME` as GUARDIAN_USER_NAME,
confo.`NAME` as CONFIRM_DEPARTMENT_NAME,
confu.`NAME` as CONFIRM_USER_NAME,
leao.`NAME` as LEADER_DEPARTMENT_NAME,
leau.`NAME` as LEADER_USER_NAME,
acceo.`NAME` as ACCEPT_DEPARTMENT_NAME,
acceu.`NAME` as ACCEPT_USER_NAME,
stao.`NAME` as WORK_START_DEPARTMENT_NAME,
stau.`NAME` as WORK_START_USER_NAME,
endo.`NAME` as WORK_END_DEPARTMENT_NAME,
endu.`NAME` as WORK_END_USER_NAME,
confirm.SIGN_TIME as CONFIRM_USER_SIGNER_TIME,
confirm.SIGN_PATH as CONFIRM_USER_SIGNER_PATH,
IFNULL(confirm.DESCR,'无') as CONFIRM_CONTENT,
leader.SIGN_TIME as LEADER_USER_SIGNER_TIME,
leader.SIGN_PATH as LEADER_USER_SIGNER_PATH,
IFNULL(leader.DESCR,'无') as LEADER_CONTENT,
start.SIGN_TIME as WORK_START_USER_SIGNER_TIME,
start.SIGN_PATH as WORK_START_USER_SIGNER_PATH,
end.SIGN_TIME as WORK_END_USER_SIGNER_TIME,
end.SIGN_PATH as WORK_END_USER_SIGNER_PATH,
accept.SIGN_TIME as ACCEPT_USER_SIGNER_TIME,
accept.SIGN_PATH as ACCEPT_USER_SIGNER_PATH,
IFNULL(accept.DESCR,'无') as ACCEPT_CONTENT,
sp.NAME as LIMITSPACE_NAME,
f.ANALYZE_TIME
FROM
bus_confinedspace AS f
left join BUS_LIMITSPACE sp on sp.LIMITSPACE_ID=f.LIMITSPACE_ID
left join oa_department as woro on f.APPLY_DEPARTMENT_ID = woro.DEPARTMENT_ID
left join sys_user as woru on f.APPLY_USER_ID = woru.USER_ID
left join oa_department as appo on f.APPLY_DEPARTMENT_ID = appo.DEPARTMENT_ID
left join sys_user as appu on f.APPLY_USER_ID = appu.USER_ID
left join oa_department as anao on f.ANALYZE_DEPARTMENT_ID = anao.DEPARTMENT_ID
left join sys_user as anau on f.ANALYZE_USER_ID = anau.USER_ID
left join oa_department as cono on f.CONFESS_DEPARTMENT_ID = cono.DEPARTMENT_ID
left join sys_user as conu on f.CONFESS_USER_ID = conu.USER_ID
left join oa_department as acco on f.ACCEPT_CONFESS_DEPARTMENT_ID = acco.DEPARTMENT_ID
left join sys_user as accu on f.ACCEPT_CONFESS_USER_ID = accu.USER_ID
left join oa_department as guao on f.GUARDIAN_DEPARTMENT_ID = guao.DEPARTMENT_ID
left join sys_user as guau on f.GUARDIAN_USER_ID = guau.USER_ID
left join oa_department as confo on f.CONFIRM_DEPARTMENT_ID = confo.DEPARTMENT_ID
left join sys_user as confu on f.CONFIRM_USER_ID = confu.USER_ID
left join oa_department as leao on f.LEADER_DEPARTMENT_ID = leao.DEPARTMENT_ID
left join sys_user as leau on f.LEADER_USER_ID = leau.USER_ID
left join oa_department as acceo on f.ACCEPT_DEPARTMENT_ID = acceo.DEPARTMENT_ID
left join sys_user as acceu on f.ACCEPT_USER_ID = acceu.USER_ID
left join oa_department as stao on f.WORK_START_DEPARTMENT_ID = stao.DEPARTMENT_ID
left join sys_user as stau on f.WORK_START_USER_ID = stau.USER_ID
left join oa_department as endo on f.WORK_END_DEPARTMENT_ID = endo.DEPARTMENT_ID
left join sys_user as endu on f.WORK_END_USER_ID = endu.USER_ID
left join bus_confinedspace_sign confirm on confirm.CONFINEDSPACE_ID = f.CONFINEDSPACE_ID and confirm.STEP_ID = '8'
left join bus_confinedspace_sign leader on leader.CONFINEDSPACE_ID = f.CONFINEDSPACE_ID and leader.STEP_ID = '9'
left join bus_confinedspace_sign start on start.CONFINEDSPACE_ID = f.CONFINEDSPACE_ID and start.STEP_ID = '13'
left join bus_confinedspace_sign end on end.CONFINEDSPACE_ID = f.CONFINEDSPACE_ID and end.STEP_ID = '14'
left join bus_confinedspace_sign accept on accept.CONFINEDSPACE_ID = f.CONFINEDSPACE_ID and accept.STEP_ID = '15'
WHERE f.CONFINEDSPACE_ID = #{CONFINEDSPACE_ID}
</select>
<!-- 修改 -->
<update id="editStep" parameterType="pd">
update
<include refid="tableName"></include>
set
<if test="WORK_START_DATE != null and WORK_START_DATE != ''"><!-- 关键词检索 -->
WORK_START_DATE = #{WORK_START_DATE},
</if>
<if test="WORK_END_DATE != null and WORK_END_DATE != ''"><!-- 关键词检索 -->
WORK_END_DATE = #{WORK_END_DATE},
</if>
<if test="ACCEPT_TIME != null and ACCEPT_TIME != ''"><!-- 关键词检索 -->
ACCEPT_TIME = #{ACCEPT_TIME},
</if>
STEP_ID = #{STEP_ID}
where
CONFINEDSPACE_ID = #{CONFINEDSPACE_ID}
</update>
<!-- 列表 -->
<select id="datalistPage" parameterType="page" resultType="pd">
select
<include refid="Field"></include>,
woro.`NAME` as WORK_USER_DEPARTMENT_NAME,
woru.`NAME` as WORK_USER_NAME,
appo.`NAME` as APPLY_DEPARTMENT_NAME,
appu.`NAME` as APPLY_USER_NAME,
anao.`NAME` as ANALYZE_DEPARTMENT_NAME,
anau.`NAME` as ANALYZE_USER_NAME,
cono.`NAME` as CONFESS_DEPARTMENT_NAME,
conu.`NAME` as CONFESS_USER_NAME,
acco.`NAME` as ACCEPT_CONFESS_DEPARTMENT_NAME,
accu.`NAME` as ACCEPT_CONFESS_USER_NAME,
guao.`NAME` as GUARDIAN_DEPARTMENT_NAME,
guau.`NAME` as GUARDIAN_USER_NAME,
confo.`NAME` as CONFIRM_DEPARTMENT_NAME,
confu.`NAME` as CONFIRM_USER_NAME,
leao.`NAME` as LEADER_DEPARTMENT_NAME,
leau.`NAME` as LEADER_USER_NAME,
acceo.`NAME` as ACCEPT_DEPARTMENT_NAME,
acceu.`NAME` as ACCEPT_USER_NAME,
stao.`NAME` as WORK_START_DEPARTMENT_NAME,
stau.`NAME` as WORK_START_USER_NAME,
endo.`NAME` as WORK_END_DEPARTMENT_NAME,
endu.`NAME` as WORK_END_USER_NAME,
log.STEP_NAME,
log.NEXT_STEP_NAME,
log.STATUS
from
<include refid="tableName"></include> f
left join oa_department as woro on f.APPLY_DEPARTMENT_ID = woro.DEPARTMENT_ID
left join sys_user as woru on f.APPLY_USER_ID = woru.USER_ID
left join oa_department as appo on f.APPLY_DEPARTMENT_ID = appo.DEPARTMENT_ID
left join sys_user as appu on f.APPLY_USER_ID = appu.USER_ID
left join oa_department as anao on f.ANALYZE_DEPARTMENT_ID = anao.DEPARTMENT_ID
left join sys_user as anau on f.ANALYZE_USER_ID = anau.USER_ID
left join oa_department as cono on f.CONFESS_DEPARTMENT_ID = cono.DEPARTMENT_ID
left join sys_user as conu on f.CONFESS_USER_ID = conu.USER_ID
left join oa_department as acco on f.ACCEPT_CONFESS_DEPARTMENT_ID = acco.DEPARTMENT_ID
left join sys_user as accu on f.ACCEPT_CONFESS_USER_ID = accu.USER_ID
left join oa_department as guao on f.GUARDIAN_DEPARTMENT_ID = guao.DEPARTMENT_ID
left join sys_user as guau on f.GUARDIAN_USER_ID = guau.USER_ID
left join oa_department as confo on f.CONFIRM_DEPARTMENT_ID = confo.DEPARTMENT_ID
left join sys_user as confu on f.CONFIRM_USER_ID = confu.USER_ID
left join oa_department as leao on f.LEADER_DEPARTMENT_ID = leao.DEPARTMENT_ID
left join sys_user as leau on f.LEADER_USER_ID = leau.USER_ID
left join oa_department as acceo on f.ACCEPT_DEPARTMENT_ID = acceo.DEPARTMENT_ID
left join sys_user as acceu on f.ACCEPT_USER_ID = acceu.USER_ID
left join oa_department as stao on f.WORK_START_DEPARTMENT_ID = stao.DEPARTMENT_ID
left join sys_user as stau on f.WORK_START_USER_ID = stau.USER_ID
left join oa_department as endo on f.WORK_END_DEPARTMENT_ID = endo.DEPARTMENT_ID
left join sys_user as endu on f.WORK_END_USER_ID = endu.USER_ID
left join (select * from(select * from vi_eightwork_flow_log log having 1 order by log.ACT_TIME desc
) tmp group by tmp.WORK_ID) log on log.WORK_ID = f.CONFINEDSPACE_ID
where f.ISDELETE = '0'
<if test="pd.KEYWORDS != null and pd.KEYWORDS != ''"><!-- 关键词检索 -->
and f.CHECK_NO LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%')
</if>
<if test="pd.STEP_NAME != null and pd.STEP_NAME != ''"><!-- 关键词检索 -->
and exists (
select 1 from bus_confinedspace_sign sign
left join bus_eightwork_step step on step.STEP_ID = sign.STEP_ID
where sign.CONFINEDSPACE_ID = f.CONFINEDSPACE_ID
and sign.SIGN_TIME is null
and sign.SIGN_USER_ID = #{pd.USER_ID}
and step.STEP_NAME = #{pd.STEP_NAME}
and f.STEP_ID != -1
)
</if>
<if test="pd.STEP_ID != null and pd.STEP_ID != ''"><!-- 关键词检索 -->
and log.NEXT_STEP_ID = #{pd.STEP_ID} and f.STEP_ID != -1
</if>
<if test="pd.CREATOR != null and pd.CREATOR != ''"><!-- 关键词检索 -->
and f.CREATOR = #{pd.CREATOR}
</if>
<if test="pd.GASCHECK != null and pd.GASCHECK != ''"><!-- 关键词检索 -->
and f.STEP_ID &gt; 0 and f.STEP_ID != 15 and f.ANALYZE_USER_ID = #{pd.GASCHECK}
</if>
</select>
<select id="checkWorkCount" parameterType="pd" resultType="pd" >
select
step.CODE,count(1) COUNT
from
bus_confinedspace_sign sign
left join bus_eightwork_step step on step.STEP_ID = sign.STEP_ID
left join bus_confinedspace work on work.CONFINEDSPACE_ID = sign.CONFINEDSPACE_ID
where
sign.SIGN_TIME is null
and work.STEP_ID != '-1'
and
sign.SIGN_USER_ID = #{USER_ID}
group by step.CODE
</select>
<select id="listAllMeasures" resultType="pd">
select
*
from
BUS_CONFINEDSPACE_MEASURES
</select>
<select id="getFlowList" resultType="pd">
select
step.STEP_NAME,
user.NAME as ACT_USER_NAME,
log.ACT_TIME,
log.STATUS,
cu.SIGN_USER,
cu.STEP_ID as CURRENT_STEP
from
bus_eightwork_task_flow flow
left join bus_eightwork_step step on step.STEP_ID = flow.STEP_ID
left join bus_eightwork_flow_log log on log.STEP_ID = flow.STEP_ID and
log.WORK_ID = #{CONFINEDSPACE_ID}
left join sys_user user on user.USER_ID = log.ACT_USER
left join (select sign.STEP_ID,GROUP_CONCAT(signer.NAME) sign_user from bus_confinedspace_sign sign
left join sys_user signer on signer.USER_ID = sign.SIGN_USER_ID where sign.CONFINEDSPACE_ID = #{CONFINEDSPACE_ID}
and sign.SIGN_TIME is null) cu on cu.STEP_ID = step.STEP_ID
where
flow.TASK_ID = #{TASK_ID}
and
flow.STEP_ID != 0
order by
flow.ORDER_BY
</select>
</mapper>

View File

@ -0,0 +1,140 @@
<?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.ConfinedspaceSignMapper">
<!--表名 -->
<sql id="tableName">
BUS_CONFINEDSPACE_SIGN
</sql>
<!--数据字典表名 -->
<sql id="dicTableName">
SYS_DICTIONARIES
</sql>
<!-- 字段 -->
<sql id="Field">
f.Confinedspace_SIGN_ID,
f.CONFINEDSPACE_ID,
f.CORPINFO_ID,
f.SIGN_USER_ID,
f.SIGN_PATH,
f.SIGN_TIME,
f.DESCR,
f.STEP_ID,
f.IMG_PATH
</sql>
<!-- 字段用于新增 -->
<sql id="Field2">
CONFINEDSPACE_SIGN_ID,
CONFINEDSPACE_ID,
CORPINFO_ID,
SIGN_USER_ID,
SIGN_PATH,
SIGN_TIME,
DESCR,
STEP_ID,
IMG_PATH
</sql>
<!-- 字段值 -->
<sql id="FieldValue">
#{CONFINEDSPACE_SIGN_ID},
#{CONFINEDSPACE_ID},
#{CORPINFO_ID},
#{SIGN_USER_ID},
#{SIGN_PATH},
#{SIGN_TIME},
#{DESCR},
#{STEP_ID},
#{IMG_PATH}
</sql>
<!-- 新增-->
<insert id="save" parameterType="pd">
insert into
<include refid="tableName"></include>
(
<include refid="Field2"></include>
) values (
<include refid="FieldValue"></include>
)
</insert>
<insert id="saveBatch" parameterType="pd">
insert into
<include refid="tableName"></include>
(
CONFINEDSPACE_SIGN_ID,
CONFINEDSPACE_ID,
CORPINFO_ID,
SIGN_USER_ID,
STEP_ID
) values
<foreach collection="list" item="item" index="index" separator="," >
(#{item.CONFINEDSPACE_SIGN_ID},
#{item.CONFINEDSPACE_ID},
#{item.CORPINFO_ID},
#{item.SIGN_USER_ID},
#{item.STEP_ID})
</foreach>
</insert>
<!-- 修改 -->
<update id="edit" parameterType="pd">
update
<include refid="tableName"></include>
set
DESCR = #{DESCR},
SIGN_PATH = #{SIGN_PATH},
SIGN_TIME= #{SIGN_TIME},
IMG_PATH = #{IMG_PATH}
where
CONFINEDSPACE_ID = #{CONFINEDSPACE_ID} and SIGN_USER_ID = #{SIGN_USER_ID} and STEP_ID = #{STEP_ID}
</update>
<select id="listById" parameterType="pd" resultType="pd">
select
<include refid="Field"></include>
from
<include refid="tableName"></include> f
where
f.CONFINEDSPACE_ID = #{pd.CONFINEDSPACE_ID}
order by f.SIGN_TIME desc
</select>
<select id="listAll" parameterType="pd" resultType="pd">
select
f.CONFINEDSPACE_SIGN_ID,
f.CONFINEDSPACE_ID,
f.CORPINFO_ID,
f.SIGN_USER_ID,
f.SIGN_PATH,
f.SIGN_TIME,
f.STEP_ID,
f.IMG_PATH,
IFNULL(f.DESCR,'无') as DESCR,
step.CODE
from
<include refid="tableName"></include> f
left join bus_eightwork_step step on step.STEP_ID = f.STEP_ID
where
f.CONFINEDSPACE_ID = #{CONFINEDSPACE_ID}
and
f.SIGN_TIME is not null
</select>
<select id="checkUnsigned" parameterType="pd" resultType="pd">
select
<include refid="Field"></include>
from
<include refid="tableName"></include> f
where
f.CONFINEDSPACE_ID = #{CONFINEDSPACE_ID}
and
f.SIGN_TIME is null
</select>
</mapper>

View File

@ -0,0 +1,154 @@
<?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.ConfinedspaceToMeasuresMapper">
<!--表名 -->
<sql id="tableName">
BUS_CONFINEDSPACETOMEASURES
</sql>
<!--数据字典表名 -->
<sql id="dicTableName">
SYS_DICTIONARIES
</sql>
<!-- 字段 -->
<sql id="Field">
f.CONFINEDSPACE_ID,
f.BUS_CONFINEDSPACE_MEASURES_ID,
f.STATUS,
f.CONFINEDSPACETOMEASURES_ID,
f.CONFIRM_ID,
f.SIGN_PATH,
f.SIGN_TIME,
f.IMG_PATH
</sql>
<!-- 字段用于新增 -->
<sql id="Field2">
CONFINEDSPACE_ID,
BUS_CONFINEDSPACE_MEASURES_ID,
STATUS,
CONFINEDSPACETOMEASURES_ID,
CONFIRM_ID,
SIGN_PATH,
IMG_PATH
</sql>
<!-- 字段值 -->
<sql id="FieldValue">
#{CONFINEDSPACE_ID},
#{BUS_CONFINEDSPACE_MEASURES_ID},
#{STATUS},
#{CONFINEDSPACETOMEASURES_ID},
#{CONFIRM_ID},
#{SIGN_PATH},
#{IMG_PATH}
</sql>
<!-- 新增-->
<insert id="save" parameterType="pd">
insert into
<include refid="tableName"></include>
(
<include refid="Field2"></include>
) values (
<include refid="FieldValue"></include>
)
</insert>
<insert id="saveBatch" parameterType="pd">
insert into
<include refid="tableName"></include>
(
CONFINEDSPACE_ID,
BUS_CONFINEDSPACE_MEASURES_ID,
CONFINEDSPACETOMEASURES_ID,
CONFIRM_ID
) values
<foreach collection="list" item="item" index="index" separator="," >
(
#{item.CONFINEDSPACE_ID},
#{item.BUS_CONFINEDSPACE_MEASURES_ID},
#{item.CONFINEDSPACETOMEASURES_ID},
#{item.CONFIRM_ID}
)
</foreach>
</insert>
<!-- 删除-->
<delete id="delete" parameterType="pd">
delete from
<include refid="tableName"></include>
where
CONFINEDSPACE_ID = #{CONFINEDSPACE_ID}
</delete>
<!-- 修改 -->
<update id="edit" parameterType="pd">
update
<include refid="tableName"></include>
set
STATUS = #{STATUS},
SIGN_PATH = #{SIGN_PATH},
IMG_PATH = #{IMG_PATH},
SIGN_TIME = #{SIGN_TIME}
where
CONFINEDSPACETOMEASURES_ID = #{CONFINEDSPACETOMEASURES_ID}
</update>
<!-- 通过ID获取数据 -->
<select id="findById" parameterType="pd" resultType="pd">
select
<include refid="Field"></include>
from
<include refid="tableName"></include> f
where
f.CONFINEDSPACETOMEASURES_ID = #{CONFINEDSPACETOMEASURES_ID}
</select>
<!-- 列表(全部) -->
<select id="listAll" parameterType="pd" resultType="pd">
select
<include refid="Field"></include>
from
<include refid="tableName"></include> f
</select>
<!-- 批量删除 -->
<delete id="deleteAll" parameterType="String">
update
<include refid="tableName"></include>
set
ISDELETE = '1'
where
CONFINEDSPACETOMEASURES_ID in
<foreach item="item" index="index" collection="ArrayDATA_IDS" open="(" separator="," close=")">
#{item}
</foreach>
</delete>
<select id="listAllMeasuresForSign" parameterType="pd" resultType="pd">
select
f.CONFINEDSPACETOMEASURES_ID,
m.*
from
<include refid="tableName"></include> f
left join bus_confinedspace_measures m on f.BUS_CONFINEDSPACE_MEASURES_ID = m.BUS_CONFINEDSPACE_MEASURES_ID
where
f.CONFINEDSPACE_ID = #{CONFINEDSPACE_ID} and f.CONFIRM_ID = #{CONFIRM_ID}
</select>
<select id="listSignFinishMeasures" parameterType="pd" resultType="pd">
select
<include refid="Field"></include>,
m.*
from
<include refid="tableName"></include> f
left join bus_confinedspace_measures m on f.BUS_CONFINEDSPACE_MEASURES_ID = m.BUS_CONFINEDSPACE_MEASURES_ID
where
f.CONFINEDSPACE_ID = #{CONFINEDSPACE_ID}
</select>
</mapper>