动火增加消息通知

pull/4/head
fangjiakai 2024-02-26 10:34:55 +08:00
parent 387a31b276
commit 91ce11d64a
9 changed files with 231 additions and 84 deletions

View File

@ -129,7 +129,7 @@ public class MapController extends BaseController {
@RequestMapping(value = "/getFenceList") @RequestMapping(value = "/getFenceList")
@ResponseBody @ResponseBody
public ReturnMap getFenceList() throws Exception { 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); int cameraCount = usersService.getUserCount(pageData);
return ReturnMap.ok().put("cameraCount", cameraCount); 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<Map<String, String>> generateTimeArray() { public static List<Map<String, String>> generateTimeArray() {

View File

@ -1,4 +1,4 @@
package com.zcloud.mapper.dsno2.message; package com.zcloud.mapper.datasource.message;
import com.zcloud.entity.PageData; import com.zcloud.entity.PageData;

View File

@ -42,7 +42,8 @@ public class HotworkServiceImpl implements HotworkService {
private Smb smb; private Smb smb;
@Autowired @Autowired
private com.zcloud.mapper.datasource.eightWork.EightWorkVideoManagerMapper eightworkvideomanagerMapper; private com.zcloud.mapper.datasource.eightWork.EightWorkVideoManagerMapper eightworkvideomanagerMapper;
@Autowired
private SendMessageUtil sendMessageUtil;
private final String primary_key = "HOTWORK_ID"; private final String primary_key = "HOTWORK_ID";
@ -166,6 +167,7 @@ public class HotworkServiceImpl implements HotworkService {
eightworkvideomanagerMapper.editStatus(work); eightworkvideomanagerMapper.editStatus(work);
work.put("STEP_ID",-1); work.put("STEP_ID",-1);
hotworkMapper.editStep(work); 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")); 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(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; return;
} }
//提前保存下一步签字人 //提前保存下一步签字人
@ -325,6 +331,7 @@ public class HotworkServiceImpl implements HotworkService {
signer.put("STEP_ID", flow.get("NEXT_STEP_ID")); signer.put("STEP_ID", flow.get("NEXT_STEP_ID"));
signers.add(signer); signers.add(signer);
hotworkSignMapper.saveBatch(signers); 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) { private void saveMeasures(PageData pd) {
@ -374,6 +381,12 @@ public class HotworkServiceImpl implements HotworkService {
signer.put("SIGN_USER_ID", item); signer.put("SIGN_USER_ID", item);
signer.put("STEP_ID", flow.get("NEXT_STEP_ID")); signer.put("STEP_ID", flow.get("NEXT_STEP_ID"));
nextSigners.add(signer); 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); hotworkSignMapper.saveBatch(nextSigners);
@ -424,4 +437,59 @@ public class HotworkServiceImpl implements HotworkService {
hotworkMapper.setPosition(pd); 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<PageData> paramsList = new ArrayList<PageData>();
// 第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<PageData> paramsList = new ArrayList<PageData>();
// 第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);
}
}
} }

View File

@ -315,6 +315,22 @@ public class PLSUtil {
return exchange.getBody(); 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<JSONObject> httpEntity = new HttpEntity<>(headers);
ResponseEntity<JSONObject> exchange = restTemplate.exchange(PLSUtil.BAKEADDR.get(CORPINFO_ID) + "/region/region/list?pageNum=" +
currentPage +
"&pageSize=" + showCount, HttpMethod.GET, httpEntity, JSONObject.class);
return exchange.getBody();
}
/** /**
* @Description: * @Description:
* @Param: [java.lang.String, java.lang.Integer] [CORPINFO_ID, id] * @Param: [java.lang.String, java.lang.Integer] [CORPINFO_ID, id]
@ -330,6 +346,43 @@ public class PLSUtil {
return exchange.getBody(); 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<JSONObject> httpEntity = new HttpEntity<>(headers);
ResponseEntity<JSONObject> 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<JSONObject> httpEntity = new HttpEntity<>(uriVariables, headers);
ResponseEntity<JSONObject> exchange = restTemplate.exchange(PLSUtil.BAKEADDR.get(CORPINFO_ID) + "/location/loca/characterTrajectories",
HttpMethod.POST,
httpEntity,
JSONObject.class);
return exchange.getBody();
}
/** /**
* @Description: 线 * @Description: 线
* @Date: 2024/1/25/025 14:37 * @Date: 2024/1/25/025 14:37

View File

@ -48,74 +48,74 @@ public class SendMessageUtil {
* @param paramsList * @param paramsList
* @throws Exception * @throws Exception
*/ */
public Object sendMessages(PageData pd, List<PageData> paramsList) throws Exception { public void sendMessages(PageData pd, List<PageData> paramsList) throws Exception {
sendNotice(pd, paramsList); sendNotice(pd, paramsList);
pushWxNotice(pd, paramsList); // pushWxNotice(pd, paramsList);
//
Map<String,Object> map = new HashMap<String,Object>(); // Map<String,Object> map = new HashMap<String,Object>();
// 查询公司信息 // // 查询公司信息
PageData corpinfo = new PageData(); // PageData corpinfo = new PageData();
corpinfo.put("CORPINFO_ID", pd.getString("CORPINFO_ID")); // corpinfo.put("CORPINFO_ID", pd.getString("CORPINFO_ID"));
corpinfo =corpinfoService.findById(corpinfo); // corpinfo =corpinfoService.findById(corpinfo);
// 查看公司剩余短信条数是否足以支持发送短信 // // 查看公司剩余短信条数是否足以支持发送短信
Boolean canSend = checkCorpMsg(corpinfo); // Boolean canSend = checkCorpMsg(corpinfo);
// 发送抄送短信 // // 发送抄送短信
PageData sms = new PageData(); // PageData sms = new PageData();
sms.put("CORPINFO_ID", pd.getString("CORPINFO_ID")); // sms.put("CORPINFO_ID", pd.getString("CORPINFO_ID"));
sms.put("ISENABLE", "1"); // sms.put("ISENABLE", "1");
sms.put("SMSCODE", pd.get("templateCode")); // sms.put("SMSCODE", pd.get("templateCode"));
List<PageData> sList =smsmanagementService.listAll(sms); // List<PageData> sList =smsmanagementService.listAll(sms);
if(canSend && sList.size()>0) { // if(canSend && sList.size()>0) {
// 发送短信 // // 发送短信
// 收信人 // // 收信人
PageData user = new PageData(); // PageData user = new PageData();
user.put("USER_ID", pd.get("RECEIVER_ID")); // user.put("USER_ID", pd.get("RECEIVER_ID"));
user = usersService.findById(user); // user = usersService.findById(user);
if(user.get("USERNAME") != null && Tools.notEmpty(user.get("USERNAME").toString())) { // if(user.get("USERNAME") != null && Tools.notEmpty(user.get("USERNAME").toString())) {
String phone=user.get("USERNAME").toString(); // String phone=user.get("USERNAME").toString();
// 发送短信 // // 发送短信
SendSmsResponse ssms= send(pd, phone, paramsList); // SendSmsResponse ssms= send(pd, phone, paramsList);
if(ssms.getCode().equals("OK")){ // if(ssms.getCode().equals("OK")){
map.put("result", "success"); // map.put("result", "success");
}else{ // }else{
map.put("result", "fail"); // map.put("result", "fail");
map.put("msg", "您的操作过去频繁,请稍后重试!"); // map.put("msg", "您的操作过去频繁,请稍后重试!");
return map; // return map;
} // }
} // }
} else { // } else {
map.put("result", "fail"); // map.put("result", "fail");
map.put("msg", "公司剩余短信数量不足"); // map.put("msg", "公司剩余短信数量不足");
return map; // return map;
} // }
//
if(sList.size()>0 && sList.get(0).get("ADDRESSEE") != null && !sList.get(0).getString("ADDRESSEE").equals("")) {// 查看是否有需要抄送的人 // if(sList.size()>0 && sList.get(0).get("ADDRESSEE") != null && !sList.get(0).getString("ADDRESSEE").equals("")) {// 查看是否有需要抄送的人
String[] uid=sList.get(0).getString("ADDRESSEE").split(","); // String[] uid=sList.get(0).getString("ADDRESSEE").split(",");
for(int i=0;i<uid.length;i++) { // for(int i=0;i<uid.length;i++) {
if(checkCorpMsg(corpinfo)) {// 查看公司剩余短信条数是否足以支持发送短信 // if(checkCorpMsg(corpinfo)) {// 查看公司剩余短信条数是否足以支持发送短信
PageData suser = new PageData(); // PageData suser = new PageData();
suser.put("USER_ID", uid[i].toString()); // suser.put("USER_ID", uid[i].toString());
suser = usersService.findById(suser); // suser = usersService.findById(suser);
if(suser.get("USERNAME") != null && Tools.notEmpty(suser.get("USERNAME").toString())) { // if(suser.get("USERNAME") != null && Tools.notEmpty(suser.get("USERNAME").toString())) {
String uphone=suser.get("USERNAME").toString(); // String uphone=suser.get("USERNAME").toString();
// 发送短信 // // 发送短信
SendSmsResponse ssms= send(pd, uphone, paramsList); // SendSmsResponse ssms= send(pd, uphone, paramsList);
if(ssms.getCode().equals("OK")){ // if(ssms.getCode().equals("OK")){
map.put("result", "success"); // map.put("result", "success");
}else{ // }else{
map.put("result", "fail"); // map.put("result", "fail");
map.put("msg", "您的操作过去频繁,请稍后重试!"); // map.put("msg", "您的操作过去频繁,请稍后重试!");
return map; // return map;
} // }
} // }
} else { // } else {
map.put("result", "fail"); // map.put("result", "fail");
map.put("msg", "公司剩余短信数量不足抄送所有用户"); // map.put("msg", "公司剩余短信数量不足抄送所有用户");
return map; // return map;
} // }
} // }
} // }
return map; // return map;
} }
/** /**
@ -233,7 +233,7 @@ public class SendMessageUtil {
pd1.put("TYPE",0); pd1.put("TYPE",0);
noticeCorpUserService.save(pd1); noticeCorpUserService.save(pd1);
Set<String> push_cids_set = new HashSet<String>(); // Set<String> push_cids_set = new HashSet<String>();
PageData user = new PageData(); PageData user = new PageData();
if("".equals(pd.getString("RECEIVER_ID"))){ if("".equals(pd.getString("RECEIVER_ID"))){
@ -248,9 +248,9 @@ public class SendMessageUtil {
} }
user = usersService.findById(user); user = usersService.findById(user);
if(user.get("PUSH_CID") != null){ // if(user.get("PUSH_CID") != null){
push_cids_set.add(user.getString("PUSH_CID")); // push_cids_set.add(user.getString("PUSH_CID"));
} // }
//查看是否有抄送 //查看是否有抄送
if(nmList.size()>0 && nmList.get(0).get("ADDRESSEE") != null && !nmList.get(0).getString("ADDRESSEE").equals("")) {// 查看是否有需要抄送的人 if(nmList.size()>0 && nmList.get(0).get("ADDRESSEE") != null && !nmList.get(0).getString("ADDRESSEE").equals("")) {// 查看是否有需要抄送的人
String[] uid=nmList.get(0).getString("ADDRESSEE").split(","); String[] uid=nmList.get(0).getString("ADDRESSEE").split(",");
@ -263,15 +263,15 @@ public class SendMessageUtil {
PageData user1 = new PageData(); PageData user1 = new PageData();
user1.put("USER_ID", uid[i].toString()); user1.put("USER_ID", uid[i].toString());
user1 = usersService.findById(user1); user1 = usersService.findById(user1);
if(user1.get("PUSH_CID") != null){ // if(user1.get("PUSH_CID") != null){
push_cids_set.add(user1.getString("PUSH_CID")); // push_cids_set.add(user1.getString("PUSH_CID"));
} // }
} }
} }
} }
if(push_cids_set.size()>0){ // if(push_cids_set.size()>0){
PushUtil.push(push_cids_set.toArray(),"通知",pd1.getString("SYNOPSIS")); // PushUtil.push(push_cids_set.toArray(),"通知",pd1.getString("SYNOPSIS"));
} // }
} }
/* /*

View File

@ -1,7 +1,7 @@
package com.zcloud.util.message; package com.zcloud.util.message;
import com.zcloud.entity.PageData; 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.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;

View File

@ -3,7 +3,7 @@ package com.zcloud.util.message.imp;
import com.zcloud.entity.PageData; import com.zcloud.entity.PageData;
import com.zcloud.mapper.datasource.notice.NoticeCorpMapper; import com.zcloud.mapper.datasource.notice.NoticeCorpMapper;
import com.zcloud.mapper.datasource.notice.NoticeCorpUserMapper; 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.DateUtil;
import com.zcloud.util.PushUtil; import com.zcloud.util.PushUtil;
import com.zcloud.util.Tools; import com.zcloud.util.Tools;
@ -95,7 +95,7 @@ public class MessageServiceImpl implements MessageService {
pd.put("USER_ID",userID); pd.put("USER_ID",userID);
pd.put("url",url); pd.put("url",url);
try { try {
PushUtil.push(userID,encode,synpsis,"other"); // PushUtil.push(userID,encode,synpsis,"other");
return this.sendMessageByParameter(pd); return this.sendMessageByParameter(pd);
}catch (Exception e){ }catch (Exception e){
System.out.println(e); System.out.println(e);

View File

@ -56,6 +56,7 @@
<select id="getStep" parameterType="pd" resultType="pd" > <select id="getStep" parameterType="pd" resultType="pd" >
select select
<include refid="Field"></include>, <include refid="Field"></include>,
ns.STEP_NAME as NEXT_STEP_NAME,
n.ACTOR_FIELD as NEXT_ACTOR_FIELD, n.ACTOR_FIELD as NEXT_ACTOR_FIELD,
n.CAN_SKIP n.CAN_SKIP
from from
@ -64,6 +65,7 @@
<include refid="tableName"></include> n <include refid="tableName"></include> n
on on
f.NEXT_STEP_ID = n.STEP_ID and f.TASK_ID = n.TASK_ID f.NEXT_STEP_ID = n.STEP_ID and f.TASK_ID = n.TASK_ID
left join bus_eightwork_step ns on ns.STEP_ID = f.NEXT_STEP_ID
where where
f.TASK_ID = #{TASK_ID} f.TASK_ID = #{TASK_ID}
and and

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?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"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zcloud.mapper.dsno2.message.MessageTemplatesMapper"> <mapper namespace="com.zcloud.mapper.datasource.message.MessageTemplatesMapper">
<!--表名 --> <!--表名 -->
<sql id="tableName"> <sql id="tableName">