From 91ce11d64a53e59115db6aea2cb67325bacaf338 Mon Sep 17 00:00:00 2001 From: fangjiakai <450850793@qq.com> Date: Mon, 26 Feb 2024 10:34:55 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A8=E7=81=AB=E5=A2=9E=E5=8A=A0=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E9=80=9A=E7=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/mapApi/MapController.java | 26 ++- .../message/MessageTemplatesMapper.java | 2 +- .../eightwork/impl/HotworkServiceImpl.java | 70 +++++++- src/main/java/com/zcloud/util/PLSUtil.java | 53 ++++++ .../java/com/zcloud/util/SendMessageUtil.java | 154 +++++++++--------- .../zcloud/util/message/MessagePublic.java | 2 +- .../util/message/imp/MessageServiceImpl.java | 4 +- .../eightwork/EightWorkTaskFlowMapper.xml | 2 + .../system}/MessageTemplatesMapper.xml | 2 +- 9 files changed, 231 insertions(+), 84 deletions(-) rename src/main/java/com/zcloud/mapper/{dsno2 => datasource}/message/MessageTemplatesMapper.java (94%) rename src/main/resources/mybatis/{dsno2/Message => datasource/system}/MessageTemplatesMapper.xml (97%) diff --git a/src/main/java/com/zcloud/controller/mapApi/MapController.java b/src/main/java/com/zcloud/controller/mapApi/MapController.java index 48ac4b6..3628b57 100644 --- a/src/main/java/com/zcloud/controller/mapApi/MapController.java +++ b/src/main/java/com/zcloud/controller/mapApi/MapController.java @@ -129,7 +129,7 @@ public class MapController extends BaseController { @RequestMapping(value = "/getFenceList") @ResponseBody public ReturnMap getFenceList() throws Exception { - return ReturnMap.ok().put("data", PLSUtil.getRyRegionList(Jurisdiction.getCORPINFO_ID(),"",1,999999)); + return ReturnMap.ok().put("data", PLSUtil.getAreaRegionList(Jurisdiction.getCORPINFO_ID(),1,999999)); } /** @@ -250,6 +250,30 @@ public class MapController extends BaseController { int cameraCount = usersService.getUserCount(pageData); return ReturnMap.ok().put("cameraCount", cameraCount); } + + /** + * @Description: 获取轨迹 + * @Param: [] [] + * @Return: com.zcloud.util.ReturnMap + */ + @RequestMapping(value = "/getCharacterTrajectories") + @ResponseBody + public ReturnMap getCharacterTrajectories() throws Exception { + PageData pageData = getPageData(); + return ReturnMap.ok().put("data", PLSUtil.characterTrajectories(Jurisdiction.getCORPINFO_ID(),Integer.parseInt(pageData.getString("id")), + pageData.getString("startTime"),pageData.getString("endTime"),Integer.parseInt(pageData.getString("type")))); + } + + /** + * @Description: 获取拥有历史轨迹的全部角色 + * @Param: [] [] + * @Return: com.zcloud.util.ReturnMap + */ + @RequestMapping(value = "/getPersonnelTrajectories") + @ResponseBody + public ReturnMap getPersonnelTrajectories() throws Exception { + return ReturnMap.ok().put("data", PLSUtil.getPersonnelTrajectories(Jurisdiction.getCORPINFO_ID())); + } // -----------------------// public static List> generateTimeArray() { diff --git a/src/main/java/com/zcloud/mapper/dsno2/message/MessageTemplatesMapper.java b/src/main/java/com/zcloud/mapper/datasource/message/MessageTemplatesMapper.java similarity index 94% rename from src/main/java/com/zcloud/mapper/dsno2/message/MessageTemplatesMapper.java rename to src/main/java/com/zcloud/mapper/datasource/message/MessageTemplatesMapper.java index 8a20502..eaf1ba0 100644 --- a/src/main/java/com/zcloud/mapper/dsno2/message/MessageTemplatesMapper.java +++ b/src/main/java/com/zcloud/mapper/datasource/message/MessageTemplatesMapper.java @@ -1,4 +1,4 @@ -package com.zcloud.mapper.dsno2.message; +package com.zcloud.mapper.datasource.message; import com.zcloud.entity.PageData; diff --git a/src/main/java/com/zcloud/service/eightwork/impl/HotworkServiceImpl.java b/src/main/java/com/zcloud/service/eightwork/impl/HotworkServiceImpl.java index 79937bd..87ca29a 100644 --- a/src/main/java/com/zcloud/service/eightwork/impl/HotworkServiceImpl.java +++ b/src/main/java/com/zcloud/service/eightwork/impl/HotworkServiceImpl.java @@ -42,7 +42,8 @@ public class HotworkServiceImpl implements HotworkService { private Smb smb; @Autowired private com.zcloud.mapper.datasource.eightWork.EightWorkVideoManagerMapper eightworkvideomanagerMapper; - + @Autowired + private SendMessageUtil sendMessageUtil; private final String primary_key = "HOTWORK_ID"; @@ -166,6 +167,7 @@ public class HotworkServiceImpl implements HotworkService { eightworkvideomanagerMapper.editStatus(work); work.put("STEP_ID",-1); hotworkMapper.editStep(work); + sendMessageForFinished(work.getString("CORPINFO_ID"),work.getString("CREATOR"),"EIGHTWORK_REJECT",work.getString("CHECK_NO")); } } @@ -313,6 +315,10 @@ public class HotworkServiceImpl implements HotworkService { 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("")){ + if(flow.get("NEXT_STEP_ID").equals("99")){ + sendMessageForFinished(pd.getString("CORPINFO_ID"),pd.getString("CREATOR"),"EIGHTWORK_ACCEPT",pd.getString("CHECK_NO")); + + } return; } //提前保存下一步签字人 @@ -325,6 +331,7 @@ public class HotworkServiceImpl implements HotworkService { signer.put("STEP_ID", flow.get("NEXT_STEP_ID")); signers.add(signer); hotworkSignMapper.saveBatch(signers); + sendMessageForNext(pd.getString("CORPINFO_ID"),pd.getString(flow.get("NEXT_ACTOR_FIELD")),pd.getString("CHECK_NO"),flow.getString("NEXT_STEP_NAME")); } private void saveMeasures(PageData pd) { @@ -374,6 +381,12 @@ public class HotworkServiceImpl implements HotworkService { signer.put("SIGN_USER_ID", item); signer.put("STEP_ID", flow.get("NEXT_STEP_ID")); nextSigners.add(signer); + + try { + sendMessageForNext(pd.getString("CORPINFO_ID"),item,pd.getString("CHECK_NO"),flow.getString("NEXT_STEP_NAME")); + } catch (Exception e) { + throw new RuntimeException(e); + } }); hotworkSignMapper.saveBatch(nextSigners); @@ -424,4 +437,59 @@ public class HotworkServiceImpl implements HotworkService { hotworkMapper.setPosition(pd); } + private void sendMessageForNext(String corpinfo_id,String userId,String number,String flow_name) throws Exception { + PageData mes = new PageData(); + mes.put("RECEIVER_ID", userId);// 收信人userid + mes.put("templateCode", "EIGHTWORK_REMINDER");// 短信模板编码 + mes.put("CORPINFO_ID", corpinfo_id);// 企业id + + // 参数集合 + List paramsList = new ArrayList(); + // 第1个参数 + PageData params1 = new PageData(); + params1.put("name", "number");// 存入短信模板中的参数名称 + params1.put("value", number);// 存入上面参数名称所传递的值 + paramsList.add(params1); + + PageData params2 = new PageData(); + params2.put("name", "type");// 存入短信模板中的参数名称 + params2.put("value", "动火作业");// 存入上面参数名称所传递的值 + paramsList.add(params2); + + PageData params3 = new PageData(); + params3.put("name", "flow");// 存入短信模板中的参数名称 + params3.put("value", flow_name);// 存入上面参数名称所传递的值 + paramsList.add(params3); + try { + sendMessageUtil.sendMessages(mes, paramsList); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + private void sendMessageForFinished(String corpinfo_id,String userId,String template,String number) throws Exception { + PageData mes = new PageData(); + mes.put("RECEIVER_ID", userId);// 收信人userid + mes.put("templateCode", template);// 短信模板编码 + mes.put("CORPINFO_ID", corpinfo_id);// 企业id + + // 参数集合 + List paramsList = new ArrayList(); + // 第1个参数 + PageData params1 = new PageData(); + params1.put("name", "number");// 存入短信模板中的参数名称 + params1.put("value", number);// 存入上面参数名称所传递的值 + paramsList.add(params1); + + PageData params2 = new PageData(); + params2.put("name", "type");// 存入短信模板中的参数名称 + params2.put("value", "动火作业");// 存入上面参数名称所传递的值 + paramsList.add(params2); + + try { + sendMessageUtil.sendMessages(mes, paramsList); + } catch (Exception e) { + throw new RuntimeException(e); + } + } } diff --git a/src/main/java/com/zcloud/util/PLSUtil.java b/src/main/java/com/zcloud/util/PLSUtil.java index 2f4f43a..c2071ad 100644 --- a/src/main/java/com/zcloud/util/PLSUtil.java +++ b/src/main/java/com/zcloud/util/PLSUtil.java @@ -315,6 +315,22 @@ public class PLSUtil { return exchange.getBody(); } + /** + * @Description: 所有区域列表 + * @Param: [java.lang.String, java.lang.Integer, java.lang.Integer] [keywords, currentPage, showCount] + * @Return: com.alibaba.fastjson.JSONObject + */ + public static JSONObject getAreaRegionList(String CORPINFO_ID, Integer currentPage, Integer showCount) 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/list?pageNum=" + + currentPage + + "&pageSize=" + showCount, HttpMethod.GET, httpEntity, JSONObject.class); + return exchange.getBody(); + } + /** * @Description: 电子围栏详情 * @Param: [java.lang.String, java.lang.Integer] [CORPINFO_ID, id] @@ -330,6 +346,43 @@ public class PLSUtil { return exchange.getBody(); } + /** + * @Description: 获取拥有历史轨迹的全部角色 + * @Return: com.alibaba.fastjson.JSONObject + */ + public static JSONObject getPersonnelTrajectories(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) + "/location/loca/personnelTrajectories",HttpMethod.GET, httpEntity, JSONObject.class); + return exchange.getBody(); + } + + /** + * @Description: 人员历史轨迹查询 + * @Return: com.alibaba.fastjson.JSONObject + */ + public static JSONObject characterTrajectories(String CORPINFO_ID,int id,String startTime,String endTime,int type) throws Exception { + + HttpHeaders headers = new HttpHeaders(); + headers.set("Authorization", getToken(CORPINFO_ID)); + headers.setContentType(org.springframework.http.MediaType.valueOf("application/json")); + JSONObject uriVariables = new JSONObject(); + uriVariables.put("id", id); + uriVariables.put("startTime",startTime); + uriVariables.put("endTime", endTime); + uriVariables.put("type", type); + HttpEntity httpEntity = new HttpEntity<>(uriVariables, headers); + + ResponseEntity exchange = restTemplate.exchange(PLSUtil.BAKEADDR.get(CORPINFO_ID) + "/location/loca/characterTrajectories", + HttpMethod.POST, + httpEntity, + JSONObject.class); + return exchange.getBody(); + + } + /** * @Description: 当前在线人员实时位置信息 * @Date: 2024/1/25/025 14:37 diff --git a/src/main/java/com/zcloud/util/SendMessageUtil.java b/src/main/java/com/zcloud/util/SendMessageUtil.java index ff1d597..6c63a41 100644 --- a/src/main/java/com/zcloud/util/SendMessageUtil.java +++ b/src/main/java/com/zcloud/util/SendMessageUtil.java @@ -48,74 +48,74 @@ public class SendMessageUtil { * @param paramsList 参数集合 * @throws Exception */ - public Object sendMessages(PageData pd, List paramsList) throws Exception { + public void sendMessages(PageData pd, List paramsList) throws Exception { sendNotice(pd, paramsList); - pushWxNotice(pd, paramsList); - - Map map = new HashMap(); - // 查询公司信息 - PageData corpinfo = new PageData(); - corpinfo.put("CORPINFO_ID", pd.getString("CORPINFO_ID")); - corpinfo =corpinfoService.findById(corpinfo); - // 查看公司剩余短信条数是否足以支持发送短信 - Boolean canSend = checkCorpMsg(corpinfo); - // 发送抄送短信 - PageData sms = new PageData(); - sms.put("CORPINFO_ID", pd.getString("CORPINFO_ID")); - sms.put("ISENABLE", "1"); - sms.put("SMSCODE", pd.get("templateCode")); - List sList =smsmanagementService.listAll(sms); - if(canSend && sList.size()>0) { - // 发送短信 - // 收信人 - PageData user = new PageData(); - user.put("USER_ID", pd.get("RECEIVER_ID")); - user = usersService.findById(user); - if(user.get("USERNAME") != null && Tools.notEmpty(user.get("USERNAME").toString())) { - String phone=user.get("USERNAME").toString(); - // 发送短信 - SendSmsResponse ssms= send(pd, phone, paramsList); - if(ssms.getCode().equals("OK")){ - map.put("result", "success"); - }else{ - map.put("result", "fail"); - map.put("msg", "您的操作过去频繁,请稍后重试!"); - return map; - } - } - } else { - map.put("result", "fail"); - map.put("msg", "公司剩余短信数量不足"); - return map; - } - - if(sList.size()>0 && sList.get(0).get("ADDRESSEE") != null && !sList.get(0).getString("ADDRESSEE").equals("")) {// 查看是否有需要抄送的人 - String[] uid=sList.get(0).getString("ADDRESSEE").split(","); - for(int i=0;i map = new HashMap(); +// // 查询公司信息 +// PageData corpinfo = new PageData(); +// corpinfo.put("CORPINFO_ID", pd.getString("CORPINFO_ID")); +// corpinfo =corpinfoService.findById(corpinfo); +// // 查看公司剩余短信条数是否足以支持发送短信 +// Boolean canSend = checkCorpMsg(corpinfo); +// // 发送抄送短信 +// PageData sms = new PageData(); +// sms.put("CORPINFO_ID", pd.getString("CORPINFO_ID")); +// sms.put("ISENABLE", "1"); +// sms.put("SMSCODE", pd.get("templateCode")); +// List sList =smsmanagementService.listAll(sms); +// if(canSend && sList.size()>0) { +// // 发送短信 +// // 收信人 +// PageData user = new PageData(); +// user.put("USER_ID", pd.get("RECEIVER_ID")); +// user = usersService.findById(user); +// if(user.get("USERNAME") != null && Tools.notEmpty(user.get("USERNAME").toString())) { +// String phone=user.get("USERNAME").toString(); +// // 发送短信 +// SendSmsResponse ssms= send(pd, phone, paramsList); +// if(ssms.getCode().equals("OK")){ +// map.put("result", "success"); +// }else{ +// map.put("result", "fail"); +// map.put("msg", "您的操作过去频繁,请稍后重试!"); +// return map; +// } +// } +// } else { +// map.put("result", "fail"); +// map.put("msg", "公司剩余短信数量不足"); +// return map; +// } +// +// if(sList.size()>0 && sList.get(0).get("ADDRESSEE") != null && !sList.get(0).getString("ADDRESSEE").equals("")) {// 查看是否有需要抄送的人 +// String[] uid=sList.get(0).getString("ADDRESSEE").split(","); +// for(int i=0;i push_cids_set = new HashSet(); +// Set push_cids_set = new HashSet(); PageData user = new PageData(); if("".equals(pd.getString("RECEIVER_ID"))){ @@ -248,9 +248,9 @@ public class SendMessageUtil { } user = usersService.findById(user); - if(user.get("PUSH_CID") != null){ - push_cids_set.add(user.getString("PUSH_CID")); - } +// if(user.get("PUSH_CID") != null){ +// push_cids_set.add(user.getString("PUSH_CID")); +// } //查看是否有抄送 if(nmList.size()>0 && nmList.get(0).get("ADDRESSEE") != null && !nmList.get(0).getString("ADDRESSEE").equals("")) {// 查看是否有需要抄送的人 String[] uid=nmList.get(0).getString("ADDRESSEE").split(","); @@ -263,15 +263,15 @@ public class SendMessageUtil { PageData user1 = new PageData(); user1.put("USER_ID", uid[i].toString()); user1 = usersService.findById(user1); - if(user1.get("PUSH_CID") != null){ - push_cids_set.add(user1.getString("PUSH_CID")); - } +// if(user1.get("PUSH_CID") != null){ +// push_cids_set.add(user1.getString("PUSH_CID")); +// } } } } - if(push_cids_set.size()>0){ - PushUtil.push(push_cids_set.toArray(),"通知",pd1.getString("SYNOPSIS")); - } +// if(push_cids_set.size()>0){ +// PushUtil.push(push_cids_set.toArray(),"通知",pd1.getString("SYNOPSIS")); +// } } /* diff --git a/src/main/java/com/zcloud/util/message/MessagePublic.java b/src/main/java/com/zcloud/util/message/MessagePublic.java index 5b1c8ff..76009c3 100644 --- a/src/main/java/com/zcloud/util/message/MessagePublic.java +++ b/src/main/java/com/zcloud/util/message/MessagePublic.java @@ -1,7 +1,7 @@ package com.zcloud.util.message; import com.zcloud.entity.PageData; -import com.zcloud.mapper.dsno2.message.MessageTemplatesMapper; +import com.zcloud.mapper.datasource.message.MessageTemplatesMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; diff --git a/src/main/java/com/zcloud/util/message/imp/MessageServiceImpl.java b/src/main/java/com/zcloud/util/message/imp/MessageServiceImpl.java index 88b3ed9..f07177b 100644 --- a/src/main/java/com/zcloud/util/message/imp/MessageServiceImpl.java +++ b/src/main/java/com/zcloud/util/message/imp/MessageServiceImpl.java @@ -3,7 +3,7 @@ package com.zcloud.util.message.imp; import com.zcloud.entity.PageData; import com.zcloud.mapper.datasource.notice.NoticeCorpMapper; import com.zcloud.mapper.datasource.notice.NoticeCorpUserMapper; -import com.zcloud.mapper.dsno2.message.MessageTemplatesMapper; +import com.zcloud.mapper.datasource.message.MessageTemplatesMapper; import com.zcloud.util.DateUtil; import com.zcloud.util.PushUtil; import com.zcloud.util.Tools; @@ -95,7 +95,7 @@ public class MessageServiceImpl implements MessageService { pd.put("USER_ID",userID); pd.put("url",url); try { - PushUtil.push(userID,encode,synpsis,"other"); +// PushUtil.push(userID,encode,synpsis,"other"); return this.sendMessageByParameter(pd); }catch (Exception e){ System.out.println(e); diff --git a/src/main/resources/mybatis/datasource/eightwork/EightWorkTaskFlowMapper.xml b/src/main/resources/mybatis/datasource/eightwork/EightWorkTaskFlowMapper.xml index f93ad91..2f88a2b 100644 --- a/src/main/resources/mybatis/datasource/eightwork/EightWorkTaskFlowMapper.xml +++ b/src/main/resources/mybatis/datasource/eightwork/EightWorkTaskFlowMapper.xml @@ -56,6 +56,7 @@