八项作业地图统计

pull/4/head
fangjiakai 2024-01-30 10:38:22 +08:00
parent 336ccfa0c5
commit bc49136400
14 changed files with 269 additions and 108 deletions

View File

@ -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<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());
// pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID());
page.setPd(pd);
List<PageData> 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<String,Object> map = new HashMap<String,Object>();
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;
}
}

View File

@ -303,5 +303,4 @@ public class AppHotworkController extends BaseController {
map.put("result", errInfo); //返回结果
return map;
}
}

View File

@ -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<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());
pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID());
page.setPd(pd);
List<PageData> 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<String,Object> map = new HashMap<String,Object>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
List<PageData> 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<String,Object> map = new HashMap<>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
pd = hotworkService.findById(pd);
PageData signs = hotworkService.listSignFinished(pd);
List<PageData> 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;
}
}

View File

@ -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

View File

@ -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);

View File

@ -13,13 +13,6 @@ import java.util.List;
*/
public interface EightWorkMapper {
/**
* @param page
* @throws Exception
*/
List<PageData> datalist(Page page);
List<PageData> getEightWorks(PageData corp);
}

View File

@ -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<PageData> getTaskSetps(PageData pd);
PageData checkWork(PageData pd);
/**
* @param page
* @throws Exception
*/
public List<PageData> list(Page page)throws Exception;
ReturnMap getEightWorks()throws Exception;
}

View File

@ -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<PageData> list(Page page)throws Exception{
return eightworkMapper.datalist(page);
public ReturnMap getEightWorks()throws Exception{
ReturnMap returnMap = new ReturnMap();
// 循环获取最近6个月的年份和月份并格式化为"YYYY-MM"格式
TreeMap<String, List<PageData>> 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<PageData>());
}
//统计数
Map<String, List<PageData>> 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<PageData> 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<String, Integer> monthMapCount = new TreeMap<>();
monthMap.forEach((k, v) -> {
monthMapCount.put(k, v.size());
});
Map<String, Integer> 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;
}
}

View File

@ -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<JSONObject> httpEntity = new HttpEntity<>(headers);
ResponseEntity<JSONObject> 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<JSONObject> httpEntity = new HttpEntity<>(headers);
ResponseEntity<JSONObject> 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

View File

@ -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}
</select>

View File

@ -2,56 +2,16 @@
<!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.EightWorkMapper">
<!-- 列表 -->
<select id="datalist" parameterType="page" resultType="pd">
select
CONCAT_WS(" ","受限空间作业",f.CHECK_NO) as CHECK_NO,f.CONFINEDSPACE_ID as ID
from
bus_confinedspace f
where f.ISDELETE = '0' and f.STEP_ID &gt; 0 and f.STEP_ID &lt; 15 and f.CORPINFO_ID = #{pd.CORPINFO_ID}
union
<!-- select
CONCAT_WS(" ","盲板抽堵作业",b.CHECK_NO) as CHECK_NO,b.BLINDBOARD_ID as ID
from
bus_blindboard b
where b.CORPINFO_ID = #{pd.CORPINFO_ID} and b.STEP_ID &gt; 0 and b.STEP_ID &lt; 15 and b.ISDELETE = '0'
union
select
CONCAT_WS(" ","临时用电作业",e.CHECK_NO) as CHECK_NO,e.ELECTRICITY_ID as ID
from
bus_electricity e
where e.CORPINFO_ID = #{pd.CORPINFO_ID} and e.STEP_ID &gt; 0 and e.STEP_ID &lt; 15 and e.ISDELETE = '0'
union
select
CONCAT_WS(" ","吊装作业",g.CHECK_NO) as CHECK_NO,g.HOISTING_ID as ID
from
bus_hoisting g
where g.CORPINFO_ID = #{pd.CORPINFO_ID} and g.STEP_ID &gt; 0 and g.STEP_ID &lt; 15 and g.ISDELETE = '0'
union
select
CONCAT_WS(" ","动土作业",a.CHECK_NO) as CHECK_NO ,a.BREAKGROUND_ID as ID
from
bus_breakground a
where a.CORPINFO_ID = #{pd.CORPINFO_ID} and a.STEP_ID &gt; 0 and a.STEP_ID &lt; 15 and a.ISDELETE = '0'
union
select
CONCAT_WS(" ","断路作业",d.CHECK_NO) as CHECK_NO,d.CUTROAD_ID as ID
from
bus_cutroad d
where d.CORPINFO_ID = #{pd.CORPINFO_ID} and d.STEP_ID &gt; 0 and d.STEP_ID &lt; 15 and d.ISDELETE = '0'
union
select
CONCAT_WS(" ","高处作业",w.CHECK_NO) as CHECK_NO,w.HIGHWORK_ID as ID
from
bus_highwork w
where w.CORPINFO_ID = #{pd.CORPINFO_ID} and w.STEP_ID &gt; 0 and w.STEP_ID &lt; 15 and w.ISDELETE = '0'
union -->
select
CONCAT_WS(" ","动火作业",h.CHECK_NO) as CHECK_NO,h.HOTWORK_ID as ID
from
bus_hotwork h
where h.CORPINFO_ID = #{pd.CORPINFO_ID} and h.STEP_ID &gt; 0 and h.STEP_ID &lt; 15 and h.ISDELETE = '0'
<select id="getEightWorks" resultType="pd">
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
</select>
</mapper>

View File

@ -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 @@
<if test="pd.KEYWORDS != null and pd.KEYWORDS != ''"><!-- 关键词检索 -->
and f.CHECK_NO LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%')
</if>
<if test="pd.CORPINFO_ID != null and pd.CORPINFO_ID != ''"><!-- 关键词检索 -->
and f.CORPINFO_ID = #{pd.CORPINFO_ID}
</if>
<if test="pd.STEP_NAME != null and pd.STEP_NAME != ''"><!-- 关键词检索 -->
and exists (
select 1 from bus_hotwork_sign sign

View File

@ -153,6 +153,7 @@
select
d5.NAME EQUIPMENTTYPENAME,
d6.NAME EQUIPMENTSTATENAME,
d7.NAME PERIOD_NAME,
d.NAME RESPONSIBLEUNITNAME,
u.NAME PERSONCHARGENAME,
<include refid="Field"></include>
@ -160,10 +161,13 @@
<include refid="tableName"></include> f
left join
<include refid="dicTableName"></include> d5
on f.EQUIPMENTTYPE = d5.BIANMA and d5.parent_id = 'cffb3d28d48548328ddd78976610b05d'
on f.EQUIPMENTTYPE = d5.BIANMA
left join
<include refid="dicTableName"></include> d6
on f.EQUIPMENTSTATE = d6.BIANMA and d6.parent_id = '0feb448f975e422fafbf5db20c0b85c9'
on f.EQUIPMENTSTATE = d6.BIANMA
left join
<include refid="dicTableName"></include> 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

View File

@ -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
<if test="CORPINFO_ID != null and CORPINFO_ID != ''">
and u.CORPINFO_ID = #{CORPINFO_ID}