From 17518aa2d44742c4d84953c9f0f0fd63fcb57e83 Mon Sep 17 00:00:00 2001 From: lvleigang <957075182@qq.com> Date: Wed, 11 Sep 2024 14:04:44 +0800 Subject: [PATCH 01/10] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=BB=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E4=BF=9D=E5=AD=98=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mdmDistribute/plugin/MdmModulePluginInitializer.java | 6 +++--- .../com/hzya/frame/mdm/service/impl/MdmServiceImpl.java | 4 ++-- .../application/service/impl/SysApplicationServiceImpl.java | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/mdmDistribute/plugin/MdmModulePluginInitializer.java b/buildpackage/src/main/java/com/hzya/frame/plugin/mdmDistribute/plugin/MdmModulePluginInitializer.java index de6fb968..ebff9dc2 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/mdmDistribute/plugin/MdmModulePluginInitializer.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/mdmDistribute/plugin/MdmModulePluginInitializer.java @@ -704,7 +704,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity { continue; }else { //保存日志 - saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"2","转发失败",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),sysApplicationEntity.getId(),apiEntity.getApiName(),apiEntity.getId(),doObjects.get(i).toJSONString(),"3"); + saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"2","转发失败:"+jsonResultEntity.getAttribute(),mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),sysApplicationEntity.getId(),apiEntity.getApiName(),apiEntity.getId(),doObjects.get(i).toJSONString(),"3"); continue; } } @@ -885,7 +885,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity { continue; }else { //保存日志 - saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"2","转发失败",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),sysApplicationEntity.getId(),apiEntity.getApiName(),apiEntity.getId(),doObjects.get(i).toJSONString(),"2"); + saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"2","转发失败:"+jsonResultEntity.getAttribute(),mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),sysApplicationEntity.getId(),apiEntity.getApiName(),apiEntity.getId(),doObjects.get(i).toJSONString(),"2"); continue; } } @@ -1124,7 +1124,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity { continue; }else { //保存日志 - saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"2","转发失败",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),sysApplicationEntity.getId(),apiEntity.getApiName(),apiEntity.getId(),doObjects.get(i).toJSONString(),"1"); + saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"2","转发失败:"+jsonResultEntity.getAttribute(),mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),sysApplicationEntity.getId(),apiEntity.getApiName(),apiEntity.getId(),doObjects.get(i).toJSONString(),"1"); continue; } } diff --git a/service/src/main/java/com/hzya/frame/mdm/service/impl/MdmServiceImpl.java b/service/src/main/java/com/hzya/frame/mdm/service/impl/MdmServiceImpl.java index 26c03807..fcb46154 100644 --- a/service/src/main/java/com/hzya/frame/mdm/service/impl/MdmServiceImpl.java +++ b/service/src/main/java/com/hzya/frame/mdm/service/impl/MdmServiceImpl.java @@ -1935,7 +1935,7 @@ public class MdmServiceImpl implements IMdmService { } } catch (Exception e) { logger.error("新增返回脚本解析保存三方id错误" + jsonResultEntity.getAttribute()); - saveMdmModuleSendLogEntity(mdmModuleEntity.getMdmCode(), mdmModuleDistributeEntity.getId(), "2", "转发失败", dbname, object.getString("id"), sysApplicationEntity.getName(), sysApplicationEntity.getId(), apiEntity.getApiName(), apiEntity.getId(), object.toJSONString(), type); + saveMdmModuleSendLogEntity(mdmModuleEntity.getMdmCode(), mdmModuleDistributeEntity.getId(), "2", "转发失败:"+jsonResultEntity.getAttribute(), dbname, object.getString("id"), sysApplicationEntity.getName(), sysApplicationEntity.getId(), apiEntity.getApiName(), apiEntity.getId(), object.toJSONString(), type); return BaseResult.getFailureMessageEntity("发送错误:新增返回脚本解析保存三方id错误"); } } @@ -1943,7 +1943,7 @@ public class MdmServiceImpl implements IMdmService { saveMdmModuleSendLogEntity(mdmModuleEntity.getMdmCode(), mdmModuleDistributeEntity.getId(), "1", "发送成功", dbname, object.getString("id"), sysApplicationEntity.getName(), sysApplicationEntity.getId(), apiEntity.getApiName(), apiEntity.getId(), object.toJSONString(), type); return BaseResult.getSuccessMessageEntity("发送成功"); } else { - saveMdmModuleSendLogEntity(mdmModuleEntity.getMdmCode(), mdmModuleDistributeEntity.getId(), "2", "转发失败", dbname, object.getString("id"), sysApplicationEntity.getName(), sysApplicationEntity.getId(), apiEntity.getApiName(), apiEntity.getId(), object.toJSONString(), type); + saveMdmModuleSendLogEntity(mdmModuleEntity.getMdmCode(), mdmModuleDistributeEntity.getId(), "2", "转发失败:"+jsonResultEntity.getAttribute(), dbname, object.getString("id"), sysApplicationEntity.getName(), sysApplicationEntity.getId(), apiEntity.getApiName(), apiEntity.getId(), object.toJSONString(), type); return BaseResult.getFailureMessageEntity("发送错误:" + jsonResultEntity.getAttribute()); } } diff --git a/service/src/main/java/com/hzya/frame/sysnew/application/service/impl/SysApplicationServiceImpl.java b/service/src/main/java/com/hzya/frame/sysnew/application/service/impl/SysApplicationServiceImpl.java index 2a11d6ef..b6ad01cd 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/application/service/impl/SysApplicationServiceImpl.java +++ b/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; } From 504c9e54c0333527a8030f0e1d72144e55e1aada Mon Sep 17 00:00:00 2001 From: lvleigang <957075182@qq.com> Date: Wed, 11 Sep 2024 14:07:03 +0800 Subject: [PATCH 02/10] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=BB=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E4=BF=9D=E5=AD=98=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/hzya/frame/mdm/mdmModule/entity/MdmModuleEntity.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModule/entity/MdmModuleEntity.xml b/service/src/main/java/com/hzya/frame/mdm/mdmModule/entity/MdmModuleEntity.xml index bd141eed..d9571819 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModule/entity/MdmModuleEntity.xml +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModule/entity/MdmModuleEntity.xml @@ -379,7 +379,7 @@ where id = #{id} `org_id` varchar(50) DEFAULT NULL COMMENT '组织机构ID', `company_id` varchar(50) DEFAULT NULL COMMENT '公司id', `data_type` varchar(255) DEFAULT NULL COMMENT '状态 1、成功2、失败', - `remark` varchar(255) DEFAULT NULL COMMENT '备注', + `remark` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci COMMENT '备注', `id` varchar(50) NOT NULL COMMENT '唯一标识码', @@ -397,7 +397,7 @@ where id = #{id} `org_id` varchar(50) DEFAULT NULL COMMENT '组织机构ID', `company_id` varchar(50) DEFAULT NULL COMMENT '公司id', `data_type` varchar(50) DEFAULT NULL COMMENT '状态 1、成功2、失败', - `remark` varchar(255) DEFAULT NULL COMMENT '备注', + `remark` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci COMMENT '备注', `distribute_id` varchar(50) DEFAULT NULL COMMENT 'distribute_id', `api_id` varchar(50) DEFAULT NULL COMMENT 'apiid', `app_id` varchar(50) DEFAULT NULL COMMENT 'app_id', From 97a4f62a8d9b0c19750e9bded63330db2673c169 Mon Sep 17 00:00:00 2001 From: lvleigang <957075182@qq.com> Date: Fri, 13 Sep 2024 09:48:32 +0800 Subject: [PATCH 03/10] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=BB=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E8=A7=84=E5=88=99=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hzya/frame/mdm/mdmModule/entity/MdmModuleEntity.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModule/entity/MdmModuleEntity.xml b/service/src/main/java/com/hzya/frame/mdm/mdmModule/entity/MdmModuleEntity.xml index d9571819..629067a8 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModule/entity/MdmModuleEntity.xml +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModule/entity/MdmModuleEntity.xml @@ -985,20 +985,20 @@ where id = #{id} - ${item.rightParenthesis} and + ${item.rightParenthesis} - ${item.rightParenthesis} + ${item.rightParenthesis} and - ${item.rightParenthesis} or + ${item.rightParenthesis} - ${item.rightParenthesis} + ${item.rightParenthesis} or From 55d5d4399dafd56896fb39d0a74fab82d21a6d31 Mon Sep 17 00:00:00 2001 From: username Date: Sat, 14 Sep 2024 15:50:13 +0800 Subject: [PATCH 04/10] =?UTF-8?q?=E6=B6=88=E6=81=AF=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E3=80=81=E6=B6=88=E6=81=AF=E6=A8=A1=E7=89=88=E3=80=81=E9=A2=84?= =?UTF-8?q?=E8=AD=A6=E8=AE=BE=E7=BD=AE=E3=80=81=E6=B6=88=E6=81=AF=E5=8D=95?= =?UTF-8?q?=E6=AC=A1/=E5=AE=9A=E6=97=B6=E6=8E=A8=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plugin/PushMessagePluginInitializer.java | 1 + .../com/hzya/frame/basedao/dao/IBaseDao.java | 2 + .../frame/basedao/dao/MybatisGenericDao.java | 5 + .../api/entity/SysApplicationApiEntity.xml | 112 ++- .../service/ISysApplicationApiService.java | 2 + .../impl/SysApplicationApiServiceImpl.java | 40 + .../entity/SysApplicationEntity.java | 10 + .../impl/SysApplicationServiceImpl.java | 2 +- .../entity/SysMessageTemplateEntity.java | 44 +- .../entity/SysMessageTemplateEntity.xml | 40 +- .../impl/SysMessageTemplateServiceImpl.java | 24 +- .../sysnew/person/entity/SysPersonEntity.xml | 133 ++-- .../entity/SysPushMessageEntity.java | 10 - .../entity/SysPushMessageEntity.xml | 10 +- .../impl/SysPushMessageServiceImpl.java | 1 + .../entity/SysSendMessageLogEntity.java | 102 ++- .../entity/SysSendMessageLogEntity.xml | 224 +++--- .../service/ISysSendMessageLogService.java | 2 + .../impl/SysSendMessageLogServiceImpl.java | 739 ++++++++++-------- .../sysnew/user/entity/SysUserEntity.java | 2 + .../sysnew/user/service/ISysUserService.java | 3 + .../user/service/impl/SysUserServiceImpl.java | 14 + .../entity/SysWarningConfigEntity.java | 76 +- .../entity/SysWarningConfigEntity.xml | 98 +-- .../impl/SysWarningConfigServiceImpl.java | 260 +++++- .../entity/SysWarningInterfaceEntity.java | 21 +- .../entity/SysWarningInterfaceEntity.xml | 64 +- .../service/ISysWarningInterfaceService.java | 2 + .../impl/SysWarningInterfaceServiceImpl.java | 53 +- 29 files changed, 1291 insertions(+), 805 deletions(-) diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/pushMessage/plugin/PushMessagePluginInitializer.java b/buildpackage/src/main/java/com/hzya/frame/plugin/pushMessage/plugin/PushMessagePluginInitializer.java index 3e0a996f..3bc07a67 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/pushMessage/plugin/PushMessagePluginInitializer.java +++ b/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/common/src/main/java/com/hzya/frame/basedao/dao/IBaseDao.java b/common/src/main/java/com/hzya/frame/basedao/dao/IBaseDao.java index 1b9d09b3..094e87af 100644 --- a/common/src/main/java/com/hzya/frame/basedao/dao/IBaseDao.java +++ b/common/src/main/java/com/hzya/frame/basedao/dao/IBaseDao.java @@ -22,6 +22,8 @@ public interface IBaseDao { */ List getAll(); + List getWarningAppList(); + /** * 查询一个对象 * @param paramString mapper ID diff --git a/common/src/main/java/com/hzya/frame/basedao/dao/MybatisGenericDao.java b/common/src/main/java/com/hzya/frame/basedao/dao/MybatisGenericDao.java index 95e43393..6c9dea71 100644 --- a/common/src/main/java/com/hzya/frame/basedao/dao/MybatisGenericDao.java +++ b/common/src/main/java/com/hzya/frame/basedao/dao/MybatisGenericDao.java @@ -115,6 +115,11 @@ public abstract class MybatisGenericDao getWarningAppList(){ + List tempList = this.sqlSession.selectList(getSqlIdPrifx() + "warning_app_list"); + return tempList; + } + @Override @DS("#param.dataSourceCode") public List query(Serializable param) { diff --git a/service/src/main/java/com/hzya/frame/sysnew/application/api/entity/SysApplicationApiEntity.xml b/service/src/main/java/com/hzya/frame/sysnew/application/api/entity/SysApplicationApiEntity.xml index 089b6eb5..f2d0a1dc 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/application/api/entity/SysApplicationApiEntity.xml +++ b/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/service/src/main/java/com/hzya/frame/sysnew/application/api/service/ISysApplicationApiService.java b/service/src/main/java/com/hzya/frame/sysnew/application/api/service/ISysApplicationApiService.java index 2218bf04..52272f22 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/application/api/service/ISysApplicationApiService.java +++ b/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/service/src/main/java/com/hzya/frame/sysnew/application/entity/SysApplicationEntity.java b/service/src/main/java/com/hzya/frame/sysnew/application/entity/SysApplicationEntity.java index 3eb1ff34..3be0953f 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/application/entity/SysApplicationEntity.java +++ b/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/service/src/main/java/com/hzya/frame/sysnew/application/service/impl/SysApplicationServiceImpl.java b/service/src/main/java/com/hzya/frame/sysnew/application/service/impl/SysApplicationServiceImpl.java index b6ad01cd..2a11d6ef 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/application/service/impl/SysApplicationServiceImpl.java +++ b/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/service/src/main/java/com/hzya/frame/sysnew/messageTemplate/entity/SysMessageTemplateEntity.java b/service/src/main/java/com/hzya/frame/sysnew/messageTemplate/entity/SysMessageTemplateEntity.java index 5cda5ede..5a1ba2a6 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/messageTemplate/entity/SysMessageTemplateEntity.java +++ b/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/service/src/main/java/com/hzya/frame/sysnew/messageTemplate/entity/SysMessageTemplateEntity.xml b/service/src/main/java/com/hzya/frame/sysnew/messageTemplate/entity/SysMessageTemplateEntity.xml index 80002b16..e1cf60d5 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/messageTemplate/entity/SysMessageTemplateEntity.xml +++ b/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/service/src/main/java/com/hzya/frame/sysnew/messageTemplate/service/impl/SysMessageTemplateServiceImpl.java b/service/src/main/java/com/hzya/frame/sysnew/messageTemplate/service/impl/SysMessageTemplateServiceImpl.java index 7f4db12a..43acb849 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/messageTemplate/service/impl/SysMessageTemplateServiceImpl.java +++ b/service/src/main/java/com/hzya/frame/sysnew/messageTemplate/service/impl/SysMessageTemplateServiceImpl.java @@ -85,9 +85,6 @@ public class SysMessageTemplateServiceImpl extends BaseService id - ,organ_id - ,person_code - ,person_name - ,sex + ,organ_id + ,person_code + ,person_name + ,sex ,mobile_phone - ,entry_time - ,email - ,degree_id - ,post_id - ,level_id - ,birth_day - ,tel_phone - ,hometown - ,id_card - ,address - ,leave_time - ,state - ,remark - ,dd_user_id - ,wx_user_id - ,head_image_id - ,sorts - ,create_user_id - ,create_time - ,modify_user_id - ,modify_time - ,sts - ,org_id - ,company_id - + ,entry_time + ,email + ,degree_id + ,post_id + ,level_id + ,birth_day + ,tel_phone + ,hometown + ,id_card + ,address + ,leave_time + ,state + ,remark + ,dd_user_id + ,wx_user_id + ,head_image_id + ,sorts + ,create_user_id + ,create_time + ,modify_user_id + ,modify_time + ,sts + ,org_id + ,company_id + @@ -314,7 +314,7 @@ a.id + > insert into sys_person( id , @@ -476,9 +476,9 @@ a.id -update sys_person set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} -where id = #{id} - + update sys_person set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} + where id = #{id} + update sys_person set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} @@ -513,8 +513,7 @@ where id = #{id} - delete from sys_person where id = #{id} - + delete from sys_person where id = #{id} + - diff --git a/service/src/main/java/com/hzya/frame/sysnew/pushMessage/entity/SysPushMessageEntity.java b/service/src/main/java/com/hzya/frame/sysnew/pushMessage/entity/SysPushMessageEntity.java index 94eeb61f..9f5ba071 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/pushMessage/entity/SysPushMessageEntity.java +++ b/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/service/src/main/java/com/hzya/frame/sysnew/pushMessage/entity/SysPushMessageEntity.xml b/service/src/main/java/com/hzya/frame/sysnew/pushMessage/entity/SysPushMessageEntity.xml index 0916a33a..547ed5e9 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/pushMessage/entity/SysPushMessageEntity.xml +++ b/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/service/src/main/java/com/hzya/frame/sysnew/pushMessage/service/impl/SysPushMessageServiceImpl.java b/service/src/main/java/com/hzya/frame/sysnew/pushMessage/service/impl/SysPushMessageServiceImpl.java index 28a7028d..c3200814 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/pushMessage/service/impl/SysPushMessageServiceImpl.java +++ b/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/service/src/main/java/com/hzya/frame/sysnew/sendMessageLog/entity/SysSendMessageLogEntity.java b/service/src/main/java/com/hzya/frame/sysnew/sendMessageLog/entity/SysSendMessageLogEntity.java index 6e88baf2..b425872e 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/sendMessageLog/entity/SysSendMessageLogEntity.java +++ b/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/service/src/main/java/com/hzya/frame/sysnew/sendMessageLog/entity/SysSendMessageLogEntity.xml b/service/src/main/java/com/hzya/frame/sysnew/sendMessageLog/entity/SysSendMessageLogEntity.xml index 144a67e7..5c80f848 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/sendMessageLog/entity/SysSendMessageLogEntity.xml +++ b/service/src/main/java/com/hzya/frame/sysnew/sendMessageLog/entity/SysSendMessageLogEntity.xml @@ -12,31 +12,24 @@ - - - + + + + + + + + + - - - - - - - - - - - - - id @@ -47,53 +40,64 @@ ,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 +114,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 +131,45 @@ @@ -172,10 +188,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 +216,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 +239,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 +278,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 +297,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 +322,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 +339,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/service/src/main/java/com/hzya/frame/sysnew/sendMessageLog/service/ISysSendMessageLogService.java b/service/src/main/java/com/hzya/frame/sysnew/sendMessageLog/service/ISysSendMessageLogService.java index 929a22b3..0472f9ac 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/sendMessageLog/service/ISysSendMessageLogService.java +++ b/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; + @Resource + private ApplicationCache applicationCache; + @Resource + private ISysWarningInterfaceDao sysWarningInterfaceDao; + @Resource + private ISysWarningConfigDao sysWarningConfigDao; + @Resource + private ISysMessageTemplateDao sysMessageTemplateDao; + @Resource + private ISysUserDao sysUserDao; + @Resource + private ISysPersonDao sysPersonsDao; - private ISysSendMessageLogDao sysSendMessageLogDao; + @Resource + private ISysApplicationApiDao sysApplicationApiDao; + @Resource + private ISysApplicationApiParaDao sysApplicationApiParaDao; - @Autowired - public void setSysSendMessageLogDao(ISysSendMessageLogDao dao) { - this.sysSendMessageLogDao = dao; - this.dao = dao; - } + private ISysSendMessageLogDao sysSendMessageLogDao; - @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); - } + @Autowired + public void setSysSendMessageLogDao(ISysSendMessageLogDao dao) { + this.sysSendMessageLogDao = dao; + this.dao = dao; + } - @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 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 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 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 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 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 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 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 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 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(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("http://127.0.0.1:9999/kangarooDataCenterV3/entranceController/externalCallInterface"). - 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("http://127.0.0.1:9999/kangarooDataCenterV3/entranceController/externalCallInterface"). + 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/service/src/main/java/com/hzya/frame/sysnew/user/entity/SysUserEntity.java b/service/src/main/java/com/hzya/frame/sysnew/user/entity/SysUserEntity.java index 8358eb94..c1b298e4 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/user/entity/SysUserEntity.java +++ b/service/src/main/java/com/hzya/frame/sysnew/user/entity/SysUserEntity.java @@ -86,6 +86,8 @@ public class SysUserEntity extends BaseEntity { private String wxUserId; + //private String personName; + public String getDdUserId() { return ddUserId; } diff --git a/service/src/main/java/com/hzya/frame/sysnew/user/service/ISysUserService.java b/service/src/main/java/com/hzya/frame/sysnew/user/service/ISysUserService.java index 559a5424..b9425a67 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/user/service/ISysUserService.java +++ b/service/src/main/java/com/hzya/frame/sysnew/user/service/ISysUserService.java @@ -31,6 +31,9 @@ public interface ISysUserService extends IBaseService { **/ JsonResultEntity queryEntity(JSONObject jsonObject); + /**查找配置了预警应用的用户列表*/ + JsonResultEntity queryWarningEntity(JSONObject jsonObject); + /** * @param jsonObject * @return com.hzya.frame.web.entity.JsonResultEntity diff --git a/service/src/main/java/com/hzya/frame/sysnew/user/service/impl/SysUserServiceImpl.java b/service/src/main/java/com/hzya/frame/sysnew/user/service/impl/SysUserServiceImpl.java index e7648cce..faa4c703 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/user/service/impl/SysUserServiceImpl.java +++ b/service/src/main/java/com/hzya/frame/sysnew/user/service/impl/SysUserServiceImpl.java @@ -125,6 +125,20 @@ public class SysUserServiceImpl extends BaseService imple return BaseResult.getSuccessMessageEntity("查询数据成功", list); } + @Override + public JsonResultEntity queryWarningEntity(JSONObject jsonObject){ + String warningApp = jsonObject.getJSONObject("jsonStr").getString("warningApp"); + switch (warningApp){ + case "6WX": + //List list = sysUserDao + break; + case "5DD": + + break; + } + return BaseResult.getSuccessMessageEntity("查询数据成功", null); + } + /** * @param jsonObject * @return com.hzya.frame.web.entity.JsonResultEntity diff --git a/service/src/main/java/com/hzya/frame/sysnew/warningConfig/entity/SysWarningConfigEntity.java b/service/src/main/java/com/hzya/frame/sysnew/warningConfig/entity/SysWarningConfigEntity.java index 11be0abe..61d21a2e 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/warningConfig/entity/SysWarningConfigEntity.java +++ b/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/service/src/main/java/com/hzya/frame/sysnew/warningConfig/entity/SysWarningConfigEntity.xml b/service/src/main/java/com/hzya/frame/sysnew/warningConfig/entity/SysWarningConfigEntity.xml index c7ff7a11..eeb0bcea 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/warningConfig/entity/SysWarningConfigEntity.xml +++ b/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 select - - from sys_warning_config + config.* + ,template.template_name + from sys_warning_config config + LEFT JOIN sys_message_template template ON template.id = config.message_template_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 message_template_id like concat('%',#{messageTemplateId},'%') - and app_id like concat('%',#{appId},'%') - and warning_app_id like concat('%',#{warningAppId},'%') - and accept_message_api_code like concat('%',#{acceptMessageApiCode},'%') - and remark like concat('%',#{remark},'%') - and status like concat('%',#{status},'%') - and recipient_id like concat('%',#{recipientId},'%') - and sts='Y' + and config.id like concat('%',#{id},'%') + and config.sorts like concat('%',#{sorts},'%') + and config.create_user_id like concat('%',#{create_user_id},'%') + and config.create_time like concat('%',#{create_time},'%') + and config.modify_user_id like concat('%',#{modify_user_id},'%') + and config.modify_time like concat('%',#{modify_time},'%') + and config.sts like concat('%',#{sts},'%') + and config.org_id like concat('%',#{org_id},'%') + and config.company_id like concat('%',#{companyId},'%') + and config.message_template_id like concat('%',#{messageTemplateId},'%') + and config.app_id_list like concat('%',#{appIdList},'%') + and config.warning_app_id like concat('%',#{warningAppId},'%') + and config.accept_message_api_code like concat('%',#{acceptMessageApiCode},'%') + and config.remark like concat('%',#{remark},'%') + and config.status like concat('%',#{status},'%') + and config.recipient_id_list like concat('%',#{recipientIdList},'%') + and config.sts='Y' - order by sorts asc + order by config.sorts asc order by ${sort} ${order} @@ -144,12 +150,12 @@ or org_id = #{org_id} or company_id = #{companyId} or message_template_id = #{messageTemplateId} - or app_id = #{appId} + or app_id_list = #{appIdList} or warning_app_id = #{warningAppId} or accept_message_api_code = #{acceptMessageApiCode} or remark = #{remark} or status = #{status} - or recipient_id = #{recipientId} + or recipient_id_list = #{recipientIdList} and sts='Y' order by sorts asc @@ -170,12 +176,12 @@ 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 , sts, )values( @@ -190,30 +196,30 @@ #{org_id} , #{companyId} , #{messageTemplateId} , - #{appId} , + #{appIdList} , #{warningAppId} , #{acceptMessageApiCode} , #{remark} , #{status} , - #{recipientId} , + #{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, 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 +230,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 +248,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 +271,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/service/src/main/java/com/hzya/frame/sysnew/warningConfig/service/impl/SysWarningConfigServiceImpl.java b/service/src/main/java/com/hzya/frame/sysnew/warningConfig/service/impl/SysWarningConfigServiceImpl.java index 7634e93f..370faee7 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/warningConfig/service/impl/SysWarningConfigServiceImpl.java +++ b/service/src/main/java/com/hzya/frame/sysnew/warningConfig/service/impl/SysWarningConfigServiceImpl.java @@ -1,11 +1,20 @@ 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.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 +22,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 +33,17 @@ 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; + private ISysWarningConfigDao sysWarningConfigDao; @Autowired @@ -40,7 +60,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 +73,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 +88,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 +273,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/service/src/main/java/com/hzya/frame/sysnew/warningInterface/entity/SysWarningInterfaceEntity.java b/service/src/main/java/com/hzya/frame/sysnew/warningInterface/entity/SysWarningInterfaceEntity.java index fa2181c9..c9abb5c7 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/warningInterface/entity/SysWarningInterfaceEntity.java +++ b/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/service/src/main/java/com/hzya/frame/sysnew/warningInterface/entity/SysWarningInterfaceEntity.xml b/service/src/main/java/com/hzya/frame/sysnew/warningInterface/entity/SysWarningInterfaceEntity.xml index 663e7cd1..f22c6755 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/warningInterface/entity/SysWarningInterfaceEntity.xml +++ b/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 + + @@ -155,6 +179,7 @@ push_method , status , warning_config_id , + app_id , sts, )values( @@ -173,6 +198,7 @@ #{pushMethod} , #{status} , #{warningConfigId} , + #{appId} , 'Y', ) diff --git a/service/src/main/java/com/hzya/frame/sysnew/warningInterface/service/ISysWarningInterfaceService.java b/service/src/main/java/com/hzya/frame/sysnew/warningInterface/service/ISysWarningInterfaceService.java index 09f2ff30..b8514bc7 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/warningInterface/service/ISysWarningInterfaceService.java +++ b/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); + } + } From 98efa0a7c9a93538f143d053ac658a34ed5f5850 Mon Sep 17 00:00:00 2001 From: "476474485@qq.com" Date: Sat, 14 Sep 2024 17:15:52 +0800 Subject: [PATCH 05/10] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E7=A7=BB=E5=8A=A8?= =?UTF-8?q?=E7=AB=AF=E8=B7=A8=E5=9F=9F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../webapp/web/corsconfig/CorsConfig.java | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 webapp/src/main/java/com/hzya/frame/webapp/web/corsconfig/CorsConfig.java diff --git a/webapp/src/main/java/com/hzya/frame/webapp/web/corsconfig/CorsConfig.java b/webapp/src/main/java/com/hzya/frame/webapp/web/corsconfig/CorsConfig.java new file mode 100644 index 00000000..36acaac4 --- /dev/null +++ b/webapp/src/main/java/com/hzya/frame/webapp/web/corsconfig/CorsConfig.java @@ -0,0 +1,24 @@ +package com.hzya.frame.webapp.web.corsconfig; + +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.config.annotation.CorsRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +/** + * @author 👻👻👻👻👻👻👻👻👻👻 gjh + * @version 1.0 + * @content + * @date 2024-09-14 17:10 + */ +@Configuration +public class CorsConfig implements WebMvcConfigurer { + + @Override + public void addCorsMappings(CorsRegistry registry) { + registry.addMapping("/**") + .allowedOrigins("*") + .allowedMethods("GET", "POST", "PUT", "DELETE") + .allowedHeaders("*") + .allowCredentials(true); + } +} From 7409f90e2ffab1f4772e2fd892d8c5ecd8c5294c Mon Sep 17 00:00:00 2001 From: username Date: Wed, 18 Sep 2024 10:37:36 +0800 Subject: [PATCH 06/10] =?UTF-8?q?=E6=8E=A8=E9=80=81=E6=B6=88=E6=81=AFurl?= =?UTF-8?q?=E6=94=B9=E5=8A=A8=EF=BC=8C=E6=B6=88=E6=81=AF=E6=8E=A8=E9=80=81?= =?UTF-8?q?=E5=87=A0=E4=B8=AA=E6=9F=A5=E8=AF=A2=E5=85=B3=E8=81=94=E8=A1=A8?= =?UTF-8?q?sql=E8=AF=AD=E5=8F=A5=E8=A1=A5=E5=85=85sts=3D=E2=80=98Y?= =?UTF-8?q?=E2=80=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../entity/SysMessageManageLogEntity.xml | 4 +++- .../sendMessageLog/entity/SysSendMessageLogEntity.xml | 11 ++++++++++- .../service/impl/SysSendMessageLogServiceImpl.java | 2 +- .../warningConfig/entity/SysWarningConfigEntity.xml | 3 ++- .../entity/SysWarningInterfaceEntity.xml | 1 + 5 files changed, 17 insertions(+), 4 deletions(-) diff --git a/service/src/main/java/com/hzya/frame/sysnew/messageManageLog/entity/SysMessageManageLogEntity.xml b/service/src/main/java/com/hzya/frame/sysnew/messageManageLog/entity/SysMessageManageLogEntity.xml index 5c02e0bb..990d106a 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/messageManageLog/entity/SysMessageManageLogEntity.xml +++ b/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/service/src/main/java/com/hzya/frame/sysnew/sendMessageLog/entity/SysSendMessageLogEntity.xml b/service/src/main/java/com/hzya/frame/sysnew/sendMessageLog/entity/SysSendMessageLogEntity.xml index 5c80f848..b0e9b621 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/sendMessageLog/entity/SysSendMessageLogEntity.xml +++ b/service/src/main/java/com/hzya/frame/sysnew/sendMessageLog/entity/SysSendMessageLogEntity.xml @@ -62,7 +62,7 @@ from sys_send_message_log log LEFT JOIN sys_person p1 ON p1.id = log.recipients_person_id LEFT JOIN sys_person p2 ON p2.id = log.send_person_id - where log.id = #{ id } and log.sts='Y' + where log.id = #{ id } and log.sts='Y' and p1.sts='Y' and p2.sts='Y' @@ -129,6 +129,7 @@ and config.status like concat('%',#{status},'%') and config.recipient_id_list like concat('%',#{recipientIdList},'%') and config.sts='Y' + and template.sts='Y' order by config.sorts asc order by ${sort} ${order} diff --git a/service/src/main/java/com/hzya/frame/sysnew/warningInterface/entity/SysWarningInterfaceEntity.xml b/service/src/main/java/com/hzya/frame/sysnew/warningInterface/entity/SysWarningInterfaceEntity.xml index f22c6755..f43f9f82 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/warningInterface/entity/SysWarningInterfaceEntity.xml +++ b/service/src/main/java/com/hzya/frame/sysnew/warningInterface/entity/SysWarningInterfaceEntity.xml @@ -130,6 +130,7 @@ and i.status like concat('%',#{status},'%') and i.warning_config_id like concat('%',#{warningConfigId},'%') and i.sts='Y' + and app.sts='Y' order by i.sorts asc order by ${sort} ${order} From b038b7e0c276ba0c8b77a853c54114b75b5fe15f Mon Sep 17 00:00:00 2001 From: username Date: Wed, 18 Sep 2024 10:53:02 +0800 Subject: [PATCH 07/10] =?UTF-8?q?=E8=B7=A8=E5=9F=9F=E6=8A=A5=E9=94=99?= =?UTF-8?q?=E3=80=81zt=EF=BC=9Aurl=E4=BD=BF=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- buildpackage/src/main/resources/application-zqtlocal.yml | 2 +- .../service/impl/SysSendMessageLogServiceImpl.java | 6 +++++- .../com/hzya/frame/webapp/web/corsconfig/CorsConfig.java | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/buildpackage/src/main/resources/application-zqtlocal.yml b/buildpackage/src/main/resources/application-zqtlocal.yml index ffff00a3..3f1d773b 100644 --- a/buildpackage/src/main/resources/application-zqtlocal.yml +++ b/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:9999/kangarooDataCenterV3/entranceController/externalCallInterface \ No newline at end of file diff --git a/service/src/main/java/com/hzya/frame/sysnew/sendMessageLog/service/impl/SysSendMessageLogServiceImpl.java b/service/src/main/java/com/hzya/frame/sysnew/sendMessageLog/service/impl/SysSendMessageLogServiceImpl.java index b6e8019c..962f48e5 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/sendMessageLog/service/impl/SysSendMessageLogServiceImpl.java +++ b/service/src/main/java/com/hzya/frame/sysnew/sendMessageLog/service/impl/SysSendMessageLogServiceImpl.java @@ -29,6 +29,7 @@ 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.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.beans.factory.annotation.Autowired; @@ -67,6 +68,9 @@ public class SysSendMessageLogServiceImpl extends BaseService Date: Wed, 18 Sep 2024 14:15:19 +0800 Subject: [PATCH 08/10] =?UTF-8?q?=E6=B6=88=E6=81=AF=E6=A8=A1=E7=89=88?= =?UTF-8?q?=E8=A2=AB=E5=BC=95=E7=94=A8=E8=BF=87=EF=BC=8C=E5=B0=B1=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E5=88=A0=E9=99=A4=20=E5=81=9C=E7=94=A8=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E6=A8=A1=E7=89=88=E6=97=B6=EF=BC=8C=E5=90=8C=E6=AD=A5?= =?UTF-8?q?=E5=81=9C=E7=94=A8=E5=AF=B9=E5=BA=94=E9=A2=84=E8=AD=A6=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=20=E6=8E=A8=E9=80=81=E6=B6=88=E6=81=AF=E6=97=B6?= =?UTF-8?q?=EF=BC=8C=E6=A0=A1=E9=AA=8C=E9=A2=84=E8=AD=A6=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E4=B8=AD=E6=B6=88=E6=81=AF=E6=A8=A1=E7=89=88=E5=90=AF=E7=94=A8?= =?UTF-8?q?=E7=8A=B6=E6=80=81=20=E9=A2=84=E8=AD=A6=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E5=90=AF=E7=94=A8=E6=97=B6=EF=BC=8C=E6=A0=A1=E9=AA=8C=E8=AF=A5?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E4=B8=AD=E5=AF=B9=E5=BA=94=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E6=A8=A1=E7=89=88=E6=98=AF=E5=90=A6=E5=90=AF=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/SysMessageTemplateServiceImpl.java | 310 ++++++++++-------- .../impl/SysSendMessageLogServiceImpl.java | 4 + .../impl/SysWarningConfigServiceImpl.java | 16 + 3 files changed, 186 insertions(+), 144 deletions(-) diff --git a/service/src/main/java/com/hzya/frame/sysnew/messageTemplate/service/impl/SysMessageTemplateServiceImpl.java b/service/src/main/java/com/hzya/frame/sysnew/messageTemplate/service/impl/SysMessageTemplateServiceImpl.java index 43acb849..6930fd2c 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/messageTemplate/service/impl/SysMessageTemplateServiceImpl.java +++ b/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,160 +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.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 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.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 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/service/src/main/java/com/hzya/frame/sysnew/sendMessageLog/service/impl/SysSendMessageLogServiceImpl.java b/service/src/main/java/com/hzya/frame/sysnew/sendMessageLog/service/impl/SysSendMessageLogServiceImpl.java index 962f48e5..0b03ee45 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/sendMessageLog/service/impl/SysSendMessageLogServiceImpl.java +++ b/service/src/main/java/com/hzya/frame/sysnew/sendMessageLog/service/impl/SysSendMessageLogServiceImpl.java @@ -249,6 +249,10 @@ public class SysSendMessageLogServiceImpl extends BaseService Date: Wed, 18 Sep 2024 16:07:33 +0800 Subject: [PATCH 09/10] =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E9=9C=80=E8=A6=81?= =?UTF-8?q?=E7=9A=84=E5=BA=94=E7=94=A8=E6=96=B9=E6=B3=95=EF=BC=8C=E5=86=99?= =?UTF-8?q?=E5=88=B0sysWarningInterface=E7=9A=84dao=E5=B1=82=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/hzya/frame/basedao/dao/IBaseDao.java | 2 -- .../com/hzya/frame/basedao/dao/MybatisGenericDao.java | 5 ----- .../warningInterface/dao/ISysWarningInterfaceDao.java | 5 ++++- .../dao/impl/SysWarningInterfaceDaoImpl.java | 9 ++++++++- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/common/src/main/java/com/hzya/frame/basedao/dao/IBaseDao.java b/common/src/main/java/com/hzya/frame/basedao/dao/IBaseDao.java index 094e87af..1b9d09b3 100644 --- a/common/src/main/java/com/hzya/frame/basedao/dao/IBaseDao.java +++ b/common/src/main/java/com/hzya/frame/basedao/dao/IBaseDao.java @@ -22,8 +22,6 @@ public interface IBaseDao { */ List getAll(); - List getWarningAppList(); - /** * 查询一个对象 * @param paramString mapper ID diff --git a/common/src/main/java/com/hzya/frame/basedao/dao/MybatisGenericDao.java b/common/src/main/java/com/hzya/frame/basedao/dao/MybatisGenericDao.java index 6c9dea71..95e43393 100644 --- a/common/src/main/java/com/hzya/frame/basedao/dao/MybatisGenericDao.java +++ b/common/src/main/java/com/hzya/frame/basedao/dao/MybatisGenericDao.java @@ -115,11 +115,6 @@ public abstract class MybatisGenericDao getWarningAppList(){ - List tempList = this.sqlSession.selectList(getSqlIdPrifx() + "warning_app_list"); - return tempList; - } - @Override @DS("#param.dataSourceCode") public List query(Serializable param) { diff --git a/service/src/main/java/com/hzya/frame/sysnew/warningInterface/dao/ISysWarningInterfaceDao.java b/service/src/main/java/com/hzya/frame/sysnew/warningInterface/dao/ISysWarningInterfaceDao.java index 544241f6..61a64efa 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/warningInterface/dao/ISysWarningInterfaceDao.java +++ b/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/service/src/main/java/com/hzya/frame/sysnew/warningInterface/dao/impl/SysWarningInterfaceDaoImpl.java b/service/src/main/java/com/hzya/frame/sysnew/warningInterface/dao/impl/SysWarningInterfaceDaoImpl.java index 655eb183..fdcbb1f2 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/warningInterface/dao/impl/SysWarningInterfaceDaoImpl.java +++ b/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; + } } From c5182abbff6ded2727a0493630e91581da6acb69 Mon Sep 17 00:00:00 2001 From: username Date: Sat, 21 Sep 2024 11:55:58 +0800 Subject: [PATCH 10/10] =?UTF-8?q?=E6=8F=92=E4=BB=B6=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=8F=92=E4=BB=B6=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../entity/SysApplicationPluginDto.java | 10 + .../entity/SysApplicationPluginEntity.java | 22 +- .../entity/SysApplicationPluginEntity.xml | 77 ++++--- .../dao/ISysApplicationPluginTypeDao.java | 15 ++ .../impl/SysApplicationPluginTypeDaoImpl.java | 17 ++ .../SysApplicationPluginTypeEntity.java | 25 +++ .../entity/SysApplicationPluginTypeEntity.xml | 201 ++++++++++++++++++ .../ISysApplicationPluginTypeService.java | 22 ++ .../SysApplicationPluginTypeServiceImpl.java | 106 +++++++++ .../impl/SysWarningConfigServiceImpl.java | 4 + 10 files changed, 467 insertions(+), 32 deletions(-) create mode 100644 service/src/main/java/com/hzya/frame/sysnew/application/pluginType/dao/ISysApplicationPluginTypeDao.java create mode 100644 service/src/main/java/com/hzya/frame/sysnew/application/pluginType/dao/impl/SysApplicationPluginTypeDaoImpl.java create mode 100644 service/src/main/java/com/hzya/frame/sysnew/application/pluginType/entity/SysApplicationPluginTypeEntity.java create mode 100644 service/src/main/java/com/hzya/frame/sysnew/application/pluginType/entity/SysApplicationPluginTypeEntity.xml create mode 100644 service/src/main/java/com/hzya/frame/sysnew/application/pluginType/service/ISysApplicationPluginTypeService.java create mode 100644 service/src/main/java/com/hzya/frame/sysnew/application/pluginType/service/impl/SysApplicationPluginTypeServiceImpl.java diff --git a/service/src/main/java/com/hzya/frame/sysnew/application/plugin/entity/SysApplicationPluginDto.java b/service/src/main/java/com/hzya/frame/sysnew/application/plugin/entity/SysApplicationPluginDto.java index 54a3dc3f..8825215f 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/application/plugin/entity/SysApplicationPluginDto.java +++ b/service/src/main/java/com/hzya/frame/sysnew/application/plugin/entity/SysApplicationPluginDto.java @@ -20,6 +20,16 @@ public class SysApplicationPluginDto { private Integer pageNum; private Integer pageSize; + private String typeId; + + public String getTypeId() { + return typeId; + } + + public void setTypeId(String typeId) { + this.typeId = typeId; + } + public String getAppId() { return appId; } diff --git a/service/src/main/java/com/hzya/frame/sysnew/application/plugin/entity/SysApplicationPluginEntity.java b/service/src/main/java/com/hzya/frame/sysnew/application/plugin/entity/SysApplicationPluginEntity.java index 5929e14b..79b8c326 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/application/plugin/entity/SysApplicationPluginEntity.java +++ b/service/src/main/java/com/hzya/frame/sysnew/application/plugin/entity/SysApplicationPluginEntity.java @@ -22,13 +22,33 @@ public class SysApplicationPluginEntity extends BaseEntity { private String pluginVersion; /** 描述 */ private String pluginRemark; + /** 插件类型id */ + private String typeId; + /** 插件类型名称 */ + private String typeName; /** 发布日期 */ private Date releaseDate; /** 启用停用(1启用2停用) */ private String pluginStatus; - + /** 附件id */ private String attachmentId; + public String getTypeName() { + return typeName; + } + + public void setTypeName(String typeName) { + this.typeName = typeName; + } + + public String getTypeId() { + return typeId; + } + + public void setTypeId(String typeId) { + this.typeId = typeId; + } + public String getPluginPackageName() { return pluginPackageName; } diff --git a/service/src/main/java/com/hzya/frame/sysnew/application/plugin/entity/SysApplicationPluginEntity.xml b/service/src/main/java/com/hzya/frame/sysnew/application/plugin/entity/SysApplicationPluginEntity.xml index 90b5444d..5ba4c199 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/application/plugin/entity/SysApplicationPluginEntity.xml +++ b/service/src/main/java/com/hzya/frame/sysnew/application/plugin/entity/SysApplicationPluginEntity.xml @@ -20,6 +20,8 @@ + + @@ -40,6 +42,7 @@ ,org_id ,attachment_id ,plugin_package_name + ,type_id - select - - from sys_application_plugin + SELECT + p.*, + type.NAME AS type_name + FROM + sys_application_plugin p + LEFT JOIN sys_application_plugin_type type ON p.type_id = type.id - and id like concat('%',#{id},'%') - and app_id like concat('%',#{appId},'%') - and plugin_name like concat('%',#{pluginName},'%') - and plugin_code like concat('%',#{pluginCode},'%') - and plugin_version like concat('%',#{pluginVersion},'%') - and plugin_remark like concat('%',#{pluginRemark},'%') - and release_date like concat('%',#{releaseDate},'%') - and plugin_status like concat('%',#{pluginStatus},'%') - 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 attachment_id like concat('%',#{attachmentId},'%') - and plugin_package_name like concat('%',#{pluginPackageName},'%') - and sts='Y' + and p.id like concat('%',#{id},'%') + and p.app_id like concat('%',#{appId},'%') + and p.plugin_name like concat('%',#{pluginName},'%') + and p.plugin_code like concat('%',#{pluginCode},'%') + and p.plugin_version like concat('%',#{pluginVersion},'%') + and p.plugin_remark like concat('%',#{pluginRemark},'%') + and p.release_date like concat('%',#{releaseDate},'%') + and p.plugin_status like concat('%',#{pluginStatus},'%') + and p.sorts like concat('%',#{sorts},'%') + and p.create_user_id like concat('%',#{create_user_id},'%') + and p.create_time like concat('%',#{create_time},'%') + and p.modify_user_id like concat('%',#{modify_user_id},'%') + and p.modify_time like concat('%',#{modify_time},'%') + and p.sts like concat('%',#{sts},'%') + and p.org_id like concat('%',#{org_id},'%') + and p.attachment_id like concat('%',#{attachmentId},'%') + and p.plugin_package_name like concat('%',#{pluginPackageName},'%') + and p.type_id like concat('%',#{typeId},'%') + and p.sts='Y' - order by sorts asc + order by p.sorts asc order by ${sort} ${order} @@ -182,6 +190,7 @@ org_id , attachment_id , plugin_package_name , + type_id , sts, )values( @@ -203,6 +212,7 @@ #{org_id} , #{attachmentId} , #{pluginPackageName} , + #{typeId} , 'Y', ) @@ -254,9 +264,10 @@ update sys_application_plugin set modify_user_id = #{modify_user_id}, modify_time = #{modify_time}, sts = #{sts}, - org_id = #{org_id}, + org_id = #{org_id}, attachment_id = #{attachmentId}, plugin_package_name = #{pluginPackageName}, + type_id = #{typeId}, where id = #{id} @@ -291,16 +302,20 @@ update sys_application_plugin set sts= 'N' ,modify_time = #{modify_time},modify diff --git a/service/src/main/java/com/hzya/frame/sysnew/application/pluginType/dao/ISysApplicationPluginTypeDao.java b/service/src/main/java/com/hzya/frame/sysnew/application/pluginType/dao/ISysApplicationPluginTypeDao.java new file mode 100644 index 00000000..2578639c --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sysnew/application/pluginType/dao/ISysApplicationPluginTypeDao.java @@ -0,0 +1,15 @@ +package com.hzya.frame.sysnew.application.pluginType.dao; + +import com.hzya.frame.sysnew.application.pluginType.entity.SysApplicationPluginTypeEntity; +import com.hzya.frame.basedao.dao.IBaseDao; + +/** + * 插件类型表(sys_application_plugin_type: table)表数据库访问层 + * + * @author makejava + * @since 2024-09-19 09:56:24 + */ +public interface ISysApplicationPluginTypeDao extends IBaseDao { + +} + diff --git a/service/src/main/java/com/hzya/frame/sysnew/application/pluginType/dao/impl/SysApplicationPluginTypeDaoImpl.java b/service/src/main/java/com/hzya/frame/sysnew/application/pluginType/dao/impl/SysApplicationPluginTypeDaoImpl.java new file mode 100644 index 00000000..78e7ac17 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sysnew/application/pluginType/dao/impl/SysApplicationPluginTypeDaoImpl.java @@ -0,0 +1,17 @@ +package com.hzya.frame.sysnew.application.pluginType.dao.impl; + +import com.hzya.frame.sysnew.application.pluginType.entity.SysApplicationPluginTypeEntity; +import com.hzya.frame.sysnew.application.pluginType.dao.ISysApplicationPluginTypeDao; +import org.springframework.stereotype.Repository; +import com.hzya.frame.basedao.dao.MybatisGenericDao; +/** + * 插件类型表(SysApplicationPluginType)表数据库访问层 + * + * @author makejava + * @since 2024-09-19 09:56:24 + */ +@Repository(value = "SysApplicationPluginTypeDaoImpl") +public class SysApplicationPluginTypeDaoImpl extends MybatisGenericDao implements ISysApplicationPluginTypeDao{ + +} + diff --git a/service/src/main/java/com/hzya/frame/sysnew/application/pluginType/entity/SysApplicationPluginTypeEntity.java b/service/src/main/java/com/hzya/frame/sysnew/application/pluginType/entity/SysApplicationPluginTypeEntity.java new file mode 100644 index 00000000..b8362993 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sysnew/application/pluginType/entity/SysApplicationPluginTypeEntity.java @@ -0,0 +1,25 @@ +package com.hzya.frame.sysnew.application.pluginType.entity; + +import java.util.Date; +import com.hzya.frame.web.entity.BaseEntity; +/** + * 插件类型表(SysApplicationPluginType)实体类 + * + * @author makejava + * @since 2024-09-19 09:56:24 + */ +public class SysApplicationPluginTypeEntity extends BaseEntity { + + /** 插件类型名称 */ + private String name; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + +} + diff --git a/service/src/main/java/com/hzya/frame/sysnew/application/pluginType/entity/SysApplicationPluginTypeEntity.xml b/service/src/main/java/com/hzya/frame/sysnew/application/pluginType/entity/SysApplicationPluginTypeEntity.xml new file mode 100644 index 00000000..f48b07c9 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sysnew/application/pluginType/entity/SysApplicationPluginTypeEntity.xml @@ -0,0 +1,201 @@ + + + + + + + + + + + + + + + + + + id + ,name + ,sorts + ,org_id + ,sts + ,create_time + ,create_user_id + ,modify_time + ,modify_user_id + + + + + + + + + + + + + + + + insert into sys_application_plugin_type( + + id , + name , + sorts , + org_id , + sts , + create_time , + create_user_id , + modify_time , + modify_user_id , + sts, + + )values( + + #{id} , + #{name} , + #{sorts} , + #{org_id} , + #{sts} , + #{create_time} , + #{create_user_id} , + #{modify_time} , + #{modify_user_id} , + 'Y', + + ) + + + + insert into sys_application_plugin_type(app_id, name, org_id, sts, create_time, create_user_id, modify_time, modify_user_id, sts) + values + + (#{entity.appId},#{entity.name},#{entity.org_id},#{entity.sts},#{entity.create_time},#{entity.create_user_id},#{entity.modify_time},#{entity.modify_user_id}, 'Y') + + + + + insert into sys_application_plugin_type(app_id, name, org_id, sts, create_time, create_user_id, modify_time, modify_user_id) + values + + (#{entity.appId},#{entity.name},#{entity.org_id},#{entity.sts},#{entity.create_time},#{entity.create_user_id},#{entity.modify_time},#{entity.modify_user_id}) + + on duplicate key update + app_id = values(app_id), + name = values(name), + org_id = values(org_id), + sts = values(sts), + create_time = values(create_time), + create_user_id = values(create_user_id), + modify_time = values(modify_time), + modify_user_id = values(modify_user_id) + + +update sys_application_plugin_type set + + name = #{name}, + org_id = #{org_id}, + sts = #{sts}, + create_time = #{create_time}, + create_user_id = #{create_user_id}, + modify_time = #{modify_time}, + modify_user_id = #{modify_user_id}, + +where id = #{id} + + + +update sys_application_plugin_type set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} +where id = #{id} + + + +update sys_application_plugin_type set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} + + and id = #{id} + and name = #{name} + and sorts = #{sorts} + and sts = #{sts} + and sts='Y' + + + + + delete from sys_application_plugin_type where id = #{id} + + + + diff --git a/service/src/main/java/com/hzya/frame/sysnew/application/pluginType/service/ISysApplicationPluginTypeService.java b/service/src/main/java/com/hzya/frame/sysnew/application/pluginType/service/ISysApplicationPluginTypeService.java new file mode 100644 index 00000000..dfee99d3 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sysnew/application/pluginType/service/ISysApplicationPluginTypeService.java @@ -0,0 +1,22 @@ +package com.hzya.frame.sysnew.application.pluginType.service; + +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.sysnew.application.pluginType.entity.SysApplicationPluginTypeEntity; +import com.hzya.frame.basedao.service.IBaseService; +import com.hzya.frame.web.entity.JsonResultEntity; + +/** + * 插件类型表(SysApplicationPluginType)表服务接口 + * + * @author makejava + * @since 2024-09-19 09:56:24 + */ +public interface ISysApplicationPluginTypeService extends IBaseService{ + JsonResultEntity queryPluginType(JSONObject jsonObject); + + JsonResultEntity savePluginType(JSONObject jsonObject); + + JsonResultEntity updatePluginType(JSONObject jsonObject); + + JsonResultEntity deletePluginType(JSONObject jsonObject); +} diff --git a/service/src/main/java/com/hzya/frame/sysnew/application/pluginType/service/impl/SysApplicationPluginTypeServiceImpl.java b/service/src/main/java/com/hzya/frame/sysnew/application/pluginType/service/impl/SysApplicationPluginTypeServiceImpl.java new file mode 100644 index 00000000..d6c00bc1 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sysnew/application/pluginType/service/impl/SysApplicationPluginTypeServiceImpl.java @@ -0,0 +1,106 @@ +package com.hzya.frame.sysnew.application.pluginType.service.impl; + +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.sysnew.application.entity.SysApplicationEntity; +import com.hzya.frame.sysnew.application.plugin.dao.ISysApplicationPluginDao; +import com.hzya.frame.sysnew.application.plugin.entity.SysApplicationPluginEntity; +import com.hzya.frame.sysnew.application.pluginType.entity.SysApplicationPluginTypeEntity; +import com.hzya.frame.sysnew.application.pluginType.dao.ISysApplicationPluginTypeDao; +import com.hzya.frame.sysnew.application.pluginType.service.ISysApplicationPluginTypeService; +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 org.springframework.transaction.annotation.Transactional; + +import java.util.List; + +/** + * 插件类型表(SysApplicationPluginType)表服务实现类 + * + * @author makejava + * @since 2024-09-19 09:56:24 + */ +@Service(value = "sysApplicationPluginTypeService") +public class SysApplicationPluginTypeServiceImpl extends BaseService implements ISysApplicationPluginTypeService { + + private ISysApplicationPluginTypeDao sysApplicationPluginTypeDao; + + @Resource + private ISysApplicationPluginDao sysApplicationPluginDao; + + @Autowired + public void setSysApplicationPluginTypeDao(ISysApplicationPluginTypeDao dao) { + this.sysApplicationPluginTypeDao = dao; + this.dao = dao; + } + + @Override + public JsonResultEntity queryPluginType(JSONObject jsonObject){ + SysApplicationPluginTypeEntity entity = getData("jsonStr", jsonObject, SysApplicationPluginTypeEntity.class); + if(entity == null){ + entity = new SysApplicationPluginTypeEntity(); + } + List list = sysApplicationPluginTypeDao.queryByLike(entity); + return BaseResult.getSuccessMessageEntity("查询数据成功",list); + } + + @Override + public JsonResultEntity savePluginType(JSONObject jsonObject) { + SysApplicationPluginTypeEntity entity = getData("jsonStr", jsonObject, SysApplicationPluginTypeEntity.class); + if(entity == null){ + return BaseResult.getFailureMessageEntity("参数错误"); + } + if(entity.getName() == null || "".equals(entity.getName())){ + return BaseResult.getFailureMessageEntity("插件类型名称不能为空"); + } + entity.setCreate(); + sysApplicationPluginTypeDao.save(entity); + return BaseResult.getSuccessMessageEntity("保存数据成功",entity); + } + + @Override + public JsonResultEntity updatePluginType(JSONObject jsonObject) { + SysApplicationPluginTypeEntity entity = getData("jsonStr", jsonObject, SysApplicationPluginTypeEntity.class); + if(entity == null){ + return BaseResult.getFailureMessageEntity("参数错误"); + } + if(entity.getId() == null || "".equals(entity.getId())){ + return BaseResult.getFailureMessageEntity("ID不能为空"); + } + if(entity.getName() == null || "".equals(entity.getName())){ + return BaseResult.getFailureMessageEntity("插件类型名称不能为空"); + } + entity.setUpdate(); + sysApplicationPluginTypeDao.update(entity); + return BaseResult.getSuccessMessageEntity("更新数据成功",entity); + } + + @Transactional + @Override + public JsonResultEntity deletePluginType(JSONObject jsonObject) { + SysApplicationPluginTypeEntity entity = getData("jsonStr", jsonObject, SysApplicationPluginTypeEntity.class); + if(entity == null){ + return BaseResult.getFailureMessageEntity("参数错误"); + } + if(entity.getId() == null || "".equals(entity.getId())){ + return BaseResult.getFailureMessageEntity("ID不能为空"); + } + // 同步删除匹配插件中的插件类型,将其赋值为null + SysApplicationPluginEntity pluginEntity = new SysApplicationPluginEntity(); + pluginEntity.setTypeId(entity.getId()); + List pluginList = sysApplicationPluginDao.queryBase(pluginEntity); + for(SysApplicationPluginEntity plugin : pluginList){ + plugin.setTypeId("无"); + plugin.setUpdate(); + sysApplicationPluginDao.update(plugin); + } + entity.setUpdate(); + sysApplicationPluginTypeDao.logicRemove(entity); + return BaseResult.getSuccessMessageEntity("删除数据成功"); + } + + +} diff --git a/service/src/main/java/com/hzya/frame/sysnew/warningConfig/service/impl/SysWarningConfigServiceImpl.java b/service/src/main/java/com/hzya/frame/sysnew/warningConfig/service/impl/SysWarningConfigServiceImpl.java index 541d44f1..32092216 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/warningConfig/service/impl/SysWarningConfigServiceImpl.java +++ b/service/src/main/java/com/hzya/frame/sysnew/warningConfig/service/impl/SysWarningConfigServiceImpl.java @@ -23,6 +23,7 @@ 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 org.springframework.transaction.annotation.Transactional; import java.util.ArrayList; import java.util.List; @@ -120,6 +121,7 @@ public class SysWarningConfigServiceImpl extends BaseService