diff --git a/src/main/java/com/zcloud/controller/eightwork/AppEightWorkController.java b/src/main/java/com/zcloud/controller/eightwork/AppEightWorkController.java index 1875d5c..e3ba483 100644 --- a/src/main/java/com/zcloud/controller/eightwork/AppEightWorkController.java +++ b/src/main/java/com/zcloud/controller/eightwork/AppEightWorkController.java @@ -9,6 +9,7 @@ import com.zcloud.entity.Response; import com.zcloud.logs.LogAnno; import com.zcloud.service.eightwork.EightWorkService; import com.zcloud.service.system.DictionariesService; +import com.zcloud.service.system.UsersService; import com.zcloud.util.*; import org.apache.commons.lang.StringUtils; import org.apache.fop.util.DataURLUtil; @@ -30,29 +31,8 @@ public class AppEightWorkController extends BaseController { private EightWorkService eightWorkService; @Autowired private DictionariesService dictionariesService; - - /**八项作业列表 - * @param page - * @throws Exception - */ - @RequestMapping(value="/list") - @ResponseBody - @LogAnno(menuType= "手机",menuServer= "八项作业",instructionsOperate = "八项作业",instructionsType = "列表") - 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()); - page.setPd(pd); - List varList = eightWorkService.list(page); //列出confinedspace列表 - map.put("varList", varList); -// map.put("page", page); - map.put("result", errInfo); - return map; - } + @Autowired + private UsersService usersService; /** * description: @@ -160,4 +140,22 @@ public class AppEightWorkController extends BaseController { } return ReturnMap.error("查询失败"); } + + /**获取动火作业流程 + * @param + * @throws Exception + */ + @RequestMapping(value="/isInPls") + @ResponseBody + public Object isInPls() throws Exception{ + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = new PageData(); + pd = this.getPageData(); + PageData user = usersService.findById(pd); + map.put("flag", PLSUtil.determineWhetherThePersonIsInTheElectronicFence(pd.getString("CORPINFO_ID"),Integer.parseInt(user.getString("PLS_ID")),pd.getString("PLS_ID"))); + map.put("result", errInfo); //返回结果 + return map; + } + } diff --git a/src/main/java/com/zcloud/controller/eightwork/AppHotworkController.java b/src/main/java/com/zcloud/controller/eightwork/AppHotworkController.java index 1257544..76e3f74 100644 --- a/src/main/java/com/zcloud/controller/eightwork/AppHotworkController.java +++ b/src/main/java/com/zcloud/controller/eightwork/AppHotworkController.java @@ -303,5 +303,4 @@ public class AppHotworkController extends BaseController { map.put("result", errInfo); //返回结果 return map; } - } diff --git a/src/main/java/com/zcloud/controller/eightwork/HotworkController.java b/src/main/java/com/zcloud/controller/eightwork/HotworkController.java new file mode 100644 index 0000000..17f6e9d --- /dev/null +++ b/src/main/java/com/zcloud/controller/eightwork/HotworkController.java @@ -0,0 +1,99 @@ +package com.zcloud.controller.eightwork; + +import com.alibaba.fastjson.JSONObject; +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.HotworkGasService; +import com.zcloud.service.eightwork.HotworkService; +import com.zcloud.util.Jurisdiction; +import com.zcloud.util.PLSUtil; +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("/hotwork") +public class HotworkController extends BaseController { + + @Autowired + private HotworkService hotworkService; + @Autowired + private HotworkGasService hotworkGasService; + + /**列表 + * @param page + * @throws Exception + */ + @RequestMapping(value="/list") + @ResponseBody + @LogAnno(menuType= "高危作业管理",menuServer= "动火作业",instructionsOperate = "动火作业",instructionsType = "列表") + 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()); + page.setPd(pd); + List varList = hotworkService.list(page); //列出hotwork列表 + map.put("varList", varList); + map.put("page", page); + map.put("result", errInfo); + + return map; + } + + /**获取动火作业流程 + * @param + * @throws Exception + */ + @RequestMapping(value="/getFlowList") + @ResponseBody + @LogAnno(menuType= "高危作业管理",menuServer= "动火作业",instructionsOperate = "动火作业",instructionsType = "获取动火作业流程") + public Object getFlowList() throws Exception{ + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = new PageData(); + pd = this.getPageData(); + List flowList = hotworkService.getFlowList(pd); + map.put("flowList", flowList); + map.put("result", errInfo); //返回结果 + return map; + } + + @RequestMapping("/findById") + @ResponseBody + @LogAnno(menuType= "高危作业管理",menuServer= "动火作业",instructionsOperate = "动火作业",instructionsType = "获取详情") + public Object findById() throws Exception { + Map map = new HashMap<>(); + String errInfo = "success"; + PageData pd = new PageData(); + pd = this.getPageData(); + pd = hotworkService.findById(pd); + PageData signs = hotworkService.listSignFinished(pd); + List finishMeasuresList = hotworkService.listSignFinishMeasures(pd); + map.put("gasList", hotworkGasService.listAll(pd)); + map.put("measuresList",finishMeasuresList); + map.put("signs",signs); + map.put("pd",pd); + map.put("result",errInfo); + return map; + } + +} diff --git a/src/main/java/com/zcloud/controller/mapApi/MapController.java b/src/main/java/com/zcloud/controller/mapApi/MapController.java index 043ad75..8b2c467 100644 --- a/src/main/java/com/zcloud/controller/mapApi/MapController.java +++ b/src/main/java/com/zcloud/controller/mapApi/MapController.java @@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject; import com.zcloud.controller.base.BaseController; import com.zcloud.entity.Page; import com.zcloud.entity.PageData; +import com.zcloud.service.eightwork.EightWorkService; import com.zcloud.service.system.UsersService; import com.zcloud.service.video.VideoManagerService; import com.zcloud.util.DateUtil; @@ -30,6 +31,8 @@ public class MapController extends BaseController { @Autowired private UsersService usersService; @Autowired + private EightWorkService eightWorkService; + @Autowired private VideoManagerService videomanagerService; // ----------人员定位相关-------------// @@ -76,6 +79,28 @@ public class MapController extends BaseController { JSONObject personnelPositioningCount = PLSUtil.getPersonnelPositioningCount(Jurisdiction.getCORPINFO_ID(), page.getCurrentPage(), page.getShowCount()); return ReturnMap.ok().put("data", personnelPositioningCount); } + + /** + * @Description: 当前在线人员实时位置信息 + * @Param: [] [] + * @Return: com.zcloud.util.ReturnMap + */ + @RequestMapping(value = "/getRealTimeList") + @ResponseBody + public ReturnMap getRealTimeList() throws Exception { + return ReturnMap.ok().put("data", PLSUtil.getRealTimeList(Jurisdiction.getCORPINFO_ID())); + } + + /** + * @Description: 获取八项作业数 + * @Param: [] [] + * @Return: com.zcloud.util.ReturnMap + */ + @RequestMapping(value = "/getEightWorks") + @ResponseBody + public ReturnMap getEightWorks() throws Exception { + return eightWorkService.getEightWorks(); + } // ----------摄像头相关-------------// // 摄像头告警数 disposed diff --git a/src/main/java/com/zcloud/controller/system/LoginController.java b/src/main/java/com/zcloud/controller/system/LoginController.java index f627c64..f194aab 100644 --- a/src/main/java/com/zcloud/controller/system/LoginController.java +++ b/src/main/java/com/zcloud/controller/system/LoginController.java @@ -124,18 +124,19 @@ public class LoginController extends BaseController { PageData cpd = corpinfoService.findById(pd); // if (pd != null && pd.get("RIGHTS") != null && Tools.notEmpty(pd.get("RIGHTS").toString()) // && "788664966448".equals(pd.get("RIGHTS").toString())) { - map.put("USERNAME", USERNAME); - map.put("USER_ID", pd.getString("USER_ID")); - map.put("NAME", pd.getString("NAME")); - map.put("ISMAIN", pd.getString("ISMAIN")); - map.put("IS_SAFETY", pd.get("IS_SAFETY")); - map.put("ISHEAD", pd.getString("ISHEAD")); - map.put("ISLEADER", pd.getString("ISLEADER")); - map.put("DEPARTMENT_ID", pd.getString("DEPARTMENT_ID")); - map.put("CORPINFO_ID", pd.getString("CORPINFO_ID")); - map.put("CORP_NAME", cpd.getString("CORP_NAME")); - map.put("PROVINCE", cpd.getString("PROVINCE")); - map.put("PLS_ID", pd.getOrDefault("PLS_ID","")); + map.put("USERNAME", USERNAME); + map.put("USER_ID", pd.getString("USER_ID")); + map.put("NAME", pd.getString("NAME")); + map.put("ISMAIN", pd.getString("ISMAIN")); + map.put("IS_SAFETY", pd.get("IS_SAFETY")); + map.put("ISHEAD", pd.getString("ISHEAD")); + map.put("ISLEADER", pd.getString("ISLEADER")); + map.put("DEPARTMENT_ID", pd.getString("DEPARTMENT_ID")); + map.put("CORPINFO_ID", pd.getString("CORPINFO_ID")); + map.put("CORP_NAME", cpd.getString("CORP_NAME")); + map.put("PROVINCE", cpd.getString("PROVINCE")); + map.put("PLS_ID", pd.getOrDefault("PLS_ID","")); + map.put("POST_URL", cpd.getOrDefault("POST_URL","")); // PageData dpd = new PageData(); // dpd.put("DEPARTMENT_ID", pd.getString("DEPARTMENT_ID")); // dpd=departmentService.findById(dpd); diff --git a/src/main/java/com/zcloud/mapper/datasource/eightwork/EightWorkMapper.java b/src/main/java/com/zcloud/mapper/datasource/eightwork/EightWorkMapper.java index 77095f3..8e1e6c0 100644 --- a/src/main/java/com/zcloud/mapper/datasource/eightwork/EightWorkMapper.java +++ b/src/main/java/com/zcloud/mapper/datasource/eightwork/EightWorkMapper.java @@ -13,13 +13,6 @@ import java.util.List; */ public interface EightWorkMapper { - - - /**列表 - * @param page - * @throws Exception - */ - List datalist(Page page); - + List getEightWorks(PageData corp); } diff --git a/src/main/java/com/zcloud/service/eightwork/EightWorkService.java b/src/main/java/com/zcloud/service/eightwork/EightWorkService.java index 9f30af1..f693764 100644 --- a/src/main/java/com/zcloud/service/eightwork/EightWorkService.java +++ b/src/main/java/com/zcloud/service/eightwork/EightWorkService.java @@ -2,6 +2,7 @@ package com.zcloud.service.eightwork; import com.zcloud.entity.Page; import com.zcloud.entity.PageData; +import com.zcloud.util.ReturnMap; import java.util.List; @@ -13,9 +14,5 @@ public interface EightWorkService { public List getTaskSetps(PageData pd); PageData checkWork(PageData pd); - /**列表 - * @param page - * @throws Exception - */ - public List list(Page page)throws Exception; + ReturnMap getEightWorks()throws Exception; } diff --git a/src/main/java/com/zcloud/service/eightwork/impl/EightWorkServiceImpl.java b/src/main/java/com/zcloud/service/eightwork/impl/EightWorkServiceImpl.java index 4e61b63..e7f0e65 100644 --- a/src/main/java/com/zcloud/service/eightwork/impl/EightWorkServiceImpl.java +++ b/src/main/java/com/zcloud/service/eightwork/impl/EightWorkServiceImpl.java @@ -4,12 +4,16 @@ import com.zcloud.entity.Page; import com.zcloud.entity.PageData; import com.zcloud.mapper.datasource.eightwork.*; import com.zcloud.service.eightwork.EightWorkService; +import com.zcloud.util.Jurisdiction; +import com.zcloud.util.ReturnMap; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.zcloud.mapper.datasource.eightwork.EightWorkMapper; -import java.util.List; +import java.time.YearMonth; +import java.time.format.DateTimeFormatter; +import java.util.*; /** * @author fangjiakai @@ -36,12 +40,57 @@ public class EightWorkServiceImpl implements EightWorkService { return eightWorkTaskMapper.checkWorkCount(pd); } - /**列表 - * @param page - * @throws Exception - */ - public List list(Page page)throws Exception{ - return eightworkMapper.datalist(page); + public ReturnMap getEightWorks()throws Exception{ + ReturnMap returnMap = new ReturnMap(); + + // 循环获取最近6个月的年份和月份,并格式化为"YYYY-MM"格式 + TreeMap> monthMap = new TreeMap<>(); + YearMonth currentYearMonth = YearMonth.now(); + for (int i = 5; i >= 0; i--) { + YearMonth yearMonth = currentYearMonth.minusMonths(i); + String formattedDate = yearMonth.format(DateTimeFormatter.ofPattern("yyyy-MM")); + monthMap.computeIfAbsent(formattedDate, k -> new ArrayList()); + } + + //统计数 + Map> staMap = new HashMap<>(); + staMap.put("total", new ArrayList<>()); + staMap.put("flowing", new ArrayList<>()); + staMap.put("finished", new ArrayList<>()); + + PageData corp = new PageData(); + corp.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); + List eightworks = eightworkMapper.getEightWorks(corp); + if(eightworks != null && eightworks.size() > 0){ + eightworks.stream().forEach(e -> { + staMap.get("total").add(e); + if(e.getString("NEXT_STEP_ID").equals("99")){ + staMap.get("finished").add(e); + }else if(!e.getString("STATUS").equals("-1") && Integer.parseInt(e.getString("NEXT_STEP_ID")) > 1){ + staMap.get("flowing").add(e); + } + + if(monthMap.containsKey(e.getString("WORK_MONTH"))){ + monthMap.get(e.getString("WORK_MONTH")).add(e); + } + + }); + } + + TreeMap monthMapCount = new TreeMap<>(); + monthMap.forEach((k, v) -> { + monthMapCount.put(k, v.size()); + }); + + Map staMapCount = new HashMap<>(); + staMap.forEach((k, v) -> { + staMapCount.put(k, v.size()); + }); + + returnMap.put("eightworks", eightworks); + returnMap.put("staMapCount", staMapCount); + returnMap.put("monthMapCount", monthMapCount); + return returnMap; } } diff --git a/src/main/java/com/zcloud/util/PLSUtil.java b/src/main/java/com/zcloud/util/PLSUtil.java index b33417f..c979f6c 100644 --- a/src/main/java/com/zcloud/util/PLSUtil.java +++ b/src/main/java/com/zcloud/util/PLSUtil.java @@ -162,6 +162,35 @@ public class PLSUtil { return exchange.getBody(); } + /** + * @Description: 电子围栏详情 + * @Param: [java.lang.String, java.lang.Integer] [CORPINFO_ID, id] + * @Return: com.alibaba.fastjson.JSONObject + */ + public static JSONObject getRyRegionInfo(String CORPINFO_ID, int id) throws Exception { + HttpHeaders headers = new HttpHeaders(); + + headers.set("Authorization", getToken(CORPINFO_ID)); + HttpEntity httpEntity = new HttpEntity<>(headers); + ResponseEntity exchange = restTemplate.exchange(PLSUtil.BAKEADDR.get(CORPINFO_ID) + "/region/region/" + + id, HttpMethod.GET, httpEntity, JSONObject.class); + return exchange.getBody(); + } + + /** + * @Description: 当前在线人员实时位置信息 + * @Date: 2024/1/25/025 14:37 + * @Return: com.alibaba.fastjson.JSONObject + */ + public static JSONObject getRealTimeList(String CORPINFO_ID) throws Exception { + HttpHeaders headers = new HttpHeaders(); + + headers.set("Authorization", getToken(CORPINFO_ID)); + HttpEntity httpEntity = new HttpEntity<>(headers); + ResponseEntity exchange = restTemplate.exchange(PLSUtil.BAKEADDR.get(CORPINFO_ID) + "/api/prod-api/coordinate/realTime/data", HttpMethod.GET, httpEntity, JSONObject.class); + return exchange.getBody(); + } + /** * @Description: 根据定位卡号获取人是否再电子围栏里 * @Author: dearLin diff --git a/src/main/resources/mybatis/datasource/corp/CorpInfoMapper.xml b/src/main/resources/mybatis/datasource/corp/CorpInfoMapper.xml index e5c2e3a..9650d4b 100644 --- a/src/main/resources/mybatis/datasource/corp/CorpInfoMapper.xml +++ b/src/main/resources/mybatis/datasource/corp/CorpInfoMapper.xml @@ -364,6 +364,7 @@ abl.NAME AQ_BZ_LEVEL_NAME, dicT.NAME as TRAINTYPE_NAME, b.ISSTOP, + pls.POST_URL, ( SELECT DATEDIFF( @@ -387,6 +388,7 @@ LEFT JOIN SYS_DICTIONARIES abl on abl.DICTIONARIES_ID = r.AQ_BZ_LEVEL left join SYS_DICTIONARIES dicT on dicT.DICTIONARIES_ID = f.TRAINTYPE left join BUS_CORPTYPE t on t.CORPTYPE_ID = f.REGULARTYPE and t.ISDELETE = '0' + left join bus_corp_pls_info pls on pls.CORPINFO_ID = f.CORPINFO_ID where f.CORPINFO_ID = #{CORPINFO_ID} diff --git a/src/main/resources/mybatis/datasource/eightwork/EightWorkMapper.xml b/src/main/resources/mybatis/datasource/eightwork/EightWorkMapper.xml index a7b170e..66350ac 100644 --- a/src/main/resources/mybatis/datasource/eightwork/EightWorkMapper.xml +++ b/src/main/resources/mybatis/datasource/eightwork/EightWorkMapper.xml @@ -2,56 +2,16 @@ - - + SELECT + *, + DATE_FORMAT(tmp.ACT_TIME,'%Y-%m') WORK_MONTH + FROM + ( SELECT * FROM vi_eightwork_flow_log log + where log.CORPINFO_ID=#{CORPINFO_ID} HAVING 1 ORDER BY log.ACT_TIME DESC ) tmp + GROUP BY + tmp.WORK_ID + order by tmp.ACT_TIME DESC - diff --git a/src/main/resources/mybatis/datasource/eightwork/HotWorkMapper.xml b/src/main/resources/mybatis/datasource/eightwork/HotWorkMapper.xml index 5d5f183..ae60224 100644 --- a/src/main/resources/mybatis/datasource/eightwork/HotWorkMapper.xml +++ b/src/main/resources/mybatis/datasource/eightwork/HotWorkMapper.xml @@ -427,6 +427,7 @@ endo.`NAME` as WORK_END_DEPARTMENT_NAME, endu.`NAME` as WORK_END_USER_NAME, log.STEP_NAME, + log.NEXT_STEP_ID, log.NEXT_STEP_NAME, log.STATUS from @@ -476,6 +477,9 @@ and f.CHECK_NO LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%') + + and f.CORPINFO_ID = #{pd.CORPINFO_ID} + and exists ( select 1 from bus_hotwork_sign sign diff --git a/src/main/resources/mybatis/datasource/speEquip/SpecialEquipmentMapper.xml b/src/main/resources/mybatis/datasource/speEquip/SpecialEquipmentMapper.xml index 6a2fffd..06d163a 100644 --- a/src/main/resources/mybatis/datasource/speEquip/SpecialEquipmentMapper.xml +++ b/src/main/resources/mybatis/datasource/speEquip/SpecialEquipmentMapper.xml @@ -153,6 +153,7 @@ select d5.NAME EQUIPMENTTYPENAME, d6.NAME EQUIPMENTSTATENAME, + d7.NAME PERIOD_NAME, d.NAME RESPONSIBLEUNITNAME, u.NAME PERSONCHARGENAME, @@ -160,10 +161,13 @@ f left join d5 - on f.EQUIPMENTTYPE = d5.BIANMA and d5.parent_id = 'cffb3d28d48548328ddd78976610b05d' + on f.EQUIPMENTTYPE = d5.BIANMA left join d6 - on f.EQUIPMENTSTATE = d6.BIANMA and d6.parent_id = '0feb448f975e422fafbf5db20c0b85c9' + on f.EQUIPMENTSTATE = d6.BIANMA + left join + d7 + on f.PERIOD = d7.BIANMA left join OA_DEPARTMENT d on f.RESPONSIBLEUNIT = d.DEPARTMENT_ID left join SYS_USER u on f.PERSONCHARGE = u.USER_ID where diff --git a/src/main/resources/mybatis/datasource/system/UsersMapper.xml b/src/main/resources/mybatis/datasource/system/UsersMapper.xml index 3fb259c..0250045 100644 --- a/src/main/resources/mybatis/datasource/system/UsersMapper.xml +++ b/src/main/resources/mybatis/datasource/system/UsersMapper.xml @@ -1404,6 +1404,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" left join SYS_ROLE r on u.ROLE_ID = r.ROLE_ID left join OA_DEPARTMENT d on d.DEPARTMENT_ID=u.DEPARTMENT_ID left join SYS_POST p on p.POST_ID=u.POST_ID + where u.CARDNO = #{CARDNO} and u.ISDELETE = 0 and u.CORPINFO_ID = #{CORPINFO_ID}