diff --git a/db/prod/2024-3-18-变更.sql b/db/prod/2024-3-18-变更.sql index efbc38cb..fef3dd12 100644 --- a/db/prod/2024-3-18-变更.sql +++ b/db/prod/2024-3-18-变更.sql @@ -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); diff --git a/laws-module-system/src/main/java/com/jero/modules/message/handle/ISendMsgHandle.java b/laws-module-system/src/main/java/com/jero/modules/message/handle/ISendMsgHandle.java index 364addf0..16909da0 100644 --- a/laws-module-system/src/main/java/com/jero/modules/message/handle/ISendMsgHandle.java +++ b/laws-module-system/src/main/java/com/jero/modules/message/handle/ISendMsgHandle.java @@ -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); } diff --git a/laws-modules-docking/src/main/java/com/jero/modules/docking/hiwork/service/impl/HiworkMsgServiceImpl.java b/laws-modules-docking/src/main/java/com/jero/modules/docking/hiwork/service/impl/HiworkMsgServiceImpl.java index 6c946161..dd59eea1 100644 --- a/laws-modules-docking/src/main/java/com/jero/modules/docking/hiwork/service/impl/HiworkMsgServiceImpl.java +++ b/laws-modules-docking/src/main/java/com/jero/modules/docking/hiwork/service/impl/HiworkMsgServiceImpl.java @@ -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); diff --git a/laws-modules-docking/src/main/java/com/jero/modules/docking/hiwork/service/impl/SendMessageServiceImpl.java b/laws-modules-docking/src/main/java/com/jero/modules/docking/hiwork/service/impl/SendMessageServiceImpl.java index c751d5fc..79aed254 100644 --- a/laws-modules-docking/src/main/java/com/jero/modules/docking/hiwork/service/impl/SendMessageServiceImpl.java +++ b/laws-modules-docking/src/main/java/com/jero/modules/docking/hiwork/service/impl/SendMessageServiceImpl.java @@ -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 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系统消息 diff --git a/laws-modules/src/main/java/com/jero/modules/laws/standard/service/impl/LawsNewsFeedServiceImpl.java b/laws-modules/src/main/java/com/jero/modules/laws/standard/service/impl/LawsNewsFeedServiceImpl.java index 3505f1b6..03d772b7 100644 --- a/laws-modules/src/main/java/com/jero/modules/laws/standard/service/impl/LawsNewsFeedServiceImpl.java +++ b/laws-modules/src/main/java/com/jero/modules/laws/standard/service/impl/LawsNewsFeedServiceImpl.java @@ -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