预警配置,定时插件推送消息,消息模版配置,推送消息日志

This commit is contained in:
username 2024-09-07 14:12:25 +08:00
parent 1f2d0584e2
commit 07d8962046
46 changed files with 4099 additions and 2 deletions

View File

@ -0,0 +1,7 @@
package com.hzya.frame.plugin.pushMessage.dao;
import com.hzya.frame.basedao.dao.IBaseDao;
import com.hzya.frame.plugin.pushMessage.entity.PushMessageEntity;
public interface IPushMessageDao extends IBaseDao<PushMessageEntity, String> {
}

View File

@ -0,0 +1,8 @@
package com.hzya.frame.plugin.pushMessage.dao.impl;
import com.hzya.frame.basedao.dao.MybatisGenericDao;
import com.hzya.frame.plugin.pushMessage.dao.IPushMessageDao;
import com.hzya.frame.plugin.pushMessage.entity.PushMessageEntity;
public class PushMessageDaoImpl extends MybatisGenericDao<PushMessageEntity, String> implements IPushMessageDao {
}

View File

@ -0,0 +1,106 @@
package com.hzya.frame.plugin.pushMessage.entity;
import com.hzya.frame.web.entity.BaseEntity;
public class PushMessageEntity extends BaseEntity {
private String pushMethod;
private String warningAppCode;
private String warningApiCode;
private String recipientIdList;
private String warningAppType;
private String sendAppName;
private String receiveAppName;
private String receiveApiName;
private String returnData;
private String receiveApiCode;
private String status;
public String getPushMethod() {
return pushMethod;
}
public void setPushMethod(String pushMethod) {
this.pushMethod = pushMethod;
}
public String getWarningAppCode() {
return warningAppCode;
}
public void setWarningAppCode(String warningAppCode) {
this.warningAppCode = warningAppCode;
}
public String getWarningApiCode() {
return warningApiCode;
}
public void setWarningApiCode(String warningApiCode) {
this.warningApiCode = warningApiCode;
}
public String getRecipientIdList() {
return recipientIdList;
}
public void setRecipientIdList(String recipientIdList) {
this.recipientIdList = recipientIdList;
}
public String getWarningAppType() {
return warningAppType;
}
public void setWarningAppType(String warningAppType) {
this.warningAppType = warningAppType;
}
public String getSendAppName() {
return sendAppName;
}
public void setSendAppName(String sendAppName) {
this.sendAppName = sendAppName;
}
public String getReceiveAppName() {
return receiveAppName;
}
public void setReceiveAppName(String receiveAppName) {
this.receiveAppName = receiveAppName;
}
public String getReceiveApiName() {
return receiveApiName;
}
public void setReceiveApiName(String receiveApiName) {
this.receiveApiName = receiveApiName;
}
public String getReturnData() {
return returnData;
}
public void setReturnData(String returnData) {
this.returnData = returnData;
}
public String getReceiveApiCode() {
return receiveApiCode;
}
public void setReceiveApiCode(String receiveApiCode) {
this.receiveApiCode = receiveApiCode;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
}

View File

@ -0,0 +1,43 @@
<?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">
<mapper namespace="com.hzya.frame.plugin.pushMessage.dao.impl.PushMessageDaoImpl">
<resultMap id="get-PushMessageEntity-result" type="com.hzya.frame.plugin.pushMessage.entity.PushMessageEntity" >
<result property="pushMessage" column="push_message" jdbcType="VARCHAR"/>
<result property="warningAppCode" column="warning_app_code" jdbcType="VARCHAR"/>
<result property="warningApiCode" column="warning_api_code" jdbcType="VARCHAR"/>
<result property="appType" column="app_type" jdbcType="VARCHAR"/>
<result property="recipientIdList" column="recipient_id_list" jdbcType="VARCHAR"/>
<result property="sendAppName" column="send_app_name" jdbcType="VARCHAR"/>
<result property="receiveAppName" column="receive_app_name" jdbcType="VARCHAR"/>
<result property="receiveApiName" column="receive_api_name" jdbcType="VARCHAR"/>
<result property="receiveApiCode" column="receive_api_code" jdbcType="VARCHAR"/>
<result property="returnData" column="return_data" jdbcType="VARCHAR"/>
<result property="status" column="status" jdbcType="VARCHAR"/>
</resultMap>
<!-- 查询 采用==查询 -->
<select id="entity_list_base" resultMap="get-PushMessageEntity-result" parameterType = "com.hzya.frame.plugin.pushMessage.entity.PushMessageEntity">
SELECT
warning_config.push_method,
warning_config.sendAppid AS warning_app_code,
warning_config.endApiCode AS warning_api_code,
warning_config.app_type,
warning_config.recipient_id AS recipient_id_list,
log.send_app_name,
log.receive_app_name,
receive_api_name,
log.receive_api_code,
log.return_data,
log.STATUS
FROM
v_hzya_sys_warning warning_config
LEFT JOIN v_hzya_sys_send_message_log log ON warning_config.api_code = log.receive_api_code
WHERE
log.STATUS = '4'
AND warning_config.push_method = '定时'
</select>
</mapper>

View File

@ -0,0 +1,77 @@
package com.hzya.frame.plugin.pushMessage.plugin;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.base.PluginBaseEntity;
import com.hzya.frame.plugin.pushMessage.dao.IPushMessageDao;
import com.hzya.frame.plugin.pushMessage.entity.PushMessageEntity;
import com.hzya.frame.sysnew.comparison.masterData.service.IMasterDataService;
import com.hzya.frame.sysnew.pushMessage.dao.ISysPushMessageDao;
import com.hzya.frame.sysnew.pushMessage.entity.SysPushMessageEntity;
import com.hzya.frame.sysnew.pushMessage.service.ISysPushMessageService;
import com.hzya.frame.sysnew.sendMessageLog.service.ISysSendMessageLogService;
import com.hzya.frame.web.entity.BaseResult;
import com.hzya.frame.web.entity.JsonResultEntity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
@Service("PushMessagePluginInitializer")
public class PushMessagePluginInitializer extends PluginBaseEntity {
Logger logger = LoggerFactory.getLogger(PushMessagePluginInitializer.class);
@Autowired
private ISysPushMessageDao sysPushMessageDao;
@Resource
public ISysSendMessageLogService sysSendMessageLogService;
@Override
public void initialize() {
logger.info(getPluginLabel() + "執行初始化方法initialize()");
}
@Override
public void destroy() {
logger.info(getPluginLabel() + "執行銷毀方法destroy()");
}
@Override
public String getPluginId() {
return "PushMessagePlugin";
}
@Override
public String getPluginName() {
return "PushMessagePlugin插件";
}
@Override
public String getPluginLabel() {
return "PushMessagePlugin";
}
@Override
public String getPluginType() {
return "1";
}
@Override
public JsonResultEntity executeBusiness(JSONObject requestJson) {
try {
logger.info("======开始执行定时消息推送========");
List<SysPushMessageEntity> list = sysPushMessageDao.getAll();
for(SysPushMessageEntity entity : list){
sysSendMessageLogService.sendMessage(entity);
}
return BaseResult.getSuccessMessageEntity("定时推送消息成功");
}catch (Exception e){
logger.info("======执行定时消息推送失败:{}========",e.getMessage());
e.printStackTrace();
}
return null;
}
}

View File

@ -0,0 +1,10 @@
package com.hzya.frame.plugin.pushMessage.service;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.basedao.service.IBaseService;
import com.hzya.frame.plugin.pushMessage.entity.PushMessageEntity;
import com.hzya.frame.web.entity.JsonResultEntity;
public interface IPushMessageService extends IBaseService<PushMessageEntity, String> {
}

View File

@ -0,0 +1,25 @@
package com.hzya.frame.plugin.pushMessage.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.basedao.service.impl.BaseService;
import com.hzya.frame.plugin.pushMessage.dao.IPushMessageDao;
import com.hzya.frame.plugin.pushMessage.entity.PushMessageEntity;
import com.hzya.frame.plugin.pushMessage.service.IPushMessageService;
import com.hzya.frame.web.entity.BaseResult;
import com.hzya.frame.web.entity.JsonResultEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
public class PushMessageServiceImpl extends BaseService<PushMessageEntity, String> implements IPushMessageService {
private IPushMessageDao pushMessageDao;
@Autowired
public void setPushMessageDao(IPushMessageDao dao) {
this.pushMessageDao = dao;
this.dao = dao;
}
}

View File

@ -2,7 +2,7 @@
logging:
#日志级别 指定目录级别
level:
root: warn
root: info
encodings: UTF-8
file:
# 日志保存路径

View File

@ -0,0 +1,15 @@
package com.hzya.frame.sysnew.message.dao;
import com.hzya.frame.sysnew.message.entity.SysMessageEntity;
import com.hzya.frame.basedao.dao.IBaseDao;
/**
* (sys_message: table)表数据库访问层
*
* @author makejava
* @since 2024-08-30 14:17:11
*/
public interface ISysMessageDao extends IBaseDao<SysMessageEntity, String> {
}

View File

@ -0,0 +1,17 @@
package com.hzya.frame.sysnew.message.dao.impl;
import com.hzya.frame.sysnew.message.entity.SysMessageEntity;
import com.hzya.frame.sysnew.message.dao.ISysMessageDao;
import org.springframework.stereotype.Repository;
import com.hzya.frame.basedao.dao.MybatisGenericDao;
/**
* (SysMessage)表数据库访问层
*
* @author makejava
* @since 2024-08-30 14:17:11
*/
@Repository(value = "SysMessageDaoImpl")
public class SysMessageDaoImpl extends MybatisGenericDao<SysMessageEntity, String> implements ISysMessageDao{
}

View File

@ -0,0 +1,136 @@
package com.hzya.frame.sysnew.message.entity;
import java.util.Date;
import com.hzya.frame.web.entity.BaseEntity;
/**
* (SysMessage)实体类
*
* @author makejava
* @since 2024-08-30 14:17:11
*/
public class SysMessageEntity extends BaseEntity {
/** 公司id */
private String companyId;
/** 调用单据类型 */
private Integer billKindId;
/** 来源业务单据id */
private String billId;
/** 模版id */
private String templateId;
/** 1文本消息 2 卡片消息 */
private String messageType;
/** 消息标题 */
private String title;
/** 消息内容 */
private String content;
/** 消息操作区域 */
private String btns;
/** 发送时间 */
private Date pushTime;
/** 发送者 */
private String sendPersonId;
/** 接受者 */
private String sendToPersonId;
/** 状态 */
private Integer state;
public String getCompanyId() {
return companyId;
}
public void setCompanyId(String companyId) {
this.companyId = companyId;
}
public Integer getBillKindId() {
return billKindId;
}
public void setBillKindId(Integer billKindId) {
this.billKindId = billKindId;
}
public String getBillId() {
return billId;
}
public void setBillId(String billId) {
this.billId = billId;
}
public String getTemplateId() {
return templateId;
}
public void setTemplateId(String templateId) {
this.templateId = templateId;
}
public String getMessageType() {
return messageType;
}
public void setMessageType(String messageType) {
this.messageType = messageType;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getBtns() {
return btns;
}
public void setBtns(String btns) {
this.btns = btns;
}
public Date getPushTime() {
return pushTime;
}
public void setPushTime(Date pushTime) {
this.pushTime = pushTime;
}
public String getSendPersonId() {
return sendPersonId;
}
public void setSendPersonId(String sendPersonId) {
this.sendPersonId = sendPersonId;
}
public String getSendToPersonId() {
return sendToPersonId;
}
public void setSendToPersonId(String sendToPersonId) {
this.sendToPersonId = sendToPersonId;
}
public Integer getState() {
return state;
}
public void setState(Integer state) {
this.state = state;
}
}

View File

@ -0,0 +1,327 @@
<?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">
<mapper namespace="com.hzya.frame.sysnew.message.dao.impl.SysMessageDaoImpl">
<resultMap id="get-SysMessageEntity-result" type="com.hzya.frame.sysnew.message.entity.SysMessageEntity" >
<result property="id" column="id" jdbcType="VARCHAR"/>
<result property="sorts" column="sorts" jdbcType="INTEGER"/>
<result property="create_user_id" column="create_user_id" jdbcType="VARCHAR"/>
<result property="create_time" column="create_time" jdbcType="TIMESTAMP"/>
<result property="modify_user_id" column="modify_user_id" jdbcType="VARCHAR"/>
<result property="modify_time" column="modify_time" jdbcType="TIMESTAMP"/>
<result property="sts" column="sts" jdbcType="VARCHAR"/>
<result property="org_id" column="org_id" jdbcType="VARCHAR"/>
<result property="companyId" column="company_id" jdbcType="VARCHAR"/>
<result property="billKindId" column="bill_kind_id" jdbcType="INTEGER"/>
<result property="billId" column="bill_id" jdbcType="VARCHAR"/>
<result property="templateId" column="template_id" jdbcType="VARCHAR"/>
<result property="messageType" column="message_type" jdbcType="VARCHAR"/>
<result property="title" column="title" jdbcType="VARCHAR"/>
<result property="content" column="content" jdbcType="VARCHAR"/>
<result property="btns" column="btns" jdbcType="VARCHAR"/>
<result property="pushTime" column="push_time" jdbcType="TIMESTAMP"/>
<result property="sendPersonId" column="send_person_id" jdbcType="VARCHAR"/>
<result property="sendToPersonId" column="send_to_person_id" jdbcType="VARCHAR"/>
<result property="state" column="state" jdbcType="INTEGER"/>
</resultMap>
<!-- 查询的字段-->
<sql id = "SysMessageEntity_Base_Column_List">
id
,sorts
,create_user_id
,create_time
,modify_user_id
,modify_time
,sts
,org_id
,company_id
,bill_kind_id
,bill_id
,template_id
,message_type
,title
,content
,btns
,push_time
,send_person_id
,send_to_person_id
,state
</sql>
<!--通过ID获取数据 -->
<select id="entity_get" resultMap="get-SysMessageEntity-result">
select
<include refid="SysMessageEntity_Base_Column_List" />
from sys_message where id = #{ id } and sts='Y'
</select>
<!-- 查询 采用==查询 -->
<select id="entity_list_base" resultMap="get-SysMessageEntity-result" parameterType = "com.hzya.frame.sysnew.message.entity.SysMessageEntity">
select
<include refid="SysMessageEntity_Base_Column_List" />
from sys_message
<trim prefix="where" prefixOverrides="and">
<if test="id != null and id != ''"> and id = #{id} </if>
<if test="sorts != null"> and sorts = #{sorts} </if>
<if test="create_user_id != null and create_user_id != ''"> and create_user_id = #{create_user_id} </if>
<if test="create_time != null"> and create_time = #{create_time} </if>
<if test="modify_user_id != null and modify_user_id != ''"> and modify_user_id = #{modify_user_id} </if>
<if test="modify_time != null"> and modify_time = #{modify_time} </if>
<if test="sts != null and sts != ''"> and sts = #{sts} </if>
<if test="org_id != null and org_id != ''"> and org_id = #{org_id} </if>
<if test="companyId != null and companyId != ''"> and company_id = #{companyId} </if>
<if test="billKindId != null"> and bill_kind_id = #{billKindId} </if>
<if test="billId != null and billId != ''"> and bill_id = #{billId} </if>
<if test="templateId != null and templateId != ''"> and template_id = #{templateId} </if>
<if test="messageType != null and messageType != ''"> and message_type = #{messageType} </if>
<if test="title != null and title != ''"> and title = #{title} </if>
<if test="content != null and content != ''"> and content = #{content} </if>
<if test="btns != null and btns != ''"> and btns = #{btns} </if>
<if test="pushTime != null"> and push_time = #{pushTime} </if>
<if test="sendPersonId != null and sendPersonId != ''"> and send_person_id = #{sendPersonId} </if>
<if test="sendToPersonId != null and sendToPersonId != ''"> and send_to_person_id = #{sendToPersonId} </if>
<if test="state != null"> and state = #{state} </if>
and sts='Y'
</trim>
<if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
<if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
</select>
<!-- 查询符合条件的数量 -->
<select id="entity_count" resultType="Integer" parameterType = "com.hzya.frame.sysnew.message.entity.SysMessageEntity">
select count(1) from sys_message
<trim prefix="where" prefixOverrides="and">
<if test="id != null and id != ''"> and id = #{id} </if>
<if test="sorts != null"> and sorts = #{sorts} </if>
<if test="create_user_id != null and create_user_id != ''"> and create_user_id = #{create_user_id} </if>
<if test="create_time != null"> and create_time = #{create_time} </if>
<if test="modify_user_id != null and modify_user_id != ''"> and modify_user_id = #{modify_user_id} </if>
<if test="modify_time != null"> and modify_time = #{modify_time} </if>
<if test="sts != null and sts != ''"> and sts = #{sts} </if>
<if test="org_id != null and org_id != ''"> and org_id = #{org_id} </if>
<if test="companyId != null and companyId != ''"> and company_id = #{companyId} </if>
<if test="billKindId != null"> and bill_kind_id = #{billKindId} </if>
<if test="billId != null and billId != ''"> and bill_id = #{billId} </if>
<if test="templateId != null and templateId != ''"> and template_id = #{templateId} </if>
<if test="messageType != null and messageType != ''"> and message_type = #{messageType} </if>
<if test="title != null and title != ''"> and title = #{title} </if>
<if test="content != null and content != ''"> and content = #{content} </if>
<if test="btns != null and btns != ''"> and btns = #{btns} </if>
<if test="pushTime != null"> and push_time = #{pushTime} </if>
<if test="sendPersonId != null and sendPersonId != ''"> and send_person_id = #{sendPersonId} </if>
<if test="sendToPersonId != null and sendToPersonId != ''"> and send_to_person_id = #{sendToPersonId} </if>
<if test="state != null"> and state = #{state} </if>
and sts='Y'
</trim>
<if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
<if test=" sort !='' and sort!=null and order !='' and order!=null "> order by ${sort} ${order}</if>
</select>
<!-- 分页查询列表 采用like格式 -->
<select id="entity_list_like" resultMap="get-SysMessageEntity-result" parameterType = "com.hzya.frame.sysnew.message.entity.SysMessageEntity">
select
<include refid="SysMessageEntity_Base_Column_List" />
from sys_message
<trim prefix="where" prefixOverrides="and">
<if test="id != null and id != ''"> and id like concat('%',#{id},'%') </if>
<if test="sorts != null"> and sorts like concat('%',#{sorts},'%') </if>
<if test="create_user_id != null and create_user_id != ''"> and create_user_id like concat('%',#{create_user_id},'%') </if>
<if test="create_time != null"> and create_time like concat('%',#{create_time},'%') </if>
<if test="modify_user_id != null and modify_user_id != ''"> and modify_user_id like concat('%',#{modify_user_id},'%') </if>
<if test="modify_time != null"> and modify_time like concat('%',#{modify_time},'%') </if>
<if test="sts != null and sts != ''"> and sts like concat('%',#{sts},'%') </if>
<if test="org_id != null and org_id != ''"> and org_id like concat('%',#{org_id},'%') </if>
<if test="companyId != null and companyId != ''"> and company_id like concat('%',#{companyId},'%') </if>
<if test="billKindId != null"> and bill_kind_id like concat('%',#{billKindId},'%') </if>
<if test="billId != null and billId != ''"> and bill_id like concat('%',#{billId},'%') </if>
<if test="templateId != null and templateId != ''"> and template_id like concat('%',#{templateId},'%') </if>
<if test="messageType != null and messageType != ''"> and message_type like concat('%',#{messageType},'%') </if>
<if test="title != null and title != ''"> and title like concat('%',#{title},'%') </if>
<if test="content != null and content != ''"> and content like concat('%',#{content},'%') </if>
<if test="btns != null and btns != ''"> and btns like concat('%',#{btns},'%') </if>
<if test="pushTime != null"> and push_time like concat('%',#{pushTime},'%') </if>
<if test="sendPersonId != null and sendPersonId != ''"> and send_person_id like concat('%',#{sendPersonId},'%') </if>
<if test="sendToPersonId != null and sendToPersonId != ''"> and send_to_person_id like concat('%',#{sendToPersonId},'%') </if>
<if test="state != null"> and state like concat('%',#{state},'%') </if>
and sts='Y'
</trim>
<if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
<if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
</select>
<!-- 查询列表 字段采用or格式 -->
<select id="SysMessageentity_list_or" resultMap="get-SysMessageEntity-result" parameterType = "com.hzya.frame.sysnew.message.entity.SysMessageEntity">
select
<include refid="SysMessageEntity_Base_Column_List" />
from sys_message
<trim prefix="where" prefixOverrides="and">
<if test="id != null and id != ''"> or id = #{id} </if>
<if test="sorts != null"> or sorts = #{sorts} </if>
<if test="create_user_id != null and create_user_id != ''"> or create_user_id = #{create_user_id} </if>
<if test="create_time != null"> or create_time = #{create_time} </if>
<if test="modify_user_id != null and modify_user_id != ''"> or modify_user_id = #{modify_user_id} </if>
<if test="modify_time != null"> or modify_time = #{modify_time} </if>
<if test="sts != null and sts != ''"> or sts = #{sts} </if>
<if test="org_id != null and org_id != ''"> or org_id = #{org_id} </if>
<if test="companyId != null and companyId != ''"> or company_id = #{companyId} </if>
<if test="billKindId != null"> or bill_kind_id = #{billKindId} </if>
<if test="billId != null and billId != ''"> or bill_id = #{billId} </if>
<if test="templateId != null and templateId != ''"> or template_id = #{templateId} </if>
<if test="messageType != null and messageType != ''"> or message_type = #{messageType} </if>
<if test="title != null and title != ''"> or title = #{title} </if>
<if test="content != null and content != ''"> or content = #{content} </if>
<if test="btns != null and btns != ''"> or btns = #{btns} </if>
<if test="pushTime != null"> or push_time = #{pushTime} </if>
<if test="sendPersonId != null and sendPersonId != ''"> or send_person_id = #{sendPersonId} </if>
<if test="sendToPersonId != null and sendToPersonId != ''"> or send_to_person_id = #{sendToPersonId} </if>
<if test="state != null"> or state = #{state} </if>
and sts='Y'
</trim>
<if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
<if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
</select>
<!--新增所有列-->
<insert id="entity_insert" parameterType = "com.hzya.frame.sysnew.message.entity.SysMessageEntity" keyProperty="id" useGeneratedKeys="true">
insert into sys_message(
<trim suffix="" suffixOverrides=",">
<if test="id != null and id != ''"> id , </if>
<if test="sorts != null"> sorts , </if>
<if test="create_user_id != null and create_user_id != ''"> create_user_id , </if>
<if test="create_time != null"> create_time , </if>
<if test="modify_user_id != null and modify_user_id != ''"> modify_user_id , </if>
<if test="modify_time != null"> modify_time , </if>
<if test="sts != null and sts != ''"> sts , </if>
<if test="org_id != null and org_id != ''"> org_id , </if>
<if test="companyId != null and companyId != ''"> company_id , </if>
<if test="billKindId != null"> bill_kind_id , </if>
<if test="billId != null and billId != ''"> bill_id , </if>
<if test="templateId != null and templateId != ''"> template_id , </if>
<if test="messageType != null and messageType != ''"> message_type , </if>
<if test="title != null and title != ''"> title , </if>
<if test="content != null and content != ''"> content , </if>
<if test="btns != null and btns != ''"> btns , </if>
<if test="pushTime != null"> push_time , </if>
<if test="sendPersonId != null and sendPersonId != ''"> send_person_id , </if>
<if test="sendToPersonId != null and sendToPersonId != ''"> send_to_person_id , </if>
<if test="state != null"> state , </if>
<if test="sts == null ">sts,</if>
</trim>
)values(
<trim suffix="" suffixOverrides=",">
<if test="id != null and id != ''"> #{id} ,</if>
<if test="sorts != null"> #{sorts} ,</if>
<if test="create_user_id != null and create_user_id != ''"> #{create_user_id} ,</if>
<if test="create_time != null"> #{create_time} ,</if>
<if test="modify_user_id != null and modify_user_id != ''"> #{modify_user_id} ,</if>
<if test="modify_time != null"> #{modify_time} ,</if>
<if test="sts != null and sts != ''"> #{sts} ,</if>
<if test="org_id != null and org_id != ''"> #{org_id} ,</if>
<if test="companyId != null and companyId != ''"> #{companyId} ,</if>
<if test="billKindId != null"> #{billKindId} ,</if>
<if test="billId != null and billId != ''"> #{billId} ,</if>
<if test="templateId != null and templateId != ''"> #{templateId} ,</if>
<if test="messageType != null and messageType != ''"> #{messageType} ,</if>
<if test="title != null and title != ''"> #{title} ,</if>
<if test="content != null and content != ''"> #{content} ,</if>
<if test="btns != null and btns != ''"> #{btns} ,</if>
<if test="pushTime != null"> #{pushTime} ,</if>
<if test="sendPersonId != null and sendPersonId != ''"> #{sendPersonId} ,</if>
<if test="sendToPersonId != null and sendToPersonId != ''"> #{sendToPersonId} ,</if>
<if test="state != null"> #{state} ,</if>
<if test="sts == null ">'Y',</if>
</trim>
)
</insert>
<!-- 批量新增 -->
<insert id="entityInsertBatch" keyProperty="id" useGeneratedKeys="true">
insert into sys_message(create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id, bill_kind_id, bill_id, template_id, message_type, title, content, btns, push_time, send_person_id, send_to_person_id, state, sts)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId},#{entity.billKindId},#{entity.billId},#{entity.templateId},#{entity.messageType},#{entity.title},#{entity.content},#{entity.btns},#{entity.pushTime},#{entity.sendPersonId},#{entity.sendToPersonId},#{entity.state}, 'Y')
</foreach>
</insert>
<!-- 批量新增或者修改-->
<insert id="entityInsertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
insert into sys_message(create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id, bill_kind_id, bill_id, template_id, message_type, title, content, btns, push_time, send_person_id, send_to_person_id, state)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId},#{entity.billKindId},#{entity.billId},#{entity.templateId},#{entity.messageType},#{entity.title},#{entity.content},#{entity.btns},#{entity.pushTime},#{entity.sendPersonId},#{entity.sendToPersonId},#{entity.state})
</foreach>
on duplicate key update
create_user_id = values(create_user_id),
create_time = values(create_time),
modify_user_id = values(modify_user_id),
modify_time = values(modify_time),
sts = values(sts),
org_id = values(org_id),
company_id = values(company_id),
bill_kind_id = values(bill_kind_id),
bill_id = values(bill_id),
template_id = values(template_id),
message_type = values(message_type),
title = values(title),
content = values(content),
btns = values(btns),
push_time = values(push_time),
send_person_id = values(send_person_id),
send_to_person_id = values(send_to_person_id),
state = values(state)</insert>
<!--通过主键修改方法-->
<update id="entity_update" parameterType = "com.hzya.frame.sysnew.message.entity.SysMessageEntity" >
update sys_message set
<trim suffix="" suffixOverrides=",">
<if test="create_user_id != null and create_user_id != ''"> create_user_id = #{create_user_id},</if>
<if test="create_time != null"> create_time = #{create_time},</if>
<if test="modify_user_id != null and modify_user_id != ''"> modify_user_id = #{modify_user_id},</if>
<if test="modify_time != null"> modify_time = #{modify_time},</if>
<if test="sts != null and sts != ''"> sts = #{sts},</if>
<if test="org_id != null and org_id != ''"> org_id = #{org_id},</if>
<if test="companyId != null and companyId != ''"> company_id = #{companyId},</if>
<if test="billKindId != null"> bill_kind_id = #{billKindId},</if>
<if test="billId != null and billId != ''"> bill_id = #{billId},</if>
<if test="templateId != null and templateId != ''"> template_id = #{templateId},</if>
<if test="messageType != null and messageType != ''"> message_type = #{messageType},</if>
<if test="title != null and title != ''"> title = #{title},</if>
<if test="content != null and content != ''"> content = #{content},</if>
<if test="btns != null and btns != ''"> btns = #{btns},</if>
<if test="pushTime != null"> push_time = #{pushTime},</if>
<if test="sendPersonId != null and sendPersonId != ''"> send_person_id = #{sendPersonId},</if>
<if test="sendToPersonId != null and sendToPersonId != ''"> send_to_person_id = #{sendToPersonId},</if>
<if test="state != null"> state = #{state},</if>
</trim>
where id = #{id}
</update>
<!-- 逻辑删除 -->
<update id="entity_logicDelete" parameterType = "com.hzya.frame.sysnew.message.entity.SysMessageEntity" >
update sys_message set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id}
where id = #{id}
</update>
<!-- 多条件逻辑删除 -->
<update id="entity_logicDelete_Multi_Condition" parameterType = "com.hzya.frame.sysnew.message.entity.SysMessageEntity" >
update sys_message set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id}
<trim prefix="where" prefixOverrides="and">
<if test="id != null and id != ''"> and id = #{id} </if>
<if test="sorts != null"> and sorts = #{sorts} </if>
<if test="sts != null and sts != ''"> and sts = #{sts} </if>
<if test="companyId != null and companyId != ''"> and company_id = #{companyId} </if>
<if test="billKindId != null"> and bill_kind_id = #{billKindId} </if>
<if test="billId != null and billId != ''"> and bill_id = #{billId} </if>
<if test="templateId != null and templateId != ''"> and template_id = #{templateId} </if>
<if test="messageType != null and messageType != ''"> and message_type = #{messageType} </if>
<if test="title != null and title != ''"> and title = #{title} </if>
<if test="content != null and content != ''"> and content = #{content} </if>
<if test="btns != null and btns != ''"> and btns = #{btns} </if>
<if test="pushTime != null"> and push_time = #{pushTime} </if>
<if test="sendPersonId != null and sendPersonId != ''"> and send_person_id = #{sendPersonId} </if>
<if test="sendToPersonId != null and sendToPersonId != ''"> and send_to_person_id = #{sendToPersonId} </if>
<if test="state != null"> and state = #{state} </if>
and sts='Y'
</trim>
</update>
<!--通过主键删除-->
<delete id="entity_delete">
delete from sys_message where id = #{id}
</delete>
</mapper>

View File

@ -0,0 +1,26 @@
package com.hzya.frame.sysnew.message.service;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.sysnew.message.entity.SysMessageEntity;
import com.hzya.frame.basedao.service.IBaseService;
import com.hzya.frame.web.entity.JsonResultEntity;
/**
* (SysMessage)表服务接口
*
* @author makejava
* @since 2024-08-30 14:17:11
*/
public interface ISysMessageService extends IBaseService<SysMessageEntity, String>{
JsonResultEntity queryEntityPage(JSONObject jsonObject);
JsonResultEntity queryEntity(JSONObject jsonObject);
JsonResultEntity saveEntity(JSONObject jsonObject);
JsonResultEntity getEntity(JSONObject jsonObject);
JsonResultEntity updateEntity(JSONObject jsonObject);
JsonResultEntity deleteEntity(JSONObject jsonObject);
}

View File

@ -0,0 +1,112 @@
package com.hzya.frame.sysnew.message.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hzya.frame.sysnew.message.entity.SysMessageEntity;
import com.hzya.frame.sysnew.message.dao.ISysMessageDao;
import com.hzya.frame.sysnew.message.service.ISysMessageService;
import com.hzya.frame.sysnew.organ.entity.SysOrganEntity;
import com.hzya.frame.web.entity.BaseResult;
import com.hzya.frame.web.entity.JsonResultEntity;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import javax.annotation.Resource;
import com.hzya.frame.basedao.service.impl.BaseService;
import java.util.List;
/**
* (SysMessage)表服务实现类
*
* @author makejava
* @since 2024-08-30 14:17:11
*/
@Service(value = "sysMessageService")
public class SysMessageServiceImpl extends BaseService<SysMessageEntity, String> implements ISysMessageService {
private ISysMessageDao sysMessageDao;
@Autowired
public void setSysMessageDao(ISysMessageDao dao) {
this.sysMessageDao = dao;
this.dao = dao;
}
@Override
public JsonResultEntity queryEntityPage(JSONObject jsonObject){
SysMessageEntity entity = getData("jsonStr", jsonObject, SysMessageEntity.class);
if(entity == null || entity.getPageNum() == null || entity.getPageSize() == null){
return BaseResult.getFailureMessageEntity("分页查询参数不存在");
}
PageHelper.startPage(entity.getPageNum(), entity.getPageSize());
List<SysMessageEntity> list = sysMessageDao.queryByLike(entity);
PageInfo<SysMessageEntity> pageInfo = new PageInfo<>(list);
return BaseResult.getSuccessMessageEntity("查询数据成功", pageInfo);
}
@Override
public JsonResultEntity queryEntity(JSONObject jsonObject){
SysMessageEntity entity = getData("jsonStr", jsonObject, SysMessageEntity.class);
if(entity == null){
entity = new SysMessageEntity();
}
List<SysMessageEntity> list = sysMessageDao.queryByLike(entity);
return BaseResult.getSuccessMessageEntity("查询数据成功", list);
}
@Override
public JsonResultEntity getEntity(JSONObject jsonObject){
SysMessageEntity entity = getData("jsonStr", jsonObject, SysMessageEntity.class);
if(entity == null){
return BaseResult.getFailureMessageEntity("参数不允许为空");
}
if(entity.getId() == null || "".equals(entity.getId())){
return BaseResult.getFailureMessageEntity("系统错误");
}
entity = sysMessageDao.get(entity.getId());
if(entity == null){
return BaseResult.getFailureMessageEntity("获取站内消息失败");
}
return BaseResult.getSuccessMessageEntity("获取站内消息成功", entity);
}
@Override
public JsonResultEntity saveEntity(JSONObject jsonObject) {
SysMessageEntity entity = getData("jsonStr", jsonObject, SysMessageEntity.class);
if (entity == null) {
return BaseResult.getFailureMessageEntity("参数不允许为空");
}
entity.setCreate();
//保存
sysMessageDao.save(entity);
return BaseResult.getSuccessMessageEntity("保存消息成功", entity);
}
@Override
public JsonResultEntity updateEntity(JSONObject jsonObject) {
SysMessageEntity entity = getData("jsonStr", jsonObject, SysMessageEntity.class);
if(entity == null){
return BaseResult.getFailureMessageEntity("参数不允许为空");
}
if(entity.getId() == null || "".equals(entity.getId())){
return BaseResult.getFailureMessageEntity("系统错误");
}
entity.setUpdate();
sysMessageDao.update(entity);
return BaseResult.getSuccessMessageEntity("修改站内消息成功", entity);
}
@Override
public JsonResultEntity deleteEntity(JSONObject jsonObject) {
SysMessageEntity entity = getData("jsonStr", jsonObject, SysMessageEntity.class);
if(entity == null){
return BaseResult.getFailureMessageEntity("参数不允许为空");
}
if(entity.getId() == null || "".equals(entity.getId())){
return BaseResult.getFailureMessageEntity("系统错误");
}
sysMessageDao.logicRemove(entity);
return BaseResult.getSuccessMessageEntity("删除站内消息成功");
}
}

View File

@ -0,0 +1,15 @@
package com.hzya.frame.sysnew.messageTemplate.dao;
import com.hzya.frame.sysnew.messageTemplate.entity.SysMessageTemplateEntity;
import com.hzya.frame.basedao.dao.IBaseDao;
/**
* (sys_message_template: table)表数据库访问层
*
* @author makejava
* @since 2024-08-30 14:21:15
*/
public interface ISysMessageTemplateDao extends IBaseDao<SysMessageTemplateEntity, String> {
}

View File

@ -0,0 +1,17 @@
package com.hzya.frame.sysnew.messageTemplate.dao.impl;
import com.hzya.frame.sysnew.messageTemplate.entity.SysMessageTemplateEntity;
import com.hzya.frame.sysnew.messageTemplate.dao.ISysMessageTemplateDao;
import org.springframework.stereotype.Repository;
import com.hzya.frame.basedao.dao.MybatisGenericDao;
/**
* (SysMessageTemplate)表数据库访问层
*
* @author makejava
* @since 2024-08-30 14:21:15
*/
@Repository(value = "SysMessageTemplateDaoImpl")
public class SysMessageTemplateDaoImpl extends MybatisGenericDao<SysMessageTemplateEntity, String> implements ISysMessageTemplateDao{
}

View File

@ -0,0 +1,136 @@
package com.hzya.frame.sysnew.messageTemplate.entity;
import java.util.Date;
import com.hzya.frame.web.entity.BaseEntity;
/**
* (SysMessageTemplate)实体类
*
* @author makejava
* @since 2024-08-30 14:21:15
*/
public class SysMessageTemplateEntity extends BaseEntity {
/** 公司id */
private String companyId;
/** 调用单据类型 */
private String billKindId;
/** 模版类型 */
private String templateType;
/** 模版名称 */
private String templateName;
/** 消息标题 */
private String messageTitle;
/** 消息内容 */
private String messageContents;
/** 消息操作区域 */
private String btns;
/** 数据源 */
private String dataSource;
/** 创建时间 */
private Date createDate;
/** 创建人 */
private String createPersonId;
/** 状态 */
private String state;
/** 删除标志 */
private Integer isdelete;
public String getCompanyId() {
return companyId;
}
public void setCompanyId(String companyId) {
this.companyId = companyId;
}
public String getBillKindId() {
return billKindId;
}
public void setBillKindId(String billKindId) {
this.billKindId = billKindId;
}
public String getTemplateType() {
return templateType;
}
public void setTemplateType(String templateType) {
this.templateType = templateType;
}
public String getTemplateName() {
return templateName;
}
public void setTemplateName(String templateName) {
this.templateName = templateName;
}
public String getMessageTitle() {
return messageTitle;
}
public void setMessageTitle(String messageTitle) {
this.messageTitle = messageTitle;
}
public String getMessageContents() {
return messageContents;
}
public void setMessageContents(String messageContents) {
this.messageContents = messageContents;
}
public String getBtns() {
return btns;
}
public void setBtns(String btns) {
this.btns = btns;
}
public String getDataSource() {
return dataSource;
}
public void setDataSource(String dataSource) {
this.dataSource = dataSource;
}
public Date getCreateDate() {
return createDate;
}
public void setCreateDate(Date createDate) {
this.createDate = createDate;
}
public String getCreatePersonId() {
return createPersonId;
}
public void setCreatePersonId(String createPersonId) {
this.createPersonId = createPersonId;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
public Integer getIsdelete() {
return isdelete;
}
public void setIsdelete(Integer isdelete) {
this.isdelete = isdelete;
}
}

View File

@ -0,0 +1,328 @@
<?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">
<mapper namespace="com.hzya.frame.sysnew.messageTemplate.dao.impl.SysMessageTemplateDaoImpl">
<resultMap id="get-SysMessageTemplateEntity-result" type="com.hzya.frame.sysnew.messageTemplate.entity.SysMessageTemplateEntity" >
<result property="id" column="id" jdbcType="VARCHAR"/>
<result property="sorts" column="sorts" jdbcType="INTEGER"/>
<result property="create_user_id" column="create_user_id" jdbcType="VARCHAR"/>
<result property="create_time" column="create_time" jdbcType="TIMESTAMP"/>
<result property="modify_user_id" column="modify_user_id" jdbcType="VARCHAR"/>
<result property="modify_time" column="modify_time" jdbcType="TIMESTAMP"/>
<result property="sts" column="sts" jdbcType="VARCHAR"/>
<result property="org_id" column="org_id" jdbcType="VARCHAR"/>
<result property="companyId" column="company_id" jdbcType="VARCHAR"/>
<result property="billKindId" column="bill_kind_id" jdbcType="VARCHAR"/>
<result property="templateType" column="template_type" jdbcType="VARCHAR"/>
<result property="templateName" column="template_name" jdbcType="VARCHAR"/>
<result property="messageTitle" column="message_title" jdbcType="VARCHAR"/>
<result property="messageContents" column="message_contents" jdbcType="VARCHAR"/>
<result property="btns" column="btns" jdbcType="VARCHAR"/>
<result property="dataSource" column="data_source" jdbcType="VARCHAR"/>
<result property="createDate" column="create_date" jdbcType="TIMESTAMP"/>
<result property="createPersonId" column="create_person_id" jdbcType="VARCHAR"/>
<result property="state" column="state" jdbcType="VARCHAR"/>
<result property="isdelete" column="isdelete" jdbcType="INTEGER"/>
</resultMap>
<!-- 查询的字段-->
<sql id = "SysMessageTemplateEntity_Base_Column_List">
id
,sorts
,create_user_id
,create_time
,modify_user_id
,modify_time
,sts
,org_id
,company_id
,bill_kind_id
,template_type
,template_name
,message_title
,message_contents
,btns
,data_source
,create_date
,create_person_id
,state
,isdelete
</sql>
<!--通过ID获取数据 -->
<select id="entity_get" resultMap="get-SysMessageTemplateEntity-result">
select
<include refid="SysMessageTemplateEntity_Base_Column_List" />
from sys_message_template where id = #{ id } and sts='Y'
</select>
<!-- 查询 采用==查询 -->
<select id="entity_list_base" resultMap="get-SysMessageTemplateEntity-result" parameterType = "com.hzya.frame.sysnew.messageTemplate.entity.SysMessageTemplateEntity">
select
<include refid="SysMessageTemplateEntity_Base_Column_List" />
from sys_message_template
<trim prefix="where" prefixOverrides="and">
<if test="id != null and id != ''"> and id = #{id} </if>
<if test="sorts != null"> and sorts = #{sorts} </if>
<if test="create_user_id != null and create_user_id != ''"> and create_user_id = #{create_user_id} </if>
<if test="create_time != null"> and create_time = #{create_time} </if>
<if test="modify_user_id != null and modify_user_id != ''"> and modify_user_id = #{modify_user_id} </if>
<if test="modify_time != null"> and modify_time = #{modify_time} </if>
<if test="sts != null and sts != ''"> and sts = #{sts} </if>
<if test="org_id != null and org_id != ''"> and org_id = #{org_id} </if>
<if test="companyId != null and companyId != ''"> and company_id = #{companyId} </if>
<if test="billKindId != null and billKindId != ''"> and bill_kind_id = #{billKindId} </if>
<if test="templateType != null and templateType != ''"> and template_type = #{templateType} </if>
<if test="templateName != null and templateName != ''"> and template_name = #{templateName} </if>
<if test="messageTitle != null and messageTitle != ''"> and message_title = #{messageTitle} </if>
<if test="messageContents != null and messageContents != ''"> and message_contents = #{messageContents} </if>
<if test="btns != null and btns != ''"> and btns = #{btns} </if>
<if test="dataSource != null and dataSource != ''"> and data_source = #{dataSource} </if>
<if test="createDate != null"> and create_date = #{createDate} </if>
<if test="createPersonId != null and createPersonId != ''"> and create_person_id = #{createPersonId} </if>
<if test="state != null and state != ''"> and state = #{state} </if>
<if test="isdelete != null"> and isdelete = #{isdelete} </if>
and sts='Y'
</trim>
<if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
<if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
</select>
<!-- 查询符合条件的数量 -->
<select id="entity_count" resultType="Integer" parameterType = "com.hzya.frame.sysnew.messageTemplate.entity.SysMessageTemplateEntity">
select count(1) from sys_message_template
<trim prefix="where" prefixOverrides="and">
<if test="id != null and id != ''"> and id = #{id} </if>
<if test="sorts != null"> and sorts = #{sorts} </if>
<if test="create_user_id != null and create_user_id != ''"> and create_user_id = #{create_user_id} </if>
<if test="create_time != null"> and create_time = #{create_time} </if>
<if test="modify_user_id != null and modify_user_id != ''"> and modify_user_id = #{modify_user_id} </if>
<if test="modify_time != null"> and modify_time = #{modify_time} </if>
<if test="sts != null and sts != ''"> and sts = #{sts} </if>
<if test="org_id != null and org_id != ''"> and org_id = #{org_id} </if>
<if test="companyId != null and companyId != ''"> and company_id = #{companyId} </if>
<if test="billKindId != null and billKindId != ''"> and bill_kind_id = #{billKindId} </if>
<if test="templateType != null and templateType != ''"> and template_type = #{templateType} </if>
<if test="templateName != null and templateName != ''"> and template_name = #{templateName} </if>
<if test="messageTitle != null and messageTitle != ''"> and message_title = #{messageTitle} </if>
<if test="messageContents != null and messageContents != ''"> and message_contents = #{messageContents} </if>
<if test="btns != null and btns != ''"> and btns = #{btns} </if>
<if test="dataSource != null and dataSource != ''"> and data_source = #{dataSource} </if>
<if test="createDate != null"> and create_date = #{createDate} </if>
<if test="createPersonId != null and createPersonId != ''"> and create_person_id = #{createPersonId} </if>
<if test="state != null and state != ''"> and state = #{state} </if>
<if test="isdelete != null"> and isdelete = #{isdelete} </if>
and sts='Y'
</trim>
<if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
<if test=" sort !='' and sort!=null and order !='' and order!=null "> order by ${sort} ${order}</if>
</select>
<!-- 分页查询列表 采用like格式 -->
<select id="entity_list_like" resultMap="get-SysMessageTemplateEntity-result" parameterType = "com.hzya.frame.sysnew.messageTemplate.entity.SysMessageTemplateEntity">
select
<include refid="SysMessageTemplateEntity_Base_Column_List" />
from sys_message_template
<trim prefix="where" prefixOverrides="and">
<if test="id != null and id != ''"> and id like concat('%',#{id},'%') </if>
<if test="sorts != null"> and sorts like concat('%',#{sorts},'%') </if>
<if test="create_user_id != null and create_user_id != ''"> and create_user_id like concat('%',#{create_user_id},'%') </if>
<if test="create_time != null"> and create_time like concat('%',#{create_time},'%') </if>
<if test="modify_user_id != null and modify_user_id != ''"> and modify_user_id like concat('%',#{modify_user_id},'%') </if>
<if test="modify_time != null"> and modify_time like concat('%',#{modify_time},'%') </if>
<if test="sts != null and sts != ''"> and sts like concat('%',#{sts},'%') </if>
<if test="org_id != null and org_id != ''"> and org_id like concat('%',#{org_id},'%') </if>
<if test="companyId != null and companyId != ''"> and company_id like concat('%',#{companyId},'%') </if>
<if test="billKindId != null and billKindId != ''"> and bill_kind_id like concat('%',#{billKindId},'%') </if>
<if test="templateType != null and templateType != ''"> and template_type like concat('%',#{templateType},'%') </if>
<if test="templateName != null and templateName != ''"> and template_name like concat('%',#{templateName},'%') </if>
<if test="messageTitle != null and messageTitle != ''"> and message_title like concat('%',#{messageTitle},'%') </if>
<if test="messageContents != null and messageContents != ''"> and message_contents like concat('%',#{messageContents},'%') </if>
<if test="btns != null and btns != ''"> and btns like concat('%',#{btns},'%') </if>
<if test="dataSource != null and dataSource != ''"> and data_source like concat('%',#{dataSource},'%') </if>
<if test="createDate != null"> and create_date like concat('%',#{createDate},'%') </if>
<if test="createPersonId != null and createPersonId != ''"> and create_person_id like concat('%',#{createPersonId},'%') </if>
<if test="state != null and state != ''"> and state like concat('%',#{state},'%') </if>
<if test="isdelete != null"> and isdelete like concat('%',#{isdelete},'%') </if>
and sts='Y'
</trim>
<if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
<if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
</select>
<!-- 查询列表 字段采用or格式 -->
<select id="SysMessageTemplateentity_list_or" resultMap="get-SysMessageTemplateEntity-result" parameterType = "com.hzya.frame.sysnew.messageTemplate.entity.SysMessageTemplateEntity">
select
<include refid="SysMessageTemplateEntity_Base_Column_List" />
from sys_message_template
<trim prefix="where" prefixOverrides="and">
<if test="id != null and id != ''"> or id = #{id} </if>
<if test="sorts != null"> or sorts = #{sorts} </if>
<if test="create_user_id != null and create_user_id != ''"> or create_user_id = #{create_user_id} </if>
<if test="create_time != null"> or create_time = #{create_time} </if>
<if test="modify_user_id != null and modify_user_id != ''"> or modify_user_id = #{modify_user_id} </if>
<if test="modify_time != null"> or modify_time = #{modify_time} </if>
<if test="sts != null and sts != ''"> or sts = #{sts} </if>
<if test="org_id != null and org_id != ''"> or org_id = #{org_id} </if>
<if test="companyId != null and companyId != ''"> or company_id = #{companyId} </if>
<if test="billKindId != null and billKindId != ''"> or bill_kind_id = #{billKindId} </if>
<if test="templateType != null and templateType != ''"> or template_type = #{templateType} </if>
<if test="templateName != null and templateName != ''"> or template_name = #{templateName} </if>
<if test="messageTitle != null and messageTitle != ''"> or message_title = #{messageTitle} </if>
<if test="messageContents != null and messageContents != ''"> or message_contents = #{messageContents} </if>
<if test="btns != null and btns != ''"> or btns = #{btns} </if>
<if test="dataSource != null and dataSource != ''"> or data_source = #{dataSource} </if>
<if test="createDate != null"> or create_date = #{createDate} </if>
<if test="createPersonId != null and createPersonId != ''"> or create_person_id = #{createPersonId} </if>
<if test="state != null and state != ''"> or state = #{state} </if>
<if test="isdelete != null"> or isdelete = #{isdelete} </if>
and sts='Y'
</trim>
<if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
<if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
</select>
<!--新增所有列-->
<insert id="entity_insert" parameterType = "com.hzya.frame.sysnew.messageTemplate.entity.SysMessageTemplateEntity" keyProperty="id" useGeneratedKeys="true">
insert into sys_message_template(
<trim suffix="" suffixOverrides=",">
<if test="id != null and id != ''"> id , </if>
<if test="sorts != null"> sorts , </if>
<if test="create_user_id != null and create_user_id != ''"> create_user_id , </if>
<if test="create_time != null"> create_time , </if>
<if test="modify_user_id != null and modify_user_id != ''"> modify_user_id , </if>
<if test="modify_time != null"> modify_time , </if>
<if test="sts != null and sts != ''"> sts , </if>
<if test="org_id != null and org_id != ''"> org_id , </if>
<if test="companyId != null and companyId != ''"> company_id , </if>
<if test="billKindId != null and billKindId != ''"> bill_kind_id , </if>
<if test="templateType != null and templateType != ''"> template_type , </if>
<if test="templateName != null and templateName != ''"> template_name , </if>
<if test="messageTitle != null and messageTitle != ''"> message_title , </if>
<if test="messageContents != null and messageContents != ''"> message_contents , </if>
<if test="btns != null and btns != ''"> btns , </if>
<if test="dataSource != null and dataSource != ''"> data_source , </if>
<if test="createDate != null"> create_date , </if>
<if test="createPersonId != null and createPersonId != ''"> create_person_id , </if>
<if test="state != null and state != ''"> state , </if>
<if test="isdelete != null"> isdelete , </if>
<if test="sts == null ">sts,</if>
</trim>
)values(
<trim suffix="" suffixOverrides=",">
<if test="id != null and id != ''"> #{id} ,</if>
<if test="sorts != null"> #{sorts} ,</if>
<if test="create_user_id != null and create_user_id != ''"> #{create_user_id} ,</if>
<if test="create_time != null"> #{create_time} ,</if>
<if test="modify_user_id != null and modify_user_id != ''"> #{modify_user_id} ,</if>
<if test="modify_time != null"> #{modify_time} ,</if>
<if test="sts != null and sts != ''"> #{sts} ,</if>
<if test="org_id != null and org_id != ''"> #{org_id} ,</if>
<if test="companyId != null and companyId != ''"> #{companyId} ,</if>
<if test="billKindId != null and billKindId != ''"> #{billKindId} ,</if>
<if test="templateType != null and templateType != ''"> #{templateType} ,</if>
<if test="templateName != null and templateName != ''"> #{templateName} ,</if>
<if test="messageTitle != null and messageTitle != ''"> #{messageTitle} ,</if>
<if test="messageContents != null and messageContents != ''"> #{messageContents} ,</if>
<if test="btns != null and btns != ''"> #{btns} ,</if>
<if test="dataSource != null and dataSource != ''"> #{dataSource} ,</if>
<if test="createDate != null"> #{createDate} ,</if>
<if test="createPersonId != null and createPersonId != ''"> #{createPersonId} ,</if>
<if test="state != null and state !=''"> #{state} ,</if>
<if test="isdelete != null"> #{isdelete} ,</if>
<if test="sts == null ">'Y',</if>
</trim>
)
</insert>
<!-- 批量新增 -->
<insert id="entityInsertBatch" keyProperty="id" useGeneratedKeys="true">
insert into sys_message_template(create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id, bill_kind_id, template_type, template_name, message_title, message_contents, btns, data_source, create_date, create_person_id, state, isdelete, sts)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId},#{entity.billKindId},#{entity.templateType},#{entity.templateName},#{entity.messageTitle},#{entity.messageContents},#{entity.btns},#{entity.dataSource},#{entity.createDate},#{entity.createPersonId},#{entity.state},#{entity.isdelete}, 'Y')
</foreach>
</insert>
<!-- 批量新增或者修改-->
<insert id="entityInsertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
insert into sys_message_template(create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id, bill_kind_id, template_type, template_name, message_title, message_contents, btns, data_source, create_date, create_person_id, state, isdelete)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId},#{entity.billKindId},#{entity.templateType},#{entity.templateName},#{entity.messageTitle},#{entity.messageContents},#{entity.btns},#{entity.dataSource},#{entity.createDate},#{entity.createPersonId},#{entity.state},#{entity.isdelete})
</foreach>
on duplicate key update
create_user_id = values(create_user_id),
create_time = values(create_time),
modify_user_id = values(modify_user_id),
modify_time = values(modify_time),
sts = values(sts),
org_id = values(org_id),
company_id = values(company_id),
bill_kind_id = values(bill_kind_id),
template_type = values(template_type),
template_name = values(template_name),
message_title = values(message_title),
message_contents = values(message_contents),
btns = values(btns),
data_source = values(data_source),
create_date = values(create_date),
create_person_id = values(create_person_id),
state = values(state),
isdelete = values(isdelete)</insert>
<!--通过主键修改方法-->
<update id="entity_update" parameterType = "com.hzya.frame.sysnew.messageTemplate.entity.SysMessageTemplateEntity" >
update sys_message_template set
<trim suffix="" suffixOverrides=",">
<if test="create_user_id != null and create_user_id != ''"> create_user_id = #{create_user_id},</if>
<if test="create_time != null"> create_time = #{create_time},</if>
<if test="modify_user_id != null and modify_user_id != ''"> modify_user_id = #{modify_user_id},</if>
<if test="modify_time != null"> modify_time = #{modify_time},</if>
<if test="sts != null and sts != ''"> sts = #{sts},</if>
<if test="org_id != null and org_id != ''"> org_id = #{org_id},</if>
<if test="companyId != null and companyId != ''"> company_id = #{companyId},</if>
<if test="billKindId != null and billKindId != ''"> bill_kind_id = #{billKindId},</if>
<if test="templateType != null and templateType != ''"> template_type = #{templateType},</if>
<if test="templateName != null and templateName != ''"> template_name = #{templateName},</if>
<if test="messageTitle != null and messageTitle != ''"> message_title = #{messageTitle},</if>
<if test="messageContents != null and messageContents != ''"> message_contents = #{messageContents},</if>
<if test="btns != null and btns != ''"> btns = #{btns},</if>
<if test="dataSource != null and dataSource != ''"> data_source = #{dataSource},</if>
<if test="createDate != null"> create_date = #{createDate},</if>
<if test="createPersonId != null and createPersonId != ''"> create_person_id = #{createPersonId},</if>
<if test="state != null and state !=''"> state = #{state},</if>
<if test="isdelete != null"> isdelete = #{isdelete},</if>
</trim>
where id = #{id}
</update>
<!-- 逻辑删除 -->
<update id="entity_logicDelete" parameterType = "com.hzya.frame.sysnew.messageTemplate.entity.SysMessageTemplateEntity" >
update sys_message_template set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id}
where id = #{id}
</update>
<!-- 多条件逻辑删除 -->
<update id="entity_logicDelete_Multi_Condition" parameterType = "com.hzya.frame.sysnew.messageTemplate.entity.SysMessageTemplateEntity" >
update sys_message_template set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id}
<trim prefix="where" prefixOverrides="and">
<if test="id != null and id != ''"> and id = #{id} </if>
<if test="sorts != null"> and sorts = #{sorts} </if>
<if test="sts != null and sts != ''"> and sts = #{sts} </if>
<if test="companyId != null and companyId != ''"> and company_id = #{companyId} </if>
<if test="billKindId != null and billKindId != ''"> and bill_kind_id = #{billKindId} </if>
<if test="templateType != null and templateType != ''"> and template_type = #{templateType} </if>
<if test="templateName != null and templateName != ''"> and template_name = #{templateName} </if>
<if test="messageTitle != null and messageTitle != ''"> and message_title = #{messageTitle} </if>
<if test="messageContents != null and messageContents != ''"> and message_contents = #{messageContents} </if>
<if test="btns != null and btns != ''"> and btns = #{btns} </if>
<if test="dataSource != null and dataSource != ''"> and data_source = #{dataSource} </if>
<if test="createDate != null"> and create_date = #{createDate} </if>
<if test="createPersonId != null and createPersonId != ''"> and create_person_id = #{createPersonId} </if>
<if test="state != null"> and state = #{state} </if>
<if test="isdelete != null"> and isdelete = #{isdelete} </if>
and sts='Y'
</trim>
</update>
<!--通过主键删除-->
<delete id="entity_delete">
delete from sys_message_template where id = #{id}
</delete>
</mapper>

View File

@ -0,0 +1,36 @@
package com.hzya.frame.sysnew.messageTemplate.service;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.sysnew.messageTemplate.entity.SysMessageTemplateEntity;
import com.hzya.frame.basedao.service.IBaseService;
import com.hzya.frame.web.entity.JsonResultEntity;
import org.apache.ibatis.annotations.Select;
import java.sql.SQLException;
/**
* (SysMessageTemplate)表服务接口
*
* @author makejava
* @since 2024-08-30 14:21:15
*/
public interface ISysMessageTemplateService extends IBaseService<SysMessageTemplateEntity, String>{
JsonResultEntity queryEntityPage(JSONObject jsonObject);
JsonResultEntity queryEntity(JSONObject jsonObject);
JsonResultEntity saveEntity(JSONObject jsonObject);
JsonResultEntity getEntity(JSONObject jsonObject);
JsonResultEntity updateEntity(JSONObject jsonObject);
JsonResultEntity deleteEntity(JSONObject jsonObject);
JsonResultEntity enableDisableEntity(JSONObject jsonObject);
JsonResultEntity checkSql(JSONObject jsonObject)throws Exception;
JsonResultEntity spliceMessage(JSONObject jsonObject);
}

View File

@ -0,0 +1,205 @@
package com.hzya.frame.sysnew.messageTemplate.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hzya.frame.execsql.service.IExecSqlService;
import com.hzya.frame.sysnew.messageTemplate.entity.SysMessageTemplateEntity;
import com.hzya.frame.sysnew.messageTemplate.dao.ISysMessageTemplateDao;
import com.hzya.frame.sysnew.messageTemplate.service.ISysMessageTemplateService;
import com.hzya.frame.sysnew.person.dao.ISysPersonDao;
import com.hzya.frame.sysnew.user.entity.SysUserEntity;
import com.hzya.frame.web.entity.BaseResult;
import com.hzya.frame.web.entity.JsonResultEntity;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import javax.annotation.Resource;
import com.hzya.frame.basedao.service.impl.BaseService;
import java.sql.*;
import java.util.HashMap;
import java.util.List;
/**
* (SysMessageTemplate)表服务实现类
*
* @author makejava
* @since 2024-08-30 14:21:15
*/
@Service(value = "sysMessageTemplateService")
public class SysMessageTemplateServiceImpl extends BaseService<SysMessageTemplateEntity, String> implements ISysMessageTemplateService {
private ISysMessageTemplateDao sysMessageTemplateDao;
@Resource
public IExecSqlService execSqlService;
@Autowired
public void setSysMessageTemplateDao(ISysMessageTemplateDao dao) {
this.sysMessageTemplateDao = dao;
this.dao = dao;
}
@Override
public JsonResultEntity queryEntityPage(JSONObject jsonObject) {
SysMessageTemplateEntity entity = getData("jsonStr", jsonObject, SysMessageTemplateEntity.class);
//判断分页
if (entity == null || entity.getPageNum() == null || entity.getPageSize() == null) {
return BaseResult.getFailureMessageEntity("分页查询参数不存在");
}
PageHelper.startPage(entity.getPageNum(), entity.getPageSize());
List<SysMessageTemplateEntity> list = sysMessageTemplateDao.queryByLike(entity);
PageInfo<SysMessageTemplateEntity> pageInfo = new PageInfo(list);
return BaseResult.getSuccessMessageEntity("查询数据成功", pageInfo);
}
@Override
public JsonResultEntity queryEntity(JSONObject jsonObject){
SysMessageTemplateEntity entity = getData("jsonStr", jsonObject, SysMessageTemplateEntity.class);
if(entity == null){
entity = new SysMessageTemplateEntity();
}
List<SysMessageTemplateEntity> list = sysMessageTemplateDao.queryByLike(entity);
return BaseResult.getSuccessMessageEntity("查询数据成功", list);
}
@Override
public JsonResultEntity getEntity(JSONObject jsonObject){
SysMessageTemplateEntity entity = getData("jsonStr", jsonObject, SysMessageTemplateEntity.class);
if(entity == null){
return BaseResult.getFailureMessageEntity("参数不允许为空");
}
if(entity.getId() == null || "".equals(entity.getId())){
return BaseResult.getFailureMessageEntity("系统错误");
}
entity = sysMessageTemplateDao.get(entity.getId());
if(entity == null){
return BaseResult.getFailureMessageEntity("获取消息模版失败");
}
return BaseResult.getSuccessMessageEntity("获取消息模版成功", entity);
}
@Override
public JsonResultEntity saveEntity(JSONObject jsonObject){
SysMessageTemplateEntity entity = getData("jsonStr", jsonObject, SysMessageTemplateEntity.class);
if (entity == null) {
return BaseResult.getFailureMessageEntity("参数不允许为空");
}
if(entity.getBillKindId() == null || "".equals(entity.getBillKindId())){
return BaseResult.getFailureMessageEntity("调用单据类型不允许为空");
}
if(entity.getTemplateType() == null || "".equals(entity.getTemplateType())){
return BaseResult.getFailureMessageEntity("模版类型不允许为空");
}
if(entity.getTemplateName() == null || "".equals(entity.getTemplateName())){
return BaseResult.getFailureMessageEntity("模版名称不允许为空");
}
if(entity.getMessageContents() == null || "".equals(entity.getMessageContents())){
return BaseResult.getFailureMessageEntity("消息内容不允许为空");
}
if(entity.getDataSource() == null || "".equals(entity.getDataSource())){
return BaseResult.getFailureMessageEntity("数据源不允许为空");
}
if(entity.getCreateDate() == null){
return BaseResult.getFailureMessageEntity("创建时间不允许为空");
}
if(entity.getCreatePersonId() == null || "".equals(entity.getCreatePersonId())){
return BaseResult.getFailureMessageEntity("创建人不允许为空");
}
entity.setCreate();
sysMessageTemplateDao.save(entity);
return BaseResult.getSuccessMessageEntity("保存消息模版成功",entity);
}
@Override
public JsonResultEntity updateEntity(JSONObject jsonObject){
SysMessageTemplateEntity entity = getData("jsonStr", jsonObject, SysMessageTemplateEntity.class);
if(entity == null){
return BaseResult.getFailureMessageEntity("参数不允许为空");
}
if (entity.getId() == null || "".equals(entity.getId())) {
return BaseResult.getFailureMessageEntity("系统错误");
}
if(entity.getBillKindId() == null || "".equals(entity.getBillKindId())){
return BaseResult.getFailureMessageEntity("调用单据类型不允许为空");
}
if(entity.getTemplateType() == null || "".equals(entity.getTemplateType())){
return BaseResult.getFailureMessageEntity("模版类型不允许为空");
}
if(entity.getTemplateName() == null || "".equals(entity.getTemplateName())){
return BaseResult.getFailureMessageEntity("模版名称不允许为空");
}
if(entity.getMessageContents() == null || "".equals(entity.getMessageContents())){
return BaseResult.getFailureMessageEntity("消息内容不允许为空");
}
if(entity.getDataSource() == null || "".equals(entity.getDataSource())){
return BaseResult.getFailureMessageEntity("数据源不允许为空");
}
if(entity.getCreateDate() == null){
return BaseResult.getFailureMessageEntity("创建时间不允许为空");
}
if(entity.getCreatePersonId() == null || "".equals(entity.getCreatePersonId())){
return BaseResult.getFailureMessageEntity("创建人不允许为空");
}
entity.setUpdate();
sysMessageTemplateDao.update(entity);
return BaseResult.getSuccessMessageEntity("修改消息模版成功",entity);
}
@Override
public JsonResultEntity deleteEntity(JSONObject jsonObject){
SysMessageTemplateEntity entity = getData("jsonStr", jsonObject, SysMessageTemplateEntity.class);
if(entity == null){
return BaseResult.getFailureMessageEntity("参数不允许为空");
}
if (entity.getId() == null || "".equals(entity.getId())) {
return BaseResult.getFailureMessageEntity("系统错误");
}
entity.setUpdate();
//1判断这个模版有没有被使用过使用过就不能删除待完成
//将模版id去预警配置表里查一下如果有匹配的数据代表有人正在使用不能删除
sysMessageTemplateDao.logicRemove(entity);
return BaseResult.getSuccessMessageEntity("删除消息模版成功");
}
@Override
public JsonResultEntity enableDisableEntity(JSONObject jsonObject){
SysMessageTemplateEntity entity = getData("jsonStr", jsonObject, SysMessageTemplateEntity.class);
if(entity == null){
return BaseResult.getFailureMessageEntity("参数不允许为空");
}
if (entity.getId() == null || "".equals(entity.getId())) {
return BaseResult.getFailureMessageEntity("系统错误");
}
if (entity.getState() == null || "".equals(entity.getState())) {
return BaseResult.getFailureMessageEntity("系统错误");
}
//0启用1禁用
if("0".equals(entity.getState())){
entity.setUpdate();
sysMessageTemplateDao.update(entity);
return BaseResult.getSuccessMessageEntity("启用模版成功");
}else{
//停用消息模版
entity.setUpdate();
sysMessageTemplateDao.update(entity);
return BaseResult.getSuccessMessageEntity("停用模版成功");
}
}
@Override
public JsonResultEntity checkSql(JSONObject jsonObject) throws Exception {
try {
String sql = JSONObject.parseObject(jsonObject.getString("jsonStr")).getString("sql");
List<HashMap<String, Object>> result = execSqlService.execSelectSql(sql, "master");
return BaseResult.getSuccessMessageEntity("SQL检查成功", result);
} catch (Exception e) {
return BaseResult.getFailureMessageEntity("SQL检查失败原因" + e.getMessage());
}
}
@Override
public JsonResultEntity spliceMessage(JSONObject jsonObject){
return BaseResult.getSuccessMessageEntity("消息拼接成功");
}
}

View File

@ -0,0 +1,7 @@
package com.hzya.frame.sysnew.pushMessage.dao;
import com.hzya.frame.basedao.dao.IBaseDao;
import com.hzya.frame.sysnew.pushMessage.entity.SysPushMessageEntity;
public interface ISysPushMessageDao extends IBaseDao<SysPushMessageEntity,String>{
}

View File

@ -0,0 +1,10 @@
package com.hzya.frame.sysnew.pushMessage.dao.impl;
import com.hzya.frame.basedao.dao.MybatisGenericDao;
import com.hzya.frame.sysnew.pushMessage.dao.ISysPushMessageDao;
import com.hzya.frame.sysnew.pushMessage.entity.SysPushMessageEntity;
import org.springframework.stereotype.Repository;
@Repository("sysPushMessageDaoImpl")
public class SysPushMessageDaoImpl extends MybatisGenericDao<SysPushMessageEntity,String> implements ISysPushMessageDao {
}

View File

@ -0,0 +1,116 @@
package com.hzya.frame.sysnew.pushMessage.entity;
import com.hzya.frame.web.entity.BaseEntity;
public class SysPushMessageEntity extends BaseEntity {
/** 推送方式 “一次”、“定时” */
private String pushMethod;
/** 预警应用编码 */
private String warningAppCode;
/** 预警接口编码 */
private String warningApiCode;
/** 接收者ID列表*/
private String recipientIdList;
/** 预警应用类型 */
private String warningAppType;
/** 发送应用名称 */
private String sendAppName;
/** 接收应用名称 */
private String receiveAppName;
/** 接收接口名称 */
private String receiveApiName;
/** 返回信息 */
private String returnData;
/** 接收接口编码 */
private String receiveApiCode;
/** 状态1、待发送2、发送中3、发送成功4、发送失败 */
private String status;
public String getPushMethod() {
return pushMethod;
}
public void setPushMethod(String pushMethod) {
this.pushMethod = pushMethod;
}
public String getWarningAppCode() {
return warningAppCode;
}
public void setWarningAppCode(String warningAppCode) {
this.warningAppCode = warningAppCode;
}
public String getWarningApiCode() {
return warningApiCode;
}
public void setWarningApiCode(String warningApiCode) {
this.warningApiCode = warningApiCode;
}
public String getRecipientIdList() {
return recipientIdList;
}
public void setRecipientIdList(String recipientIdList) {
this.recipientIdList = recipientIdList;
}
public String getWarningAppType() {
return warningAppType;
}
public void setWarningAppType(String warningAppType) {
this.warningAppType = warningAppType;
}
public String getSendAppName() {
return sendAppName;
}
public void setSendAppName(String sendAppName) {
this.sendAppName = sendAppName;
}
public String getReceiveAppName() {
return receiveAppName;
}
public void setReceiveAppName(String receiveAppName) {
this.receiveAppName = receiveAppName;
}
public String getReceiveApiName() {
return receiveApiName;
}
public void setReceiveApiName(String receiveApiName) {
this.receiveApiName = receiveApiName;
}
public String getReturnData() {
return returnData;
}
public void setReturnData(String returnData) {
this.returnData = returnData;
}
public String getReceiveApiCode() {
return receiveApiCode;
}
public void setReceiveApiCode(String receiveApiCode) {
this.receiveApiCode = receiveApiCode;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
}

View File

@ -0,0 +1,42 @@
<?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">
<mapper namespace="com.hzya.frame.sysnew.pushMessage.dao.impl.SysPushMessageDaoImpl">
<resultMap id="get-SysPushMessageEntity-result" type="com.hzya.frame.sysnew.pushMessage.entity.SysPushMessageEntity" >
<result property="pushMethod" column="push_method" jdbcType="VARCHAR"/>
<result property="warningAppCode" column="warning_app_code" jdbcType="VARCHAR"/>
<result property="warningApiCode" column="warning_api_code" jdbcType="VARCHAR"/>
<result property="warningAppType" column="warning_app_type" jdbcType="VARCHAR"/>
<result property="recipientIdList" column="recipient_id_list" jdbcType="VARCHAR"/>
<result property="sendAppName" column="send_app_name" jdbcType="VARCHAR"/>
<result property="receiveAppName" column="receive_app_name" jdbcType="VARCHAR"/>
<result property="receiveApiName" column="receive_api_name" jdbcType="VARCHAR"/>
<result property="receiveApiCode" column="receive_api_code" jdbcType="VARCHAR"/>
<result property="returnData" column="return_data" jdbcType="LONGVARCHAR"/>
<result property="status" column="status" jdbcType="VARCHAR"/>
</resultMap>
<!-- 查询 采用==查询 -->
<select id="entity_list_base" resultMap="get-SysPushMessageEntity-result" parameterType = "com.hzya.frame.sysnew.pushMessage.entity.SysPushMessageEntity">
SELECT
warning_config.push_method,
warning_config.sendAppid AS warning_app_code,
warning_config.endApiCode AS warning_api_code,
warning_config.app_type AS warning_app_type,
warning_config.recipient_id AS recipient_id_list,
log.send_app_name,
log.receive_app_name,
receive_api_name,
log.receive_api_code,
log.return_data,
log.STATUS
FROM
v_hzya_sys_warning warning_config
LEFT JOIN v_hzya_sys_send_message_log log ON warning_config.api_code = log.receive_api_code
WHERE
log.STATUS = '4'
AND warning_config.push_method = '定时'
</select>
</mapper>

View File

@ -0,0 +1,10 @@
package com.hzya.frame.sysnew.pushMessage.service;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.basedao.service.IBaseService;
import com.hzya.frame.sysnew.pushMessage.entity.SysPushMessageEntity;
import com.hzya.frame.web.entity.JsonResultEntity;
public interface ISysPushMessageService extends IBaseService<SysPushMessageEntity,String>{
JsonResultEntity queryEntity(JSONObject jsonObject);
}

View File

@ -0,0 +1,33 @@
package com.hzya.frame.sysnew.pushMessage.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.basedao.service.impl.BaseService;
import com.hzya.frame.sysnew.pushMessage.dao.ISysPushMessageDao;
import com.hzya.frame.sysnew.pushMessage.dao.impl.SysPushMessageDaoImpl;
import com.hzya.frame.sysnew.pushMessage.entity.SysPushMessageEntity;
import com.hzya.frame.sysnew.pushMessage.service.ISysPushMessageService;
import com.hzya.frame.sysnew.sendMessageLog.dao.ISysSendMessageLogDao;
import com.hzya.frame.web.entity.BaseResult;
import com.hzya.frame.web.entity.JsonResultEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service("sysPushMessageService")
public class SysPushMessageServiceImpl extends BaseService<SysPushMessageEntity,String> implements ISysPushMessageService {
private ISysPushMessageDao sysPushMessageDao;
@Autowired
public void setSysPushMessageDao(ISysPushMessageDao dao) {
this.sysPushMessageDao = dao;
this.dao = dao;
}
@Override
public JsonResultEntity queryEntity(JSONObject jsonObject){
List<SysPushMessageEntity> list = sysPushMessageDao.getAll();
return BaseResult.getSuccessMessageEntity("success");
}
}

View File

@ -0,0 +1,15 @@
package com.hzya.frame.sysnew.sendMessageLog.dao;
import com.hzya.frame.sysnew.sendMessageLog.entity.SysSendMessageLogEntity;
import com.hzya.frame.basedao.dao.IBaseDao;
/**
* (sys_send_message_log: table)表数据库访问层
*
* @author makejava
* @since 2024-08-30 14:19:30
*/
public interface ISysSendMessageLogDao extends IBaseDao<SysSendMessageLogEntity, String> {
}

View File

@ -0,0 +1,17 @@
package com.hzya.frame.sysnew.sendMessageLog.dao.impl;
import com.hzya.frame.sysnew.sendMessageLog.entity.SysSendMessageLogEntity;
import com.hzya.frame.sysnew.sendMessageLog.dao.ISysSendMessageLogDao;
import org.springframework.stereotype.Repository;
import com.hzya.frame.basedao.dao.MybatisGenericDao;
/**
* (SysSendMessageLog)表数据库访问层
*
* @author makejava
* @since 2024-08-30 14:19:30
*/
@Repository(value = "SysSendMessageLogDaoImpl")
public class SysSendMessageLogDaoImpl extends MybatisGenericDao<SysSendMessageLogEntity, String> implements ISysSendMessageLogDao{
}

View File

@ -0,0 +1,126 @@
package com.hzya.frame.sysnew.sendMessageLog.entity;
import java.util.Date;
import com.hzya.frame.web.entity.BaseEntity;
/**
* (SysSendMessageLog)实体类
*
* @author makejava
* @since 2024-08-30 14:19:30
*/
public class SysSendMessageLogEntity extends BaseEntity {
/** 公司id */
private String companyId;
/** 来源业务单据 */
private String billId;
/** 消息类型1、系统消息、2、单据消息、3、钉钉、4微信、5短信、6、邮件 */
private String type;
/** 发送给谁三方系统userID 钉钉微信、邮箱、手机号) */
private String sendToUserId;
/** 发送给系统内部人员ID */
private String sendToPersonId;
/** 消息内容 */
private String sendCount;
/** 发送时间 */
private Date sendDatetime;
/** 发送人Id */
private String sendPersonId;
/** 消息发送来源模块 */
private String sourceModelName;
/** 消息状态0未读1已读 */
private Integer state;
/** 三方系统消息结果 */
private String resultMessage;
public String getCompanyId() {
return companyId;
}
public void setCompanyId(String companyId) {
this.companyId = companyId;
}
public String getBillId() {
return billId;
}
public void setBillId(String billId) {
this.billId = billId;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getSendToUserId() {
return sendToUserId;
}
public void setSendToUserId(String sendToUserId) {
this.sendToUserId = sendToUserId;
}
public String getSendToPersonId() {
return sendToPersonId;
}
public void setSendToPersonId(String sendToPersonId) {
this.sendToPersonId = sendToPersonId;
}
public String getSendCount() {
return sendCount;
}
public void setSendCount(String sendCount) {
this.sendCount = sendCount;
}
public Date getSendDatetime() {
return sendDatetime;
}
public void setSendDatetime(Date sendDatetime) {
this.sendDatetime = sendDatetime;
}
public String getSendPersonId() {
return sendPersonId;
}
public void setSendPersonId(String sendPersonId) {
this.sendPersonId = sendPersonId;
}
public String getSourceModelName() {
return sourceModelName;
}
public void setSourceModelName(String sourceModelName) {
this.sourceModelName = sourceModelName;
}
public Integer getState() {
return state;
}
public void setState(Integer state) {
this.state = state;
}
public String getResultMessage() {
return resultMessage;
}
public void setResultMessage(String resultMessage) {
this.resultMessage = resultMessage;
}
}

View File

@ -0,0 +1,353 @@
<?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">
<mapper namespace="com.hzya.frame.sysnew.sendMessageLog.dao.impl.SysSendMessageLogDaoImpl">
<resultMap id="get-SysSendMessageLogEntity-result" type="com.hzya.frame.sysnew.sendMessageLog.entity.SysSendMessageLogEntity" >
<result property="id" column="id" jdbcType="VARCHAR"/>
<result property="sorts" column="sorts" jdbcType="INTEGER"/>
<result property="create_user_id" column="create_user_id" jdbcType="VARCHAR"/>
<result property="create_time" column="create_time" jdbcType="TIMESTAMP"/>
<result property="modify_user_id" column="modify_user_id" jdbcType="VARCHAR"/>
<result property="modify_time" column="modify_time" jdbcType="TIMESTAMP"/>
<result property="sts" column="sts" jdbcType="VARCHAR"/>
<result property="org_id" column="org_id" jdbcType="VARCHAR"/>
<result property="companyId" column="company_id" jdbcType="VARCHAR"/>
<result property="billId" column="bill_id" jdbcType="VARCHAR"/>
<result property="type" column="type" jdbcType="VARCHAR"/>
<result property="sendToUserId" column="send_to_user_id" jdbcType="VARCHAR"/>
<result property="sendToPersonId" column="send_to_person_id" jdbcType="VARCHAR"/>
<result property="sendCount" column="send_count" jdbcType="VARCHAR"/>
<result property="sendDatetime" column="send_datetime" jdbcType="TIMESTAMP"/>
<result property="sendPersonId" column="send_person_id" jdbcType="VARCHAR"/>
<result property="sourceModelName" column="source_model_name" jdbcType="VARCHAR"/>
<result property="state" column="state" jdbcType="INTEGER"/>
<result property="resultMessage" column="result_message" jdbcType="VARCHAR"/>
</resultMap>
<resultMap id="get-PushMessageEntity-result" type="com.hzya.frame.plugin.pushMessage.entity.PushMessageEntity" >
<result property="pushMessage" column="push_message" jdbcType="VARCHAR"/>
<result property="warningAppCode" column="warning_app_code" jdbcType="VARCHAR"/>
<result property="warningApiCode" column="warning_api_code" jdbcType="VARCHAR"/>
<result property="appType" column="app_type" jdbcType="VARCHAR"/>
<result property="recipientIdList" column="recipient_id_list" jdbcType="VARCHAR"/>
<result property="sendAppName" column="send_app_name" jdbcType="VARCHAR"/>
<result property="receiveAppName" column="receive_app_name" jdbcType="VARCHAR"/>
<result property="receiveApiName" column="receive_api_name" jdbcType="VARCHAR"/>
<result property="receiveApiCode" column="receive_api_code" jdbcType="VARCHAR"/>
<result property="returnData" column="return_data" jdbcType="VARCHAR"/>
<result property="status" column="status" jdbcType="VARCHAR"/>
</resultMap>
<!-- 查询的字段-->
<sql id = "SysSendMessageLogEntity_Base_Column_List">
id
,sorts
,create_user_id
,create_time
,modify_user_id
,modify_time
,sts
,org_id
,company_id
,bill_id
,type
,send_to_user_id
,send_to_person_id
,send_count
,send_datetime
,send_person_id
,source_model_name
,state
,result_message
</sql>
<!--通过ID获取数据 -->
<select id="entity_get" resultMap="get-SysSendMessageLogEntity-result">
select
<include refid="SysSendMessageLogEntity_Base_Column_List" />
from sys_send_message_log where id = #{ id } and sts='Y'
</select>
<!-- 查询 采用==查询 -->
<select id="entity_list_base" resultMap="get-SysSendMessageLogEntity-result" parameterType = "com.hzya.frame.sysnew.sendMessageLog.entity.SysSendMessageLogEntity">
select
<include refid="SysSendMessageLogEntity_Base_Column_List" />
from sys_send_message_log
<trim prefix="where" prefixOverrides="and">
<if test="id != null and id != ''"> and id = #{id} </if>
<if test="sorts != null"> and sorts = #{sorts} </if>
<if test="create_user_id != null and create_user_id != ''"> and create_user_id = #{create_user_id} </if>
<if test="create_time != null"> and create_time = #{create_time} </if>
<if test="modify_user_id != null and modify_user_id != ''"> and modify_user_id = #{modify_user_id} </if>
<if test="modify_time != null"> and modify_time = #{modify_time} </if>
<if test="sts != null and sts != ''"> and sts = #{sts} </if>
<if test="org_id != null and org_id != ''"> and org_id = #{org_id} </if>
<if test="companyId != null and companyId != ''"> and company_id = #{companyId} </if>
<if test="billId != null and billId != ''"> and bill_id = #{billId} </if>
<if test="type != null and type != ''"> and type = #{type} </if>
<if test="sendToUserId != null and sendToUserId != ''"> and send_to_user_id = #{sendToUserId} </if>
<if test="sendToPersonId != null and sendToPersonId != ''"> and send_to_person_id = #{sendToPersonId} </if>
<if test="sendCount != null and sendCount != ''"> and send_count = #{sendCount} </if>
<if test="sendDatetime != null"> and send_datetime = #{sendDatetime} </if>
<if test="sendPersonId != null and sendPersonId != ''"> and send_person_id = #{sendPersonId} </if>
<if test="sourceModelName != null and sourceModelName != ''"> and source_model_name = #{sourceModelName} </if>
<if test="state != null"> and state = #{state} </if>
<if test="resultMessage != null and resultMessage != ''"> and result_message = #{resultMessage} </if>
and sts='Y'
</trim>
<if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
<if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
</select>
<!-- 查询符合条件的数量 -->
<select id="entity_count" resultType="Integer" parameterType = "com.hzya.frame.sysnew.sendMessageLog.entity.SysSendMessageLogEntity">
select count(1) from sys_send_message_log
<trim prefix="where" prefixOverrides="and">
<if test="id != null and id != ''"> and id = #{id} </if>
<if test="sorts != null"> and sorts = #{sorts} </if>
<if test="create_user_id != null and create_user_id != ''"> and create_user_id = #{create_user_id} </if>
<if test="create_time != null"> and create_time = #{create_time} </if>
<if test="modify_user_id != null and modify_user_id != ''"> and modify_user_id = #{modify_user_id} </if>
<if test="modify_time != null"> and modify_time = #{modify_time} </if>
<if test="sts != null and sts != ''"> and sts = #{sts} </if>
<if test="org_id != null and org_id != ''"> and org_id = #{org_id} </if>
<if test="companyId != null and companyId != ''"> and company_id = #{companyId} </if>
<if test="billId != null and billId != ''"> and bill_id = #{billId} </if>
<if test="type != null and type != ''"> and type = #{type} </if>
<if test="sendToUserId != null and sendToUserId != ''"> and send_to_user_id = #{sendToUserId} </if>
<if test="sendToPersonId != null and sendToPersonId != ''"> and send_to_person_id = #{sendToPersonId} </if>
<if test="sendCount != null and sendCount != ''"> and send_count = #{sendCount} </if>
<if test="sendDatetime != null"> and send_datetime = #{sendDatetime} </if>
<if test="sendPersonId != null and sendPersonId != ''"> and send_person_id = #{sendPersonId} </if>
<if test="sourceModelName != null and sourceModelName != ''"> and source_model_name = #{sourceModelName} </if>
<if test="state != null"> and state = #{state} </if>
<if test="resultMessage != null and resultMessage != ''"> and result_message = #{resultMessage} </if>
and sts='Y'
</trim>
<if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
<if test=" sort !='' and sort!=null and order !='' and order!=null "> order by ${sort} ${order}</if>
</select>
<!-- 分页查询列表 采用like格式 -->
<select id="entity_list_like" resultMap="get-SysSendMessageLogEntity-result" parameterType = "com.hzya.frame.sysnew.sendMessageLog.entity.SysSendMessageLogEntity">
select
<include refid="SysSendMessageLogEntity_Base_Column_List" />
from sys_send_message_log
<trim prefix="where" prefixOverrides="and">
<if test="id != null and id != ''"> and id like concat('%',#{id},'%') </if>
<if test="sorts != null"> and sorts like concat('%',#{sorts},'%') </if>
<if test="create_user_id != null and create_user_id != ''"> and create_user_id like concat('%',#{create_user_id},'%') </if>
<if test="create_time != null"> and create_time like concat('%',#{create_time},'%') </if>
<if test="modify_user_id != null and modify_user_id != ''"> and modify_user_id like concat('%',#{modify_user_id},'%') </if>
<if test="modify_time != null"> and modify_time like concat('%',#{modify_time},'%') </if>
<if test="sts != null and sts != ''"> and sts like concat('%',#{sts},'%') </if>
<if test="org_id != null and org_id != ''"> and org_id like concat('%',#{org_id},'%') </if>
<if test="companyId != null and companyId != ''"> and company_id like concat('%',#{companyId},'%') </if>
<if test="billId != null and billId != ''"> and bill_id like concat('%',#{billId},'%') </if>
<if test="type != null and type != ''"> and type like concat('%',#{type},'%') </if>
<if test="sendToUserId != null and sendToUserId != ''"> and send_to_user_id like concat('%',#{sendToUserId},'%') </if>
<if test="sendToPersonId != null and sendToPersonId != ''"> and send_to_person_id like concat('%',#{sendToPersonId},'%') </if>
<if test="sendCount != null and sendCount != ''"> and send_count like concat('%',#{sendCount},'%') </if>
<if test="sendDatetime != null"> and send_datetime like concat('%',#{sendDatetime},'%') </if>
<if test="sendPersonId != null and sendPersonId != ''"> and send_person_id like concat('%',#{sendPersonId},'%') </if>
<if test="sourceModelName != null and sourceModelName != ''"> and source_model_name like concat('%',#{sourceModelName},'%') </if>
<if test="state != null"> and state like concat('%',#{state},'%') </if>
<if test="resultMessage != null and resultMessage != ''"> and result_message like concat('%',#{resultMessage},'%') </if>
and sts='Y'
</trim>
<if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
<if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
</select>
<!-- 查询列表 字段采用or格式 -->
<select id="SysSendMessageLogentity_list_or" resultMap="get-SysSendMessageLogEntity-result" parameterType = "com.hzya.frame.sysnew.sendMessageLog.entity.SysSendMessageLogEntity">
select
<include refid="SysSendMessageLogEntity_Base_Column_List" />
from sys_send_message_log
<trim prefix="where" prefixOverrides="and">
<if test="id != null and id != ''"> or id = #{id} </if>
<if test="sorts != null"> or sorts = #{sorts} </if>
<if test="create_user_id != null and create_user_id != ''"> or create_user_id = #{create_user_id} </if>
<if test="create_time != null"> or create_time = #{create_time} </if>
<if test="modify_user_id != null and modify_user_id != ''"> or modify_user_id = #{modify_user_id} </if>
<if test="modify_time != null"> or modify_time = #{modify_time} </if>
<if test="sts != null and sts != ''"> or sts = #{sts} </if>
<if test="org_id != null and org_id != ''"> or org_id = #{org_id} </if>
<if test="companyId != null and companyId != ''"> or company_id = #{companyId} </if>
<if test="billId != null and billId != ''"> or bill_id = #{billId} </if>
<if test="type != null and type != ''"> or type = #{type} </if>
<if test="sendToUserId != null and sendToUserId != ''"> or send_to_user_id = #{sendToUserId} </if>
<if test="sendToPersonId != null and sendToPersonId != ''"> or send_to_person_id = #{sendToPersonId} </if>
<if test="sendCount != null and sendCount != ''"> or send_count = #{sendCount} </if>
<if test="sendDatetime != null"> or send_datetime = #{sendDatetime} </if>
<if test="sendPersonId != null and sendPersonId != ''"> or send_person_id = #{sendPersonId} </if>
<if test="sourceModelName != null and sourceModelName != ''"> or source_model_name = #{sourceModelName} </if>
<if test="state != null"> or state = #{state} </if>
<if test="resultMessage != null and resultMessage != ''"> or result_message = #{resultMessage} </if>
and sts='Y'
</trim>
<if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
<if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
</select>
<!--新增所有列-->
<insert id="entity_insert" parameterType = "com.hzya.frame.sysnew.sendMessageLog.entity.SysSendMessageLogEntity">
insert into sys_send_message_log(
<trim suffix="" suffixOverrides=",">
<if test="id != null and id != ''"> id , </if>
<if test="sorts != null"> sorts , </if>
<if test="create_user_id != null and create_user_id != ''"> create_user_id , </if>
<if test="create_time != null"> create_time , </if>
<if test="modify_user_id != null and modify_user_id != ''"> modify_user_id , </if>
<if test="modify_time != null"> modify_time , </if>
<if test="sts != null and sts != ''"> sts , </if>
<if test="org_id != null and org_id != ''"> org_id , </if>
<if test="companyId != null and companyId != ''"> company_id , </if>
<if test="billId != null and billId != ''"> bill_id , </if>
<if test="type != null and type != ''"> type , </if>
<if test="sendToUserId != null and sendToUserId != ''"> send_to_user_id , </if>
<if test="sendToPersonId != null and sendToPersonId != ''"> send_to_person_id , </if>
<if test="sendCount != null and sendCount != ''"> send_count , </if>
<if test="sendDatetime != null"> send_datetime , </if>
<if test="sendPersonId != null and sendPersonId != ''"> send_person_id , </if>
<if test="sourceModelName != null and sourceModelName != ''"> source_model_name , </if>
<if test="state != null"> state , </if>
<if test="resultMessage != null and resultMessage != ''"> result_message , </if>
<if test="sts == null ">sts,</if>
</trim>
)values(
<trim suffix="" suffixOverrides=",">
<if test="id != null and id != ''"> #{id} ,</if>
<if test="sorts != null"> #{sorts} ,</if>
<if test="create_user_id != null and create_user_id != ''"> #{create_user_id} ,</if>
<if test="create_time != null"> #{create_time} ,</if>
<if test="modify_user_id != null and modify_user_id != ''"> #{modify_user_id} ,</if>
<if test="modify_time != null"> #{modify_time} ,</if>
<if test="sts != null and sts != ''"> #{sts} ,</if>
<if test="org_id != null and org_id != ''"> #{org_id} ,</if>
<if test="companyId != null and companyId != ''"> #{companyId} ,</if>
<if test="billId != null and billId != ''"> #{billId} ,</if>
<if test="type != null and type != ''"> #{type} ,</if>
<if test="sendToUserId != null and sendToUserId != ''"> #{sendToUserId} ,</if>
<if test="sendToPersonId != null and sendToPersonId != ''"> #{sendToPersonId} ,</if>
<if test="sendCount != null and sendCount != ''"> #{sendCount} ,</if>
<if test="sendDatetime != null"> #{sendDatetime} ,</if>
<if test="sendPersonId != null and sendPersonId != ''"> #{sendPersonId} ,</if>
<if test="sourceModelName != null and sourceModelName != ''"> #{sourceModelName} ,</if>
<if test="state != null"> #{state} ,</if>
<if test="resultMessage != null and resultMessage != ''"> #{resultMessage} ,</if>
<if test="sts == null ">'Y',</if>
</trim>
)
</insert>
<!-- 批量新增 -->
<insert id="entityInsertBatch" keyProperty="id" useGeneratedKeys="true">
insert into sys_send_message_log(create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id, bill_id, type, send_to_user_id, send_to_person_id, send_count, send_datetime, send_person_id, source_model_name, state, result_message, sts)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId},#{entity.billId},#{entity.type},#{entity.sendToUserId},#{entity.sendToPersonId},#{entity.sendCount},#{entity.sendDatetime},#{entity.sendPersonId},#{entity.sourceModelName},#{entity.state},#{entity.resultMessage}, 'Y')
</foreach>
</insert>
<!-- 批量新增或者修改-->
<insert id="entityInsertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
insert into sys_send_message_log(create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id, bill_id, type, send_to_user_id, send_to_person_id, send_count, send_datetime, send_person_id, source_model_name, state, result_message)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId},#{entity.billId},#{entity.type},#{entity.sendToUserId},#{entity.sendToPersonId},#{entity.sendCount},#{entity.sendDatetime},#{entity.sendPersonId},#{entity.sourceModelName},#{entity.state},#{entity.resultMessage})
</foreach>
on duplicate key update
create_user_id = values(create_user_id),
create_time = values(create_time),
modify_user_id = values(modify_user_id),
modify_time = values(modify_time),
sts = values(sts),
org_id = values(org_id),
company_id = values(company_id),
bill_id = values(bill_id),
type = values(type),
send_to_user_id = values(send_to_user_id),
send_to_person_id = values(send_to_person_id),
send_count = values(send_count),
send_datetime = values(send_datetime),
send_person_id = values(send_person_id),
source_model_name = values(source_model_name),
state = values(state),
result_message = values(result_message)</insert>
<!--通过主键修改方法-->
<update id="entity_update" parameterType = "com.hzya.frame.sysnew.sendMessageLog.entity.SysSendMessageLogEntity" >
update sys_send_message_log set
<trim suffix="" suffixOverrides=",">
<if test="create_user_id != null and create_user_id != ''"> create_user_id = #{create_user_id},</if>
<if test="create_time != null"> create_time = #{create_time},</if>
<if test="modify_user_id != null and modify_user_id != ''"> modify_user_id = #{modify_user_id},</if>
<if test="modify_time != null"> modify_time = #{modify_time},</if>
<if test="sts != null and sts != ''"> sts = #{sts},</if>
<if test="org_id != null and org_id != ''"> org_id = #{org_id},</if>
<if test="companyId != null and companyId != ''"> company_id = #{companyId},</if>
<if test="billId != null and billId != ''"> bill_id = #{billId},</if>
<if test="type != null and type != ''"> type = #{type},</if>
<if test="sendToUserId != null and sendToUserId != ''"> send_to_user_id = #{sendToUserId},</if>
<if test="sendToPersonId != null and sendToPersonId != ''"> send_to_person_id = #{sendToPersonId},</if>
<if test="sendCount != null and sendCount != ''"> send_count = #{sendCount},</if>
<if test="sendDatetime != null"> send_datetime = #{sendDatetime},</if>
<if test="sendPersonId != null and sendPersonId != ''"> send_person_id = #{sendPersonId},</if>
<if test="sourceModelName != null and sourceModelName != ''"> source_model_name = #{sourceModelName},</if>
<if test="state != null"> state = #{state},</if>
<if test="resultMessage != null and resultMessage != ''"> result_message = #{resultMessage},</if>
</trim>
where id = #{id}
</update>
<!-- 逻辑删除 -->
<update id="entity_logicDelete" parameterType = "com.hzya.frame.sysnew.sendMessageLog.entity.SysSendMessageLogEntity" >
update sys_send_message_log set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id}
where id = #{id}
</update>
<!-- 多条件逻辑删除 -->
<update id="entity_logicDelete_Multi_Condition" parameterType = "com.hzya.frame.sysnew.sendMessageLog.entity.SysSendMessageLogEntity" >
update sys_send_message_log set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id}
<trim prefix="where" prefixOverrides="and">
<if test="id != null and id != ''"> and id = #{id} </if>
<if test="sorts != null"> and sorts = #{sorts} </if>
<if test="sts != null and sts != ''"> and sts = #{sts} </if>
<if test="companyId != null and companyId != ''"> and company_id = #{companyId} </if>
<if test="billId != null and billId != ''"> and bill_id = #{billId} </if>
<if test="type != null and type != ''"> and type = #{type} </if>
<if test="sendToUserId != null and sendToUserId != ''"> and send_to_user_id = #{sendToUserId} </if>
<if test="sendToPersonId != null and sendToPersonId != ''"> and send_to_person_id = #{sendToPersonId} </if>
<if test="sendCount != null and sendCount != ''"> and send_count = #{sendCount} </if>
<if test="sendDatetime != null"> and send_datetime = #{sendDatetime} </if>
<if test="sendPersonId != null and sendPersonId != ''"> and send_person_id = #{sendPersonId} </if>
<if test="sourceModelName != null and sourceModelName != ''"> and source_model_name = #{sourceModelName} </if>
<if test="state != null"> and state = #{state} </if>
<if test="resultMessage != null and resultMessage != ''"> and result_message = #{resultMessage} </if>
and sts='Y'
</trim>
</update>
<!--通过主键删除-->
<delete id="entity_delete">
delete from sys_send_message_log where id = #{id}
</delete>
<!-- 查询 采用==查询 -->
<select id="entity_list_base" resultMap="get-PushMessageEntity-result" parameterType = "com.hzya.frame.plugin.pushMessage.entity.PushMessageEntity">
SELECT
warning_config.push_method,
warning_config.sendAppid AS warning_app_code,
warning_config.endApiCode AS warning_api_code,
warning_config.app_type,
warning_config.recipient_id AS recipient_id_list,
log.send_app_name,
log.receive_app_name,
receive_api_name,
log.receive_api_code,
log.return_data,
log.STATUS
FROM
v_hzya_sys_warning warning_config
LEFT JOIN v_hzya_sys_send_message_log log ON warning_config.api_code = log.receive_api_code
WHERE
log.STATUS = '4'
AND warning_config.push_method = '定时'
</select>
</mapper>

View File

@ -0,0 +1,34 @@
package com.hzya.frame.sysnew.sendMessageLog.service;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.sysnew.pushMessage.entity.SysPushMessageEntity;
import com.hzya.frame.sysnew.sendMessageLog.entity.SysSendMessageLogEntity;
import com.hzya.frame.basedao.service.IBaseService;
import com.hzya.frame.web.entity.JsonResultEntity;
/**
* (SysSendMessageLog)表服务接口
*
* @author makejava
* @since 2024-08-30 14:19:30
*/
public interface ISysSendMessageLogService extends IBaseService<SysSendMessageLogEntity, String>{
JsonResultEntity queryEntityPage(JSONObject jsonObject);
JsonResultEntity queryEntity(JSONObject jsonObject);
JsonResultEntity getEntity(JSONObject jsonObject);
JsonResultEntity saveEntity(JSONObject jsonObject);
JsonResultEntity updateEntity(JSONObject jsonObject);
JsonResultEntity deleteEntity(JSONObject jsonObject);
boolean sendMessage(SysPushMessageEntity entity);
}

View File

@ -0,0 +1,496 @@
package com.hzya.frame.sysnew.sendMessageLog.service.impl;
import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.http.HttpRequest;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hzya.frame.sysnew.application.apiPara.dao.ISysApplicationApiParaDao;
import com.hzya.frame.sysnew.application.apiPara.entity.SysApplicationApiParaEntity;
import com.hzya.frame.sysnew.messageTemplate.dao.ISysMessageTemplateDao;
import com.hzya.frame.sysnew.messageTemplate.entity.SysMessageTemplateEntity;
import com.hzya.frame.sysnew.pushMessage.entity.SysPushMessageEntity;
import com.hzya.frame.sysnew.sendMessageLog.entity.SysSendMessageLogEntity;
import com.hzya.frame.sysnew.sendMessageLog.dao.ISysSendMessageLogDao;
import com.hzya.frame.sysnew.sendMessageLog.service.ISysSendMessageLogService;
import com.hzya.frame.sysnew.user.dao.ISysUserDao;
import com.hzya.frame.sysnew.user.entity.SysUserEntity;
import com.hzya.frame.sysnew.warningConfig.dao.ISysWarningConfigDao;
import com.hzya.frame.sysnew.warningConfig.entity.SysWarningConfigEntity;
import com.hzya.frame.sysnew.warningInterface.dao.ISysWarningInterfaceDao;
import com.hzya.frame.sysnew.warningInterface.entity.SysWarningInterfaceEntity;
import com.hzya.frame.uuid.UUIDUtils;
import com.hzya.frame.web.entity.BaseResult;
import com.hzya.frame.web.entity.JsonResultEntity;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import javax.annotation.Resource;
import com.hzya.frame.basedao.service.impl.BaseService;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* (SysSendMessageLog)表服务实现类
*
* @author makejava
* @since 2024-08-30 14:19:30
*/
@Service(value = "sysSendMessageLogService")
public class SysSendMessageLogServiceImpl extends BaseService<SysSendMessageLogEntity, String> implements ISysSendMessageLogService {
@Resource
private ISysWarningInterfaceDao sysWarningInterfaceDao;
@Resource
private ISysWarningConfigDao sysWarningConfigDao;
@Resource
private ISysMessageTemplateDao sysMessageTemplateDao;
@Resource
private ISysUserDao sysUserDao;
@Resource
private ISysApplicationApiParaDao sysApplicationApiParaDao;
private ISysSendMessageLogDao sysSendMessageLogDao;
@Autowired
public void setSysSendMessageLogDao(ISysSendMessageLogDao dao) {
this.sysSendMessageLogDao = dao;
this.dao = dao;
}
@Override
public JsonResultEntity queryEntityPage(JSONObject jsonObject) {
SysSendMessageLogEntity entity = getData("jsonStr", jsonObject, SysSendMessageLogEntity.class);
if (entity == null || entity.getPageNum() == null || entity.getPageSize() == null) {
return BaseResult.getFailureMessageEntity("分页查询参数不存在");
}
PageHelper.startPage(entity.getPageNum(), entity.getPageSize());
List<SysSendMessageLogEntity> list = sysSendMessageLogDao.queryByLike(entity);
PageInfo pageInfo = new PageInfo(list);
return BaseResult.getSuccessMessageEntity("查询数据成功", pageInfo);
}
@Override
public JsonResultEntity queryEntity(JSONObject jsonObject) {
SysSendMessageLogEntity entity = getData("jsonStr", jsonObject, SysSendMessageLogEntity.class);
if (entity == null) {
entity = new SysSendMessageLogEntity();
}
List<SysSendMessageLogEntity> list = sysSendMessageLogDao.queryByLike(entity);
return BaseResult.getSuccessMessageEntity("查询数据成功", list);
}
@Override
public JsonResultEntity getEntity(JSONObject jsonObject) {
SysSendMessageLogEntity entity = getData("jsonStr", jsonObject, SysSendMessageLogEntity.class);
if (entity == null) {
return BaseResult.getFailureMessageEntity("参数不能为空");
}
if (entity.getId() == null || "".equals(entity.getId())) {
return BaseResult.getFailureMessageEntity("系统错误");
}
entity = sysSendMessageLogDao.get(entity.getId());
if (entity == null) {
return BaseResult.getFailureMessageEntity("获取发送消息日志失败");
}
return BaseResult.getSuccessMessageEntity("获取发送消息日志成功", entity);
}
@Override
public JsonResultEntity saveEntity(JSONObject jsonObject) {
SysSendMessageLogEntity entity = getData("jsonStr", jsonObject, SysSendMessageLogEntity.class);
if (entity == null) {
return BaseResult.getFailureMessageEntity("参数不能为空");
}
if (entity.getBillId() == null || "".equals(entity.getBillId())) {
return BaseResult.getFailureMessageEntity("来源业务单据不能为空");
}
entity.setCreate();
sysSendMessageLogDao.save(entity);
return BaseResult.getSuccessMessageEntity("保存发送消息日志成功", entity);
}
@Override
public JsonResultEntity updateEntity(JSONObject jsonObject){
SysSendMessageLogEntity entity = getData("jsonStr", jsonObject, SysSendMessageLogEntity.class);
if (entity == null) {
return BaseResult.getFailureMessageEntity("参数不能为空");
}
if (entity.getId() == null || "".equals(entity.getId())) {
return BaseResult.getFailureMessageEntity("系统错误");
}
if (entity.getBillId() == null || "".equals(entity.getBillId())) {
return BaseResult.getFailureMessageEntity("来源业务单据不能为空");
}
entity.setUpdate();
sysSendMessageLogDao.update(entity);
return BaseResult.getSuccessMessageEntity("修改发送消息日志成功", entity);
}
@Override
public JsonResultEntity deleteEntity(JSONObject jsonObject){
SysSendMessageLogEntity entity = getData("jsonStr", jsonObject, SysSendMessageLogEntity.class);
if(entity == null){
return BaseResult.getFailureMessageEntity("参数不能为空");
}
if (entity.getId() == null || "".equals(entity.getId())) {
return BaseResult.getFailureMessageEntity("系统错误");
}
entity.setUpdate();;
sysSendMessageLogDao.logicRemove(entity);
return BaseResult.getSuccessMessageEntity("删除发送消息日志成功", entity);
}
// public JsonResultEntity sendMsg(JSONObject jsonObject){
// //拼接一条测试消息数据
// jsonObject.put("log_id","e2f213567c2242eab7401edcb3949c45");
// jsonObject.put("send_app_name","数智中台");
// jsonObject.put("recieve_app_name","东进U8C");
// jsonObject.put("recieve_api_name","存货基本档案修改");
// jsonObject.put("receive_api_code","8000350046");
// jsonObject.put("return_data","{\n" +
// " \"status\": \"falied\",\n" +
// " \"errorcode\": \"-32000\",\n" +
// " \"errormsg\": \"U8C返回信息:以下档案在U8cloud系统中根据公司或者账簿信息找不到请检查详细信息1、档案类型计量档案公司编码0001档案编码\",\n" +
// " \"taskNumber\": \"202408220001\"\n" +
// "}");
// jsonObject.put("status","4");
// jsonObject.put("url","https://oapi.dingtalk.com/topapi/message/corpconversation/asyncsend_v2");
// jsonObject.put("appType","5DD");
//
// //1根据测试消息状态成功失败以及目标API是否启用推送决定是否要推送消息只推送失败的且启用推送的
// //2根据目标API找到其消息模版并根据模版生成消息内容
// //3根据目标API找到其预警应用api并推送消息
// String status = jsonObject.get("status").toString();
// String receiveApiCode = jsonObject.get("receive_api_code").toString();
// String sendAppName = jsonObject.get("send_app_name").toString();
// String receiveApiName = jsonObject.get("recieve_api_name").toString();
// String recieveAppName = jsonObject.get("recieve_app_name").toString();
// String returnData = jsonObject.get("return_data").toString();
// String url = jsonObject.get("url").toString();
// String appType = jsonObject.get("appType").toString();
// String sendMsgContent = "";
//
// SysWarningInterfaceEntity interfaceEntity = new SysWarningInterfaceEntity();
// SysWarningConfigEntity configEntity = new SysWarningConfigEntity();
// SysMessageTemplateEntity templateEntity = new SysMessageTemplateEntity();
//
// interfaceEntity.setApiCode(receiveApiCode);
//
// if(status == null){
// logger.error("日志状态为空");
// return BaseResult.getFailureMessageEntity("日志状态为空");
// }
// if ("4".equals(status)) {
// interfaceEntity = sysWarningInterfaceDao.queryOne(interfaceEntity);
// if(interfaceEntity == null){
// logger.error("未找到API接口预警信息");
// return BaseResult.getFailureMessageEntity("未找到API接口预警信息");
// }
// if(interfaceEntity.getStatus() == null || interfaceEntity.getStatus().equals("1") == false){
// logger.error("API接口未启用推送");
// return BaseResult.getFailureMessageEntity("API接口未启用推送");
// }
// //根据主表id找到主表记录中的消息模版id
// String warningConfigId = interfaceEntity.getWarningConfigId();
// if(warningConfigId == null || "".equals(warningConfigId)){
// logger.error("未找到该接口预警配置信息的主表id");
// return BaseResult.getFailureMessageEntity("未找到该接口预警配置信息的主表id");
// }
// configEntity = sysWarningConfigDao.get(warningConfigId);
// if(configEntity == null){
// logger.error("未找到该接口预警配置信息");
// return BaseResult.getFailureMessageEntity("未找到该接口预警配置信息");
// }
//
// String messageTemplateId = configEntity.getMessageTemplateId();
// if(messageTemplateId == null || "".equals(messageTemplateId)){
// logger.error("未找到该接口预警配置信息的消息模版id");
// return BaseResult.getFailureMessageEntity("未找到该接口预警配置信息的消息模版id");
// }
// templateEntity = sysMessageTemplateDao.get(messageTemplateId);
// if(templateEntity == null){
// logger.error("未找到该接口预警配置信息的消息模版信息");
// return BaseResult.getFailureMessageEntity("未找到该接口预警配置信息的消息模版信息");
// }
//
// String messageContent = templateEntity.getMessageContents();
// if(messageContent == null || "".equals(messageContent)){
// logger.error("未找到该接口预警配置信息的消息模版内容");
// return BaseResult.getFailureMessageEntity("未找到该接口预警配置信息的消息模版内容");
// }
//
// sendMsgContent = messageContent.replace("${reciecveAppName}",recieveAppName);
// sendMsgContent = sendMsgContent.replace("${sendAppName}",sendAppName);
// sendMsgContent = sendMsgContent.replace("${receiveApiName}",receiveApiName);
// sendMsgContent = sendMsgContent.replace("${returnData}",returnData);
//
// String templateName = templateEntity.getTemplateName();
//
// switch (appType){
// case "6WX":
// //调用微信推送消息
// break;
// case "5DD":
// //消息类型3表示钉钉
// String appkey = "dingbltm9wszcl7hoxyg";
// String appsecret = "ex3a9qwdTXWf_VKJEddAg8YE7x98kIl3Nsy_7g0NdwvK3w3nXdUhJ3XQP4lUYs2d";
//
// String type = "3";
// //发送消息时使用的微应用的AgentID
// String agent_id = "3209295620";
// //接收者的userid列表最大用户列表长度100
// String userid_list = configEntity.getRecipientId();
//
// String bodyParams = splicingDDBody(sendMsgContent,agent_id,userid_list).toString();
//
//// String access_token = getAccessToken(appkey,appsecret);
//// String Baseurl = url + "?access_token="+ access_token;
//
// String result = HttpRequest.post("http://127.0.0.1:9999/kangarooDataCenterV3/entranceController/externalCallInterface").
// header("appId","800043").
// header("apiCode","8000430001").
// header("publicKey","ZJYA7v6DubGMm8EdBPGo+Jj9wCpUeCGJEpfBRLiInq4dvDlCe7eDIk+3zDUT+v578prj").
// header("secretKey","bsAMm6tvJs/BV1SO/9ZzjlW+OQaK0mwyv6rLvktyNy/OdltLuG2zze9bT7ttfAA9j3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=").
// body(bodyParams).
// execute().
// body();
// JSONObject resultJson = JSONObject.parseObject(result);
// String errcode = resultJson.getString("errcode");
//
// if(errcode != null && errcode.equals("0")){
// logger.info("推送消息成功,开始保存日志");
// SysSendMessageLogEntity logentity = saveLog(sendMsgContent,type,resultJson.toString(),templateName);
// logger.info("保存日志成功");
// }else{
// logger.error("推送消息失败,开始保存日志");
// SysSendMessageLogEntity logentity = saveLog(sendMsgContent,type,resultJson.toString(),templateName);
// logger.error("保存日志成功");
// }
// break;
// default:
// logger.error("未找到该应用类型");
// break;
// }
//
// }else{
// logger.error("日志状态为成功,不需要推送消息");
// return BaseResult.getFailureMessageEntity("日志状态为成功,不需要推送消息");
// }
// return BaseResult.getSuccessMessageEntity("true");
// }
/**
* sendMessage方法根据请求错误消息组装成消息模版推送到三方业务系统
* 1先获取接口调用的日志数据
* 2如果日志状态为失败且该接口预警状态为启用则进行消息推送
* 3根据预警配置找到消息模版并生成消息内容
* 4根据预警配置找到预警应用并推送消息
* 5保存消息推送日志
* */
@Override
public boolean sendMessage(SysPushMessageEntity entity){
String status = entity.getStatus();
String receiveApiCode = entity.getReceiveApiCode();
String sendAppName = entity.getSendAppName();
String receiveApiName = entity.getReceiveApiName();
String recieveAppName = entity.getReceiveAppName();
String returnData = entity.getReturnData();
String warningAppType = entity.getWarningAppType();
String warningAppCode = entity.getWarningAppCode();
String warningApiCode = entity.getWarningApiCode();
String sendMsgContent = "";
SysWarningInterfaceEntity interfaceEntity = new SysWarningInterfaceEntity();
SysWarningConfigEntity configEntity = new SysWarningConfigEntity();
SysMessageTemplateEntity templateEntity = new SysMessageTemplateEntity();
SysApplicationApiParaEntity sysApplicationApiParaEntity = new SysApplicationApiParaEntity();
interfaceEntity.setApiCode(receiveApiCode);
if(status == null){
logger.error("日志状态为空");
return false;
}
//只有发送失败的日志才会推送消息成功的日志不推送消息
if ("4".equals(status)) {
interfaceEntity = sysWarningInterfaceDao.queryOne(interfaceEntity);
if(interfaceEntity == null){
logger.error("未找到API接口预警信息");
return false;
}
//只有预警接口状态为启用才会进行消息推送
if(interfaceEntity.getStatus() == null || interfaceEntity.getStatus().equals("1") == false){
logger.error("API接口未启用推送");
return false;
}
//根据主表id找到主表记录中的消息模版id
String warningConfigId = interfaceEntity.getWarningConfigId();
if(warningConfigId == null || "".equals(warningConfigId)){
logger.error("未找到该接口预警配置信息的主表id");
return false;
}
configEntity = sysWarningConfigDao.get(warningConfigId);
if(configEntity == null){
logger.error("未找到该接口预警配置信息");
return false;
}
String messageTemplateId = configEntity.getMessageTemplateId();
if(messageTemplateId == null || "".equals(messageTemplateId)){
logger.error("未找到该接口预警配置信息的消息模版id");
return false;
}
templateEntity = sysMessageTemplateDao.get(messageTemplateId);
if(templateEntity == null){
logger.error("未找到该接口预警配置信息的消息模版信息");
return false;
}
String messageContent = templateEntity.getMessageContents();
if(messageContent == null || "".equals(messageContent)){
logger.error("未找到该接口预警配置信息的消息模版内容");
return false;
}
//推送消息内容拼接
sendMsgContent = messageContent.replace("${reciecveAppName}",recieveAppName);
sendMsgContent = sendMsgContent.replace("${sendAppName}",sendAppName);
sendMsgContent = sendMsgContent.replace("${receiveApiName}",receiveApiName);
sendMsgContent = sendMsgContent.replace("${returnData}",returnData);
//消息模版名称
String templateName = templateEntity.getTemplateName();
String type = "";
String bodyParams = "";
String warningAppId = configEntity.getWarningAppId();
//查询预警人员id列表
String recipientIdList = configEntity.getRecipientId();
//根据预警人员id列表获取预警应用人员id列表
String warningAppReceiverIdList = getWarningAppReceiverIdList(warningAppType,recipientIdList);
switch (warningAppType){
case "6WX":
//调用微信推送消息
break;
case "5DD":
//消息类型3表示钉钉
type = "3";
//获取钉钉发送消息时使用的微应用的AgentID
sysApplicationApiParaEntity.setAppId(warningAppId);
sysApplicationApiParaEntity.setInterfaceKey("agentId");
String agentId = sysApplicationApiParaDao.queryOne(sysApplicationApiParaEntity).getInterfaceValue();
//拼接调用钉钉接口的body参数
bodyParams = splicingDDBody(sendMsgContent,agentId,warningAppReceiverIdList).toString();
break;
default:
logger.error("未找到该应用类型");
break;
}
String result = HttpRequest.post("http://127.0.0.1:9999/kangarooDataCenterV3/entranceController/externalCallInterface").
header("appId",warningAppCode).
header("apiCode",warningApiCode).
header("publicKey","ZJYA7v6DubGMm8EdBPGo+Jj9wCpUeCGJEpfBRLiInq4dvDlCe7eDIk+3zDUT+v578prj").
header("secretKey","bsAMm6tvJs/BV1SO/9ZzjlW+OQaK0mwyv6rLvktyNy/OdltLuG2zze9bT7ttfAA9j3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=").
body(bodyParams).
execute().
body();
JSONObject resultJson = JSONObject.parseObject(result);
String errcode = resultJson.getJSONObject("attribute").getString("errcode");
if(errcode != null && errcode.equals("0")){
logger.info("推送消息成功,开始保存日志");
saveLog(sendMsgContent,type,resultJson.toString(),templateName,recipientIdList,warningAppReceiverIdList);
logger.info("保存日志成功");
}else{
logger.error("推送消息失败,开始保存日志");
saveLog(sendMsgContent,type,resultJson.toString(),templateName,recipientIdList,warningAppReceiverIdList);
logger.error("保存日志成功");
}
}else{
logger.error("日志状态为成功,不需要推送消息");
return false;
}
return true;
}
/**保存推送消息日志时需要循环预警应用人员id列表*/
public void saveLog(String sendMsgContent,String type,String resultMessage,String templateName,String recipientIdList,String warningAppReceiverIdList){
SysSendMessageLogEntity logEntity = new SysSendMessageLogEntity();
logEntity.setSendCount(sendMsgContent);
logEntity.setType(type);
logEntity.setBillId("test1411");
logEntity.setSendDatetime(new Date());
logEntity.setSts("Y");
logEntity.setCreate_user_id("1");
logEntity.setModify_user_id("1");
logEntity.setCreate_time(new Date());
logEntity.setModify_time(new Date());
logEntity.setOrg_id("0");
logEntity.setCompanyId("0");
logEntity.setSendPersonId("1");
logEntity.setResultMessage(resultMessage);
logEntity.setSourceModelName(templateName);
String[] personIdList = warningAppReceiverIdList.split(",");
String[] userIdList = recipientIdList.split(",");
for(int i=0;i<personIdList.length;i++){
logEntity.setSendToPersonId(personIdList[i]);
logEntity.setSendToUserId(userIdList[i]);
logEntity.setId(UUIDUtils.getUUID());
sysSendMessageLogDao.save(logEntity);
}
}
/**拼接调用钉钉接口的body参数*/
public JSONObject splicingDDBody(String sendMsgContent,String agentId,String userid_list){
JSONObject bodyJson = new JSONObject();
JSONObject msg = new JSONObject();
JSONObject text = new JSONObject();
text.put("content",sendMsgContent);
msg.put("msgtype","text");
msg.put("text",text);
bodyJson.put("msg",msg);
bodyJson.put("to_all_user","false");
bodyJson.put("agent_id",agentId);
bodyJson.put("userid_list",userid_list);
return bodyJson;
}
/**根据预警应用类型和预警人员id列表,获取预警应用人员id列表*/
public String getWarningAppReceiverIdList(String warningAppType,String userIdList){
String[] userIdArray = userIdList.split(",");
String warningAppReceiverIdList = "";
//根据预警人员id列表查表sys_user中匹配的数据记录
List<SysUserEntity> sysUserList = new ArrayList<>();
for(String userId : userIdArray){
sysUserList.add(sysUserDao.get(userId));
}
switch (warningAppType){
case "6WX":
//获取微信预警人员id列表
break;
case "5DD":
//获取钉钉预警人员id列表
for(SysUserEntity sysUser : sysUserList){
if(sysUser.getDdUserId()!= null && !"".equals(sysUser.getDdUserId())){
if(!warningAppReceiverIdList.isEmpty()){
warningAppReceiverIdList += ",";
}
warningAppReceiverIdList += sysUser.getDdUserId();
}
}
break;
default:
logger.error("未找到该应用类型");
break;
}
return warningAppReceiverIdList;
}
}

View File

@ -82,6 +82,26 @@ public class SysUserEntity extends BaseEntity {
*/
private String mobilePhone;
private String ddUserId;
private String wxUserId;
public String getDdUserId() {
return ddUserId;
}
public void setDdUserId(String ddUserId) {
this.ddUserId = ddUserId;
}
public String getWxUserId() {
return wxUserId;
}
public void setWxUserId(String wxUserId) {
this.wxUserId = wxUserId;
}
public String getPersonId() {
return personId;
}

View File

@ -24,6 +24,8 @@
<result property="personName" column="person_Name" jdbcType="VARCHAR"/>
<result property="organName" column="organ_name" jdbcType="VARCHAR"/>
<result property="mobilePhone" column="mobile_phone" jdbcType="VARCHAR"/>
<result property="ddUserId" column="dd_user_id" jdbcType="VARCHAR"/>
<result property="wxUserId" column="wx_user_id" jdbcType="VARCHAR"/>
</resultMap>
<!-- 查询的字段-->
<sql id="SysUserEntity_Base_Column_List">
@ -44,7 +46,9 @@
,modify_time
,sts
,org_id
,company_id
,company_id
,dd_user_id
,wx_user_id
</sql>
<!--通过ID获取数据 -->
<select id="entity_get" resultMap="get-SysUserEntity-result">
@ -68,6 +72,8 @@
,a.org_id
,a.company_id
,p.person_Name
,a.wx_user_id
,a.dd_user_id
from
sys_user a
LEFT JOIN sys_person p on p.id = a.person_id and p.sts = 'Y'
@ -148,6 +154,7 @@
<if test="lastLoginIp != null and lastLoginIp != ''">and last_login_ip like concat('%',#{lastLoginIp},'%')
</if>
<if test="state != null and state != ''">and state like concat('%',#{state},'%')</if>
<if test="remark != null and remark != ''">and remark like concat('%',#{remark},'%')</if>
<if test="sorts != null">and sorts like concat('%',#{sorts},'%')</if>
<if test="create_user_id != null and create_user_id != ''">and create_user_id like

View File

@ -0,0 +1,15 @@
package com.hzya.frame.sysnew.warningConfig.dao;
import com.hzya.frame.sysnew.warningConfig.entity.SysWarningConfigEntity;
import com.hzya.frame.basedao.dao.IBaseDao;
/**
* 预警配置表(sys_warning_config: table)表数据库访问层
*
* @author makejava
* @since 2024-09-03 09:28:23
*/
public interface ISysWarningConfigDao extends IBaseDao<SysWarningConfigEntity, String> {
}

View File

@ -0,0 +1,17 @@
package com.hzya.frame.sysnew.warningConfig.dao.impl;
import com.hzya.frame.sysnew.warningConfig.entity.SysWarningConfigEntity;
import com.hzya.frame.sysnew.warningConfig.dao.ISysWarningConfigDao;
import org.springframework.stereotype.Repository;
import com.hzya.frame.basedao.dao.MybatisGenericDao;
/**
* 预警配置表(SysWarningConfig)表数据库访问层
*
* @author makejava
* @since 2024-09-03 09:28:23
*/
@Repository(value = "SysWarningConfigDaoImpl")
public class SysWarningConfigDaoImpl extends MybatisGenericDao<SysWarningConfigEntity, String> implements ISysWarningConfigDao{
}

View File

@ -0,0 +1,96 @@
package com.hzya.frame.sysnew.warningConfig.entity;
import java.util.Date;
import com.hzya.frame.web.entity.BaseEntity;
/**
* 预警配置表(SysWarningConfig)实体类
*
* @author makejava
* @since 2024-09-03 09:28:23
*/
public class SysWarningConfigEntity extends BaseEntity {
/** 公司id */
private String companyId;
/** 消息模版id */
private String messageTemplateId;
/** 应用id */
private String appId;
/** 预警应用id */
private String warningAppId;
/** 接收推送消息的api编码 */
private String acceptMessageApiCode;
/** 备注 */
private String remark;
/** 是否启用0停用、1启用 */
private String status;
/** 接收人id存表sys_user的id */
private String recipientId;
public String getCompanyId() {
return companyId;
}
public void setCompanyId(String companyId) {
this.companyId = companyId;
}
public String getMessageTemplateId() {
return messageTemplateId;
}
public void setMessageTemplateId(String messageTemplateId) {
this.messageTemplateId = messageTemplateId;
}
public String getAppId() {
return appId;
}
public void setAppId(String appId) {
this.appId = appId;
}
public String getWarningAppId() {
return warningAppId;
}
public void setWarningAppId(String warningAppId) {
this.warningAppId = warningAppId;
}
public String getAcceptMessageApiCode() {
return acceptMessageApiCode;
}
public void setAcceptMessageApiCode(String acceptMessageApiCode) {
this.acceptMessageApiCode = acceptMessageApiCode;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getRecipientId() {
return recipientId;
}
public void setRecipientId(String recipientId) {
this.recipientId = recipientId;
}
}

View File

@ -0,0 +1,283 @@
<?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">
<mapper namespace="com.hzya.frame.sysnew.warningConfig.dao.impl.SysWarningConfigDaoImpl">
<resultMap id="get-SysWarningConfigEntity-result" type="com.hzya.frame.sysnew.warningConfig.entity.SysWarningConfigEntity" >
<result property="id" column="id" jdbcType="VARCHAR"/>
<result property="sorts" column="sorts" jdbcType="INTEGER"/>
<result property="create_user_id" column="create_user_id" jdbcType="VARCHAR"/>
<result property="create_time" column="create_time" jdbcType="TIMESTAMP"/>
<result property="modify_user_id" column="modify_user_id" jdbcType="VARCHAR"/>
<result property="modify_time" column="modify_time" jdbcType="TIMESTAMP"/>
<result property="sts" column="sts" jdbcType="VARCHAR"/>
<result property="org_id" column="org_id" jdbcType="VARCHAR"/>
<result property="companyId" column="company_id" jdbcType="VARCHAR"/>
<result property="messageTemplateId" column="message_template_id" jdbcType="VARCHAR"/>
<result property="appId" column="app_id" jdbcType="VARCHAR"/>
<result property="warningAppId" column="warning_app_id" jdbcType="VARCHAR"/>
<result property="acceptMessageApiCode" column="accept_message_api_code" jdbcType="VARCHAR"/>
<result property="remark" column="remark" jdbcType="VARCHAR"/>
<result property="status" column="status" jdbcType="VARCHAR"/>
<result property="recipientId" column="recipient_id" jdbcType="VARCHAR"/>
</resultMap>
<!-- 查询的字段-->
<sql id = "SysWarningConfigEntity_Base_Column_List">
id
,sorts
,create_user_id
,create_time
,modify_user_id
,modify_time
,sts
,org_id
,company_id
,message_template_id
,app_id
,warning_app_id
,accept_message_api_code
,remark
,status
,recipient_id
</sql>
<!--通过ID获取数据 -->
<select id="entity_get" resultMap="get-SysWarningConfigEntity-result">
select
<include refid="SysWarningConfigEntity_Base_Column_List" />
from sys_warning_config where id = #{ id } and sts='Y'
</select>
<!-- 查询 采用==查询 -->
<select id="entity_list_base" resultMap="get-SysWarningConfigEntity-result" parameterType = "com.hzya.frame.sysnew.warningConfig.entity.SysWarningConfigEntity">
select
<include refid="SysWarningConfigEntity_Base_Column_List" />
from sys_warning_config
<trim prefix="where" prefixOverrides="and">
<if test="id != null and id != ''"> and id = #{id} </if>
<if test="sorts != null"> and sorts = #{sorts} </if>
<if test="create_user_id != null and create_user_id != ''"> and create_user_id = #{create_user_id} </if>
<if test="create_time != null"> and create_time = #{create_time} </if>
<if test="modify_user_id != null and modify_user_id != ''"> and modify_user_id = #{modify_user_id} </if>
<if test="modify_time != null"> and modify_time = #{modify_time} </if>
<if test="sts != null and sts != ''"> and sts = #{sts} </if>
<if test="org_id != null and org_id != ''"> and org_id = #{org_id} </if>
<if test="companyId != null and companyId != ''"> and company_id = #{companyId} </if>
<if test="messageTemplateId != null and messageTemplateId != ''"> and message_template_id = #{messageTemplateId} </if>
<if test="appId != null and appId != ''"> and app_id = #{appId} </if>
<if test="warningAppId != null and warningAppId != ''"> and warning_app_id = #{warningAppId} </if>
<if test="acceptMessageApiCode != null and acceptMessageApiCode != ''"> and accept_message_api_code = #{acceptMessageApiCode} </if>
<if test="remark != null and remark != ''"> and remark = #{remark} </if>
<if test="status != null and status != ''"> and status = #{status} </if>
<if test="recipientId != null and recipientId != ''"> and recipient_id = #{recipientId} </if>
and sts='Y'
</trim>
<if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
<if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
</select>
<!-- 查询符合条件的数量 -->
<select id="entity_count" resultType="Integer" parameterType = "com.hzya.frame.sysnew.warningConfig.entity.SysWarningConfigEntity">
select count(1) from sys_warning_config
<trim prefix="where" prefixOverrides="and">
<if test="id != null and id != ''"> and id = #{id} </if>
<if test="sorts != null"> and sorts = #{sorts} </if>
<if test="create_user_id != null and create_user_id != ''"> and create_user_id = #{create_user_id} </if>
<if test="create_time != null"> and create_time = #{create_time} </if>
<if test="modify_user_id != null and modify_user_id != ''"> and modify_user_id = #{modify_user_id} </if>
<if test="modify_time != null"> and modify_time = #{modify_time} </if>
<if test="sts != null and sts != ''"> and sts = #{sts} </if>
<if test="org_id != null and org_id != ''"> and org_id = #{org_id} </if>
<if test="companyId != null and companyId != ''"> and company_id = #{companyId} </if>
<if test="messageTemplateId != null and messageTemplateId != ''"> and message_template_id = #{messageTemplateId} </if>
<if test="appId != null and appId != ''"> and app_id = #{appId} </if>
<if test="warningAppId != null and warningAppId != ''"> and warning_app_id = #{warningAppId} </if>
<if test="acceptMessageApiCode != null and acceptMessageApiCode != ''"> and accept_message_api_code = #{acceptMessageApiCode} </if>
<if test="remark != null and remark != ''"> and remark = #{remark} </if>
<if test="status != null and status != ''"> and status = #{status} </if>
<if test="recipientId != null and recipientId != ''"> and recipient_id = #{recipientId} </if>
and sts='Y'
</trim>
<if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
<if test=" sort !='' and sort!=null and order !='' and order!=null "> order by ${sort} ${order}</if>
</select>
<!-- 分页查询列表 采用like格式 -->
<select id="entity_list_like" resultMap="get-SysWarningConfigEntity-result" parameterType = "com.hzya.frame.sysnew.warningConfig.entity.SysWarningConfigEntity">
select
<include refid="SysWarningConfigEntity_Base_Column_List" />
from sys_warning_config
<trim prefix="where" prefixOverrides="and">
<if test="id != null and id != ''"> and id like concat('%',#{id},'%') </if>
<if test="sorts != null"> and sorts like concat('%',#{sorts},'%') </if>
<if test="create_user_id != null and create_user_id != ''"> and create_user_id like concat('%',#{create_user_id},'%') </if>
<if test="create_time != null"> and create_time like concat('%',#{create_time},'%') </if>
<if test="modify_user_id != null and modify_user_id != ''"> and modify_user_id like concat('%',#{modify_user_id},'%') </if>
<if test="modify_time != null"> and modify_time like concat('%',#{modify_time},'%') </if>
<if test="sts != null and sts != ''"> and sts like concat('%',#{sts},'%') </if>
<if test="org_id != null and org_id != ''"> and org_id like concat('%',#{org_id},'%') </if>
<if test="companyId != null and companyId != ''"> and company_id like concat('%',#{companyId},'%') </if>
<if test="messageTemplateId != null and messageTemplateId != ''"> and message_template_id like concat('%',#{messageTemplateId},'%') </if>
<if test="appId != null and appId != ''"> and app_id like concat('%',#{appId},'%') </if>
<if test="warningAppId != null and warningAppId != ''"> and warning_app_id like concat('%',#{warningAppId},'%') </if>
<if test="acceptMessageApiCode != null and acceptMessageApiCode != ''"> and accept_message_api_code like concat('%',#{acceptMessageApiCode},'%') </if>
<if test="remark != null and remark != ''"> and remark like concat('%',#{remark},'%') </if>
<if test="status != null and status != ''"> and status like concat('%',#{status},'%') </if>
<if test="recipientId != null and recipientId != ''"> and recipient_id like concat('%',#{recipientId},'%') </if>
and sts='Y'
</trim>
<if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
<if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
</select>
<!-- 查询列表 字段采用or格式 -->
<select id="SysWarningConfigentity_list_or" resultMap="get-SysWarningConfigEntity-result" parameterType = "com.hzya.frame.sysnew.warningConfig.entity.SysWarningConfigEntity">
select
<include refid="SysWarningConfigEntity_Base_Column_List" />
from sys_warning_config
<trim prefix="where" prefixOverrides="and">
<if test="id != null and id != ''"> or id = #{id} </if>
<if test="sorts != null"> or sorts = #{sorts} </if>
<if test="create_user_id != null and create_user_id != ''"> or create_user_id = #{create_user_id} </if>
<if test="create_time != null"> or create_time = #{create_time} </if>
<if test="modify_user_id != null and modify_user_id != ''"> or modify_user_id = #{modify_user_id} </if>
<if test="modify_time != null"> or modify_time = #{modify_time} </if>
<if test="sts != null and sts != ''"> or sts = #{sts} </if>
<if test="org_id != null and org_id != ''"> or org_id = #{org_id} </if>
<if test="companyId != null and companyId != ''"> or company_id = #{companyId} </if>
<if test="messageTemplateId != null and messageTemplateId != ''"> or message_template_id = #{messageTemplateId} </if>
<if test="appId != null and appId != ''"> or app_id = #{appId} </if>
<if test="warningAppId != null and warningAppId != ''"> or warning_app_id = #{warningAppId} </if>
<if test="acceptMessageApiCode != null and acceptMessageApiCode != ''"> or accept_message_api_code = #{acceptMessageApiCode} </if>
<if test="remark != null and remark != ''"> or remark = #{remark} </if>
<if test="status != null and status != ''"> or status = #{status} </if>
<if test="recipientId != null and recipientId != ''"> or recipient_id = #{recipientId} </if>
and sts='Y'
</trim>
<if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
<if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
</select>
<!--新增所有列-->
<insert id="entity_insert" parameterType = "com.hzya.frame.sysnew.warningConfig.entity.SysWarningConfigEntity" keyProperty="id" useGeneratedKeys="true">
insert into sys_warning_config(
<trim suffix="" suffixOverrides=",">
<if test="id != null and id != ''"> id , </if>
<if test="sorts != null"> sorts , </if>
<if test="create_user_id != null and create_user_id != ''"> create_user_id , </if>
<if test="create_time != null"> create_time , </if>
<if test="modify_user_id != null and modify_user_id != ''"> modify_user_id , </if>
<if test="modify_time != null"> modify_time , </if>
<if test="sts != null and sts != ''"> sts , </if>
<if test="org_id != null and org_id != ''"> org_id , </if>
<if test="companyId != null and companyId != ''"> company_id , </if>
<if test="messageTemplateId != null and messageTemplateId != ''"> message_template_id , </if>
<if test="appId != null and appId != ''"> app_id , </if>
<if test="warningAppId != null and warningAppId != ''"> warning_app_id , </if>
<if test="acceptMessageApiCode != null and acceptMessageApiCode != ''"> accept_message_api_code , </if>
<if test="remark != null and remark != ''"> remark , </if>
<if test="status != null and status != ''"> status , </if>
<if test="recipientId != null and recipientId != ''"> recipient_id , </if>
<if test="sts == null ">sts,</if>
</trim>
)values(
<trim suffix="" suffixOverrides=",">
<if test="id != null and id != ''"> #{id} ,</if>
<if test="sorts != null"> #{sorts} ,</if>
<if test="create_user_id != null and create_user_id != ''"> #{create_user_id} ,</if>
<if test="create_time != null"> #{create_time} ,</if>
<if test="modify_user_id != null and modify_user_id != ''"> #{modify_user_id} ,</if>
<if test="modify_time != null"> #{modify_time} ,</if>
<if test="sts != null and sts != ''"> #{sts} ,</if>
<if test="org_id != null and org_id != ''"> #{org_id} ,</if>
<if test="companyId != null and companyId != ''"> #{companyId} ,</if>
<if test="messageTemplateId != null and messageTemplateId != ''"> #{messageTemplateId} ,</if>
<if test="appId != null and appId != ''"> #{appId} ,</if>
<if test="warningAppId != null and warningAppId != ''"> #{warningAppId} ,</if>
<if test="acceptMessageApiCode != null and acceptMessageApiCode != ''"> #{acceptMessageApiCode} ,</if>
<if test="remark != null and remark != ''"> #{remark} ,</if>
<if test="status != null and status != ''"> #{status} ,</if>
<if test="recipientId != null and recipientId != ''"> #{recipientId} ,</if>
<if test="sts == null ">'Y',</if>
</trim>
)
</insert>
<!-- 批量新增 -->
<insert id="entityInsertBatch" keyProperty="id" useGeneratedKeys="true">
insert into sys_warning_config(create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id, message_template_id, app_id, warning_app_id, accept_message_api_code, remark, status, recipient_id, sts)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId},#{entity.messageTemplateId},#{entity.appId},#{entity.warningAppId},#{entity.acceptMessageApiCode},#{entity.remark},#{entity.status},#{entity.recipientId}, 'Y')
</foreach>
</insert>
<!-- 批量新增或者修改-->
<insert id="entityInsertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
insert into sys_warning_config(create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id, message_template_id, app_id, warning_app_id, accept_message_api_code, remark, status, recipient_id)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId},#{entity.messageTemplateId},#{entity.appId},#{entity.warningAppId},#{entity.acceptMessageApiCode},#{entity.remark},#{entity.status},#{entity.recipientId})
</foreach>
on duplicate key update
create_user_id = values(create_user_id),
create_time = values(create_time),
modify_user_id = values(modify_user_id),
modify_time = values(modify_time),
sts = values(sts),
org_id = values(org_id),
company_id = values(company_id),
message_template_id = values(message_template_id),
app_id = values(app_id),
warning_app_id = values(warning_app_id),
accept_message_api_code = values(accept_message_api_code),
remark = values(remark),
status = values(status),
recipient_id = values(recipient_id)</insert>
<!--通过主键修改方法-->
<update id="entity_update" parameterType = "com.hzya.frame.sysnew.warningConfig.entity.SysWarningConfigEntity" >
update sys_warning_config set
<trim suffix="" suffixOverrides=",">
<if test="create_user_id != null and create_user_id != ''"> create_user_id = #{create_user_id},</if>
<if test="create_time != null"> create_time = #{create_time},</if>
<if test="modify_user_id != null and modify_user_id != ''"> modify_user_id = #{modify_user_id},</if>
<if test="modify_time != null"> modify_time = #{modify_time},</if>
<if test="sts != null and sts != ''"> sts = #{sts},</if>
<if test="org_id != null and org_id != ''"> org_id = #{org_id},</if>
<if test="companyId != null and companyId != ''"> company_id = #{companyId},</if>
<if test="messageTemplateId != null and messageTemplateId != ''"> message_template_id = #{messageTemplateId},</if>
<if test="appId != null and appId != ''"> app_id = #{appId},</if>
<if test="warningAppId != null and warningAppId != ''"> warning_app_id = #{warningAppId},</if>
<if test="acceptMessageApiCode != null and acceptMessageApiCode != ''"> accept_message_api_code = #{acceptMessageApiCode},</if>
<if test="remark != null and remark != ''"> remark = #{remark},</if>
<if test="status != null and status != ''"> status = #{status},</if>
<if test="recipientId != null and recipientId != ''"> recipient_id = #{recipientId},</if>
</trim>
where id = #{id}
</update>
<!-- 逻辑删除 -->
<update id="entity_logicDelete" parameterType = "com.hzya.frame.sysnew.warningConfig.entity.SysWarningConfigEntity" >
update sys_warning_config set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id}
where id = #{id}
</update>
<!-- 多条件逻辑删除 -->
<update id="entity_logicDelete_Multi_Condition" parameterType = "com.hzya.frame.sysnew.warningConfig.entity.SysWarningConfigEntity" >
update sys_warning_config set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id}
<trim prefix="where" prefixOverrides="and">
<if test="id != null and id != ''"> and id = #{id} </if>
<if test="sorts != null"> and sorts = #{sorts} </if>
<if test="sts != null and sts != ''"> and sts = #{sts} </if>
<if test="companyId != null and companyId != ''"> and company_id = #{companyId} </if>
<if test="messageTemplateId != null and messageTemplateId != ''"> and message_template_id = #{messageTemplateId} </if>
<if test="appId != null and appId != ''"> and app_id = #{appId} </if>
<if test="warningAppId != null and warningAppId != ''"> and warning_app_id = #{warningAppId} </if>
<if test="acceptMessageApiCode != null and acceptMessageApiCode != ''"> and accept_message_api_code = #{acceptMessageApiCode} </if>
<if test="remark != null and remark != ''"> and remark = #{remark} </if>
<if test="status != null and status != ''"> and status = #{status} </if>
<if test="recipientId != null and recipientId != ''"> and recipient_id = #{recipientId} </if>
and sts='Y'
</trim>
</update>
<!--通过主键删除-->
<delete id="entity_delete">
delete from sys_warning_config where id = #{id}
</delete>
</mapper>

View File

@ -0,0 +1,29 @@
package com.hzya.frame.sysnew.warningConfig.service;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.sysnew.warningConfig.entity.SysWarningConfigEntity;
import com.hzya.frame.basedao.service.IBaseService;
import com.hzya.frame.web.entity.JsonResultEntity;
/**
* 预警配置表(SysWarningConfig)表服务接口
*
* @author makejava
* @since 2024-09-03 09:28:23
*/
public interface ISysWarningConfigService extends IBaseService<SysWarningConfigEntity, String>{
JsonResultEntity queryEntityPage(JSONObject jsonObject);
JsonResultEntity queryEntity(JSONObject jsonObject);
JsonResultEntity saveEntity(JSONObject jsonObject);
JsonResultEntity getEntity(JSONObject jsonObject);
JsonResultEntity updateEntity(JSONObject jsonObject);
JsonResultEntity deleteEntity(JSONObject jsonObject);
JsonResultEntity enableDisableEntity(JSONObject jsonObject);
}

View File

@ -0,0 +1,167 @@
package com.hzya.frame.sysnew.warningConfig.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hzya.frame.sysnew.warningConfig.entity.SysWarningConfigEntity;
import com.hzya.frame.sysnew.warningConfig.dao.ISysWarningConfigDao;
import com.hzya.frame.sysnew.warningConfig.service.ISysWarningConfigService;
import com.hzya.frame.web.entity.BaseResult;
import com.hzya.frame.web.entity.JsonResultEntity;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import javax.annotation.Resource;
import com.hzya.frame.basedao.service.impl.BaseService;
import java.util.List;
/**
* 预警配置表(SysWarningConfig)表服务实现类
*
* @author makejava
* @since 2024-09-03 09:28:23
*/
@Service(value = "sysWarningConfigService")
public class SysWarningConfigServiceImpl extends BaseService<SysWarningConfigEntity, String> implements ISysWarningConfigService {
private ISysWarningConfigDao sysWarningConfigDao;
@Autowired
public void setSysWarningConfigDao(ISysWarningConfigDao dao) {
this.sysWarningConfigDao = dao;
this.dao = dao;
}
@Override
public JsonResultEntity queryEntityPage(JSONObject jsonObject){
SysWarningConfigEntity entity = getData("jsonStr", jsonObject, SysWarningConfigEntity.class);
if(entity == null || entity.getPageSize() == null || entity.getPageNum() == null){
return BaseResult.getFailureMessageEntity("分页查询参数不存在");
}
PageHelper.startPage(entity.getPageNum(), entity.getPageSize());
List<SysWarningConfigEntity> list = sysWarningConfigDao.queryByLike(entity);
PageInfo pageInfo = new PageInfo(list);
return BaseResult.getSuccessMessageEntity("查询数据成功",pageInfo);
}
@Override
public JsonResultEntity queryEntity(JSONObject jsonObject){
SysWarningConfigEntity entity = getData("jsonStr", jsonObject, SysWarningConfigEntity.class);
if(entity == null){
entity = new SysWarningConfigEntity();
}
List<SysWarningConfigEntity> list = sysWarningConfigDao.queryByLike(entity);
return BaseResult.getSuccessMessageEntity("查询数据成功",list);
}
@Override
public JsonResultEntity getEntity(JSONObject jsonObject){
SysWarningConfigEntity entity = getData("jsonStr", jsonObject, SysWarningConfigEntity.class);
if(entity == null){
return BaseResult.getFailureMessageEntity("参数不允许为空");
}
if(entity.getId() == null || "".equals(entity.getId())){
return BaseResult.getFailureMessageEntity("系统错误");
}
entity = sysWarningConfigDao.get(entity.getId());
if(entity == null){
return BaseResult.getFailureMessageEntity("获取预警配置失败");
}
return BaseResult.getSuccessMessageEntity("获取预警配置成功",entity);
}
@Override
public JsonResultEntity saveEntity(JSONObject jsonObject){
SysWarningConfigEntity entity = getData("jsonStr", jsonObject, SysWarningConfigEntity.class);
if(entity == null){
return BaseResult.getFailureMessageEntity("参数不允许为空");
}
if(entity.getMessageTemplateId() == null || "".equals(entity.getMessageTemplateId())){
return BaseResult.getFailureMessageEntity("消息模版不允许为空");
}
if(entity.getAppId() == null || "".equals(entity.getAppId())){
return BaseResult.getFailureMessageEntity("应用ID不允许为空");
}
if(entity.getWarningAppId() == null || "".equals(entity.getWarningAppId())){
return BaseResult.getFailureMessageEntity("预警应用类型不允许为空");
}
if(entity.getStatus() == null || "".equals(entity.getStatus())){
return BaseResult.getFailureMessageEntity("状态不允许为空");
}
if(entity.getRecipientId() == null || "".equals(entity.getRecipientId())){
return BaseResult.getFailureMessageEntity("接收者ID不允许为空");
}
entity.setCreate();
sysWarningConfigDao.save(entity);
return BaseResult.getSuccessMessageEntity("保存预警配置成功",entity);
}
@Override
public JsonResultEntity updateEntity(JSONObject jsonObject){
SysWarningConfigEntity entity = getData("jsonStr", jsonObject, SysWarningConfigEntity.class);
if (entity == null) {
return BaseResult.getFailureMessageEntity("参数不允许为空");
}
if (entity.getId() == null || "".equals(entity.getId())) {
return BaseResult.getFailureMessageEntity("系统错误");
}
if(entity.getMessageTemplateId() == null || "".equals(entity.getMessageTemplateId())){
return BaseResult.getFailureMessageEntity("消息模版不允许为空");
}
if(entity.getAppId() == null || "".equals(entity.getAppId())){
return BaseResult.getFailureMessageEntity("应用ID不允许为空");
}
if(entity.getWarningAppId() == null || "".equals(entity.getWarningAppId())){
return BaseResult.getFailureMessageEntity("预警应用类型不允许为空");
}
if(entity.getStatus() == null || "".equals(entity.getStatus())){
return BaseResult.getFailureMessageEntity("状态不允许为空");
}
if(entity.getRecipientId() == null || "".equals(entity.getRecipientId())){
return BaseResult.getFailureMessageEntity("接收者ID不允许为空");
}
entity.setUpdate();
sysWarningConfigDao.update(entity);
return BaseResult.getSuccessMessageEntity("修改预警配置成功",entity);
}
@Override
public JsonResultEntity deleteEntity(JSONObject jsonObject) {
SysWarningConfigEntity entity = getData("jsonStr", jsonObject, SysWarningConfigEntity.class);
if (entity == null) {
return BaseResult.getFailureMessageEntity("参数不允许为空");
}
if (entity.getId() == null || "".equals(entity.getId())) {
return BaseResult.getFailureMessageEntity("系统错误");
}
entity.setUpdate();
sysWarningConfigDao.logicRemove(entity);
return BaseResult.getSuccessMessageEntity("删除预警配置成功");
}
@Override
public JsonResultEntity enableDisableEntity(JSONObject jsonObject){
SysWarningConfigEntity entity = getData("jsonStr", jsonObject, SysWarningConfigEntity.class);
if (entity == null) {
return BaseResult.getFailureMessageEntity("参数不允许为空");
}
if (entity.getId() == null || "".equals(entity.getId())) {
return BaseResult.getFailureMessageEntity("系统错误");
}
if (entity.getStatus() == null || "".equals(entity.getStatus())) {
return BaseResult.getFailureMessageEntity("系统错误");
}
//0启用1禁用
if("0".equals(entity.getStatus())){
entity.setUpdate();
sysWarningConfigDao.update(entity);
return BaseResult.getSuccessMessageEntity("启用模版成功");
}else{
//停用消息模版
entity.setUpdate();
sysWarningConfigDao.update(entity);
return BaseResult.getSuccessMessageEntity("停用模版成功");
}
}
}

View File

@ -0,0 +1,15 @@
package com.hzya.frame.sysnew.warningInterface.dao;
import com.hzya.frame.sysnew.warningInterface.entity.SysWarningInterfaceEntity;
import com.hzya.frame.basedao.dao.IBaseDao;
/**
* 预警接口表(sys_warning_interface: table)表数据库访问层
*
* @author makejava
* @since 2024-09-03 10:06:18
*/
public interface ISysWarningInterfaceDao extends IBaseDao<SysWarningInterfaceEntity, String> {
}

View File

@ -0,0 +1,17 @@
package com.hzya.frame.sysnew.warningInterface.dao.impl;
import com.hzya.frame.sysnew.warningInterface.entity.SysWarningInterfaceEntity;
import com.hzya.frame.sysnew.warningInterface.dao.ISysWarningInterfaceDao;
import org.springframework.stereotype.Repository;
import com.hzya.frame.basedao.dao.MybatisGenericDao;
/**
* 预警接口表(SysWarningInterface)表数据库访问层
*
* @author makejava
* @since 2024-09-03 10:06:19
*/
@Repository(value = "SysWarningInterfaceDaoImpl")
public class SysWarningInterfaceDaoImpl extends MybatisGenericDao<SysWarningInterfaceEntity, String> implements ISysWarningInterfaceDao{
}

View File

@ -0,0 +1,76 @@
package com.hzya.frame.sysnew.warningInterface.entity;
import java.util.Date;
import com.hzya.frame.web.entity.BaseEntity;
/**
* 预警接口表(SysWarningInterface)实体类
*
* @author makejava
* @since 2024-09-03 10:06:19
*/
public class SysWarningInterfaceEntity extends BaseEntity {
/** 公司id */
private String companyId;
/** api名称 */
private String apiName;
/** api编码 */
private String apiCode;
/** 推送方式1推送一次、2定时 */
private String pushMethod;
/** 状态0停用、1启用 */
private String status;
/** 主表id预警配置表id */
private String warningConfigId;
public String getCompanyId() {
return companyId;
}
public void setCompanyId(String companyId) {
this.companyId = companyId;
}
public String getApiName() {
return apiName;
}
public void setApiName(String apiName) {
this.apiName = apiName;
}
public String getApiCode() {
return apiCode;
}
public void setApiCode(String apiCode) {
this.apiCode = apiCode;
}
public String getPushMethod() {
return pushMethod;
}
public void setPushMethod(String pushMethod) {
this.pushMethod = pushMethod;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getWarningConfigId() {
return warningConfigId;
}
public void setWarningConfigId(String warningConfigId) {
this.warningConfigId = warningConfigId;
}
}

View File

@ -0,0 +1,254 @@
<?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">
<mapper namespace="com.hzya.frame.sysnew.warningInterface.dao.impl.SysWarningInterfaceDaoImpl">
<resultMap id="get-SysWarningInterfaceEntity-result" type="com.hzya.frame.sysnew.warningInterface.entity.SysWarningInterfaceEntity" >
<result property="id" column="id" jdbcType="VARCHAR"/>
<result property="sorts" column="sorts" jdbcType="INTEGER"/>
<result property="create_user_id" column="create_user_id" jdbcType="VARCHAR"/>
<result property="create_time" column="create_time" jdbcType="TIMESTAMP"/>
<result property="modify_user_id" column="modify_user_id" jdbcType="VARCHAR"/>
<result property="modify_time" column="modify_time" jdbcType="TIMESTAMP"/>
<result property="sts" column="sts" jdbcType="VARCHAR"/>
<result property="org_id" column="org_id" jdbcType="VARCHAR"/>
<result property="companyId" column="company_id" jdbcType="VARCHAR"/>
<result property="apiName" column="api_name" jdbcType="VARCHAR"/>
<result property="apiCode" column="api_code" jdbcType="VARCHAR"/>
<result property="pushMethod" column="push_method" jdbcType="VARCHAR"/>
<result property="status" column="status" jdbcType="VARCHAR"/>
<result property="warningConfigId" column="warning_config_id" jdbcType="VARCHAR"/>
</resultMap>
<!-- 查询的字段-->
<sql id = "SysWarningInterfaceEntity_Base_Column_List">
id
,sorts
,create_user_id
,create_time
,modify_user_id
,modify_time
,sts
,org_id
,company_id
,api_name
,api_code
,push_method
,status
,warning_config_id
</sql>
<!-- 查询 采用==查询 -->
<select id="entity_list_base" resultMap="get-SysWarningInterfaceEntity-result" parameterType = "com.hzya.frame.sysnew.warningInterface.entity.SysWarningInterfaceEntity">
select
<include refid="SysWarningInterfaceEntity_Base_Column_List" />
from sys_warning_interface
<trim prefix="where" prefixOverrides="and">
<if test="id != null and id != ''"> and id = #{id} </if>
<if test="sorts != null"> and sorts = #{sorts} </if>
<if test="create_user_id != null and create_user_id != ''"> and create_user_id = #{create_user_id} </if>
<if test="create_time != null"> and create_time = #{create_time} </if>
<if test="modify_user_id != null and modify_user_id != ''"> and modify_user_id = #{modify_user_id} </if>
<if test="modify_time != null"> and modify_time = #{modify_time} </if>
<if test="sts != null and sts != ''"> and sts = #{sts} </if>
<if test="org_id != null and org_id != ''"> and org_id = #{org_id} </if>
<if test="companyId != null and companyId != ''"> and company_id = #{companyId} </if>
<if test="apiName != null and apiName != ''"> and api_name = #{apiName} </if>
<if test="apiCode != null and apiCode != ''"> and api_code = #{apiCode} </if>
<if test="pushMethod != null and pushMethod != ''"> and push_method = #{pushMethod} </if>
<if test="status != null and status != ''"> and status = #{status} </if>
<if test="warningConfigId != null and warningConfigId != ''"> and warning_config_id = #{warningConfigId} </if>
and sts='Y'
</trim>
<if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
<if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
</select>
<!-- 查询符合条件的数量 -->
<select id="entity_count" resultType="Integer" parameterType = "com.hzya.frame.sysnew.warningInterface.entity.SysWarningInterfaceEntity">
select count(1) from sys_warning_interface
<trim prefix="where" prefixOverrides="and">
<if test="id != null and id != ''"> and id = #{id} </if>
<if test="sorts != null"> and sorts = #{sorts} </if>
<if test="create_user_id != null and create_user_id != ''"> and create_user_id = #{create_user_id} </if>
<if test="create_time != null"> and create_time = #{create_time} </if>
<if test="modify_user_id != null and modify_user_id != ''"> and modify_user_id = #{modify_user_id} </if>
<if test="modify_time != null"> and modify_time = #{modify_time} </if>
<if test="sts != null and sts != ''"> and sts = #{sts} </if>
<if test="org_id != null and org_id != ''"> and org_id = #{org_id} </if>
<if test="companyId != null and companyId != ''"> and company_id = #{companyId} </if>
<if test="apiName != null and apiName != ''"> and api_name = #{apiName} </if>
<if test="apiCode != null and apiCode != ''"> and api_code = #{apiCode} </if>
<if test="pushMethod != null and pushMethod != ''"> and push_method = #{pushMethod} </if>
<if test="status != null and status != ''"> and status = #{status} </if>
<if test="warningConfigId != null and warningConfigId != ''"> and warning_config_id = #{warningConfigId} </if>
and sts='Y'
</trim>
<if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
<if test=" sort !='' and sort!=null and order !='' and order!=null "> order by ${sort} ${order}</if>
</select>
<!-- 分页查询列表 采用like格式 -->
<select id="entity_list_like" resultMap="get-SysWarningInterfaceEntity-result" parameterType = "com.hzya.frame.sysnew.warningInterface.entity.SysWarningInterfaceEntity">
select
<include refid="SysWarningInterfaceEntity_Base_Column_List" />
from sys_warning_interface
<trim prefix="where" prefixOverrides="and">
<if test="id != null and id != ''"> and id like concat('%',#{id},'%') </if>
<if test="sorts != null"> and sorts like concat('%',#{sorts},'%') </if>
<if test="create_user_id != null and create_user_id != ''"> and create_user_id like concat('%',#{create_user_id},'%') </if>
<if test="create_time != null"> and create_time like concat('%',#{create_time},'%') </if>
<if test="modify_user_id != null and modify_user_id != ''"> and modify_user_id like concat('%',#{modify_user_id},'%') </if>
<if test="modify_time != null"> and modify_time like concat('%',#{modify_time},'%') </if>
<if test="sts != null and sts != ''"> and sts like concat('%',#{sts},'%') </if>
<if test="org_id != null and org_id != ''"> and org_id like concat('%',#{org_id},'%') </if>
<if test="companyId != null and companyId != ''"> and company_id like concat('%',#{companyId},'%') </if>
<if test="apiName != null and apiName != ''"> and api_name like concat('%',#{apiName},'%') </if>
<if test="apiCode != null and apiCode != ''"> and api_code like concat('%',#{apiCode},'%') </if>
<if test="pushMethod != null and pushMethod != ''"> and push_method like concat('%',#{pushMethod},'%') </if>
<if test="status != null and status != ''"> and status like concat('%',#{status},'%') </if>
<if test="warningConfigId != null and warningConfigId != ''"> and warning_config_id like concat('%',#{warningConfigId},'%') </if>
and sts='Y'
</trim>
<if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
<if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
</select>
<!-- 查询列表 字段采用or格式 -->
<select id="SysWarningInterfaceentity_list_or" resultMap="get-SysWarningInterfaceEntity-result" parameterType = "com.hzya.frame.sysnew.warningInterface.entity.SysWarningInterfaceEntity">
select
<include refid="SysWarningInterfaceEntity_Base_Column_List" />
from sys_warning_interface
<trim prefix="where" prefixOverrides="and">
<if test="id != null and id != ''"> or id = #{id} </if>
<if test="sorts != null"> or sorts = #{sorts} </if>
<if test="create_user_id != null and create_user_id != ''"> or create_user_id = #{create_user_id} </if>
<if test="create_time != null"> or create_time = #{create_time} </if>
<if test="modify_user_id != null and modify_user_id != ''"> or modify_user_id = #{modify_user_id} </if>
<if test="modify_time != null"> or modify_time = #{modify_time} </if>
<if test="sts != null and sts != ''"> or sts = #{sts} </if>
<if test="org_id != null and org_id != ''"> or org_id = #{org_id} </if>
<if test="companyId != null and companyId != ''"> or company_id = #{companyId} </if>
<if test="apiName != null and apiName != ''"> or api_name = #{apiName} </if>
<if test="apiCode != null and apiCode != ''"> or api_code = #{apiCode} </if>
<if test="pushMethod != null and pushMethod != ''"> or push_method = #{pushMethod} </if>
<if test="status != null and status != ''"> or status = #{status} </if>
<if test="warningConfigId != null and warningConfigId != ''"> or warning_config_id = #{warningConfigId} </if>
and sts='Y'
</trim>
<if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
<if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
</select>
<!--新增所有列-->
<insert id="entity_insert" parameterType = "com.hzya.frame.sysnew.warningInterface.entity.SysWarningInterfaceEntity" keyProperty="id" useGeneratedKeys="true">
insert into sys_warning_interface(
<trim suffix="" suffixOverrides=",">
<if test="id != null and id != ''"> id , </if>
<if test="sorts != null"> sorts , </if>
<if test="create_user_id != null and create_user_id != ''"> create_user_id , </if>
<if test="create_time != null"> create_time , </if>
<if test="modify_user_id != null and modify_user_id != ''"> modify_user_id , </if>
<if test="modify_time != null"> modify_time , </if>
<if test="sts != null and sts != ''"> sts , </if>
<if test="org_id != null and org_id != ''"> org_id , </if>
<if test="companyId != null and companyId != ''"> company_id , </if>
<if test="apiName != null and apiName != ''"> api_name , </if>
<if test="apiCode != null and apiCode != ''"> api_code , </if>
<if test="pushMethod != null and pushMethod != ''"> push_method , </if>
<if test="status != null and status != ''"> status , </if>
<if test="warningConfigId != null and warningConfigId != ''"> warning_config_id , </if>
<if test="sts == null ">sts,</if>
</trim>
)values(
<trim suffix="" suffixOverrides=",">
<if test="id != null and id != ''"> #{id} ,</if>
<if test="sorts != null"> #{sorts} ,</if>
<if test="create_user_id != null and create_user_id != ''"> #{create_user_id} ,</if>
<if test="create_time != null"> #{create_time} ,</if>
<if test="modify_user_id != null and modify_user_id != ''"> #{modify_user_id} ,</if>
<if test="modify_time != null"> #{modify_time} ,</if>
<if test="sts != null and sts != ''"> #{sts} ,</if>
<if test="org_id != null and org_id != ''"> #{org_id} ,</if>
<if test="companyId != null and companyId != ''"> #{companyId} ,</if>
<if test="apiName != null and apiName != ''"> #{apiName} ,</if>
<if test="apiCode != null and apiCode != ''"> #{apiCode} ,</if>
<if test="pushMethod != null and pushMethod != ''"> #{pushMethod} ,</if>
<if test="status != null and status != ''"> #{status} ,</if>
<if test="warningConfigId != null and warningConfigId != ''"> #{warningConfigId} ,</if>
<if test="sts == null ">'Y',</if>
</trim>
)
</insert>
<!-- 批量新增 -->
<insert id="entityInsertBatch" keyProperty="id" useGeneratedKeys="true">
insert into sys_warning_interface(create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id, api_name, api_code, push_method, status, warning_config_id, sts)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId},#{entity.apiName},#{entity.apiCode},#{entity.pushMethod},#{entity.status},#{entity.warningConfigId}, 'Y')
</foreach>
</insert>
<!-- 批量新增或者修改-->
<insert id="entityInsertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
insert into sys_warning_interface(create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id, api_name, api_code, push_method, status, warning_config_id)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId},#{entity.apiName},#{entity.apiCode},#{entity.pushMethod},#{entity.status},#{entity.warningConfigId})
</foreach>
on duplicate key update
create_user_id = values(create_user_id),
create_time = values(create_time),
modify_user_id = values(modify_user_id),
modify_time = values(modify_time),
sts = values(sts),
org_id = values(org_id),
company_id = values(company_id),
api_name = values(api_name),
api_code = values(api_code),
push_method = values(push_method),
status = values(status),
warning_config_id = values(warning_config_id)</insert>
<!--通过主键修改方法-->
<update id="entity_update" parameterType = "com.hzya.frame.sysnew.warningInterface.entity.SysWarningInterfaceEntity" >
update sys_warning_interface set
<trim suffix="" suffixOverrides=",">
<if test="create_user_id != null and create_user_id != ''"> create_user_id = #{create_user_id},</if>
<if test="create_time != null"> create_time = #{create_time},</if>
<if test="modify_user_id != null and modify_user_id != ''"> modify_user_id = #{modify_user_id},</if>
<if test="modify_time != null"> modify_time = #{modify_time},</if>
<if test="sts != null and sts != ''"> sts = #{sts},</if>
<if test="org_id != null and org_id != ''"> org_id = #{org_id},</if>
<if test="companyId != null and companyId != ''"> company_id = #{companyId},</if>
<if test="apiName != null and apiName != ''"> api_name = #{apiName},</if>
<if test="apiCode != null and apiCode != ''"> api_code = #{apiCode},</if>
<if test="pushMethod != null and pushMethod != ''"> push_method = #{pushMethod},</if>
<if test="status != null and status != ''"> status = #{status},</if>
<if test="warningConfigId != null and warningConfigId != ''"> warning_config_id = #{warningConfigId},</if>
</trim>
where id = #{id}
</update>
<!-- 逻辑删除 -->
<update id="entity_logicDelete" parameterType = "com.hzya.frame.sysnew.warningInterface.entity.SysWarningInterfaceEntity" >
update sys_warning_interface set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id}
where id = #{id}
</update>
<!-- 多条件逻辑删除 -->
<update id="entity_logicDelete_Multi_Condition" parameterType = "com.hzya.frame.sysnew.warningInterface.entity.SysWarningInterfaceEntity" >
update sys_warning_interface set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id}
<trim prefix="where" prefixOverrides="and">
<if test="id != null and id != ''"> and id = #{id} </if>
<if test="sorts != null"> and sorts = #{sorts} </if>
<if test="sts != null and sts != ''"> and sts = #{sts} </if>
<if test="companyId != null and companyId != ''"> and company_id = #{companyId} </if>
<if test="apiName != null and apiName != ''"> and api_name = #{apiName} </if>
<if test="apiCode != null and apiCode != ''"> and api_code = #{apiCode} </if>
<if test="pushMethod != null and pushMethod != ''"> and push_method = #{pushMethod} </if>
<if test="status != null and status != ''"> and status = #{status} </if>
<if test="warningConfigId != null and warningConfigId != ''"> and warning_config_id = #{warningConfigId} </if>
and sts='Y'
</trim>
</update>
<!--通过主键删除-->
<delete id="entity_delete">
delete from sys_warning_interface where id = #{id}
</delete>
</mapper>

View File

@ -0,0 +1,29 @@
package com.hzya.frame.sysnew.warningInterface.service;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.sysnew.warningInterface.entity.SysWarningInterfaceEntity;
import com.hzya.frame.basedao.service.IBaseService;
import com.hzya.frame.web.entity.JsonResultEntity;
import org.apache.ibatis.annotations.Select;
/**
* 预警接口表(SysWarningInterface)表服务接口
*
* @author makejava
* @since 2024-09-03 10:06:19
*/
public interface ISysWarningInterfaceService extends IBaseService<SysWarningInterfaceEntity, String>{
JsonResultEntity queryEntityPage(JSONObject jsonObject);
JsonResultEntity queryEntity(JSONObject jsonObject);
JsonResultEntity saveEntity(JSONObject jsonObject);
JsonResultEntity getEntity(JSONObject jsonObject);
JsonResultEntity updateEntity(JSONObject jsonObject);
JsonResultEntity deleteEntity(JSONObject jsonObject);
JsonResultEntity enableDisableEntity(JSONObject jsonObject);
}

View File

@ -0,0 +1,167 @@
package com.hzya.frame.sysnew.warningInterface.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hzya.frame.sysnew.warningConfig.entity.SysWarningConfigEntity;
import com.hzya.frame.sysnew.warningInterface.entity.SysWarningInterfaceEntity;
import com.hzya.frame.sysnew.warningInterface.dao.ISysWarningInterfaceDao;
import com.hzya.frame.sysnew.warningInterface.service.ISysWarningInterfaceService;
import com.hzya.frame.web.entity.BaseResult;
import com.hzya.frame.web.entity.JsonResultEntity;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import javax.annotation.Resource;
import com.hzya.frame.basedao.service.impl.BaseService;
import java.util.List;
/**
* 预警接口表(SysWarningInterface)表服务实现类
*
* @author makejava
* @since 2024-09-03 10:06:19
*/
@Service(value = "sysWarningInterfaceService")
public class SysWarningInterfaceServiceImpl extends BaseService<SysWarningInterfaceEntity, String> implements ISysWarningInterfaceService {
private ISysWarningInterfaceDao sysWarningInterfaceDao;
@Autowired
public void setSysWarningInterfaceDao(ISysWarningInterfaceDao dao) {
this.sysWarningInterfaceDao = dao;
this.dao = dao;
}
@Override
public JsonResultEntity queryEntityPage(JSONObject jsonObject){
SysWarningInterfaceEntity entity = getData("jsonStr", jsonObject, SysWarningInterfaceEntity.class);
if(entity == null || entity.getPageNum() == null || entity.getPageSize() == null){
return BaseResult.getFailureMessageEntity("分页查询参数不存在");
}
PageHelper.startPage(entity.getPageNum(), entity.getPageSize());
List<SysWarningInterfaceEntity> list = sysWarningInterfaceDao.queryByLike(entity);
PageInfo<SysWarningInterfaceEntity> pageInfo = new PageInfo<>(list);
return BaseResult.getSuccessMessageEntity("查询数据成功",pageInfo);
}
@Override
public JsonResultEntity queryEntity(JSONObject jsonObject){
SysWarningInterfaceEntity entity = getData("jsonStr", jsonObject, SysWarningInterfaceEntity.class);
if(entity == null){
entity = new SysWarningInterfaceEntity();
}
List<SysWarningInterfaceEntity> list = sysWarningInterfaceDao.queryByLike(entity);
return BaseResult.getSuccessMessageEntity("查询数据成功",list);
}
@Override
public JsonResultEntity getEntity(JSONObject jsonObject){
SysWarningInterfaceEntity entity = getData("jsonStr", jsonObject, SysWarningInterfaceEntity.class);
if(entity == null){
return BaseResult.getFailureMessageEntity("查询参数不存在");
}
if(entity.getId() == null || "".equals(entity.getId())){
return BaseResult.getFailureMessageEntity("系统错误");
}
entity = sysWarningInterfaceDao.get(entity.getId());
if(entity == null){
return BaseResult.getFailureMessageEntity("获取预警接口失败");
}
return BaseResult.getSuccessMessageEntity("获取预警接口成功",entity);
}
@Override
public JsonResultEntity saveEntity(JSONObject jsonObject){
SysWarningInterfaceEntity entity = getData("jsonStr", jsonObject, SysWarningInterfaceEntity.class);
if(entity == null){
return BaseResult.getFailureMessageEntity("查询参数不存在");
}
if(entity.getId() == null || "".equals(entity.getId())){
return BaseResult.getFailureMessageEntity("系统错误");
}
if(entity.getApiCode() == null || "".equals(entity.getApiCode())){
return BaseResult.getFailureMessageEntity("接口编码不能为空");
}
if(entity.getPushMethod() == null || "".equals(entity.getPushMethod())){
return BaseResult.getFailureMessageEntity("推送方式不能为空");
}
if(entity.getStatus() == null || "".equals(entity.getStatus())){
return BaseResult.getFailureMessageEntity("状态不能为空");
}
if(entity.getWarningConfigId() == null || "".equals(entity.getWarningConfigId())){
return BaseResult.getFailureMessageEntity("预警配置id不能为空");
}
entity.setCreate();
sysWarningInterfaceDao.save(entity);
return BaseResult.getSuccessMessageEntity("保存预警接口成功",entity);
}
@Override
public JsonResultEntity updateEntity(JSONObject jsonObject){
SysWarningInterfaceEntity entity = getData("jsonStr", jsonObject, SysWarningInterfaceEntity.class);
if(entity == null){
return BaseResult.getFailureMessageEntity("查询参数不存在");
}
if(entity.getId() == null || "".equals(entity.getId())){
return BaseResult.getFailureMessageEntity("系统错误");
}
if(entity.getApiCode() == null || "".equals(entity.getApiCode())){
return BaseResult.getFailureMessageEntity("接口编码不能为空");
}
if(entity.getPushMethod() == null || "".equals(entity.getPushMethod())){
return BaseResult.getFailureMessageEntity("推送方式不能为空");
}
if(entity.getStatus() == null || "".equals(entity.getStatus())){
return BaseResult.getFailureMessageEntity("状态不能为空");
}
if(entity.getWarningConfigId() == null || "".equals(entity.getWarningConfigId())){
return BaseResult.getFailureMessageEntity("预警配置id不能为空");
}
entity.setUpdate();
sysWarningInterfaceDao.update(entity);
return BaseResult.getSuccessMessageEntity("修改预警接口成功",entity);
}
@Override
public JsonResultEntity deleteEntity(JSONObject jsonObject){
SysWarningInterfaceEntity entity = getData("jsonStr", jsonObject, SysWarningInterfaceEntity.class);
if(entity == null){
return BaseResult.getFailureMessageEntity("查询参数不存在");
}
if(entity.getId() == null || "".equals(entity.getId())){
return BaseResult.getFailureMessageEntity("系统错误");
}
entity.setUpdate();
sysWarningInterfaceDao.logicRemove(entity);
return BaseResult.getSuccessMessageEntity("删除预警接口成功");
}
@Override
public JsonResultEntity enableDisableEntity(JSONObject jsonObject) {
SysWarningInterfaceEntity entity = getData("jsonStr", jsonObject, SysWarningInterfaceEntity.class);
if (entity == null) {
return BaseResult.getFailureMessageEntity("参数不允许为空");
}
if (entity.getId() == null || "".equals(entity.getId())) {
return BaseResult.getFailureMessageEntity("系统错误");
}
if (entity.getStatus() == null || "".equals(entity.getStatus())) {
return BaseResult.getFailureMessageEntity("系统错误");
}
//0启用1禁用
if("0".equals(entity.getStatus())){
entity.setUpdate();
sysWarningInterfaceDao.update(entity);
return BaseResult.getSuccessMessageEntity("启用模版成功");
}else{
//停用消息模版
entity.setUpdate();
sysWarningInterfaceDao.update(entity);
return BaseResult.getSuccessMessageEntity("停用模版成功");
}
}
}