feat: 手机端消息跳转
This commit is contained in:
@@ -252,4 +252,4 @@ ALTER TABLE `laws_domestic_standard`
|
||||
update laws_domestic_standard set standard_source = '1';
|
||||
update laws_domestic_standard set standard_source = '2' where is_asms_import = '1';
|
||||
|
||||
INSERT INTO `laws-sinotruk-demo`.`laws_tag` (`id`, `table_name`, `db_field_name`, `db_field_en_name`, `db_field_txt`, `order_num`, `db_field_name_old`, `db_is_key`, `db_is_null`, `db_type`, `db_length`, `db_point_length`, `db_default_val`, `dict_field`, `dict_table`, `dict_text`, `field_show_type`, `field_href`, `field_length`, `field_valid_type`, `field_must_input`, `field_extend_json`, `field_default_value`, `is_show_form_create`, `is_query`, `is_show_form`, `is_show_list`, `is_read_only`, `query_mode`, `main_table`, `main_field`, `update_by`, `update_time`, `create_time`, `create_by`, `converter`, `query_def_val`, `query_dict_text`, `query_dict_field`, `query_dict_table`, `query_show_type`, `query_config_flag`, `query_valid_type`, `query_must_input`, `sort_flag`, `show_area`, `is_show_laws_list`, `is_show_search`, `del_flag`, `is_model`, `dict_id`, `home_search_context_order`, `home_search_file_order`, `dict_field_search`, `dict_table_search`, `dict_text_search`, `usable_range`, `tree_first_href`) VALUES ('1836230139970437121', 'laws_domestic_standard', 'standard_source', 'Standard Source', '标准来源', 50, 'standard_source', 0, 1, 'String', 100, NULL, NULL, 'gb_standard_source', NULL, NULL, '10', NULL, NULL, NULL, '0', NULL, NULL, 1, 1, 1, 1, 0, NULL, NULL, NULL, NULL, NULL, '2024-09-18 10:25:56', 'chh2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '0', '1499657602378825729', NULL, 1, 0, '1', '1836228197596643329', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
INSERT INTO `laws_tag` (`id`, `table_name`, `db_field_name`, `db_field_en_name`, `db_field_txt`, `order_num`, `db_field_name_old`, `db_is_key`, `db_is_null`, `db_type`, `db_length`, `db_point_length`, `db_default_val`, `dict_field`, `dict_table`, `dict_text`, `field_show_type`, `field_href`, `field_length`, `field_valid_type`, `field_must_input`, `field_extend_json`, `field_default_value`, `is_show_form_create`, `is_query`, `is_show_form`, `is_show_list`, `is_read_only`, `query_mode`, `main_table`, `main_field`, `update_by`, `update_time`, `create_time`, `create_by`, `converter`, `query_def_val`, `query_dict_text`, `query_dict_field`, `query_dict_table`, `query_show_type`, `query_config_flag`, `query_valid_type`, `query_must_input`, `sort_flag`, `show_area`, `is_show_laws_list`, `is_show_search`, `del_flag`, `is_model`, `dict_id`, `home_search_context_order`, `home_search_file_order`, `dict_field_search`, `dict_table_search`, `dict_text_search`, `usable_range`, `tree_first_href`) VALUES ('1836230139970437121', 'laws_domestic_standard', 'standard_source', 'Standard Source', '标准来源', 50, 'standard_source', 0, 1, 'String', 100, NULL, NULL, 'gb_standard_source', NULL, NULL, '10', NULL, NULL, NULL, '0', NULL, NULL, 1, 1, 1, 1, 0, NULL, NULL, NULL, NULL, NULL, '2024-09-18 10:25:56', 'chh2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '0', '1499657602378825729', NULL, 1, 0, '1', '1836228197596643329', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
|
||||
+1
-1
@@ -2,5 +2,5 @@ package com.jero.modules.message.handle;
|
||||
|
||||
public interface ISendMsgHandle {
|
||||
|
||||
void SendMsg(String esReceiver, String esTitle, String esContent, String openType, String openPage);
|
||||
void SendMsg(String esReceiver, String esTitle, String esContent, String openType, String finalHiworkPhoneUrl);
|
||||
}
|
||||
|
||||
+24
-8
@@ -1,16 +1,15 @@
|
||||
package com.jero.modules.docking.hiwork.service.impl;
|
||||
|
||||
import cn.hutool.core.annotation.Link;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jero.common.api.vo.ResultCommon;
|
||||
import com.jero.common.exception.JeroBootException;
|
||||
import com.jero.common.system.vo.LoginUser;
|
||||
import com.jero.modules.docking.hiwork.entity.HiworkDingDingMsg;
|
||||
import com.jero.modules.docking.hiwork.entity.HiworkSystemMsg;
|
||||
import com.jero.modules.docking.hiwork.service.IHiworkMsgService;
|
||||
import com.jero.modules.docking.hiwork.util.HiworkPostUtil;
|
||||
import com.jero.common.api.vo.ResultCommon;
|
||||
import com.jero.modules.system.entity.SysUser;
|
||||
import com.jero.modules.system.service.ISysUserService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -18,6 +17,7 @@ import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
@@ -39,11 +39,16 @@ public class HiworkMsgServiceImpl implements IHiworkMsgService {
|
||||
@Autowired
|
||||
private ISysUserService sysUserService;
|
||||
|
||||
@Value("${hiwork.appUrl}")
|
||||
private String appUrl;
|
||||
|
||||
private final static String TEXT = "text"; // 消息类型-文本
|
||||
private final static String TITLE = "title"; // 消息类型-文本
|
||||
private final static String LINK = "link"; // 消息类型-文本
|
||||
private final static String MSG_TYPE = "msgtype"; // 消息类型
|
||||
private final static String CONTENT = "content"; // 消息内容
|
||||
private final static String MESSAGE_URL = "messageUrl"; // 消息内容
|
||||
private final static String PC_SLIDE = "pc_slide"; // 消息内容
|
||||
|
||||
/**
|
||||
* @Author: liao
|
||||
@@ -74,12 +79,23 @@ public class HiworkMsgServiceImpl implements IHiworkMsgService {
|
||||
|
||||
// 消息体
|
||||
JSONObject msgJsonObject = new JSONObject();
|
||||
msgJsonObject.put(MSG_TYPE, TEXT);
|
||||
JSONObject textJsonObject = new JSONObject();
|
||||
textJsonObject.put(CONTENT, content);
|
||||
msgJsonObject.put(TEXT, textJsonObject);
|
||||
hiworkDingDingMsg.setMsg(msgJsonObject);
|
||||
|
||||
if (StrUtil.isBlank(messageUrl)) {
|
||||
msgJsonObject.put(MSG_TYPE, TEXT);
|
||||
JSONObject textJsonObject = new JSONObject();
|
||||
textJsonObject.put(CONTENT, content);
|
||||
msgJsonObject.put(TEXT, textJsonObject);
|
||||
hiworkDingDingMsg.setMsg(msgJsonObject);
|
||||
} else {
|
||||
// 动态消息有手机端跳转链接
|
||||
msgJsonObject.put(MSG_TYPE, LINK);
|
||||
JSONObject linkJsonObject = new JSONObject();
|
||||
String url = appUrl + messageUrl;
|
||||
linkJsonObject.put(MESSAGE_URL, url);
|
||||
linkJsonObject.put(TITLE, "【标准法规】动态消息");
|
||||
linkJsonObject.put(TEXT, content);
|
||||
msgJsonObject.put(LINK, linkJsonObject);
|
||||
hiworkDingDingMsg.setMsg(msgJsonObject);
|
||||
}
|
||||
log.info("发送Hiwork钉钉消息: {}", JSONObject.toJSONString(hiworkDingDingMsg));
|
||||
|
||||
hiworkPostUtil.postDingDingMsg(hiworkDingDingMsg);
|
||||
|
||||
+8
-1
@@ -38,6 +38,8 @@ public class SendMessageServiceImpl implements SendMessageAPI {
|
||||
private Boolean isSend;
|
||||
@Value("${hiwork.hiworkUrlPrefix}")
|
||||
private String hiworkUrlPrefix;
|
||||
@Value("")
|
||||
private String phoneUrl;
|
||||
|
||||
/**
|
||||
* @Author: liao
|
||||
@@ -63,6 +65,7 @@ public class SendMessageServiceImpl implements SendMessageAPI {
|
||||
|
||||
String openType = sysMessageTemplate.getOpenType();
|
||||
String openPage = sysMessageTemplate.getOpenPage();
|
||||
String hiworkPhoneUrl = "";
|
||||
|
||||
try {
|
||||
// 替换模板内容
|
||||
@@ -78,6 +81,9 @@ public class SendMessageServiceImpl implements SendMessageAPI {
|
||||
if (null != map.get("openPage")) {
|
||||
openPage = map.get("openPage");
|
||||
}
|
||||
if (null != map.get("hiworkPhoneUrl")) {
|
||||
hiworkPhoneUrl = map.get("hiworkPhoneUrl");
|
||||
}
|
||||
}
|
||||
|
||||
List<String> typeList = Arrays.asList(sysMessageTemplate.getTemplateType().split(","));
|
||||
@@ -92,6 +98,7 @@ public class SendMessageServiceImpl implements SendMessageAPI {
|
||||
}
|
||||
String finalOpenType = openType;
|
||||
String finalOpenPage = openPage;
|
||||
String finalHiworkPhoneUrl = hiworkPhoneUrl;
|
||||
typeList.forEach(type -> {
|
||||
log.info("消息标题:{},消息内容:{},消息类型:{}", sysMessageTemplate.getTemplateName(), sysMessageTemplate.getTemplateContent(), type);
|
||||
ISendMsgHandle sendMsgHandle;
|
||||
@@ -99,7 +106,7 @@ public class SendMessageServiceImpl implements SendMessageAPI {
|
||||
// Hiwork钉钉消息
|
||||
sendMsgHandle = new DingDingSendMsgHandle();
|
||||
if (isSend) {
|
||||
sendMsgHandle.SendMsg(sendMessageDTO.getToUserId(), sysMessageTemplate.getTemplateName(), sysMessageTemplate.getTemplateContent(), null, null);
|
||||
sendMsgHandle.SendMsg(sendMessageDTO.getToUserId(), sysMessageTemplate.getTemplateName(), sysMessageTemplate.getTemplateContent(), null, finalHiworkPhoneUrl);
|
||||
}
|
||||
} else if ("6".equals(type)) {
|
||||
// Hiwork系统消息
|
||||
|
||||
+8
-9
@@ -1,13 +1,17 @@
|
||||
package com.jero.modules.laws.standard.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.jero.common.api.dto.message.SendMessageDTO;
|
||||
import com.jero.common.api.vo.ResultCommon;
|
||||
import com.jero.common.api.vo.SendMessageAPI;
|
||||
import com.jero.common.exception.JeroBootException;
|
||||
import com.jero.common.system.vo.LoginUser;
|
||||
import com.jero.modules.laws.common.constant.DictCommon;
|
||||
import com.jero.modules.laws.common.constant.FieldCommon;
|
||||
import com.jero.modules.laws.common.constant.MessageTemplateCodeCommon;
|
||||
import com.jero.common.api.vo.ResultCommon;
|
||||
import com.jero.modules.laws.common.util.CurrentUserUtil;
|
||||
import com.jero.modules.laws.home.common.LawsHomeSearchCommon;
|
||||
import com.jero.modules.laws.home.service.ILawsHomeSearchService;
|
||||
@@ -25,16 +29,10 @@ import org.apache.shiro.SecurityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import com.jero.common.exception.JeroBootException;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
@@ -247,6 +245,7 @@ public class LawsNewsFeedServiceImpl extends ServiceImpl<LawsNewsFeedMapper, Law
|
||||
map.put("name", CurrentUserUtil.getRealName());
|
||||
map.put("openType", "url");
|
||||
map.put("openPage", "/standardRegulationLibrary/DynamicMessageDetail?id=" + lawsNewsFeed.getId());
|
||||
map.put("hiworkPhoneUrl", "/messageDetail?id=" + lawsNewsFeed.getId());
|
||||
sendMessageDTO.setMap(map);
|
||||
sendMessageAPI.sendMessage(sendMessageDTO);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user