diff --git a/base-buildpackage/pom.xml b/base-buildpackage/pom.xml
index 41435a19..1a317d04 100644
--- a/base-buildpackage/pom.xml
+++ b/base-buildpackage/pom.xml
@@ -38,6 +38,12 @@
llg
+
+ zqtlocal
+
+ zqtlocal
+
+
diff --git a/base-buildpackage/src/main/java/com/hzya/frame/plugin/pushMessage/plugin/PushMessagePluginInitializer.java b/base-buildpackage/src/main/java/com/hzya/frame/plugin/pushMessage/plugin/PushMessagePluginInitializer.java
index 3e0a996f..3bc07a67 100644
--- a/base-buildpackage/src/main/java/com/hzya/frame/plugin/pushMessage/plugin/PushMessagePluginInitializer.java
+++ b/base-buildpackage/src/main/java/com/hzya/frame/plugin/pushMessage/plugin/PushMessagePluginInitializer.java
@@ -62,6 +62,7 @@ public class PushMessagePluginInitializer extends PluginBaseEntity {
public JsonResultEntity executeBusiness(JSONObject requestJson) {
try {
logger.info("======开始执行定时消息推送========");
+ //目前只查询一周内的异常日志进行消息推送
List list = sysPushMessageDao.getAll();
for(SysPushMessageEntity entity : list){
diff --git a/base-buildpackage/src/main/resources/application-zqtlocal.yml b/base-buildpackage/src/main/resources/application-zqtlocal.yml
index ffff00a3..5aeac683 100644
--- a/base-buildpackage/src/main/resources/application-zqtlocal.yml
+++ b/base-buildpackage/src/main/resources/application-zqtlocal.yml
@@ -36,4 +36,4 @@ cbs8:
OA:
data_source_code: yc_oa
zt:
- url: http://127.0.0.1:9082/kangarooDataCenterV3/entranceController/externalCallInterface
\ No newline at end of file
+ url: http://127.0.0.1:10086/kangarooDataCenterV3/entranceController/externalCallInterface
\ No newline at end of file
diff --git a/base-service/src/main/java/com/hzya/frame/sysnew/application/api/entity/SysApplicationApiEntity.xml b/base-service/src/main/java/com/hzya/frame/sysnew/application/api/entity/SysApplicationApiEntity.xml
index 089b6eb5..f2d0a1dc 100644
--- a/base-service/src/main/java/com/hzya/frame/sysnew/application/api/entity/SysApplicationApiEntity.xml
+++ b/base-service/src/main/java/com/hzya/frame/sysnew/application/api/entity/SysApplicationApiEntity.xml
@@ -42,6 +42,7 @@
+
@@ -156,52 +157,87 @@ WHERE
diff --git a/base-service/src/main/java/com/hzya/frame/sysnew/application/api/service/ISysApplicationApiService.java b/base-service/src/main/java/com/hzya/frame/sysnew/application/api/service/ISysApplicationApiService.java
index 2218bf04..52272f22 100644
--- a/base-service/src/main/java/com/hzya/frame/sysnew/application/api/service/ISysApplicationApiService.java
+++ b/base-service/src/main/java/com/hzya/frame/sysnew/application/api/service/ISysApplicationApiService.java
@@ -24,6 +24,8 @@ public interface ISysApplicationApiService extends IBaseService resultList = new ArrayList<>();
+ for (int i = 0; i < appIdList.length; i++) {
+ entity.setAppId(appIdList[i]);
+ List list = sysApplicationApiDao.queryBase(entity);
+ resultList.addAll(list);
+ }
+ //手动分页
+ int total = resultList.size();
+ int fromIndex = (pageNum - 1) * pageSize;
+ int toIndex = Math.min(fromIndex + pageSize, total);
+ List pageList = resultList.subList(fromIndex, toIndex);
+
+ PageInfo pageInfo = new PageInfo<>(pageList);
+ pageInfo.setTotal(total);
+ pageInfo.setPages((total + pageSize - 1) / pageSize);
+
+ return BaseResult.getSuccessMessageEntity("查询数据成功", pageInfo);
+ }
+
/**
* 模糊查询,联查sys_app
*
diff --git a/base-service/src/main/java/com/hzya/frame/sysnew/application/entity/SysApplicationEntity.java b/base-service/src/main/java/com/hzya/frame/sysnew/application/entity/SysApplicationEntity.java
index 3eb1ff34..3be0953f 100644
--- a/base-service/src/main/java/com/hzya/frame/sysnew/application/entity/SysApplicationEntity.java
+++ b/base-service/src/main/java/com/hzya/frame/sysnew/application/entity/SysApplicationEntity.java
@@ -42,6 +42,16 @@ public class SysApplicationEntity extends BaseEntity {
private String interfaceStatus;
/** 数据源是否启用(1、开启 2、关闭) */
private String dbStatus;
+ /** 新消息数 */
+ private int newMessageCount;
+
+ public int getNewMessageCount() {
+ return newMessageCount;
+ }
+
+ public void setNewMessageCount(int newMessageCount) {
+ this.newMessageCount = newMessageCount;
+ }
/** 系统类型 1、致远OA 2、用友U8C 3、用友BIP */
private String appType;
diff --git a/base-service/src/main/java/com/hzya/frame/sysnew/application/service/impl/SysApplicationServiceImpl.java b/base-service/src/main/java/com/hzya/frame/sysnew/application/service/impl/SysApplicationServiceImpl.java
index b6ad01cd..2a11d6ef 100644
--- a/base-service/src/main/java/com/hzya/frame/sysnew/application/service/impl/SysApplicationServiceImpl.java
+++ b/base-service/src/main/java/com/hzya/frame/sysnew/application/service/impl/SysApplicationServiceImpl.java
@@ -2649,7 +2649,7 @@ public class SysApplicationServiceImpl extends BaseService sendMssage(sysPushMessageEntity));
+ taskExecutor.execute(() -> sendMssage(sysPushMessageEntity));
return sysMessageManageLogEntity;
}
diff --git a/base-service/src/main/java/com/hzya/frame/sysnew/messageManageLog/entity/SysMessageManageLogEntity.xml b/base-service/src/main/java/com/hzya/frame/sysnew/messageManageLog/entity/SysMessageManageLogEntity.xml
index 5c02e0bb..990d106a 100644
--- a/base-service/src/main/java/com/hzya/frame/sysnew/messageManageLog/entity/SysMessageManageLogEntity.xml
+++ b/base-service/src/main/java/com/hzya/frame/sysnew/messageManageLog/entity/SysMessageManageLogEntity.xml
@@ -566,7 +566,8 @@ where id = #{id}
a.status AS status,
a.remark AS remark,
a.create_time AS createTime,
- a.modify_time AS modifyTime
+ a.modify_time AS modifyTime,
+ receiveApi.api_name AS receiveApiName
FROM
@@ -577,6 +578,7 @@ where id = #{id}
LEFT JOIN sys_application sendApp ON a.send_app = sendApp.id AND sendApp.sts = 'Y'
+ LEFT JOIN sys_application_api receiveApi ON a.receive_code = receiveApi.api_code AND receiveApi.sts = 'Y'
AND a.id in
diff --git a/base-service/src/main/java/com/hzya/frame/sysnew/messageTemplate/entity/SysMessageTemplateEntity.java b/base-service/src/main/java/com/hzya/frame/sysnew/messageTemplate/entity/SysMessageTemplateEntity.java
index 5cda5ede..5a1ba2a6 100644
--- a/base-service/src/main/java/com/hzya/frame/sysnew/messageTemplate/entity/SysMessageTemplateEntity.java
+++ b/base-service/src/main/java/com/hzya/frame/sysnew/messageTemplate/entity/SysMessageTemplateEntity.java
@@ -12,8 +12,6 @@ public class SysMessageTemplateEntity extends BaseEntity {
/** 公司id */
private String companyId;
- /** 调用单据类型 */
- private String billKindId;
/** 模版类型 */
private String templateType;
/** 模版名称 */
@@ -26,14 +24,8 @@ public class SysMessageTemplateEntity extends BaseEntity {
private String btns;
/** 数据源 */
private String dataSource;
- /** 创建时间 */
- private Date createDate;
- /** 创建人 */
- private String createPersonId;
- /** 状态 */
+ /** 状态 0:停用 1:启用 */
private String state;
- /** 删除标志 */
- private Integer isdelete;
public String getCompanyId() {
@@ -44,14 +36,6 @@ public class SysMessageTemplateEntity extends BaseEntity {
this.companyId = companyId;
}
- public String getBillKindId() {
- return billKindId;
- }
-
- public void setBillKindId(String billKindId) {
- this.billKindId = billKindId;
- }
-
public String getTemplateType() {
return templateType;
}
@@ -99,23 +83,6 @@ public class SysMessageTemplateEntity extends BaseEntity {
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;
}
@@ -123,14 +90,5 @@ public class SysMessageTemplateEntity extends BaseEntity {
public void setState(String state) {
this.state = state;
}
-
- public Integer getIsdelete() {
- return isdelete;
- }
-
- public void setIsdelete(Integer isdelete) {
- this.isdelete = isdelete;
- }
-
}
diff --git a/base-service/src/main/java/com/hzya/frame/sysnew/messageTemplate/entity/SysMessageTemplateEntity.xml b/base-service/src/main/java/com/hzya/frame/sysnew/messageTemplate/entity/SysMessageTemplateEntity.xml
index 80002b16..e1cf60d5 100644
--- a/base-service/src/main/java/com/hzya/frame/sysnew/messageTemplate/entity/SysMessageTemplateEntity.xml
+++ b/base-service/src/main/java/com/hzya/frame/sysnew/messageTemplate/entity/SysMessageTemplateEntity.xml
@@ -12,17 +12,13 @@
-
-
-
-
@@ -34,18 +30,14 @@
,modify_time
,sts
,org_id
- ,company_id
- ,bill_kind_id
+ ,company_id
,template_type
,template_name
,message_title
,message_contents
,btns
- ,data_source
- ,create_date
- ,create_person_id
- ,state
- ,isdelete
+ ,data_source
+ ,state
@@ -70,17 +62,13 @@
and sts = #{sts}
and org_id = #{org_id}
and company_id = #{companyId}
- and bill_kind_id = #{billKindId}
and template_type = #{templateType}
and template_name = #{templateName}
and message_title = #{messageTitle}
and message_contents = #{messageContents}
and btns = #{btns}
and data_source = #{dataSource}
- and create_date = #{createDate}
- and create_person_id = #{createPersonId}
and state = #{state}
- and isdelete = #{isdelete}
and sts='Y'
order by sorts asc
@@ -100,15 +88,12 @@
and sts = #{sts}
and org_id = #{org_id}
and company_id = #{companyId}
- and bill_kind_id = #{billKindId}
and template_type = #{templateType}
and template_name = #{templateName}
and message_title = #{messageTitle}
and message_contents = #{messageContents}
and btns = #{btns}
and data_source = #{dataSource}
- and create_date = #{createDate}
- and create_person_id = #{createPersonId}
and state = #{state}
and isdelete = #{isdelete}
and sts='Y'
@@ -132,17 +117,13 @@
and sts like concat('%',#{sts},'%')
and org_id like concat('%',#{org_id},'%')
and company_id like concat('%',#{companyId},'%')
- and bill_kind_id like concat('%',#{billKindId},'%')
and template_type like concat('%',#{templateType},'%')
and template_name like concat('%',#{templateName},'%')
and message_title like concat('%',#{messageTitle},'%')
and message_contents like concat('%',#{messageContents},'%')
and btns like concat('%',#{btns},'%')
and data_source like concat('%',#{dataSource},'%')
- and create_date like concat('%',#{createDate},'%')
- and create_person_id like concat('%',#{createPersonId},'%')
and state like concat('%',#{state},'%')
- and isdelete like concat('%',#{isdelete},'%')
and sts='Y'
order by sorts asc
@@ -164,15 +145,12 @@
or sts = #{sts}
or org_id = #{org_id}
or company_id = #{companyId}
- or bill_kind_id = #{billKindId}
or template_type = #{templateType}
or template_name = #{templateName}
or message_title = #{messageTitle}
or message_contents = #{messageContents}
or btns = #{btns}
or data_source = #{dataSource}
- or create_date = #{createDate}
- or create_person_id = #{createPersonId}
or state = #{state}
or isdelete = #{isdelete}
and sts='Y'
@@ -194,17 +172,13 @@
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(
@@ -218,17 +192,13 @@
#{sts} ,
#{org_id} ,
#{companyId} ,
- #{billKindId} ,
#{templateType} ,
#{templateName} ,
#{messageTitle} ,
#{messageContents} ,
#{btns} ,
#{dataSource} ,
- #{createDate} ,
- #{createPersonId} ,
#{state} ,
- #{isdelete} ,
'Y',
)
@@ -278,17 +248,13 @@ update sys_message_template set
sts = #{sts},
org_id = #{org_id},
company_id = #{companyId},
- bill_kind_id = #{billKindId},
template_type = #{templateType},
template_name = #{templateName},
message_title = #{messageTitle},
message_contents = #{messageContents},
btns = #{btns},
data_source = #{dataSource},
- create_date = #{createDate},
- create_person_id = #{createPersonId},
state = #{state},
- isdelete = #{isdelete},
where id = #{id}
diff --git a/base-service/src/main/java/com/hzya/frame/sysnew/messageTemplate/service/impl/SysMessageTemplateServiceImpl.java b/base-service/src/main/java/com/hzya/frame/sysnew/messageTemplate/service/impl/SysMessageTemplateServiceImpl.java
index 7f4db12a..6930fd2c 100644
--- a/base-service/src/main/java/com/hzya/frame/sysnew/messageTemplate/service/impl/SysMessageTemplateServiceImpl.java
+++ b/base-service/src/main/java/com/hzya/frame/sysnew/messageTemplate/service/impl/SysMessageTemplateServiceImpl.java
@@ -9,11 +9,15 @@ 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.sysnew.warningConfig.dao.ISysWarningConfigDao;
+import com.hzya.frame.sysnew.warningConfig.entity.SysWarningConfigEntity;
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.*;
@@ -28,178 +32,178 @@ import java.util.List;
*/
@Service(value = "sysMessageTemplateService")
public class SysMessageTemplateServiceImpl extends BaseService implements ISysMessageTemplateService {
-
+
private ISysMessageTemplateDao sysMessageTemplateDao;
- @Resource
- public IExecSqlService execSqlService;
-
+ @Resource
+ private ISysWarningConfigDao sysWarningConfigDao;
+
+ @Resource
+ public IExecSqlService execSqlService;
+
@Autowired
- public void setSysMessageTemplateDao(ISysMessageTemplateDao dao) {
- this.sysMessageTemplateDao = dao;
- this.dao = dao;
- }
+ 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 list = sysMessageTemplateDao.queryByLike(entity);
- PageInfo pageInfo = new PageInfo(list);
- return BaseResult.getSuccessMessageEntity("查询数据成功", pageInfo);
- }
+ @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 list = sysMessageTemplateDao.queryByLike(entity);
+ PageInfo 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 list = sysMessageTemplateDao.queryByLike(entity);
- return BaseResult.getSuccessMessageEntity("查询数据成功", list);
- }
+ @Override
+ public JsonResultEntity queryEntity(JSONObject jsonObject) {
+ SysMessageTemplateEntity entity = getData("jsonStr", jsonObject, SysMessageTemplateEntity.class);
+ if (entity == null) {
+ entity = new SysMessageTemplateEntity();
+ }
+ List 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 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 saveEntity(JSONObject jsonObject) {
+ SysMessageTemplateEntity entity = getData("jsonStr", jsonObject, SysMessageTemplateEntity.class);
+ if (entity == null) {
+ 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("数据源不允许为空");
+ }
+ 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 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.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("数据源不允许为空");
+ }
+ 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 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("系统错误");
+ }
+ //判断这个模版有没有被使用过,使用过就不能删除
+ //将模版id去,预警配置表里查一下,如果有匹配的数据,代表有人正在使用,不能删除
+ SysWarningConfigEntity warningConfigEntity = new SysWarningConfigEntity();
+ warningConfigEntity.setMessageTemplateId(entity.getId());
+ int count = sysWarningConfigDao.getCount(warningConfigEntity);
+ if (count > 0) {
+ return BaseResult.getFailureMessageEntity("该模版已被使用,不能删除");
+ }
+ entity.setUpdate();
+ 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 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);
+ //同步停用到预警配置表
+ SysWarningConfigEntity warningConfigEntity = new SysWarningConfigEntity();
+ warningConfigEntity.setMessageTemplateId(entity.getId());
+ warningConfigEntity.setStatus("1");
+ List warningConfigList = sysWarningConfigDao.queryByLike(warningConfigEntity);
+ for (SysWarningConfigEntity warningConfig : warningConfigList) {
+ warningConfig.setStatus("0");
+ warningConfig.setUpdate();
+ sysWarningConfigDao.update(warningConfig);
+ }
+ 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> result = execSqlService.execSelectSql(sql, "master");
- return BaseResult.getSuccessMessageEntity("SQL检查成功", result);
- } catch (Exception e) {
- return BaseResult.getFailureMessageEntity("SQL检查失败,原因:" + e.getMessage());
- }
- }
+ @Override
+ public JsonResultEntity checkSql(JSONObject jsonObject) throws Exception {
+ try {
+ String sql = JSONObject.parseObject(jsonObject.getString("jsonStr")).getString("sql");
+ List> 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("消息拼接成功");
- }
+ @Override
+ public JsonResultEntity spliceMessage(JSONObject jsonObject) {
+ return BaseResult.getSuccessMessageEntity("消息拼接成功");
+ }
}
diff --git a/base-service/src/main/java/com/hzya/frame/sysnew/pushMessage/entity/SysPushMessageEntity.java b/base-service/src/main/java/com/hzya/frame/sysnew/pushMessage/entity/SysPushMessageEntity.java
index 94eeb61f..9f5ba071 100644
--- a/base-service/src/main/java/com/hzya/frame/sysnew/pushMessage/entity/SysPushMessageEntity.java
+++ b/base-service/src/main/java/com/hzya/frame/sysnew/pushMessage/entity/SysPushMessageEntity.java
@@ -9,8 +9,6 @@ public class SysPushMessageEntity extends BaseEntity {
private Long warningAppCode;
/** 预警接口编码 */
private Long warningApiCode;
- /** 接收者ID列表*/
- private String recipientIdList;
/** 预警应用类型 */
private String warningAppType;
/** 发送应用名称 */
@@ -59,14 +57,6 @@ public class SysPushMessageEntity extends BaseEntity {
this.receiveApiCode = receiveApiCode;
}
- public String getRecipientIdList() {
- return recipientIdList;
- }
-
- public void setRecipientIdList(String recipientIdList) {
- this.recipientIdList = recipientIdList;
- }
-
public String getWarningAppType() {
return warningAppType;
}
diff --git a/base-service/src/main/java/com/hzya/frame/sysnew/pushMessage/entity/SysPushMessageEntity.xml b/base-service/src/main/java/com/hzya/frame/sysnew/pushMessage/entity/SysPushMessageEntity.xml
index 0916a33a..547ed5e9 100644
--- a/base-service/src/main/java/com/hzya/frame/sysnew/pushMessage/entity/SysPushMessageEntity.xml
+++ b/base-service/src/main/java/com/hzya/frame/sysnew/pushMessage/entity/SysPushMessageEntity.xml
@@ -7,7 +7,6 @@
-
@@ -23,19 +22,20 @@
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
+ log.STATUS,
+ log.create_time
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
+ 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 = '定时'
+ AND warning_config.push_method = '定时'
+ AND log.create_time > DATE_SUB( CURDATE( ), INTERVAL 1 WEEK )
diff --git a/base-service/src/main/java/com/hzya/frame/sysnew/pushMessage/service/impl/SysPushMessageServiceImpl.java b/base-service/src/main/java/com/hzya/frame/sysnew/pushMessage/service/impl/SysPushMessageServiceImpl.java
index 28a7028d..c3200814 100644
--- a/base-service/src/main/java/com/hzya/frame/sysnew/pushMessage/service/impl/SysPushMessageServiceImpl.java
+++ b/base-service/src/main/java/com/hzya/frame/sysnew/pushMessage/service/impl/SysPushMessageServiceImpl.java
@@ -30,4 +30,5 @@ public class SysPushMessageServiceImpl extends BaseService list = sysPushMessageDao.getAll();
return BaseResult.getSuccessMessageEntity("success");
}
+
}
diff --git a/base-service/src/main/java/com/hzya/frame/sysnew/sendMessageLog/entity/SysSendMessageLogEntity.java b/base-service/src/main/java/com/hzya/frame/sysnew/sendMessageLog/entity/SysSendMessageLogEntity.java
index 6e88baf2..b425872e 100644
--- a/base-service/src/main/java/com/hzya/frame/sysnew/sendMessageLog/entity/SysSendMessageLogEntity.java
+++ b/base-service/src/main/java/com/hzya/frame/sysnew/sendMessageLog/entity/SysSendMessageLogEntity.java
@@ -9,17 +9,20 @@ import com.hzya.frame.web.entity.BaseEntity;
* @since 2024-08-30 14:19:30
*/
public class SysSendMessageLogEntity extends BaseEntity {
-
+
+
+ //接收人姓名
+ private String recipientsPersonName;
+ //发送人姓名
+ private String sendPersonName;
/** 公司id */
private String companyId;
- /** 来源业务单据 */
- private String billId;
/** 消息类型(1、系统消息、2、单据消息、3、钉钉、4微信、5短信、6、邮件) */
private String type;
/** 发送给谁(三方系统userID 钉钉微信、邮箱、手机号) */
- private String sendToUserId;
+ private String recipientsPersonId;
/** 发送给系统内部人员ID */
- private String sendToPersonId;
+ private String recipientsInteriorId;
/** 消息内容 */
private String sendCount;
/** 发送时间 */
@@ -32,7 +35,72 @@ public class SysSendMessageLogEntity extends BaseEntity {
private Integer state;
/** 三方系统消息结果 */
private String resultMessage;
+ /** 预警接口表id */
+ private String warningInterfaceId;
+ /** 应用id */
+ private String appId;
+ /** 应用名称 */
+ private String appName;
+ /** 消息标题 */
+ private String messageTitle;
+ /** 按钮 */
+ private String btns;
+ public String getAppName() {
+ return appName;
+ }
+
+ public void setAppName(String appName) {
+ this.appName = appName;
+ }
+
+ public String getMessageTitle() {
+ return messageTitle;
+ }
+
+ public void setMessageTitle(String messageTitle) {
+ this.messageTitle = messageTitle;
+ }
+
+ public String getBtns() {
+ return btns;
+ }
+
+ public void setBtns(String btns) {
+ this.btns = btns;
+ }
+
+ public String getAppId() {
+ return appId;
+ }
+
+ public void setAppId(String appId) {
+ this.appId = appId;
+ }
+
+ public String getWarningInterfaceId() {
+ return warningInterfaceId;
+ }
+
+ public void setWarningInterfaceId(String warningInterfaceId) {
+ this.warningInterfaceId = warningInterfaceId;
+ }
+
+ public String getRecipientsPersonName() {
+ return recipientsPersonName;
+ }
+
+ public void setRecipientsPersonName(String recipientsPersonName) {
+ this.recipientsPersonName = recipientsPersonName;
+ }
+
+ public String getSendPersonName() {
+ return sendPersonName;
+ }
+
+ public void setSendPersonName(String sendPersonName) {
+ this.sendPersonName = sendPersonName;
+ }
public String getCompanyId() {
return companyId;
@@ -42,14 +110,6 @@ public class SysSendMessageLogEntity extends BaseEntity {
this.companyId = companyId;
}
- public String getBillId() {
- return billId;
- }
-
- public void setBillId(String billId) {
- this.billId = billId;
- }
-
public String getType() {
return type;
}
@@ -58,20 +118,20 @@ public class SysSendMessageLogEntity extends BaseEntity {
this.type = type;
}
- public String getSendToUserId() {
- return sendToUserId;
+ public String getRecipientsPersonId() {
+ return recipientsPersonId;
}
- public void setSendToUserId(String sendToUserId) {
- this.sendToUserId = sendToUserId;
+ public void setRecipientsPersonId(String recipientsPersonId) {
+ this.recipientsPersonId = recipientsPersonId;
}
- public String getSendToPersonId() {
- return sendToPersonId;
+ public String getRecipientsInteriorId() {
+ return recipientsInteriorId;
}
- public void setSendToPersonId(String sendToPersonId) {
- this.sendToPersonId = sendToPersonId;
+ public void setRecipientsInteriorId(String recipientsInteriorId) {
+ this.recipientsInteriorId = recipientsInteriorId;
}
public String getSendCount() {
diff --git a/base-service/src/main/java/com/hzya/frame/sysnew/sendMessageLog/entity/SysSendMessageLogEntity.xml b/base-service/src/main/java/com/hzya/frame/sysnew/sendMessageLog/entity/SysSendMessageLogEntity.xml
index 144a67e7..b0e9b621 100644
--- a/base-service/src/main/java/com/hzya/frame/sysnew/sendMessageLog/entity/SysSendMessageLogEntity.xml
+++ b/base-service/src/main/java/com/hzya/frame/sysnew/sendMessageLog/entity/SysSendMessageLogEntity.xml
@@ -12,31 +12,24 @@
-
-
-
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
id
@@ -47,53 +40,67 @@
,modify_time
,sts
,org_id
- ,company_id
- ,bill_id
+ ,company_id
,type
- ,send_to_user_id
- ,send_to_person_id
+ ,recipients_person_id
+ ,recipients_interior_id
,send_count
,send_datetime
,send_person_id
,source_model_name
,state
- ,result_message
+ ,result_message
+ ,warning_interface_id
@@ -110,10 +117,9 @@
and sts = #{sts}
and org_id = #{org_id}
and company_id = #{companyId}
- and bill_id = #{billId}
and type = #{type}
- and send_to_user_id = #{sendToUserId}
- and send_to_person_id = #{sendToPersonId}
+ and recipients_person_id = #{recipientsPersonId}
+ and recipients_interior_id = #{recipientsInteriorId}
and send_count = #{sendCount}
and send_datetime = #{sendDatetime}
and send_person_id = #{sendPersonId}
@@ -128,32 +134,51 @@
@@ -172,10 +197,9 @@
or sts = #{sts}
or org_id = #{org_id}
or company_id = #{companyId}
- or bill_id = #{billId}
or type = #{type}
- or send_to_user_id = #{sendToUserId}
- or send_to_person_id = #{sendToPersonId}
+ or recipients_person_id = #{recipientsPersonId}
+ or recipients_interior_id = #{recipientsInteriorId}
or send_count = #{sendCount}
or send_datetime = #{sendDatetime}
or send_person_id = #{sendPersonId}
@@ -201,16 +225,16 @@
sts ,
org_id ,
company_id ,
- bill_id ,
type ,
- send_to_user_id ,
- send_to_person_id ,
+ recipients_person_id ,
+ recipients_interior_id ,
send_count ,
send_datetime ,
send_person_id ,
source_model_name ,
state ,
result_message ,
+ warning_interface_id ,
sts,
)values(
@@ -224,34 +248,34 @@
#{sts} ,
#{org_id} ,
#{companyId} ,
- #{billId} ,
#{type} ,
- #{sendToUserId} ,
- #{sendToPersonId} ,
+ #{recipientsPersonId} ,
+ #{recipientsInteriorId} ,
#{sendCount} ,
#{sendDatetime} ,
#{sendPersonId} ,
#{sourceModelName} ,
#{state} ,
#{resultMessage} ,
+ #{warningInterfaceId} ,
'Y',
)
- 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)
+ insert into sys_send_message_log(create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id, bill_id, type, recipients_person_id, recipients_interior_id, send_count, send_datetime, send_person_id, source_model_name, state, result_message, sts)
values
- (#{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')
+ (#{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.recipientsPersonId},#{entity.recipientsInteriorId},#{entity.sendCount},#{entity.sendDatetime},#{entity.sendPersonId},#{entity.sourceModelName},#{entity.state},#{entity.resultMessage}, 'Y')
- 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)
+ insert into sys_send_message_log(create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id, bill_id, type, recipients_person_id, recipients_interior_id, send_count, send_datetime, send_person_id, source_model_name, state, result_message)
values
- (#{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})
+ (#{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.recipientsPersonId},#{entity.recipientsInteriorId},#{entity.sendCount},#{entity.sendDatetime},#{entity.sendPersonId},#{entity.sourceModelName},#{entity.state},#{entity.resultMessage})
on duplicate key update
create_user_id = values(create_user_id),
@@ -263,8 +287,8 @@
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),
+ recipients_person_id = values(recipients_person_id),
+ recipients_interior_id = values(recipients_interior_id),
send_count = values(send_count),
send_datetime = values(send_datetime),
send_person_id = values(send_person_id),
@@ -282,10 +306,9 @@ update sys_send_message_log set
sts = #{sts},
org_id = #{org_id},
company_id = #{companyId},
- bill_id = #{billId},
type = #{type},
- send_to_user_id = #{sendToUserId},
- send_to_person_id = #{sendToPersonId},
+ recipients_person_id = #{recipientsPersonId},
+ recipients_interior_id = #{recipientsInteriorId},
send_count = #{sendCount},
send_datetime = #{sendDatetime},
send_person_id = #{sendPersonId},
@@ -308,10 +331,9 @@ update sys_send_message_log set sts= 'N' ,modify_time = #{modify_time},modify_u
and sorts = #{sorts}
and sts = #{sts}
and company_id = #{companyId}
- and bill_id = #{billId}
and type = #{type}
- and send_to_user_id = #{sendToUserId}
- and send_to_person_id = #{sendToPersonId}
+ and recipients_person_id = #{recipientsPersonId}
+ and recipients_interior_id = #{recipientsInteriorId}
and send_count = #{sendCount}
and send_datetime = #{sendDatetime}
and send_person_id = #{sendPersonId}
@@ -326,28 +348,5 @@ update sys_send_message_log set sts= 'N' ,modify_time = #{modify_time},modify_u
delete from sys_send_message_log where id = #{id}
-
-
-
-
diff --git a/base-service/src/main/java/com/hzya/frame/sysnew/sendMessageLog/service/ISysSendMessageLogService.java b/base-service/src/main/java/com/hzya/frame/sysnew/sendMessageLog/service/ISysSendMessageLogService.java
index 929a22b3..0472f9ac 100644
--- a/base-service/src/main/java/com/hzya/frame/sysnew/sendMessageLog/service/ISysSendMessageLogService.java
+++ b/base-service/src/main/java/com/hzya/frame/sysnew/sendMessageLog/service/ISysSendMessageLogService.java
@@ -23,6 +23,8 @@ public interface ISysSendMessageLogService extends IBaseService implements ISysSendMessageLogService {
- @Resource
- private ISysWarningInterfaceDao sysWarningInterfaceDao;
- @Resource
- private ISysWarningConfigDao sysWarningConfigDao;
- @Resource
- private ISysMessageTemplateDao sysMessageTemplateDao;
- @Resource
- private ISysUserDao sysUserDao;
- @Resource
- private ISysApplicationApiDao sysApplicationApiDao;
- @Resource
- private ISysApplicationApiParaDao sysApplicationApiParaDao;
- @Value("${zt.url}")
- private String url ;
- private ISysSendMessageLogDao sysSendMessageLogDao;
+ @Resource
+ private ApplicationCache applicationCache;
+ @Resource
+ private ISysWarningInterfaceDao sysWarningInterfaceDao;
+ @Resource
+ private ISysWarningConfigDao sysWarningConfigDao;
+ @Resource
+ private ISysMessageTemplateDao sysMessageTemplateDao;
+ @Resource
+ private ISysUserDao sysUserDao;
+ @Resource
+ private ISysPersonDao sysPersonsDao;
- @Autowired
- public void setSysSendMessageLogDao(ISysSendMessageLogDao dao) {
- this.sysSendMessageLogDao = dao;
- this.dao = dao;
- }
+ @Resource
+ private ISysApplicationApiDao sysApplicationApiDao;
+ @Resource
+ private ISysApplicationApiParaDao sysApplicationApiParaDao;
- @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 list = sysSendMessageLogDao.queryByLike(entity);
- PageInfo pageInfo = new PageInfo(list);
- return BaseResult.getSuccessMessageEntity("查询数据成功", pageInfo);
- }
+ @Value("${zt.url}")
+ private String url ;
- @Override
- public JsonResultEntity queryEntity(JSONObject jsonObject) {
- SysSendMessageLogEntity entity = getData("jsonStr", jsonObject, SysSendMessageLogEntity.class);
- if (entity == null) {
- entity = new SysSendMessageLogEntity();
- }
- List list = sysSendMessageLogDao.queryByLike(entity);
- return BaseResult.getSuccessMessageEntity("查询数据成功", list);
- }
+ private ISysSendMessageLogDao sysSendMessageLogDao;
- @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);
- }
+ @Autowired
+ public void setSysSendMessageLogDao(ISysSendMessageLogDao dao) {
+ this.sysSendMessageLogDao = dao;
+ this.dao = dao;
+ }
- @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 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 list = sysSendMessageLogDao.queryByLike(entity);
+ PageInfo pageInfo = new PageInfo(list);
+ return BaseResult.getSuccessMessageEntity("查询数据成功", pageInfo);
+ }
- @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 queryEntity(JSONObject jsonObject) {
+ SysSendMessageLogEntity entity = getData("jsonStr", jsonObject, SysSendMessageLogEntity.class);
+ if (entity == null) {
+ entity = new SysSendMessageLogEntity();
+ }
+ List list = sysSendMessageLogDao.queryByLike(entity);
+ return BaseResult.getSuccessMessageEntity("查询数据成功", list);
+ }
- @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);
- }
+ @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 markRead(JSONObject jsonObject) {
+ SysSendMessageLogEntity entity = getData("jsonStr", jsonObject, SysSendMessageLogEntity.class);
+ if (entity.getAppId() == null || "".equals(entity.getAppId())) {
+ return BaseResult.getFailureMessageEntity("传入appId不能为空");
+ }
+ List list = sysSendMessageLogDao.queryBase(entity);
+ if (list == null || list.size() == 0) {
+ return BaseResult.getSuccessMessageEntity("未找到需要标记已读的消息日志", list);
+ }
+ for (SysSendMessageLogEntity log : list) {
+ log.setState(1);
+ log.setUpdate();
+ sysSendMessageLogDao.update(log);
+ }
+ return BaseResult.getSuccessMessageEntity("标记已读成功", list);
+ }
+
+ @Override
+ public JsonResultEntity saveEntity(JSONObject jsonObject) {
+ SysSendMessageLogEntity entity = getData("jsonStr", jsonObject, SysSendMessageLogEntity.class);
+ if (entity == null) {
+ 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("系统错误");
+ }
+ 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);
+ }
- /**
- * sendMessage方法:根据请求错误消息,组装成消息模版,推送到三方业务系统
- * 1、先获取接口调用的日志数据
- * 2、如果日志状态为失败,且该接口预警状态为启用,则进行消息推送
- * 3、根据预警配置,找到消息模版,并生成消息内容
- * 4、根据预警配置,找到预警应用,并推送消息
- * 5、保存消息推送日志
- * */
- @Override
- public boolean sendMessage(SysPushMessageEntity entity){
- String status = entity.getStatus();
- Long receiveApiCode = entity.getReceiveApiCode();
- String sendAppName = entity.getSendAppName();
- String receiveApiName = entity.getReceiveApiName();
- String recieveAppName = entity.getReceiveAppName();
- String returnData = entity.getReturnData();
- String warningAppType = entity.getWarningAppType();
- Long warningAppCode = entity.getWarningAppCode();
- Long warningApiCode = entity.getWarningApiCode();
- String sendMsgContent = "";
+ /**
+ * sendMessage方法:根据请求错误消息,组装成消息模版,推送到三方业务系统
+ * 1、先获取接口调用的日志数据
+ * 2、如果日志状态为失败,且该接口预警状态为启用,则进行消息推送
+ * 3、根据预警配置,找到消息模版,并生成消息内容
+ * 4、根据预警配置,找到预警应用,并推送消息
+ * 5、保存消息推送日志
+ */
+ @Override
+ public boolean sendMessage(SysPushMessageEntity entity) {
+ String status = entity.getStatus();
+ Long receiveApiCode = entity.getReceiveApiCode();
+ String sendAppName = entity.getSendAppName();
+ String receiveApiName = entity.getReceiveApiName();
+ String recieveAppName = entity.getReceiveAppName();
+ String returnData = entity.getReturnData();
+ String sendMsgContent = "";
- SysWarningInterfaceEntity interfaceEntity = new SysWarningInterfaceEntity();
- SysWarningConfigEntity configEntity = new SysWarningConfigEntity();
- SysMessageTemplateEntity templateEntity = new SysMessageTemplateEntity();
- SysApplicationApiParaEntity sysApplicationApiParaEntity = new SysApplicationApiParaEntity();
+ //SysWarningInterfaceEntity interfaceEntityApi = new SysWarningInterfaceEntity();
+ SysWarningInterfaceEntity interfaceEntity = new SysWarningInterfaceEntity();
+ SysWarningConfigEntity configEntity = new SysWarningConfigEntity();
+ SysMessageTemplateEntity templateEntity = new SysMessageTemplateEntity();
+ SysApplicationApiParaEntity sysApplicationApiParaEntity = new SysApplicationApiParaEntity();
- interfaceEntity.setApiCode(receiveApiCode);
+ //interfaceEntityApi.setApiCode(receiveApiCode);
+ interfaceEntity.setApiCode(receiveApiCode);
+ if (status == null) {
+ logger.error("日志状态为空");
+ return false;
+ }
+ //只有发送失败的日志才会推送消息,成功的日志不推送消息
+ if ("4".equals(status)) {
+ try {
+ interfaceEntity = sysWarningInterfaceDao.queryOne(interfaceEntity);
+ } catch (Exception e) {
+ logger.error("API接口预警信息可能配置了多个");
+ return false;
+ }
+ //List interfaceEntityList =sysWarningInterfaceDao.queryByLike(interfaceEntityApi);
+ //for(SysWarningInterfaceEntity interfaceEntity : interfaceEntityList){
+ 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();
+ SysWarningConfigEntity statusEntity = new SysWarningConfigEntity();
+ statusEntity.setStatus("1");
+ statusEntity.setId(warningConfigId);
+ if (warningConfigId == null || "".equals(warningConfigId)) {
+ logger.error("未找到该接口预警配置信息的主表id");
+ return false;
+ }
+ configEntity = sysWarningConfigDao.queryOne(statusEntity);
+ 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;
+ }
+ if(templateEntity.getState() == null || !"1".equals(templateEntity.getState())){
+ logger.error("当前预警配置中消息模版状态为禁用");
+ return false;
+ }
- 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("${receive_app_name}", recieveAppName);
+ sendMsgContent = sendMsgContent.replace("${send_app_name}", sendAppName);
+ sendMsgContent = sendMsgContent.replace("${receive_api_name}", receiveApiName);
+ sendMsgContent = sendMsgContent.replace("${return_data}", returnData);
+ //消息模版名称
+ String templateName = templateEntity.getTemplateName();
+ String type = "";
+ String bodyParams = "";
+ String warningAppId = configEntity.getWarningAppId();
- 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();
+ Long warningApiCode = configEntity.getAcceptMessageApiCode();
+ String appCode = String.valueOf(warningApiCode).substring(0, 6);
+ SysApplicationEntity warningApp = getAppByAppId(appCode);
+ String warningAppType = warningApp.getAppType();
+ Integer warningAppCode = warningApp.getAppId();
- //查询预警人员id列表
- String recipientIdList = configEntity.getRecipientId();
- //根据预警人员id列表,获取预警应用人员id列表
- String warningAppReceiverIdList = getWarningAppReceiverIdList(warningAppType,recipientIdList);
+ //查询预警人员id列表
+ String recipientIdList = configEntity.getRecipientIdList();
+ //根据预警人员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(url).
- header("appId",warningAppCode.toString()).
- header("apiCode",warningApiCode.toString()).
- 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 body = resultJson.getString("attribute");
+ 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(url).
+ header("appId", warningAppCode.toString()).
+ header("apiCode", warningApiCode.toString()).
+ 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 body = resultJson.getString("attribute");
+ SysApplicationApiEntity warningApiEntity = getApiByAppIdApiCode(warningAppId, warningApiCode.toString());
- SysApplicationApiEntity sysApplicationApiEntity = new SysApplicationApiEntity();
- sysApplicationApiEntity.setApiCode(warningApiCode);
- SysApplicationApiEntity warningApiEntity = sysApplicationApiDao.queryOne(sysApplicationApiEntity);
+ //根据预警接口编码,以及返回数据,判断消息推送是否成功
+ if (warningApiEntity.getReturnSuccessField() != null && !"".equals(warningApiEntity.getReturnSuccessField())
+ && warningApiEntity.getReturnSuccessValue() != null && !"".equals(warningApiEntity.getReturnSuccessValue())) {
+ //先判断返回值是否为JSON格式
+ if (JSONUtil.isTypeJSON(body)) {
+ JSONObject cheackdatas = JSONObject.parseObject(body);
+ JSONObject datas = JSONObject.parseObject(body);
+ String checkdata = cheackdatas.getString(warningApiEntity.getReturnSuccessField());
+ //判断返回值是否为预警接口预期的返回值(1、返回值匹配2、返回值配置的就是not null3、返回值带.)
+ if (checkdata != null && warningApiEntity.getReturnSuccessValue().equals(checkdata)) {
+ logger.info("推送消息成功,开始保存日志");
+ } else if (warningApiEntity.getReturnSuccessValue().equals("not null") && checkdata != null) {
+ logger.info("推送消息成功,开始保存日志");
+ } else {
+ String fieldname = warningApiEntity.getReturnSuccessField();
+ if (fieldname.contains(".")) {
+ String[] fileds = fieldname.split("\\.");
+ boolean flags = false;
+ for (int i = 0; i < fileds.length; i++) {
+ if (JSONUtil.isTypeJSON(datas.getString(fileds[i]))) {
+ datas = datas.getJSONObject(fileds[i]);
+ if (fileds.length - 2 == i) {
+ String a = datas.getString(fileds[i + 1]);
+ if (a != null && warningApiEntity.getReturnSuccessValue().equals(a)) {
+ flags = true;
+ break;
+ } else if (warningApiEntity.getReturnSuccessValue().equals("not null") && a != null) {
+ flags = true;
+ break;
+ } else {
+ break;
+ }
+ }
+ }
+ }
+ if (flags) {
+ logger.info("推送消息成功,开始保存日志");
+ } else {
+ logger.error("推送消息失败,返回值错误");
+ }
- //根据预警接口编码,以及返回数据,判断消息推送是否成功
- if(warningApiEntity.getReturnSuccessField() != null && !"".equals(warningApiEntity.getReturnSuccessField())
- && warningApiEntity.getReturnSuccessValue() != null && !"".equals(warningApiEntity.getReturnSuccessValue())){
- //先判断返回值是否为JSON格式
- if (JSONUtil.isTypeJSON(body)){
- JSONObject cheackdatas = JSONObject.parseObject(body);
- JSONObject datas = JSONObject.parseObject(body);
- String checkdata = cheackdatas.getString(warningApiEntity.getReturnSuccessField());
- //判断返回值是否为预警接口预期的返回值(1、返回值匹配2、返回值配置的就是not null3、返回值带.)
- if (checkdata != null && warningApiEntity.getReturnSuccessValue().equals(checkdata)) {
- logger.info("推送消息成功,开始保存日志");
- }else if(warningApiEntity.getReturnSuccessValue().equals("not null") && checkdata != null){
- logger.info("推送消息成功,开始保存日志");
- }else {
- String fieldname = warningApiEntity.getReturnSuccessField();
- if(fieldname.contains(".")){
- String[] fileds = fieldname.split("\\.");
- boolean flags = false;
- for (int i = 0; i < fileds.length; i++) {
- if (JSONUtil.isTypeJSON(datas.getString(fileds[i]))) {
- datas = datas.getJSONObject(fileds[i]);
- if(fileds.length-2 == i ){
- String a = datas.getString(fileds[i+1]);
- if (a != null && warningApiEntity.getReturnSuccessValue().equals(a)) {
- flags = true;
- break;
- }else if(warningApiEntity.getReturnSuccessValue().equals("not null") && a != null){
- flags = true;
- break;
- }else {
- break;
- }
- }
- }
- }
- if(flags){
- logger.info("推送消息成功,开始保存日志");
- }else {
- logger.error("推送消息失败,返回值错误");
- }
+ } else {
+ logger.error("推送消息失败,返回值错误");
+ }
+ }
+ } else {
+ logger.error("接口调用失败,返回格式错误,不是JSON");
+ }
+ } else {
+ logger.error("api返回信息字段未配置,开始保存日志");
+ }
+ saveLog(sendMsgContent, type, resultJson.toString(), templateName, recipientIdList, warningAppReceiverIdList, interfaceEntity.getId());
+ logger.info("保存日志成功");
+ //}
- }else {
- logger.error("推送消息失败,返回值错误");
- }
- }
- }else{
- logger.error("接口调用失败,返回格式错误,不是JSON");
- }
- }else{
- logger.error("api返回信息字段未配置,开始保存日志");
- }
- saveLog(sendMsgContent,type,resultJson.toString(),templateName,recipientIdList,warningAppReceiverIdList);
- logger.info("保存日志成功");
- }else{
- logger.error("日志状态为成功,不需要推送消息");
- return false;
- }
- return true;
- }
+ } else {
+ logger.error("日志状态为成功,不需要推送消息");
+ return false;
+ }
+ return true;
+ }
+ /**
+ * 根据appCode查询缓存中的应用信息
+ */
+ private SysApplicationEntity getAppByAppId(String appId) {
+ String str = "appId" + appId;
+ Object o = applicationCache.get("1", str);
+ if (o != null) {
+ return (SysApplicationEntity) o;
+ }
+ return null;
+ }
- /**保存推送消息日志时,需要循环预警应用人员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());
+ /**
+ * 根据appId和apiCode查询缓存中的api信息
+ */
+ private SysApplicationApiEntity getApiByAppIdApiCode(String appId, String apiCode) {
- 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");
+ String str = "appId" + appId + "apiCode" + apiCode;
+ Object o = applicationCache.get("2", str);
+ if (o != null) {
+ return (SysApplicationApiEntity) o;
+ }
+ return null;
+ }
+
+ /**
+ * 保存推送消息日志时,需要循环预警应用人员id列表
+ */
+ public void saveLog(String sendMsgContent, String type, String resultMessage, String templateName, String recipientIdList, String warningAppReceiverIdList,String warningInterfaceId) {
+ SysSendMessageLogEntity logEntity = new SysSendMessageLogEntity();
+ logEntity.setSendCount(sendMsgContent);
+ logEntity.setType(type);
+ 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);
+ logEntity.setResultMessage(resultMessage);
+ logEntity.setSourceModelName(templateName);
+ logEntity.setState(0);
+ logEntity.setWarningInterfaceId(warningInterfaceId);
+ String[] recipientsInteriorIdList = warningAppReceiverIdList.split(",");
+ String[] recipientsPersonIdList = recipientIdList.split(",");
- String[] personIdList = warningAppReceiverIdList.split(",");
- String[] userIdList = recipientIdList.split(",");
+ for (int i = 0; i < recipientsInteriorIdList.length; i++) {
+ logEntity.setRecipientsInteriorId(recipientsInteriorIdList[i]);
+ logEntity.setRecipientsPersonId(recipientsPersonIdList[i]);
+ logEntity.setId(UUIDUtils.getUUID());
+ sysSendMessageLogDao.save(logEntity);
+ }
+ }
- for(int i=0;i 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;
- }
+ String[] personIdArray = personIdList.split(",");
+ List sysUserList = new ArrayList<>();
+ SysUserEntity sysUserEntity = new SysUserEntity();
+ for (String personId : personIdArray) {
+ sysUserEntity.setPersonId(personId);
+ sysUserList.add(sysUserDao.queryOne(sysUserEntity));
+ }
+ String warningAppReceiverIdList = "";
+ switch (warningAppType) {
+ case "6WX":
+ //获取微信预警人员id列表
+ break;
+ case "5DD":
+ //获取钉钉预警人员id列表
+ for (SysUserEntity sysUser : sysUserList) {
+ if (sysUser.getDdUserId() == null || "".equals(sysUser.getDdUserId())) {
+ String personName = sysPersonsDao.get(sysUser.getPersonId()).getPersonName();
+ logger.error("接收人:" +personName + "未配置钉钉用户id");
+ }
+ if (sysUser.getDdUserId() != null && !"".equals(sysUser.getDdUserId())) {
+ if (!warningAppReceiverIdList.isEmpty()) {
+ warningAppReceiverIdList += ",";
+ }
+ warningAppReceiverIdList += sysUser.getDdUserId();
+ }
+ }
+ break;
+ default:
+ logger.error("未找到该应用类型");
+ break;
+ }
return warningAppReceiverIdList;
- }
+ }
}
diff --git a/base-service/src/main/java/com/hzya/frame/sysnew/warningConfig/entity/SysWarningConfigEntity.java b/base-service/src/main/java/com/hzya/frame/sysnew/warningConfig/entity/SysWarningConfigEntity.java
index 11be0abe..61d21a2e 100644
--- a/base-service/src/main/java/com/hzya/frame/sysnew/warningConfig/entity/SysWarningConfigEntity.java
+++ b/base-service/src/main/java/com/hzya/frame/sysnew/warningConfig/entity/SysWarningConfigEntity.java
@@ -14,8 +14,8 @@ public class SysWarningConfigEntity extends BaseEntity {
private String companyId;
/** 消息模版id */
private String messageTemplateId;
- /** 应用id */
- private String appId;
+ /** 应用id列表 */
+ private String appIdList;
/** 预警应用id */
private String warningAppId;
/** 接收推送消息的api编码 */
@@ -25,8 +25,63 @@ public class SysWarningConfigEntity extends BaseEntity {
/** 是否启用(0:停用、1:启用) */
private String status;
/** 接收人id(存表sys_user的id) */
- private String recipientId;
+ private String recipientIdList;
+ /** 模版名称 */
+ private String templateName;
+ /** 应用名称 */
+ private String appNameList;
+ /** 预警应用名称 */
+ private String warningAppNameList;
+ /** 接收人名称列表 */
+ private String recipientNameList;
+ public String getWarningAppNameList() {
+ return warningAppNameList;
+ }
+
+ public void setWarningAppNameList(String warningAppNameList) {
+ this.warningAppNameList = warningAppNameList;
+ }
+
+ public String getTemplateName() {
+ return templateName;
+ }
+
+ public void setTemplateName(String templateName) {
+ this.templateName = templateName;
+ }
+
+ public String getAppNameList() {
+ return appNameList;
+ }
+
+ public void setAppNameList(String appNameList) {
+ this.appNameList = appNameList;
+ }
+
+ public String getRecipientNameList() {
+ return recipientNameList;
+ }
+
+ public void setRecipientNameList(String recipientNameList) {
+ this.recipientNameList = recipientNameList;
+ }
+
+ public String getAppIdList() {
+ return appIdList;
+ }
+
+ public void setAppIdList(String appIdList) {
+ this.appIdList = appIdList;
+ }
+
+ public String getRecipientIdList() {
+ return recipientIdList;
+ }
+
+ public void setRecipientIdList(String recipientIdList) {
+ this.recipientIdList = recipientIdList;
+ }
public String getCompanyId() {
return companyId;
@@ -44,13 +99,6 @@ public class SysWarningConfigEntity extends BaseEntity {
this.messageTemplateId = messageTemplateId;
}
- public String getAppId() {
- return appId;
- }
-
- public void setAppId(String appId) {
- this.appId = appId;
- }
public String getWarningAppId() {
return warningAppId;
@@ -84,13 +132,5 @@ public class SysWarningConfigEntity extends BaseEntity {
this.status = status;
}
- public String getRecipientId() {
- return recipientId;
- }
-
- public void setRecipientId(String recipientId) {
- this.recipientId = recipientId;
- }
-
}
diff --git a/base-service/src/main/java/com/hzya/frame/sysnew/warningConfig/entity/SysWarningConfigEntity.xml b/base-service/src/main/java/com/hzya/frame/sysnew/warningConfig/entity/SysWarningConfigEntity.xml
index c7ff7a11..ac4fcc10 100644
--- a/base-service/src/main/java/com/hzya/frame/sysnew/warningConfig/entity/SysWarningConfigEntity.xml
+++ b/base-service/src/main/java/com/hzya/frame/sysnew/warningConfig/entity/SysWarningConfigEntity.xml
@@ -13,12 +13,13 @@
-
+
-
+
+
@@ -32,19 +33,22 @@
,org_id
,company_id
,message_template_id
- ,app_id
+ ,app_id_list
,warning_app_id
,accept_message_api_code
,remark
,status
- ,recipient_id
+ ,recipient_id_list
- 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)
+ 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_list, warning_app_id, accept_message_api_code, remark, status, recipient_id_list, sts)
values
- (#{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')
+ (#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId},#{entity.messageTemplateId},#{entity.appIdList},#{entity.warningAppId},#{entity.acceptMessageApiCode},#{entity.remark},#{entity.status},#{entity.recipientIdList}, 'Y')
- 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)
+ 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_list, warning_app_id, accept_message_api_code, remark, status, recipient_id_list)
values
- (#{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})
+ (#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId},#{entity.messageTemplateId},#{entity.appIdList},#{entity.warningAppId},#{entity.acceptMessageApiCode},#{entity.remark},#{entity.status},#{entity.recipientIdList})
on duplicate key update
create_user_id = values(create_user_id),
@@ -224,12 +231,12 @@
org_id = values(org_id),
company_id = values(company_id),
message_template_id = values(message_template_id),
- app_id = values(app_id),
+ app_id_list = values(app_id_list),
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)
+ recipient_id_list = values(recipient_id_list)
update sys_warning_config set
@@ -242,12 +249,12 @@ update sys_warning_config set
org_id = #{org_id},
company_id = #{companyId},
message_template_id = #{messageTemplateId},
- app_id = #{appId},
+ app_id_list = #{appIdList},
warning_app_id = #{warningAppId},
accept_message_api_code = #{acceptMessageApiCode},
remark = #{remark},
status = #{status},
- recipient_id = #{recipientId},
+ recipient_id_list = #{recipientIdList},
where id = #{id}
@@ -265,12 +272,12 @@ update sys_warning_config set sts= 'N' ,modify_time = #{modify_time},modify_use
and sts = #{sts}
and company_id = #{companyId}
and message_template_id = #{messageTemplateId}
- and app_id = #{appId}
+ and app_id_list = #{appIdList}
and warning_app_id = #{warningAppId}
and accept_message_api_code = #{acceptMessageApiCode}
and remark = #{remark}
and status = #{status}
- and recipient_id = #{recipientId}
+ and recipient_id_list = #{recipientIdList}
and sts='Y'
diff --git a/base-service/src/main/java/com/hzya/frame/sysnew/warningConfig/service/impl/SysWarningConfigServiceImpl.java b/base-service/src/main/java/com/hzya/frame/sysnew/warningConfig/service/impl/SysWarningConfigServiceImpl.java
index 7634e93f..541d44f1 100644
--- a/base-service/src/main/java/com/hzya/frame/sysnew/warningConfig/service/impl/SysWarningConfigServiceImpl.java
+++ b/base-service/src/main/java/com/hzya/frame/sysnew/warningConfig/service/impl/SysWarningConfigServiceImpl.java
@@ -1,11 +1,22 @@
package com.hzya.frame.sysnew.warningConfig.service.impl;
+import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
+import com.hzya.frame.sysnew.application.dao.ISysApplicationDao;
+import com.hzya.frame.sysnew.application.entity.SysApplicationEntity;
+import com.hzya.frame.sysnew.messageTemplate.dao.ISysMessageTemplateDao;
+import com.hzya.frame.sysnew.messageTemplate.entity.SysMessageTemplateEntity;
+import com.hzya.frame.sysnew.person.dao.ISysPersonDao;
+import com.hzya.frame.sysnew.person.entity.SysPersonEntity;
+import com.hzya.frame.sysnew.user.dao.ISysUserDao;
+import com.hzya.frame.sysnew.user.entity.SysUserEntity;
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.sysnew.warningInterface.dao.ISysWarningInterfaceDao;
+import com.hzya.frame.sysnew.warningInterface.entity.SysWarningInterfaceEntity;
import com.hzya.frame.web.entity.BaseResult;
import com.hzya.frame.web.entity.JsonResultEntity;
import org.springframework.stereotype.Service;
@@ -13,6 +24,7 @@ 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.List;
/**
@@ -23,7 +35,20 @@ import java.util.List;
*/
@Service(value = "sysWarningConfigService")
public class SysWarningConfigServiceImpl extends BaseService implements ISysWarningConfigService {
-
+
+ @Resource
+ private ISysWarningInterfaceDao sysWarningInterfaceDao;
+ @Resource
+ private ISysUserDao sysUserDao;
+ @Resource
+ private ISysPersonDao sysPersonDao;
+
+ @Resource
+ private ISysApplicationDao sysApplicationDao;
+
+ @Resource
+ private ISysMessageTemplateDao sysMessageTemplateDao;
+
private ISysWarningConfigDao sysWarningConfigDao;
@Autowired
@@ -40,7 +65,9 @@ public class SysWarningConfigServiceImpl extends BaseService list = sysWarningConfigDao.queryByLike(entity);
- PageInfo pageInfo = new PageInfo(list);
+ //查询并记录应用名称、预警应用名称、接收者名称列表
+ List resultList = queryNameList(list);
+ PageInfo pageInfo = new PageInfo(resultList);
return BaseResult.getSuccessMessageEntity("查询数据成功",pageInfo);
}
@@ -51,8 +78,11 @@ public class SysWarningConfigServiceImpl extends BaseService list = sysWarningConfigDao.queryByLike(entity);
- return BaseResult.getSuccessMessageEntity("查询数据成功",list);
+ //查询并记录应用名称、预警应用名称、接收者名称列表
+ List resultList = queryNameList(list);
+ return BaseResult.getSuccessMessageEntity("查询数据成功",resultList);
}
+ /**查询应用名称、预警应用名称、接收者名称列表*/
@Override
public JsonResultEntity getEntity(JSONObject jsonObject){
@@ -63,23 +93,51 @@ public class SysWarningConfigServiceImpl extends BaseService list = new ArrayList<>();
+ list.add(entity);
+ //查询并记录应用名称、预警应用名称、接收者名称列表
+ List resultList = queryNameList(list);
+ String warningConfigId = resultList.get(0).getId();
+ //查询子表信息
+ SysWarningInterfaceEntity interfaceEntity = new SysWarningInterfaceEntity();
+ interfaceEntity.setWarningConfigId(warningConfigId);
+ List interfaceList = sysWarningInterfaceDao.queryByLike(interfaceEntity);
+ //拼接主子表信息并返回
+ JSONObject father = (JSONObject) JSONObject.toJSON(resultList.get(0));
+ JSONArray sonArray = new JSONArray();
+ for(SysWarningInterfaceEntity interfaceOne : interfaceList){
+ JSONObject interfaceJson = (JSONObject) JSONObject.toJSON(interfaceOne);
+ sonArray.add(interfaceJson);
+ }
+ JSONObject resultJson = new JSONObject();
+ resultJson.put("father", father);
+ resultJson.put("son", sonArray);
+ return BaseResult.getSuccessMessageEntity("获取预警配置成功",resultJson);
}
@Override
public JsonResultEntity saveEntity(JSONObject jsonObject){
- SysWarningConfigEntity entity = getData("jsonStr", jsonObject, SysWarningConfigEntity.class);
+ JSONObject jsonStr = jsonObject.getJSONObject("jsonStr");
+ JSONArray sonArray = jsonStr.getJSONArray("son");
+ List interfaceEntities = new ArrayList<>();
+ for(int i=0;i interfaceEntities = new ArrayList<>();
+ for(int i=0;i oldInterfaceList = sysWarningInterfaceDao.queryBase(oldInterfaceEntity);
+ //更新子表数据
+ for(SysWarningInterfaceEntity interfaceEntity : interfaceEntities){
+ interfaceEntity.setWarningConfigId(warningConfigId);
+ if(interfaceEntity.getApiCode() == null || "".equals(interfaceEntity.getApiCode())){
+ return BaseResult.getFailureMessageEntity("接口编码不能为空");
+ }
+ if(interfaceEntity.getPushMethod() == null || "".equals(interfaceEntity.getPushMethod())){
+ return BaseResult.getFailureMessageEntity("推送方式不能为空");
+ }
+ if(interfaceEntity.getStatus() == null || "".equals(interfaceEntity.getStatus())){
+ return BaseResult.getFailureMessageEntity("状态不能为空");
+ }
+ if(interfaceEntity.getWarningConfigId() == null || "".equals(interfaceEntity.getWarningConfigId())){
+ return BaseResult.getFailureMessageEntity("预警配置id不能为空");
+ }
+ if(interfaceEntity.getId() == null || "".equals(interfaceEntity.getId())){
+ //新增
+ interfaceEntity.setCreate();
+ sysWarningInterfaceDao.save(interfaceEntity);
+ }else{
+ //修改
+ interfaceEntity.setUpdate();
+ interfaceEntity.setSts("Y");
+ sysWarningInterfaceDao.update(interfaceEntity);
+ }
+ }
+ //删除多余的子表数据
+ boolean isDelete = true;
+ for(SysWarningInterfaceEntity oldInterface : oldInterfaceList){
+ isDelete = true;
+ for(SysWarningInterfaceEntity interfaceEntity : interfaceEntities){
+ if(oldInterface.getId().equals(interfaceEntity.getId())){
+ isDelete = false;
+ break;
+ }
+ }
+ if(isDelete){
+ sysWarningInterfaceDao.logicRemove(oldInterface);
+ }
+
+ }
+
return BaseResult.getSuccessMessageEntity("修改预警配置成功",entity);
}
+ /**
+ * 删除主表时,同时删除子表数据*/
@Override
public JsonResultEntity deleteEntity(JSONObject jsonObject) {
SysWarningConfigEntity entity = getData("jsonStr", jsonObject, SysWarningConfigEntity.class);
@@ -134,8 +278,14 @@ public class SysWarningConfigServiceImpl extends BaseService queryNameList(List list){
+ for(SysWarningConfigEntity configEntity : list){
+ //拼接应用名称列表
+ String appIds = configEntity.getAppIdList();
+ String[] appIdList = appIds.split(",");
+ String appNameList = "";
+ for(String appId : appIdList){
+ SysApplicationEntity appEntity = sysApplicationDao.get(appId);
+ String appName = appEntity.getName();
+ if(!"".equals(appNameList)){
+ appNameList += ",";
+ }
+ appNameList += appName;
+ }
+ configEntity.setAppNameList(appNameList);
+ //拼接预警应用名称列表
+ String warningAppIds = configEntity.getWarningAppId();
+ String[] warningAppIdList = warningAppIds.split(",");
+ String warningAppNameList = "";
+ for(String warningAppId : warningAppIdList){
+ SysApplicationEntity warningAppEntity = sysApplicationDao.get(warningAppId);
+ String warningAppName = warningAppEntity.getName();
+ if(!"".equals(warningAppNameList)){
+ warningAppNameList += ",";
+ }
+ warningAppNameList += warningAppName;
+ }
+ configEntity.setWarningAppNameList(warningAppNameList);
+ //拼接接收者名称列表
+ String recipientIds = configEntity.getRecipientIdList();
+ String[] recipientIdList = recipientIds.split(",");
+ String recipientNameList = "";
+ for(String recipientId : recipientIdList){
+// SysUserEntity userEntity = sysUserDao.get(recipientId);
+// String personId = userEntity.getPersonId();
+ SysPersonEntity personEntity = sysPersonDao.get(recipientId);
+ String recipientName = personEntity.getPersonName();
+ if(!"".equals(recipientNameList)){
+ recipientNameList += ",";
+ }
+ recipientNameList += recipientName;
+ }
+ configEntity.setRecipientNameList(recipientNameList);
+
+ }
+ return list;
+ }
+
}
diff --git a/base-service/src/main/java/com/hzya/frame/sysnew/warningInterface/dao/ISysWarningInterfaceDao.java b/base-service/src/main/java/com/hzya/frame/sysnew/warningInterface/dao/ISysWarningInterfaceDao.java
index 544241f6..61a64efa 100644
--- a/base-service/src/main/java/com/hzya/frame/sysnew/warningInterface/dao/ISysWarningInterfaceDao.java
+++ b/base-service/src/main/java/com/hzya/frame/sysnew/warningInterface/dao/ISysWarningInterfaceDao.java
@@ -1,7 +1,9 @@
package com.hzya.frame.sysnew.warningInterface.dao;
import com.hzya.frame.sysnew.warningInterface.entity.SysWarningInterfaceEntity;
-import com.hzya.frame.basedao.dao.IBaseDao;
+import com.hzya.frame.basedao.dao.IBaseDao;
+
+import java.util.List;
/**
* 预警接口表(sys_warning_interface: table)表数据库访问层
@@ -11,5 +13,6 @@ import com.hzya.frame.basedao.dao.IBaseDao;
*/
public interface ISysWarningInterfaceDao extends IBaseDao {
+ List getWarningAppList();
}
diff --git a/base-service/src/main/java/com/hzya/frame/sysnew/warningInterface/dao/impl/SysWarningInterfaceDaoImpl.java b/base-service/src/main/java/com/hzya/frame/sysnew/warningInterface/dao/impl/SysWarningInterfaceDaoImpl.java
index 655eb183..fdcbb1f2 100644
--- a/base-service/src/main/java/com/hzya/frame/sysnew/warningInterface/dao/impl/SysWarningInterfaceDaoImpl.java
+++ b/base-service/src/main/java/com/hzya/frame/sysnew/warningInterface/dao/impl/SysWarningInterfaceDaoImpl.java
@@ -4,6 +4,9 @@ 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;
+
+import java.util.List;
+
/**
* 预警接口表(SysWarningInterface)表数据库访问层
*
@@ -12,6 +15,10 @@ import com.hzya.frame.basedao.dao.MybatisGenericDao;
*/
@Repository(value = "SysWarningInterfaceDaoImpl")
public class SysWarningInterfaceDaoImpl extends MybatisGenericDao implements ISysWarningInterfaceDao{
-
+ @Override
+ public List getWarningAppList(){
+ List tempList = (List)super.selectList(getSqlIdPrifx() + "warning_app_list", null);
+ return tempList;
+ }
}
diff --git a/base-service/src/main/java/com/hzya/frame/sysnew/warningInterface/entity/SysWarningInterfaceEntity.java b/base-service/src/main/java/com/hzya/frame/sysnew/warningInterface/entity/SysWarningInterfaceEntity.java
index fa2181c9..c9abb5c7 100644
--- a/base-service/src/main/java/com/hzya/frame/sysnew/warningInterface/entity/SysWarningInterfaceEntity.java
+++ b/base-service/src/main/java/com/hzya/frame/sysnew/warningInterface/entity/SysWarningInterfaceEntity.java
@@ -9,7 +9,11 @@ import com.hzya.frame.web.entity.BaseEntity;
* @since 2024-09-03 10:06:19
*/
public class SysWarningInterfaceEntity extends BaseEntity {
-
+
+ /** 应用id */
+ private String appId;
+ /** 应用名称 */
+ private String appName;
/** 公司id */
private String companyId;
/** api名称 */
@@ -23,6 +27,21 @@ public class SysWarningInterfaceEntity extends BaseEntity {
/** 主表id(预警配置表id) */
private String warningConfigId;
+ public String getAppName() {
+ return appName;
+ }
+
+ public void setAppName(String appName) {
+ this.appName = appName;
+ }
+
+ public String getAppId() {
+ return appId;
+ }
+
+ public void setAppId(String appId) {
+ this.appId = appId;
+ }
public String getCompanyId() {
return companyId;
diff --git a/base-service/src/main/java/com/hzya/frame/sysnew/warningInterface/entity/SysWarningInterfaceEntity.xml b/base-service/src/main/java/com/hzya/frame/sysnew/warningInterface/entity/SysWarningInterfaceEntity.xml
index 663e7cd1..f43f9f82 100644
--- a/base-service/src/main/java/com/hzya/frame/sysnew/warningInterface/entity/SysWarningInterfaceEntity.xml
+++ b/base-service/src/main/java/com/hzya/frame/sysnew/warningInterface/entity/SysWarningInterfaceEntity.xml
@@ -17,7 +17,10 @@
+
+
+
id
@@ -33,7 +36,8 @@
,api_code
,push_method
,status
- ,warning_config_id
+ ,warning_config_id
+ ,app_id
@@ -85,29 +89,50 @@
order by ${sort} ${order}
+
+ select distinct app_id from sys_warning_interface where sts='Y'
+
+
select
-
- from sys_warning_interface
+ i.id
+ ,i.sorts
+ ,i.create_user_id
+ ,i.create_time
+ ,i.modify_user_id
+ ,i.modify_time
+ ,i.sts
+ ,i.org_id
+ ,i.company_id
+ ,i.api_name
+ ,i.api_code
+ ,i.push_method
+ ,i.status
+ ,i.warning_config_id
+ ,i.app_id
+ ,app.name as app_name
+ from sys_warning_interface i
+ left join sys_application app on app.id = i.app_id
- and id like concat('%',#{id},'%')
- and sorts like concat('%',#{sorts},'%')
- and create_user_id like concat('%',#{create_user_id},'%')
- and create_time like concat('%',#{create_time},'%')
- and modify_user_id like concat('%',#{modify_user_id},'%')
- and modify_time like concat('%',#{modify_time},'%')
- and sts like concat('%',#{sts},'%')
- and org_id like concat('%',#{org_id},'%')
- and company_id like concat('%',#{companyId},'%')
- and api_name like concat('%',#{apiName},'%')
- and api_code like concat('%',#{apiCode},'%')
- and push_method like concat('%',#{pushMethod},'%')
- and status like concat('%',#{status},'%')
- and warning_config_id like concat('%',#{warningConfigId},'%')
- and sts='Y'
+ and i.id like concat('%',#{id},'%')
+ and i.sorts like concat('%',#{sorts},'%')
+ and i.create_user_id like concat('%',#{create_user_id},'%')
+ and i.create_time like concat('%',#{create_time},'%')
+ and i.modify_user_id like concat('%',#{modify_user_id},'%')
+ and i.modify_time like concat('%',#{modify_time},'%')
+ and i.sts like concat('%',#{sts},'%')
+ and i.org_id like concat('%',#{org_id},'%')
+ and i.company_id like concat('%',#{companyId},'%')
+ and i.api_name like concat('%',#{apiName},'%')
+ and i.api_code like concat('%',#{apiCode},'%')
+ and i.push_method like concat('%',#{pushMethod},'%')
+ and i.status like concat('%',#{status},'%')
+ and i.warning_config_id like concat('%',#{warningConfigId},'%')
+ and i.sts='Y'
+ and app.sts='Y'
- order by sorts asc
+ order by i.sorts asc
order by ${sort} ${order}
@@ -155,6 +180,7 @@
push_method ,
status ,
warning_config_id ,
+ app_id ,
sts,
)values(
@@ -173,6 +199,7 @@
#{pushMethod} ,
#{status} ,
#{warningConfigId} ,
+ #{appId} ,
'Y',
)
diff --git a/base-service/src/main/java/com/hzya/frame/sysnew/warningInterface/service/ISysWarningInterfaceService.java b/base-service/src/main/java/com/hzya/frame/sysnew/warningInterface/service/ISysWarningInterfaceService.java
index 09f2ff30..b8514bc7 100644
--- a/base-service/src/main/java/com/hzya/frame/sysnew/warningInterface/service/ISysWarningInterfaceService.java
+++ b/base-service/src/main/java/com/hzya/frame/sysnew/warningInterface/service/ISysWarningInterfaceService.java
@@ -17,6 +17,8 @@ public interface ISysWarningInterfaceService extends IBaseService implements ISysWarningInterfaceService {
private ISysWarningInterfaceDao sysWarningInterfaceDao;
-
+
+ @Resource
+ private ISysApplicationDao sysApplicationDao;
+
+ @Resource
+ private ISysSendMessageLogDao sysSendMessageLogDao;
+
+
@Autowired
public void setSysWarningInterfaceDao(ISysWarningInterfaceDao dao) {
this.sysWarningInterfaceDao = dao;
@@ -75,10 +89,7 @@ public class SysWarningInterfaceServiceImpl extends BaseService appIdList = sysWarningInterfaceDao.getWarningAppList();
+ List appList = new ArrayList<>();
+ for (SysWarningInterfaceEntity entity : appIdList) {
+ if (entity == null) {
+ continue;
+ }
+ String appId = entity.getAppId();
+ SysApplicationEntity app = sysApplicationDao.get(appId);
+ if (app == null) {
+ continue;
+ }
+ SysSendMessageLogEntity logEntity = new SysSendMessageLogEntity();
+ logEntity.setAppId(appId);
+ logEntity.setState(0);
+ List list = sysSendMessageLogDao.queryByLike(logEntity);
+ app.setNewMessageCount(list.size());
+ if (app != null) {
+ appList.add(app);
+ }
+ }
+ return BaseResult.getSuccessMessageEntity("查询预警应用列表成功",appList);
+ }
+
}