diff --git a/hzims-service-api/alarm-api/alarm-api.iml b/hzims-service-api/alarm-api/alarm-api.iml index c167c30..1daccae 100644 --- a/hzims-service-api/alarm-api/alarm-api.iml +++ b/hzims-service-api/alarm-api/alarm-api.iml @@ -1,288 +1,8 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/hzims-service-api/common-api/common-api.iml b/hzims-service-api/common-api/common-api.iml index 1990bc3..1daccae 100644 --- a/hzims-service-api/common-api/common-api.iml +++ b/hzims-service-api/common-api/common-api.iml @@ -1,300 +1,8 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/hzims-service-api/equipment-api/equipment-api.iml b/hzims-service-api/equipment-api/equipment-api.iml index ba71ce8..1daccae 100644 --- a/hzims-service-api/equipment-api/equipment-api.iml +++ b/hzims-service-api/equipment-api/equipment-api.iml @@ -1,295 +1,8 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/hzims-service-api/message-api/message-api.iml b/hzims-service-api/message-api/message-api.iml deleted file mode 100644 index 37d66d3..0000000 --- a/hzims-service-api/message-api/message-api.iml +++ /dev/null @@ -1,298 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/hzims-service-api/message-api/pom.xml b/hzims-service-api/message-api/pom.xml deleted file mode 100644 index 06fa3da..0000000 --- a/hzims-service-api/message-api/pom.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - hzims-service-api - com.hnac.hzims - 4.0.0-SNAPSHOT - - 4.0.0 - message-api - jar - - - - org.springblade - blade-system-api - - - diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/MessageConstants.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/MessageConstants.java deleted file mode 100644 index 66a0048..0000000 --- a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/MessageConstants.java +++ /dev/null @@ -1,118 +0,0 @@ -package com.hnac.hzims.message; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; - -import java.util.Arrays; -import java.util.Optional; - -/** - * @author xiashandong - * @created 2021/6/24 9:39 - **/ -public class MessageConstants { - public final static String APP_NAME = "hzims-message"; - - /**app消息推送**/ - public final static String WX_PUSH = "wxPush"; - - /**app消息推送**/ - public final static String APP_PUSH = "appPush"; - /**短信推送**/ - public final static String SMS_PUSH = "smsPush"; - /**websocket推送**/ - public final static String WS_PUSH = "websocketPush"; - /**邮件推送**/ - public final static String MAIL_PUSH = "mailPush"; - - public final static String WS_MESSAGE_KEY = "hzims:message:websocket:push"; - - @Getter - @AllArgsConstructor - public enum LogInquireDateEnum { - YEAR("year"), - MONTH("month"), - DAY("day") - ; - private String value; - public static LogInquireDateEnum getClassifyDesByKey(String value) { - Optional anEnum = Arrays.stream(LogInquireDateEnum.class.getEnumConstants()) - .filter(e -> value.equals(e.getValue())).findFirst(); - return anEnum.isPresent() ? anEnum.get() : null; - } - } - - @Getter - @AllArgsConstructor - @NoArgsConstructor - public enum BusinessClassifyEnum { - INSPECT("inspect","巡检管理"), - OPERATIONAL("dailyRemind","运维管理"), - EQUIPMENT("equipment","设备管理"), - SAFE_PRODUCT("safeProduct","安全管理"), - SAFEPRODUCT_HIDDENDANGER("safeProduct-hiddenDanger","隐患处理消息"), - ASSETS("assets","资产管理"), - WARNING("warning","告警消息"), - DUTY("duty","值班消息"), - SAFE("safe","安全消息"), - ACCESS("access","检修消息"), - BUSINESS("business","事务消息"), - TICKETMESSAGE("ticket-message","工作票消息"), - OPERATIONTICKETMESSAGE("operation-ticket-message","操作票消息"), - ROUTINEMAINTENANCE("operation-maintenance-message","日常维护消息"), - OPERATIONDEFECTMESSAGE("operation-defect-message","消缺消息"), - CERTIFICATETNOTICE("certificatet-notice-message","证书消息"), - - OVERHAUL_PLAN("overhaul-plan","检修计划"), - - OVERHAUL_TASK("overhaul-task","检修任务"), - - WORK_TASK("work_task","工作任务单"), - - ; - private String key; - @Getter - private String description; - - public static String getClassifyDesByKey(String key) { - Optional anEnum = Arrays.stream(BusinessClassifyEnum.class.getEnumConstants()) - .filter(e -> key.equals(e.getKey())).findFirst(); - return anEnum.isPresent() ? anEnum.get().getDescription() : null; - } - } - - /**====================================推送状态====================================**/ - /**未推送**/ - public final static Integer NOT_PUSH = 0; - /**推送成功**/ - public final static Integer PUSH_SUCCESS = 1; - /**推送失败**/ - public final static Integer PUSH_FAILED = 2; - /**已确认**/ - public final static Integer CONFIRM = 3; - - @AllArgsConstructor - public enum MessagePushResultEnum { - NON(NOT_PUSH,"未推送"), - SUCCESS(PUSH_SUCCESS,"推送成功"), - FAILED(PUSH_FAILED,"推送失败"), - CONFIRM(MessageConstants.CONFIRM,"已确认") - ; - @Getter - private Integer key; - @Getter - private String value; - - } - /**====================================推送状态====================================**/ - - /**====================================推送类型====================================**/ - /**即时推送**/ - public final static String IMMEDIATELY = "0"; - /**计划推送**/ - public final static String PLAN = "1"; - - /**====================================推送类型====================================**/ - -} diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/constants/DictKeyConstants.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/constants/DictKeyConstants.java deleted file mode 100644 index 4e84bb2..0000000 --- a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/constants/DictKeyConstants.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.hnac.hzims.message.constants; - -public interface DictKeyConstants { - - /**消息推送类型 [appPush-app推送 smsPush-短信推送 websocketPush-web推送 mailPush-邮件推送]**/ - String MESSAGE_TYPE = "messageType"; - - /*** - * 业务分类 - * system-系统通知 - * business-事务消息 - * dailyRemind-日常提醒 - * inspect-巡检消息 - * warning-告警消息 - * duty-值班消息 - * safe-安全消息 - * access-检修消息 - */ - String BUSINESS_CLASSIFY = "businessClassify"; - -} diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/constants/RedisKeyConstants.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/constants/RedisKeyConstants.java deleted file mode 100644 index 2d90bd2..0000000 --- a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/constants/RedisKeyConstants.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.hnac.hzims.message.constants; - -/** - * redis中所用到的key常量池 - * @author hx - */ -public interface RedisKeyConstants { - - /**消息推送redis键值**/ - String MESSAGE_SMS_PUSH_KEY = "hzims:sms:message:messagePushKey"; - -} diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/constants/SmsConstants.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/constants/SmsConstants.java deleted file mode 100644 index 5649811..0000000 --- a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/constants/SmsConstants.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.hnac.hzims.message.constants; - -/** - * @author hx - */ -public interface SmsConstants { - - /**即时推送**/ - String PUSH_TYPE_IMMEDIATE = "0"; - /**延时推送**/ - String PUSH_TYPE_DELAY = "1"; - -} diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/constants/XxlJobConstants.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/constants/XxlJobConstants.java deleted file mode 100644 index f87de5d..0000000 --- a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/constants/XxlJobConstants.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.hnac.hzims.message.constants; - -/** - * 任务调度方法定义常量池 - * @author hx - */ -public interface XxlJobConstants { - - /**消息中心短信消息按通知人分时段集中推送**/ - String PUSH_SMS_MESSAGE_BY_NOTICE = "pushSmsMessageByNotice"; - - /**消息中心消息按通知人分时段集中推送**/ - String PUSH_MESSAGE_BY_NOTICE = "pushMessageByNotice"; - - /**推送APP消息**/ - String PUSH_APP_MESSAGE = "pushAppMessage"; - -} diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/dto/AppPushDto.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/dto/AppPushDto.java deleted file mode 100644 index 14a697d..0000000 --- a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/dto/AppPushDto.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.hnac.hzims.message.dto; - -import com.hnac.hzinfo.core.push.enums.PlatformType; -import com.hnac.hzinfo.core.push.enums.PushAudienceType; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.*; -import lombok.experimental.Accessors; -import lombok.experimental.SuperBuilder; - -import java.io.Serializable; -import java.util.List; - -/** - * @author hx - */ -@Data -@EqualsAndHashCode -@Accessors(chain=true) -@ApiModel(value = "App推送对象", description = "App推送对象") -public class AppPushDto extends PushDto implements Serializable { - - @ApiModelProperty("标题") - private String title; - - @ApiModelProperty("消息内容") - private String pushAlert; - - @ApiModelProperty("推送标签") - private PushAudienceType audienceType; - - @ApiModelProperty("是否全平台推送") - private Boolean isAll; - - @ApiModelProperty("推送标签") - private List tags; - - @ApiModelProperty("平台类型") - private PlatformType[] platformTypes; - -} diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/dto/BusinessMessageDTO.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/dto/BusinessMessageDTO.java deleted file mode 100644 index ba52449..0000000 --- a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/dto/BusinessMessageDTO.java +++ /dev/null @@ -1,72 +0,0 @@ -package com.hnac.hzims.message.dto; - -import com.baomidou.mybatisplus.annotation.TableField; -import com.fasterxml.jackson.annotation.JsonFormat; -import com.hnac.hzims.common.invalid.Create; -import com.hnac.hzims.common.invalid.Update; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.EqualsAndHashCode; -import org.springblade.core.mp.support.QueryField; -import org.springblade.core.mp.support.SqlCondition; -import org.springblade.core.tool.utils.DateUtil; -import org.springframework.format.annotation.DateTimeFormat; - -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; -import java.io.Serializable; -import java.time.LocalDate; -import java.time.LocalDateTime; - -/** - * @ClassName BusinessMessageDTO - * @description: - * @author: hx - * @create: 2023-06-15 19:10 - * @Version 4.0 - **/ -@Data -@ApiModel("事务消息") -@EqualsAndHashCode -public class BusinessMessageDTO implements Serializable { - @ApiModelProperty(value = "机构ID",required = true) - @NotNull(message = "机构ID不能为空",groups = {Create.class}) - private Long deptId; - - @ApiModelProperty("机构名称") - private String deptName; - - @ApiModelProperty(value = "业务关键字",required = true) - @NotBlank(message = "业务关键字不能为空",groups = {Create.class}) - private String businessKey; - - @ApiModelProperty(value = "业务分类。系统通知:system,事务消息:business,日常提醒:dailyRemind,巡检消息:inspect",required = true) - @NotBlank(message = "业务分类不能为空",groups = {Create.class}) - private String businessClassify; - - @ApiModelProperty("业务任务ID") - @QueryField(condition = SqlCondition.EQUAL) - private Long taskId; - - @NotBlank(message = "内容不能为空",groups = {Create.class}) - @ApiModelProperty(value = "内容") - private String content; - - @NotBlank(message = "主题不能为空",groups = {Create.class}) - @ApiModelProperty(value = "主题") - private String subject; - - @NotBlank(message = "推送用户不能为空",groups = {Create.class}) - @ApiModelProperty(value = "推送用户") - private String userIds; - - @ApiModelProperty(value = "创建用户") - private Long createUser; - - @ApiModelProperty(value = "租户ID") - private String tenantId; - - @ApiModelProperty(value = "APP推送是否紧急") - private boolean isEmergent = false; -} diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/dto/MailMessageDTO.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/dto/MailMessageDTO.java deleted file mode 100644 index 45566fc..0000000 --- a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/dto/MailMessageDTO.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.hnac.hzims.message.dto; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.EqualsAndHashCode; -import org.springblade.core.mp.support.QueryField; -import org.springblade.core.mp.support.SqlCondition; -import org.springframework.web.multipart.MultipartFile; - -import javax.validation.constraints.NotNull; -import java.io.Serializable; -import java.util.List; - -@Data -@EqualsAndHashCode -@ApiModel("邮件消息DTO") -public class MailMessageDTO implements Serializable { - - @ApiModelProperty(value = "机构ID",required = true) - @NotNull(message = "机构ID不能为空") - private Long deptId; - - @ApiModelProperty("机构名称") - private String deptName; - - @ApiModelProperty(value = "业务关键字",required = true) - @NotNull(message = "业务关键字不能为空") - private String businessKey; - - @ApiModelProperty(value = "业务分类。系统通知:system,事务消息:business,日常提醒:dailyRemind,巡检消息:inspect",required = true) - @NotNull(message = "业务分类不能为空") - private String businessClassify; - - @ApiModelProperty("业务任务ID") - @QueryField(condition = SqlCondition.EQUAL) - private Long taskId; - - @NotNull - @ApiModelProperty(value = "内容") - private String content; - - @NotNull - @ApiModelProperty(value = "主题") - private String subject; - - @NotNull - @ApiModelProperty(value = "推送用户") - private String userIds; - - @ApiModelProperty(value = "创建用户") - private Long createUser; - - @ApiModelProperty("邮件内容是否为html") - private Boolean isHtml; - - @ApiModelProperty("邮件附件") - private List appendix; - - @ApiModelProperty("抄送账户") - private String ccAccount; - - @ApiModelProperty(value = "租户ID") - private String tenantId; - -} diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/dto/MailPushDto.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/dto/MailPushDto.java deleted file mode 100644 index aef9f76..0000000 --- a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/dto/MailPushDto.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.hnac.hzims.message.dto; - -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.*; -import lombok.experimental.Accessors; -import lombok.experimental.SuperBuilder; -import lombok.experimental.Tolerate; -import org.springframework.web.multipart.MultipartFile; - -import java.io.Serializable; -import java.util.List; - -/** - * @author hx - */ -@Data -@ApiModel("邮件推送对象") -@Accessors(chain=true) -@EqualsAndHashCode(callSuper = true) -public class MailPushDto extends PushDto implements Serializable { - - @ApiModelProperty("邮件类型") - private Integer mailType; - - @ApiModelProperty("发件人邮箱") - private String fromAccount; - - @ApiModelProperty(value = "收件人邮箱",required = true) - private String[] toAccount; - - @ApiModelProperty("抄送人邮箱") - private String[] ccAccount; - - @ApiModelProperty(value = "主题",required = true) - private String subject; - - @ApiModelProperty(value = "附件") - private List appendix; - - @ApiModelProperty(value = "邮件内容",required = true) - private String text; - - @ApiModelProperty(value = "是否支持邮件",required = true) - private boolean html; - -} diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/dto/MessagePushRecordDto.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/dto/MessagePushRecordDto.java deleted file mode 100644 index 4ddcfc7..0000000 --- a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/dto/MessagePushRecordDto.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.hnac.hzims.message.dto; - -import com.hnac.hzims.message.entity.MessagePushRecordEntity; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.constraints.NotNull; -import java.io.Serializable; -import java.util.List; - -/** - * @ClassName MessagePushRecordDto - * @description: - * @author: hx - * @create: 2023-04-12 11:11 - * @Version 4.0 - **/ -@Data -public class MessagePushRecordDto extends MessagePushRecordEntity implements Serializable { - - @ApiModelProperty("多种消息类型推送使用字段") - @NotNull - private List types; - - @ApiModelProperty("创建人") - private Long createUser; - -} diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/dto/PlanMsgRecordDto.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/dto/PlanMsgRecordDto.java deleted file mode 100644 index 43ff3af..0000000 --- a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/dto/PlanMsgRecordDto.java +++ /dev/null @@ -1,72 +0,0 @@ -package com.hnac.hzims.message.dto; - -import com.fasterxml.jackson.annotation.JsonFormat; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import com.fasterxml.jackson.databind.ser.std.NullSerializer; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.*; -import lombok.experimental.Accessors; -import org.springblade.core.tool.utils.DateUtil; -import org.springframework.format.annotation.DateTimeFormat; - -import javax.validation.constraints.NotNull; -import java.io.Serializable; -import java.time.LocalDateTime; - -/** - * @ClassName PlanMsgRecordDto - * @description: - * @author: hx - * @create: 2023-04-14 14:15 - * @Version 4.0 - **/ -@Data -@ApiModel("计划推送消息请求对象") -@EqualsAndHashCode -@Accessors(chain = true) -public class PlanMsgRecordDto implements Serializable { - - @ApiModelProperty("机构ID") - @JsonSerialize(nullsUsing = NullSerializer.class) - @NotNull - private Long deptId; - - @ApiModelProperty("消息模板Id") - @JsonSerialize(nullsUsing = NullSerializer.class) - private Long templateId; - - @ApiModelProperty("业务任务Id") - @JsonSerialize(nullsUsing = NullSerializer.class) - @NotNull - private Long taskId; - - @ApiModelProperty("消息接收人") - @JsonSerialize(nullsUsing = NullSerializer.class) - @NotNull - private Long receiver; - - @ApiModelProperty("消息推送计划时间") - @JsonFormat(pattern = DateUtil.PATTERN_DATETIME) - @DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME) - @NotNull - private LocalDateTime planTime; - - @ApiModelProperty("短信推送资源编码") - private String resourceCode; - - @ApiModelProperty("消息创建人") - @JsonSerialize(nullsUsing = NullSerializer.class) - private Long createUser; - - @ApiModelProperty("阿里云短信模板参数") - private String smsParam; - - @ApiModelProperty("消息推送耳机") - @NotNull - private String content; - - @ApiModelProperty("租户ID") - private String tenantId; - -} diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/dto/PushDto.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/dto/PushDto.java deleted file mode 100644 index d9aa2ce..0000000 --- a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/dto/PushDto.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.hnac.hzims.message.dto; - -import io.swagger.annotations.ApiModelProperty; -import lombok.*; -import lombok.experimental.Accessors; -import lombok.experimental.SuperBuilder; -import lombok.experimental.Tolerate; - -import java.io.Serializable; -import java.util.Map; - -/** - * @author hx - */ -@Data -@NoArgsConstructor -@AllArgsConstructor -@Accessors(chain=true) -public class PushDto implements Serializable { - @ApiModelProperty("业务关键字") - private String businessKey; - - @ApiModelProperty(value = "业务分类。系统通知:system,事务消息:business,日常提醒:dailyRemind,巡检消息:inspect",required = true) - private String businessClassify; - - @ApiModelProperty(value = "消息类型",required = true) - private String type; - - @ApiModelProperty("扩展参数") - private Map extras; - - @ApiModelProperty("主题") - private String subject; - - @ApiModelProperty("内容") - private String content; - - @ApiModelProperty(value = "平台资源管理模块提供的code",required = true) - private String code; - - @ApiModelProperty(value = "定时推送时租户ID",required = true) - private String tenantId; - - @ApiModelProperty(value = "定时推送时创建机构",required = true) - private Long createDept; - - @ApiModelProperty(value = "定时推送时创建人",required = true) - private Long createUser; - -} diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/dto/SmsImmediatelyPushDTO.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/dto/SmsImmediatelyPushDTO.java deleted file mode 100644 index d37aad0..0000000 --- a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/dto/SmsImmediatelyPushDTO.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.hnac.hzims.message.dto; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Builder; -import lombok.Data; -import lombok.EqualsAndHashCode; -import org.springblade.core.mp.support.QueryField; -import org.springblade.core.mp.support.SqlCondition; - -import javax.validation.constraints.NotNull; -import java.io.Serializable; -import java.util.Map; - -/** - * @ClassName SmsImmediatelyPushDTO - * @description: 短信即时推送请求内容 - * @author: hx - * @create: 2023-08-09 08:46 - * @Version 4.0 - **/ -@Data -@EqualsAndHashCode -@ApiModel("短信即时推送请求内容") -@Builder -public class SmsImmediatelyPushDTO implements Serializable { - - @ApiModelProperty(value = "机构ID",required = true) - @NotNull(message = "机构ID不能为空") - private Long deptId; - - @ApiModelProperty("机构名称") - private String deptName; - - @ApiModelProperty(value = "业务关键字",required = true) - @NotNull(message = "业务关键字不能为空") - private String businessKey; - - @ApiModelProperty(value = "业务分类。系统通知:system,事务消息:business,日常提醒:dailyRemind,巡检消息:inspect",required = true) - @NotNull(message = "业务分类不能为空") - private String businessClassify; - - @ApiModelProperty("业务任务ID") - @QueryField(condition = SqlCondition.EQUAL) - private Long taskId; - - @NotNull - @ApiModelProperty(value = "内容") - private String content; - - @NotNull - @ApiModelProperty(value = "主题") - private String subject; - - @NotNull - @ApiModelProperty(value = "推送用户") - private String pusher; - - @ApiModelProperty(value = "创建用户") - private Long createUser; - - @ApiModelProperty(value = "租户ID") - private String tenantId; - - @ApiModelProperty("短信推送资源编码") - @NotNull - private String resourceCode; - - @ApiModelProperty("短信推送填充内容") - @NotNull - private Map params; - - -} diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/dto/SmsPushDto.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/dto/SmsPushDto.java deleted file mode 100644 index 27a1864..0000000 --- a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/dto/SmsPushDto.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.hnac.hzims.message.dto; - -import com.baomidou.mybatisplus.annotation.TableName; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.*; -import lombok.experimental.Accessors; -import lombok.experimental.SuperBuilder; - -import java.io.Serializable; -import java.util.List; -import java.util.Map; - -/** - * @author hx - */ -@Data -@EqualsAndHashCode(callSuper = true) -@Accessors(chain=true) -@ApiModel(value = "短信推送对象", description = "短信推送对象") -public class SmsPushDto extends PushDto implements Serializable { - - @ApiModelProperty(value = "接受短信的手机号",required = true) - private List phones; - - @ApiModelProperty("短信模板参数") - private Map params; -} diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/dto/WsPushDto.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/dto/WsPushDto.java deleted file mode 100644 index a17d0b6..0000000 --- a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/dto/WsPushDto.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.hnac.hzims.message.dto; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.*; -import lombok.experimental.Accessors; -import lombok.experimental.SuperBuilder; - -import java.io.Serializable; -import java.util.List; - -/** - * @author hx - */ -@Data -@Accessors(chain=true) -@ApiModel("websocket推送对象") -@EqualsAndHashCode -public class WsPushDto extends PushDto implements Serializable { - - @ApiModelProperty("是否推送所有人") - private boolean all; - - @ApiModelProperty("推送人员") - private List userIdList; - - @ApiModelProperty("推送内容") - private String text; - -} diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/dto/WxMessageDTO.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/dto/WxMessageDTO.java deleted file mode 100644 index 6846b6d..0000000 --- a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/dto/WxMessageDTO.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.hnac.hzims.message.dto; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.EqualsAndHashCode; -import org.springblade.core.mp.support.QueryField; -import org.springblade.core.mp.support.SqlCondition; - -import javax.validation.constraints.NotNull; -import java.io.Serializable; -import java.util.Map; - -/** - * @author ysj - */ -@Data -@ApiModel("事务消息") -@EqualsAndHashCode -public class WxMessageDTO implements Serializable { - - @ApiModelProperty(value = "微信消息模板ID",required = true) - @NotNull(message = "微信消息模板ID不能为空") - private String templateId; - - @ApiModelProperty(value = "微信消息详情H5跳转Url",required = true) - @NotNull(message = "微信消息详情H5跳转Url") - private String skipUrl; - - @ApiModelProperty(value = "机构ID",required = true) - @NotNull(message = "机构ID不能为空") - private Long deptId; - - @ApiModelProperty(value = "业务关键字",required = true) - @NotNull(message = "业务关键字不能为空") - private String businessKey; - - @ApiModelProperty(value = "业务分类。系统通知:system,事务消息:business,日常提醒:dailyRemind,巡检消息:inspect",required = true) - @NotNull(message = "业务分类不能为空") - private String businessClassify; - - @ApiModelProperty("业务任务ID") - @QueryField(condition = SqlCondition.EQUAL) - private Long taskId; - - @NotNull - @ApiModelProperty(value = "推送消息键值对") - private Map map; - - @NotNull - @ApiModelProperty(value = "内容") - private String content; - - @NotNull - @ApiModelProperty(value = "主题") - private String subject; - - @NotNull - @ApiModelProperty(value = "推送用户") - private String userIds; - - @ApiModelProperty(value = "创建用户") - private Long createUser; - - @ApiModelProperty(value = "租户ID") - private String tenantId; -} diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/dto/statistic/MsgPushStatisticDto.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/dto/statistic/MsgPushStatisticDto.java deleted file mode 100644 index 7fb111a..0000000 --- a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/dto/statistic/MsgPushStatisticDto.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.hnac.hzims.message.dto.statistic; - -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import org.springblade.core.tool.utils.DateUtil; -import org.springframework.format.annotation.DateTimeFormat; - -import javax.validation.constraints.NotNull; -import java.time.LocalDate; -import java.time.LocalDateTime; - -/** - * @author hx - */ -@Data -public class MsgPushStatisticDto { - - @ApiModelProperty(value = "查询日期类型;年月日分别对应year,month,day",required = true) - @NotNull - private String dateType; - - @ApiModelProperty(value = "查询日期",required = true) - @NotNull - private String date; - - @ApiModelProperty("开始时间") - private String startDate; - - @ApiModelProperty("结束时间") - private String endDate; - - @ApiModelProperty("发送人,按逗号分隔") - private String senders; - - @ApiModelProperty("统计机构,按逗号分隔") - private String deptId; - - @ApiModelProperty("消息业务类型,按逗号分隔") - private String businessClassify; - -} diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/entity/MessagePushRecordEntity.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/entity/MessagePushRecordEntity.java deleted file mode 100644 index ee26429..0000000 --- a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/entity/MessagePushRecordEntity.java +++ /dev/null @@ -1,120 +0,0 @@ -package com.hnac.hzims.message.entity; - -import com.alibaba.fastjson.annotation.JSONField; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableName; -import com.fasterxml.jackson.annotation.JsonFormat; -import com.hnac.hzims.message.entity.config.MessageTemplateEntity; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.EqualsAndHashCode; -import org.springblade.core.mp.support.QueryField; -import org.springblade.core.mp.support.SqlCondition; -import org.springblade.core.tool.utils.DateUtil; -import org.springframework.format.annotation.DateTimeFormat; -import org.springframework.web.multipart.MultipartFile; - -import javax.validation.constraints.NotNull; -import java.time.LocalDate; -import java.time.LocalDateTime; -import java.util.List; - -@Data -@ApiModel(value = "消息推送记录",description = "消息推送记录") -@TableName("hzims_message_push_record") -@EqualsAndHashCode -public class MessagePushRecordEntity extends MessageTemplateEntity { - - @ApiModelProperty("机构ID") - @QueryField(condition = SqlCondition.EQUAL) - @NotNull - private Long deptId; - - @ApiModelProperty("机构名称") - private String deptName; - - @ApiModelProperty("推送类型,0:即时推送,1:计划推送") - @QueryField(condition = SqlCondition.EQUAL) - @NotNull - private String pushType; - - @ApiModelProperty("消息ID") - private Long messageId; - - @ApiModelProperty("业务任务ID") - @QueryField(condition = SqlCondition.EQUAL) - private Long taskId; - - @ApiModelProperty("消息模板ID") - @QueryField(condition = SqlCondition.EQUAL) - private Long templateId; - - @ApiModelProperty("资源编码") - @QueryField(condition = SqlCondition.EQUAL) - private String resourceCode; - - @ApiModelProperty(value = "推送人") - @QueryField(condition = SqlCondition.LIKE) - @NotNull - private String pusher; - - @ApiModelProperty(value = "推送账号:手机号,邮箱") - @NotNull - private String account; - - @ApiModelProperty(value = "推送人名称") - @QueryField(condition = SqlCondition.LIKE) - private String pusherName; - - @ApiModelProperty(value = "内容") - private String content; - - @ApiModelProperty("阿里云短信模板参数") - private String smsParam; - - @ApiModelProperty(value = "计划推送时间") - @JsonFormat(pattern = DateUtil.PATTERN_DATETIME) - @DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME) - private LocalDateTime planTime; - - @ApiModelProperty(value = "实际推送时间") - @JsonFormat(pattern = DateUtil.PATTERN_DATETIME) - @DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME) - private LocalDateTime pushTime; - - @ApiModelProperty(value = "响应时间") - @JsonFormat(pattern = DateUtil.PATTERN_DATETIME) - @DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME) - private LocalDateTime respondTime; - - @ApiModelProperty(value = "响应说明") - private String respondRemark; - - @ApiModelProperty("推送失败结果") - private String faultResult; - - @ApiModelProperty("查询开始时间") - @DateTimeFormat(pattern = DateUtil.PATTERN_DATE) - @JsonFormat(pattern = DateUtil.PATTERN_DATE) - @TableField(exist = false) - private LocalDate startTime; - - @ApiModelProperty("查询结束时间") - @DateTimeFormat(pattern = DateUtil.PATTERN_DATE) - @JsonFormat(pattern = DateUtil.PATTERN_DATE) - @TableField(exist = false) - private LocalDate endTime; - - @ApiModelProperty("是否为html,邮件发送专用") - @TableField(exist = false) - private Boolean isHtml; - - @ApiModelProperty("邮件附件") - @TableField(exist = false) - private List appendix; - - @ApiModelProperty("抄送账户") - @TableField(exist = false) - private String ccAccount; -} diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/entity/MsgMailRecordEntity.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/entity/MsgMailRecordEntity.java deleted file mode 100644 index 9d9e851..0000000 --- a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/entity/MsgMailRecordEntity.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.hnac.hzims.message.entity; - -import com.baomidou.mybatisplus.annotation.TableName; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; -import org.springblade.core.tenant.mp.TenantEntity; - -/** - * @author hx - */ -@ApiModel(value = "邮箱日志记录") -@Data -@AllArgsConstructor -@NoArgsConstructor -@Builder -@TableName("hzims_msg_mail_record") -public class MsgMailRecordEntity extends TenantEntity { - - @ApiModelProperty("业务关键字") - private String businessKey; - - @ApiModelProperty(value = "业务分类",required = true) - private String businessClassify; - - @ApiModelProperty(value = "主题") - private String subject; - - @ApiModelProperty("内容") - private String content; - - @ApiModelProperty(value = "发送方邮箱;按逗号分隔") - private String toAccounts; - - @ApiModelProperty(value = "是否发送成功") - private Boolean success; - - @ApiModelProperty(value = "请求参数") - private String parameters; - - @ApiModelProperty(value = "响应数据") - private String response; - - @ApiModelProperty(value = "错误日志") - private String errorLog; - -} diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/entity/MsgPushRecordEntity.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/entity/MsgPushRecordEntity.java deleted file mode 100644 index 278d25a..0000000 --- a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/entity/MsgPushRecordEntity.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.hnac.hzims.message.entity; - -import com.baomidou.mybatisplus.annotation.TableName; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import com.fasterxml.jackson.databind.ser.std.NullSerializer; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.*; -import org.springblade.core.tenant.mp.TenantEntity; - -/** - * 消息推送日志 - * - * @author xiashandong - * @created 2021-06-28 08:38 - **/ -@Data -@TableName("hz_msg_push_record") -@EqualsAndHashCode(callSuper = true) -@ApiModel(value = "消息推送日志对象") -@Builder -@NoArgsConstructor -@AllArgsConstructor -public class MsgPushRecordEntity extends TenantEntity { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("业务关键字") - private String businessKey; - - @ApiModelProperty(value = "业务分类",required = true) - private String businessClassify; - - @ApiModelProperty(value = "主题") - private String subject; - - @ApiModelProperty(value = "标签集合,多个标签用逗号隔开") - private String tags; - - @ApiModelProperty(value = "是否推送成功") - @JsonSerialize(nullsUsing = NullSerializer.class) - private Boolean success; - - @ApiModelProperty("内容") - private String content; - - @ApiModelProperty(value = "推送方式") - private String pushType; - - @ApiModelProperty(value = "请求参数") - private String parameters; - - @ApiModelProperty(value = "响应内容") - private String response; - - @ApiModelProperty(value = "错误日志") - private String errorLog; - -} diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/entity/MsgSmsRecordEntity.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/entity/MsgSmsRecordEntity.java deleted file mode 100644 index b2b2f38..0000000 --- a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/entity/MsgSmsRecordEntity.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.hnac.hzims.message.entity; - -import com.baomidou.mybatisplus.annotation.TableName; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.*; -import org.springblade.core.tenant.mp.TenantEntity; - -/** - * - * 短信推送日志 - * - * @author xiashandong - * @created 2021-06-28 08:38 - **/ -@Data -@TableName("hz_msg_sms_record") -@EqualsAndHashCode(callSuper = true) -@Builder -@AllArgsConstructor -@NoArgsConstructor -@ApiModel(value = "短信推送日志对象") -public class MsgSmsRecordEntity extends TenantEntity { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("业务关键字") - private String businessKey; - - @ApiModelProperty(value = "业务分类",required = true) - private String businessClassify; - - @ApiModelProperty(value = "平台资源模块提供的Code") - private String smsCode; - - @ApiModelProperty(value = "主题") - private String subject; - - @ApiModelProperty("内容") - private String content; - - @ApiModelProperty(value = "手机号码") - private String phones; - - @ApiModelProperty(value = "是否发送成功") - private Boolean success; - - @ApiModelProperty(value = "请求参数") - private String parameters; - - @ApiModelProperty(value = "响应内容") - private String response; - - @ApiModelProperty(value = "错误日志") - private String errorLog; - -} diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/entity/MsgWsRecordEntity.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/entity/MsgWsRecordEntity.java deleted file mode 100644 index 5e07acd..0000000 --- a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/entity/MsgWsRecordEntity.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.hnac.hzims.message.entity; - -import com.baomidou.mybatisplus.annotation.TableName; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import com.fasterxml.jackson.databind.ser.std.NullSerializer; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.*; -import org.springblade.core.tenant.mp.TenantEntity; - -/** - * websocket消息推送日志 - * - * @author xiashandong - * @created 2021-06-28 08:38 - **/ -@Data -@TableName("hz_msg_ws_record") -@EqualsAndHashCode(callSuper = true) -@Builder -@NoArgsConstructor -@AllArgsConstructor -@ApiModel(value = "websocket消息推送日志对象") -public class MsgWsRecordEntity extends TenantEntity { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("业务关键字") - private String businessKey; - - @ApiModelProperty(value = "业务分类",required = true) - private String businessClassify; - - @ApiModelProperty(value = "是否推送所有人") - private boolean isAll; - - @ApiModelProperty(value = "推送目标账户ID 按逗号分隔") - @JsonSerialize(nullsUsing = NullSerializer.class) - private String userIds; - - @ApiModelProperty(value = "主题") - private String subject; - - @ApiModelProperty("内容") - private String content; - - @ApiModelProperty(value = "响应") - private String response; - - @ApiModelProperty(value = "请求参数") - private String parameters; - - @ApiModelProperty(value = "是否推送成功") - private Boolean success; - - @ApiModelProperty(value = "错误日志") - private String errorLog; - -} diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/entity/MsgWsRecordHistoryEntity.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/entity/MsgWsRecordHistoryEntity.java deleted file mode 100644 index acdbf5f..0000000 --- a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/entity/MsgWsRecordHistoryEntity.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.hnac.hzims.message.entity; - -import com.baomidou.mybatisplus.annotation.TableName; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import com.fasterxml.jackson.databind.ser.std.NullSerializer; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.EqualsAndHashCode; -import org.springblade.core.tenant.mp.TenantEntity; - -/** - * - * websocket消息推送日志 - * - * @author xiashandong - * @created 2021-06-28 16:45 - **/ -@Data -@TableName("hz_msg_ws_record_history") -@EqualsAndHashCode(callSuper = true) -@ApiModel(value = "websocket消息推送日志对象") -public class MsgWsRecordHistoryEntity extends TenantEntity { - - private static final long serialVersionUID = 1L; - - - /** - * 推送目标账户ID - */ - @ApiModelProperty(value = "推送目标账户ID") - @JsonSerialize(nullsUsing = NullSerializer.class) - private Long userId; - - @ApiModelProperty(value = "业务分类,一般按服务模块分类") - private String classify; - - /** - * 请求参数 - */ - @ApiModelProperty(value = "请求参数") - private String reqBody; - - /** - * 错误日志 - */ - @ApiModelProperty(value = "错误日志") - private String errorLog; - - @ApiModelProperty(value = "标题") - private String title; - -} diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/entity/PushMessageEntity.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/entity/PushMessageEntity.java deleted file mode 100644 index ca31bd9..0000000 --- a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/entity/PushMessageEntity.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.hnac.hzims.message.entity; - -import com.baomidou.mybatisplus.annotation.TableName; -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import org.springblade.core.mp.support.QueryField; -import org.springblade.core.mp.support.SqlCondition; -import org.springblade.core.tenant.mp.TenantEntity; -import org.springblade.core.tool.utils.DateUtil; -import org.springframework.format.annotation.DateTimeFormat; - -import java.io.Serializable; -import java.time.LocalDate; -import java.time.LocalDateTime; - -/** - * @author hx - */ -@TableName("hzims_push_message") -@ApiModel("待推送消息列表") -@Data -public class PushMessageEntity extends TenantEntity implements Serializable { - - @ApiModelProperty("消息类型") - @QueryField(condition = SqlCondition.EQUAL) - private String messageType; - - @ApiModelProperty("业务key值") - @QueryField(condition = SqlCondition.EQUAL) - private String businessKey; - - @ApiModelProperty("消息推送内容体") - private String messageContent; - - @ApiModelProperty("消息是否推送") - @QueryField(condition = SqlCondition.EQUAL) - private Boolean isPush; - - @ApiModelProperty("是否推送成功") - @QueryField(condition = SqlCondition.EQUAL) - private Boolean isSuccess; - - @ApiModelProperty("推送时间") - @DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME) - @JsonFormat(pattern = DateUtil.PATTERN_DATETIME) - private LocalDateTime pushTime; - -} diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/entity/config/ConfigEntity.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/entity/config/ConfigEntity.java deleted file mode 100644 index 711abd5..0000000 --- a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/entity/config/ConfigEntity.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.hnac.hzims.message.entity.config; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import org.springblade.core.mp.support.QueryField; -import org.springblade.core.mp.support.SqlCondition; -import org.springblade.core.tenant.mp.TenantEntity; - -import javax.validation.constraints.NotNull; -import java.io.Serializable; - -/** - * @author hx - */ -@Data -@ApiModel("配置类") -public class ConfigEntity extends TenantEntity implements Serializable { - - @ApiModelProperty(value = "业务关键字",required = true) - @NotNull(message = "业务关键字不能为空") - @QueryField(condition = SqlCondition.LIKE) - private String businessKey; - - @ApiModelProperty(value = "业务分类。系统通知:system,事务消息:business,日常提醒:dailyRemind,巡检消息:inspect",required = true) - @NotNull(message = "业务分类不能为空") - @QueryField(condition = SqlCondition.EQUAL) - private String businessClassify; - - @ApiModelProperty(value = "消息类型") - private String type; - - @ApiModelProperty(value = "主题",required = true) - @NotNull(message = "主题不能为空") - @QueryField(condition = SqlCondition.LIKE) - private String subject; - - @ApiModelProperty(value = "内容",required = true) - @NotNull(message = "内容不能为空") - private String content; - - @ApiModelProperty(value = "推送人") - @QueryField(condition = SqlCondition.EQUAL) - private String pushers; - - @ApiModelProperty(value = "多长时间内的推送") - @QueryField(condition = SqlCondition.EQUAL) - private Integer duration; - - @ApiModelProperty(value = "时间单位") - @QueryField(condition = SqlCondition.EQUAL) - private String timeUnit; -} diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/entity/config/MailConfigEntity.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/entity/config/MailConfigEntity.java deleted file mode 100644 index f4bf0fd..0000000 --- a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/entity/config/MailConfigEntity.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.hnac.hzims.message.entity.config; - -import com.baomidou.mybatisplus.annotation.TableName; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.constraints.NotNull; -import java.io.Serializable; - -/** - * @author hx - */ -@Data -@ApiModel("邮件配置") -@TableName("hzims_mail_config") -public class MailConfigEntity extends ConfigEntity implements Serializable { - - @ApiModelProperty(value = "发送邮箱账号",required = true) - @NotNull - private String mails; - - @ApiModelProperty("是否为html模板推送") - private boolean isHtml; - - @ApiModelProperty("html模板路径") - private String templateUrl; - - @ApiModelProperty("html模板文件名") - private String templateFileName; - - @ApiModelProperty("html模板填充数据对象json字符串") - private String jsonObject; -} diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/entity/config/MessageTemplateEntity.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/entity/config/MessageTemplateEntity.java deleted file mode 100644 index 93e182f..0000000 --- a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/entity/config/MessageTemplateEntity.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.hnac.hzims.message.entity.config; - -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableName; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.EqualsAndHashCode; -import org.springblade.core.mp.support.QueryField; -import org.springblade.core.mp.support.SqlCondition; -import org.springblade.core.tenant.mp.TenantEntity; - -import javax.validation.constraints.NotNull; -import java.io.Serializable; - -@Data -@ApiModel("消息配置") -@TableName("hzims_message_template") -@EqualsAndHashCode(callSuper = false) -public class MessageTemplateEntity extends TenantEntity implements Serializable { - - @ApiModelProperty(value = "消息类型") - @QueryField(condition = SqlCondition.EQUAL) - private String type; - - @ApiModelProperty(value = "业务分类。系统通知:system,事务消息:business,日常提醒:dailyRemind,巡检消息:inspect",required = true) - @NotNull(message = "业务分类不能为空") - @QueryField(condition = SqlCondition.EQUAL) - private String businessClassify; - - @ApiModelProperty(value = "业务关键字",required = true) - @NotNull(message = "业务关键字不能为空") - @QueryField(condition = SqlCondition.LIKE) - private String businessKey; - - @ApiModelProperty(value = "主题",required = true) - @NotNull(message = "主题不能为空") - @QueryField(condition = SqlCondition.LIKE) - private String subject; - - @ApiModelProperty(value = "集中推送时长") - private Integer concentratedDuration; - - @ApiModelProperty(value = "集中推送单位") - private String concentratedTimeUnit; - - @ApiModelProperty(value = "提前推送时长") - private Integer advanceDuration; - - @ApiModelProperty(value = "提前推送单位") - @QueryField(condition = SqlCondition.EQUAL) - private String advanceTimeUnit; - - @TableField(exist = false) - @ApiModelProperty(value = "创建人名称") - private String creatorName; - -} diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/entity/config/PushConfigEntity.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/entity/config/PushConfigEntity.java deleted file mode 100644 index ebd2a87..0000000 --- a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/entity/config/PushConfigEntity.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.hnac.hzims.message.entity.config; - -import com.baomidou.mybatisplus.annotation.TableName; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.io.Serializable; - -/** - * @author hx - */ -@Data -@ApiModel("app推送配置") -@TableName("hzims_push_config") -public class PushConfigEntity extends ConfigEntity implements Serializable { - - @ApiModelProperty("是否推送全平台") - private Boolean isAll; - - @ApiModelProperty("推送类型") - private String platformType; - -} diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/entity/config/SmsConfigEntity.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/entity/config/SmsConfigEntity.java deleted file mode 100644 index e038964..0000000 --- a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/entity/config/SmsConfigEntity.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.hnac.hzims.message.entity.config; - -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableName; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import org.springblade.core.mp.support.QueryField; -import org.springblade.core.mp.support.SqlCondition; - -import javax.validation.constraints.NotNull; -import java.io.Serializable; -import java.time.LocalDateTime; - -/** - * @author hx - */ -@ApiModel("短信配置") -@TableName("hzims_sms_config") -@Data -public class SmsConfigEntity extends ConfigEntity implements Serializable { - - @ApiModelProperty(value = "推送手机号",required = true) - @QueryField(condition = SqlCondition.LIKE) - @NotNull - private String phones; - - @ApiModelProperty(value = "资源编号",required = true) - @QueryField(condition = SqlCondition.EQUAL) - @NotNull - private String resourceCode; - - @ApiModelProperty(value = "短信模板参数,json字符串") - private String templateParam; - - @ApiModelProperty(value = "短信模板参数变量定义") - private String contentVariables; - - @TableField(exist = false) - private LocalDateTime pushTime; - -} diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/entity/config/WsConfigEntity.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/entity/config/WsConfigEntity.java deleted file mode 100644 index 1d610ce..0000000 --- a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/entity/config/WsConfigEntity.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.hnac.hzims.message.entity.config; - -import com.baomidou.mybatisplus.annotation.TableName; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.io.Serializable; - -/** - * @author hx - */ -@Data -@ApiModel("web推送配置") -@TableName("hzims_ws_config") -public class WsConfigEntity extends ConfigEntity implements Serializable { - - @ApiModelProperty("是否推送在线用户;true:推送在线用户,false:指定用户推送") - private Boolean isAll; - -} - diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/entity/log/AppLogEntity.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/entity/log/AppLogEntity.java deleted file mode 100644 index c9664a3..0000000 --- a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/entity/log/AppLogEntity.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.hnac.hzims.message.entity.log; - -import com.baomidou.mybatisplus.annotation.TableName; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -/** - * @author hx - */ -@ApiModel(value = "app推送日志对象",description = "app推送日志对象") -@TableName("hzims_app_log") -@Data -public class AppLogEntity extends MessageLogEntity { - - @ApiModelProperty("是否推送全平台") - private Boolean isAll; - - @ApiModelProperty("推送类型") - private String platformType; - -} diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/entity/log/MailLogEntity.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/entity/log/MailLogEntity.java deleted file mode 100644 index 82dfc5f..0000000 --- a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/entity/log/MailLogEntity.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.hnac.hzims.message.entity.log; - -import com.baomidou.mybatisplus.annotation.TableName; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -/** - * @author hx - */ -@Data -@ApiModel(value = "邮箱推送日志",description = "邮箱推送日志") -@TableName("hzims_mail_log") -public class MailLogEntity extends MessageLogEntity { - - @ApiModelProperty("推送邮箱") - private String email; - -} diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/entity/log/MessageLogEntity.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/entity/log/MessageLogEntity.java deleted file mode 100644 index 46b0a12..0000000 --- a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/entity/log/MessageLogEntity.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.hnac.hzims.message.entity.log; - -import com.baomidou.mybatisplus.annotation.TableName; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import org.springblade.core.mp.support.QueryField; -import org.springblade.core.mp.support.SqlCondition; -import org.springblade.core.tenant.mp.TenantEntity; - -import javax.validation.constraints.NotNull; - -/** - * @author hx - */ -@Data -@ApiModel(value = "消息日志") -@TableName("hzims_mail_log") -public class MessageLogEntity extends TenantEntity { - - @ApiModelProperty(value = "业务关键字",required = true) - @NotNull(message = "业务关键字不能为空") - @QueryField(condition = SqlCondition.LIKE) - private String businessKey; - - @ApiModelProperty(value = "业务分类。系统通知:system,事务消息:business,日常提醒:dailyRemind,巡检消息:inspect",required = true) - @NotNull(message = "业务分类不能为空") - @QueryField(condition = SqlCondition.EQUAL) - private String businessClassify; - - @ApiModelProperty(value = "主题",required = true) - @NotNull(message = "主题不能为空") - @QueryField(condition = SqlCondition.LIKE) - private String subject; - - @ApiModelProperty(value = "内容",required = true) - @NotNull(message = "内容不能为空") - private String content; - - @ApiModelProperty(value = "推送人") - @QueryField(condition = SqlCondition.EQUAL) - private String pusher; - - @ApiModelProperty(value = "消息推送请求参数") - @QueryField(condition = SqlCondition.EQUAL) - private String params; - - @ApiModelProperty(value = "错误日志") - private String errorLog; - - @ApiModelProperty(value = "推送结果") - private String result; - - @ApiModelProperty(value = "是否推送成功") - @QueryField(condition = SqlCondition.EQUAL) - private Boolean isSuccess; -} diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/entity/log/SmsLogEntity.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/entity/log/SmsLogEntity.java deleted file mode 100644 index f8ad586..0000000 --- a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/entity/log/SmsLogEntity.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.hnac.hzims.message.entity.log; - -import com.baomidou.mybatisplus.annotation.TableName; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.io.Serializable; -import java.util.List; -import java.util.Map; - -/** - * @author hx - */ -@Data -@ApiModel(value = "短信日志对象",description = "短信日志对象") -@TableName("hzims_sms_log") -public class SmsLogEntity extends MessageLogEntity implements Serializable { - - @ApiModelProperty(value = "接受短信的手机号",required = true) - private String phones; - - @ApiModelProperty("短信模板参数") - private String paramsJson; - -} diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/entity/log/WsLogEntity.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/entity/log/WsLogEntity.java deleted file mode 100644 index 1bdfb94..0000000 --- a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/entity/log/WsLogEntity.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.hnac.hzims.message.entity.log; - -import io.swagger.annotations.ApiModel; -import lombok.Data; - -/** - * @author hx - */ -@ApiModel(value = "web推送日志对象",description = "web推送日志对象") -@Data -public class WsLogEntity extends MessageLogEntity { - -} diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/enums/PushStatEnum.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/enums/PushStatEnum.java deleted file mode 100644 index f860fee..0000000 --- a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/enums/PushStatEnum.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.hnac.hzims.message.enums; - -import lombok.Data; -import lombok.Getter; -import lombok.Setter; - -/** - * @Author WL - * @Version v1.0 - * @Serial 1.0 - * @Date 2023/4/7 15:45 - */ -public enum PushStatEnum { - - UNPUSHED(0, "未推送"), - - SUCCESS(1, "推送成功"), - FAIL(2, "推送失败"), - CONFIRMED(3, "已确认"); - - - @Setter - private Integer code; - - @Getter - private final String value; - - PushStatEnum(Integer code, String value) { - this.code = code; - this.value = value; - } - -} diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/fegin/IMessageClient.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/fegin/IMessageClient.java deleted file mode 100644 index 43c639e..0000000 --- a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/fegin/IMessageClient.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.hnac.hzims.message.fegin; - -import com.hnac.hzims.message.MessageConstants; -import com.hnac.hzims.message.dto.*; -import com.hnac.hzims.message.entity.MessagePushRecordEntity; -import com.hnac.hzims.message.entity.config.MessageTemplateEntity; -import org.springblade.core.tool.api.R; -import org.springframework.cloud.openfeign.FeignClient; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestParam; - -import javax.annotation.Resource; - -/** - * @author hx - */ -@FeignClient( - value = MessageConstants.APP_NAME -// fallback = MessageClientFallback.class -) -public interface IMessageClient { - String API_PREFIX = "/feign/message"; - String SEND_MESSAGE = API_PREFIX + "/sendMessage"; - String SEND_WX_MESSAGE = API_PREFIX + "/sendWxMessage"; - String SEND_SMS_MESSAGE = API_PREFIX + "/send-sms-message"; - String PLAN_SEND_MESSAGE = API_PREFIX + "/planSendMessage"; - String GET_TEMPLATE_BY_ID = API_PREFIX + "/getMsgTemplateById"; - String SEND_APP_AND_WS_MSG = API_PREFIX + "/sendAppAndWsMsgByUsers"; - String SEND_SMS_IMMEDIATELY_MSG = API_PREFIX + "/sendSmsImmediatelyMsg"; - String SEND_MAIL_MSG_BY_USERS = API_PREFIX + "/sendMailMsgByUsers"; - - /** - * 推送消息(短信) - * - * @param pushDto - * @return - */ - @PostMapping(SEND_SMS_MESSAGE) - R sendSmsMessage(@RequestBody SmsPushDto pushDto); - - @PostMapping(SEND_MESSAGE) - R sendMessage(@RequestBody MessagePushRecordDto request); - - @GetMapping(GET_TEMPLATE_BY_ID) - R getMsgTemplateById(@RequestParam("id") Long id); - - @PostMapping(value = SEND_WX_MESSAGE,consumes = "application/json; charset=UTF-8") - R sendWxMessage(@RequestBody WxMessageDTO request); - - /** - * @return - * @Author hx - * @Description 计划推送类型消息推送 - * @Date 2023/4/14 15:04 - * @Param - **/ - @PostMapping(PLAN_SEND_MESSAGE) - R planSendMessage(@RequestBody PlanMsgRecordDto request); - - /** - * 发送多人APP、WEB消息 - * @Author hx - * @param request - * @return - */ - @PostMapping(value = SEND_APP_AND_WS_MSG,consumes = "application/json; charset=UTF-8") - R sendAppAndWsMsgByUsers(@RequestBody BusinessMessageDTO request); - - @PostMapping(SEND_MAIL_MSG_BY_USERS) - R sendMailMsgByUsers(@RequestBody MailMessageDTO request); - - - /** - * 发送即时推送短信消息 - * @param smsImmediatelyPushDTO 即时推送短信消息体 - * @return - */ - @PostMapping(SEND_SMS_IMMEDIATELY_MSG) - R sendSmsImmediatelyMsg(@RequestBody SmsImmediatelyPushDTO smsImmediatelyPushDTO); -} diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/fegin/IMessageConfigClient.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/fegin/IMessageConfigClient.java deleted file mode 100644 index fceb796..0000000 --- a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/fegin/IMessageConfigClient.java +++ /dev/null @@ -1,80 +0,0 @@ -package com.hnac.hzims.message.fegin; - -import com.hnac.hzims.message.MessageConstants; -import com.hnac.hzims.message.entity.config.MailConfigEntity; -import com.hnac.hzims.message.entity.config.PushConfigEntity; -import com.hnac.hzims.message.entity.config.SmsConfigEntity; -import com.hnac.hzims.message.entity.config.WsConfigEntity; -import org.springblade.core.tool.api.R; -import org.springframework.cloud.openfeign.FeignClient; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestParam; - -/** - * @author hx - */ -@FeignClient( - value = MessageConstants.APP_NAME, - fallback = MessageConfigClientFallback.class -) -public interface IMessageConfigClient { - - String API_PREFIX = "/feign/message/config"; - String GET_MAIL_CONFIG_BY_BUSINESS_KEY = API_PREFIX + "/getMailConfigByBusinessKey"; - String GET_APP_CONFIG_BY_BUSINESS_KEY = API_PREFIX + "/getAppConfigByBusinessKey"; - String GET_SMS_CONFIG_BY_BUSINESS_KEY = API_PREFIX + "/getSmsConfigByBusinessKey"; - String GET_WS_CONFIG_BY_BUSINESS_KEY = API_PREFIX + "/getWsConfigByBusinessKey"; - String PUSH_APP_MESSAGE_BY_CONFIG = API_PREFIX + "/pushAppMessageByConfig"; - String PUSH_SMS_MESSAGE_BY_CONFIG = API_PREFIX + "/pushSmsMessageByConfig"; - - /** - * 根据业务关键字获取邮件配置 - * @param businessKey 业务关键字 - * @return - */ - @GetMapping(GET_MAIL_CONFIG_BY_BUSINESS_KEY) - MailConfigEntity getMailConfigByBusinessKey(@RequestParam("businessKey") String businessKey); - - /** - * 根据业务关键字获取app推送配置 - * @param businessKey 业务关键字 - * @return - */ - @GetMapping(GET_APP_CONFIG_BY_BUSINESS_KEY) - PushConfigEntity getAppConfigByBusinessKey(@RequestParam("businessKey") String businessKey); - - /** - * 根据业务关键字获取app推送配置 - * @param businessKey 业务关键字 - * @return - */ - @GetMapping(GET_SMS_CONFIG_BY_BUSINESS_KEY) - SmsConfigEntity getSmsConfigByBusinessKey(@RequestParam("businessKey") String businessKey); - - /** - * 根据业务关键字获取web推送配置 - * @param businessKey 业务关键字 - * @return - */ - @GetMapping(GET_WS_CONFIG_BY_BUSINESS_KEY) - WsConfigEntity getWsConfigByBusinessKey(@RequestParam("businessKey") String businessKey); - - /** - * 根据app推送配置推送消息 - * @param pushConfigEntity - * @return - */ - @PostMapping(PUSH_APP_MESSAGE_BY_CONFIG) - R pushAppMessageByConfig(@RequestBody PushConfigEntity pushConfigEntity); - - /** - * 根据短信推送配置推送消息 - * @param smsConfigEntity - * @return - */ - @PostMapping(PUSH_SMS_MESSAGE_BY_CONFIG) - R pushSmsMessageByConfig(@RequestBody SmsConfigEntity smsConfigEntity); - -} diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/fegin/IPushMsgClient.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/fegin/IPushMsgClient.java deleted file mode 100644 index 4f780ef..0000000 --- a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/fegin/IPushMsgClient.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.hnac.hzims.message.fegin; - -import com.hnac.hzims.message.MessageConstants; -import com.hnac.hzims.message.dto.AppPushDto; -import com.hnac.hzims.message.dto.MailPushDto; -import com.hnac.hzims.message.dto.SmsPushDto; -import com.hnac.hzims.message.dto.WsPushDto; -import org.springblade.core.tool.api.R; -import org.springframework.cloud.openfeign.FeignClient; -import org.springframework.stereotype.Component; -import org.springframework.stereotype.Repository; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; - -/** - * @author hx - */ -@FeignClient( - value = MessageConstants.APP_NAME -) -public interface IPushMsgClient { - - String API_PREFIX = "/feign/message"; - String PUSH_MESSAGE_MAIL = API_PREFIX + "/sendMail"; - String PUSH_MESSAGE_SMS = API_PREFIX + "/sendSms"; - String PUSH_MESSAGE_APP = API_PREFIX + "/sendPush"; - String PUSH_MESSAGE_WEB = API_PREFIX + "/sendWebsocket"; - - /** - * 短信推送 - * @param smsPushDto 短信推送对象 - * @return 推送结果 - */ - @PostMapping(PUSH_MESSAGE_SMS) - R sendSms(@RequestBody SmsPushDto smsPushDto); - - /** - * 邮件推送 - * @param mailPushDto 邮箱推送对象(推送内容若为html;则extras内需加入html模板路径以及模板所需参数) - * @return 推送结果 - */ - @PostMapping(PUSH_MESSAGE_MAIL) - R sendMail(@RequestBody MailPushDto mailPushDto); - - /** - * app推送 - * @param appPushDto app推送对象 - * @return 推送结果 - */ - @PostMapping(PUSH_MESSAGE_APP) - R sendPush(@RequestBody AppPushDto appPushDto); - - /** - * web推送 - * @param wsPushDto web推送对象 - * @return 推送结果 - */ - @PostMapping(PUSH_MESSAGE_WEB) - R sendWebsocket(@RequestBody WsPushDto wsPushDto); -} diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/fegin/MessageClientFallback.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/fegin/MessageClientFallback.java deleted file mode 100644 index c3197fc..0000000 --- a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/fegin/MessageClientFallback.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.hnac.hzims.message.fegin; - -import com.hnac.hzims.message.dto.*; -import com.hnac.hzims.message.entity.MessagePushRecordEntity; -import com.hnac.hzims.message.entity.config.MessageTemplateEntity; -import org.springblade.core.tool.api.R; -import org.springframework.stereotype.Component; - -/** - * @author hx - */ -//@Component -public class MessageClientFallback implements IMessageClient { - - @Override - public R sendSmsMessage(SmsPushDto pushDto) { - return R.fail("推送失败!"); - } - - @Override - public R sendMessage(MessagePushRecordDto request) { - return R.fail("推送失败!"); - } - - @Override - public R getMsgTemplateById(Long id) { - return R.fail("获取消息模板失败!"); - } - - @Override - public R sendWxMessage(WxMessageDTO request) { - return R.fail("调用失败!"); - } - - @Override - public R planSendMessage(PlanMsgRecordDto request) { - return R.fail("调用失败!"); - } - - @Override - public R sendAppAndWsMsgByUsers(BusinessMessageDTO request) { - return R.fail("调用失败!"); - } - - @Override - public R sendMailMsgByUsers(MailMessageDTO request) { - return R.fail("调用失败!"); - } - - @Override - public R sendSmsImmediatelyMsg(SmsImmediatelyPushDTO smsImmediatelyPushDTO) { - return R.fail("调用失败!"); - } -} diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/fegin/MessageConfigClientFallback.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/fegin/MessageConfigClientFallback.java deleted file mode 100644 index be92c59..0000000 --- a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/fegin/MessageConfigClientFallback.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.hnac.hzims.message.fegin; - -import com.hnac.hzims.message.entity.config.MailConfigEntity; -import com.hnac.hzims.message.entity.config.PushConfigEntity; -import com.hnac.hzims.message.entity.config.SmsConfigEntity; -import com.hnac.hzims.message.entity.config.WsConfigEntity; -import com.hnac.hzims.message.entity.log.AppLogEntity; -import com.hnac.hzims.message.entity.log.MailLogEntity; -import com.hnac.hzims.message.entity.log.SmsLogEntity; -import org.springblade.core.tool.api.R; -import org.springframework.stereotype.Component; - -/** - * @author hx - */ -@Component -public class MessageConfigClientFallback implements IMessageConfigClient { - - @Override - public MailConfigEntity getMailConfigByBusinessKey(String businessKey) { - return null; - } - - @Override - public PushConfigEntity getAppConfigByBusinessKey(String businessKey) { - return null; - } - - @Override - public SmsConfigEntity getSmsConfigByBusinessKey(String businessKey) { - return null; - } - - @Override - public WsConfigEntity getWsConfigByBusinessKey(String businessKey) { - return null; - } - - @Override - public R pushAppMessageByConfig(PushConfigEntity pushConfigEntity) { - return R.fail("推送失败"); - } - - @Override - public R pushSmsMessageByConfig(SmsConfigEntity smsConfigEntity) { - return R.fail("推送失败"); - } - -} diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/req/PushExtrasReq.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/req/PushExtrasReq.java deleted file mode 100644 index f537f1d..0000000 --- a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/req/PushExtrasReq.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.hnac.hzims.message.req; - -import io.swagger.annotations.ApiModelProperty; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; -import lombok.experimental.SuperBuilder; - -/** - * websocket扩展消息体 - * - * @author xiashandong - * @created 2021/6/24 17:51 - **/ -@Data -public class PushExtrasReq extends PushReq { - - @ApiModelProperty("业务关键字") - private String businessKey; - - @ApiModelProperty("业务分类。系统通知:system,事务消息:business,日常提醒:remindsy,巡检消息:inspect") - private String businessClassify = "none"; - - @ApiModelProperty("消息类型,") - private String type = "1"; - - @ApiModelProperty("扩展参数") - private Object extras; - -} diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/req/PushReq.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/req/PushReq.java deleted file mode 100644 index 85a2e73..0000000 --- a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/req/PushReq.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.hnac.hzims.message.req; - -import io.swagger.annotations.ApiModelProperty; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -/** - * @author xiashandong - * @created 2021/6/24 17:48 - **/ -@Data -public class PushReq { - - @ApiModelProperty("平台组推送服务的业务Code") - private String code; - - @ApiModelProperty("标题") - private String title; - - @ApiModelProperty("消息内容") - private String pushAlert; - -} diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/req/SmsReq.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/req/SmsReq.java deleted file mode 100644 index 9381770..0000000 --- a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/req/SmsReq.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.hnac.hzims.message.req; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.util.List; -import java.util.Map; - -/** - * @author xiashandong - * @created 2021/6/24 16:29 - **/ -@Data -@NoArgsConstructor -@AllArgsConstructor -@Builder -public class SmsReq { - - /** - * 平台资源管理模块提供的code - */ - private String code; - - /** - * 接受短信的手机号 - */ - private List phones; - - /** - * 短信模板参数 - */ - private Map params; - - /** - * 定时推送时租户ID - */ - private String tenantId; - - /** - * 定时推送时创建机构 - */ - private Long createDept; - - /** - * 定时推送时创建人 - */ - private Long createUser; -} diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/MsgPushRecordVO.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/MsgPushRecordVO.java deleted file mode 100644 index 57ada10..0000000 --- a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/MsgPushRecordVO.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.hnac.hzims.message.vo; - -import com.hnac.hzims.message.entity.MsgPushRecordEntity; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 模型VO - * - * @author xiashandong - * @created 2021-06-28 08:38 - **/ -@Data -@EqualsAndHashCode(callSuper = true) -public class MsgPushRecordVO extends MsgPushRecordEntity { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("创建人名称") - private String createUserName; - - @ApiModelProperty("修改人名称") - private String updateUserName; -} \ No newline at end of file diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/MsgSmsRecordVO.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/MsgSmsRecordVO.java deleted file mode 100644 index 55c28d6..0000000 --- a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/MsgSmsRecordVO.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.hnac.hzims.message.vo; - -import com.hnac.hzims.message.entity.MsgSmsRecordEntity; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 模型VO - * - * @author xiashandong - * @created 2021-06-28 08:38 - **/ -@Data -@EqualsAndHashCode(callSuper = true) -public class MsgSmsRecordVO extends MsgSmsRecordEntity { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("创建人名称") - private String createUserName; - - @ApiModelProperty("修改人名称") - private String updateUserName; -} \ No newline at end of file diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/MsgWsRecordHistoryVO.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/MsgWsRecordHistoryVO.java deleted file mode 100644 index dae5add..0000000 --- a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/MsgWsRecordHistoryVO.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.hnac.hzims.message.vo; - -import com.hnac.hzims.message.entity.MsgWsRecordHistoryEntity; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 模型VO - * - * @author xiashandong - * @created 2021-06-28 16:45 - **/ -@Data -@EqualsAndHashCode(callSuper = true) -public class MsgWsRecordHistoryVO extends MsgWsRecordHistoryEntity { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("创建人名称") - private String createUserName; - - @ApiModelProperty("修改人名称") - private String updateUserName; -} \ No newline at end of file diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/MsgWsRecordVO.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/MsgWsRecordVO.java deleted file mode 100644 index 4cf1a03..0000000 --- a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/MsgWsRecordVO.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.hnac.hzims.message.vo; - -import com.hnac.hzims.message.entity.MsgWsRecordEntity; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 模型VO - * - * @author xiashandong - * @created 2021-06-28 08:38 - **/ -@Data -@EqualsAndHashCode(callSuper = true) -public class MsgWsRecordVO extends MsgWsRecordEntity { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("创建人名称") - private String createUserName; - - @ApiModelProperty("修改人名称") - private String updateUserName; -} \ No newline at end of file diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/UnreadMessageVO.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/UnreadMessageVO.java deleted file mode 100644 index 0833bf0..0000000 --- a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/UnreadMessageVO.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.hnac.hzims.message.vo; - -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import com.fasterxml.jackson.databind.ser.std.NullSerializer; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.io.Serializable; - -/** - * @ClassName UnreadMessageVO - * @description: 个人消息中心-待办消息统计返回对象 - * @author: hx - * @create: 2023-04-11 19:04 - * @Version 4.0 - **/ -@Data -@ApiModel("个人消息中心-待办消息统计返回对象") -@EqualsAndHashCode -public class UnreadMessageVO implements Serializable { - - @ApiModelProperty("业务分类") - private String businessClassify; - - @ApiModelProperty("业务分类名称") - private String businessName; - - @ApiModelProperty("待办消息数量") - @JsonSerialize(nullsUsing = NullSerializer.class) - private Long todoNum; - -} diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/UnreadMsgCountVO.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/UnreadMsgCountVO.java deleted file mode 100644 index 7edcfdd..0000000 --- a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/UnreadMsgCountVO.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.hnac.hzims.message.vo; - -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.EqualsAndHashCode; - -@Data -@EqualsAndHashCode -public class UnreadMsgCountVO { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("业务分类") - private String classify; - @ApiModelProperty("数量") - private int count; -} diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/WsMessageVO.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/WsMessageVO.java deleted file mode 100644 index 6892623..0000000 --- a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/WsMessageVO.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.hnac.hzims.message.vo; - -import com.alibaba.fastjson.annotation.JSONField; -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; -import org.springblade.core.tool.utils.DateUtil; -import org.springframework.format.annotation.DateTimeFormat; - -import java.io.Serializable; -import java.time.LocalDateTime; -import java.util.Map; - -/** - * @author hx - */ -@Builder -@AllArgsConstructor -@NoArgsConstructor -@Data -@ApiModel(value = "websocket推送消息对象",description = "websocket推送消息对象") -public class WsMessageVO implements Serializable { - - @ApiModelProperty("消息类型") - private String businessClassify; - - @ApiModelProperty("消息类型名称") - private String businessClassifyName; - - @ApiModelProperty("消息关键字") - private String businessKey; - - @ApiModelProperty("主题") - private String subject; - - @ApiModelProperty("内容") - private String content; - - @ApiModelProperty("推送时间") - @DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME) - @JsonFormat(pattern = DateUtil.PATTERN_DATETIME) - @JSONField(format = DateUtil.PATTERN_DATETIME) - private LocalDateTime pushTime; - - @ApiModelProperty("附加参数") - private Map extras; -} diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/config/MailConfigVO.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/config/MailConfigVO.java deleted file mode 100644 index 21a18bd..0000000 --- a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/config/MailConfigVO.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.hnac.hzims.message.vo.config; - -import com.hnac.hzims.message.entity.config.MailConfigEntity; -import lombok.Data; - -import java.io.Serializable; - -/** - * @author hx - */ -@Data -public class MailConfigVO extends MailConfigEntity implements Serializable { - -} diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/config/PushConfigVO.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/config/PushConfigVO.java deleted file mode 100644 index 53e4bf3..0000000 --- a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/config/PushConfigVO.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.hnac.hzims.message.vo.config; - -import com.hnac.hzims.message.entity.config.PushConfigEntity; -import lombok.Data; - -import java.io.Serializable; - -/** - * @author hx - */ -@Data -public class PushConfigVO extends PushConfigEntity implements Serializable { -} diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/config/SmsConfigVO.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/config/SmsConfigVO.java deleted file mode 100644 index 8f68a07..0000000 --- a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/config/SmsConfigVO.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.hnac.hzims.message.vo.config; - -import com.hnac.hzims.message.entity.config.SmsConfigEntity; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - - -import java.io.Serializable; - -/** - * @author hx - */ -@Data -public class SmsConfigVO extends SmsConfigEntity implements Serializable { - - @ApiModelProperty("手动填写手机号") - private String customizePhones; - -} diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/config/WsConfigVO.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/config/WsConfigVO.java deleted file mode 100644 index 27c2e93..0000000 --- a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/config/WsConfigVO.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.hnac.hzims.message.vo.config; - -import com.hnac.hzims.message.entity.config.WsConfigEntity; - -import java.io.Serializable; - -/** - * @author hx - */ -public class WsConfigVO extends WsConfigEntity implements Serializable { -} diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/log/MailLogVO.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/log/MailLogVO.java deleted file mode 100644 index d4c2f16..0000000 --- a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/log/MailLogVO.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.hnac.hzims.message.vo.log; - -import com.hnac.hzims.message.entity.log.MailLogEntity; -import lombok.Data; - -import java.io.Serializable; - -/** - * @author hx - */ -@Data -public class MailLogVO extends MailLogEntity implements Serializable { - -} diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/msgpushrecord/BusinessTypeStatVo.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/msgpushrecord/BusinessTypeStatVo.java deleted file mode 100644 index 65ff019..0000000 --- a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/msgpushrecord/BusinessTypeStatVo.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.hnac.hzims.message.vo.msgpushrecord; - -import lombok.Data; - -/** - * @Author WL - * @Version v1.0 - * @Serial 1.0 - * @Date 2023/4/7 16:41 - */ -@Data -public class BusinessTypeStatVo { - - /** - * 业务类型 - */ - private String businessClassify; - - - /** - * 业务类型 名称 - */ - private String businessClassifyName; - - /** - * 统计数量 - */ - private Long power; - -} diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/msgpushrecord/MessagePushRecordEntityVo.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/msgpushrecord/MessagePushRecordEntityVo.java deleted file mode 100644 index bb0ba83..0000000 --- a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/msgpushrecord/MessagePushRecordEntityVo.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.hnac.hzims.message.vo.msgpushrecord; - -import com.fasterxml.jackson.annotation.JsonFormat; -import lombok.Data; - -import java.time.YearMonth; - -/** - * @Author WL - * @Version v1.0 - * @Serial 1.0 - * @Date 2023/4/8 11:58 - */ -@Data -public class MessagePushRecordEntityVo { - - /** - * 站点编号 - */ - private String stationCode; - - /** - * 年月 - */ - @JsonFormat(pattern = "yyyy-MM") - private YearMonth yearMonth; - - - /** - * type - */ - private String type; -} diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/msgpushrecord/MessagePushRecordTypeVo.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/msgpushrecord/MessagePushRecordTypeVo.java deleted file mode 100644 index a1ce5ed..0000000 --- a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/msgpushrecord/MessagePushRecordTypeVo.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.hnac.hzims.message.vo.msgpushrecord; - -import lombok.Data; - -import java.util.List; - -/** - * @Author WL - * @Version v1.0 - * @Serial 1.0 - * @Date 2023/4/7 14:41 - */ -@Data -public class MessagePushRecordTypeVo { - - /** - * 消息类型 - */ - private String type; - /** - * 消息类型名称 - */ - private String typeName; - - private List messagePushRecordList; -} diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/msgpushrecord/MessagePushRecordVo.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/msgpushrecord/MessagePushRecordVo.java deleted file mode 100644 index 444ef94..0000000 --- a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/msgpushrecord/MessagePushRecordVo.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.hnac.hzims.message.vo.msgpushrecord; - -import com.fasterxml.jackson.annotation.JsonFormat; -import lombok.Data; - -import java.io.Serializable; -import java.time.LocalDateTime; -import java.time.YearMonth; - -/** - * @Author WL - * @Version v1.0 - * @Serial 1.0 - * @Date 2023/4/7 9:02 - */ -@Data -public class MessagePushRecordVo implements Serializable { - - - /** - * 年 - */ - private Integer year; - - - /** - * 月份 - */ - private Integer month; - - - /** - * 实现推送时间 - */ - private YearMonth strMonth; - - - /** - * 消息类型 - */ - private String type; - - - /** - * 消息类型名称 - */ - private String typeName; - - /** - * 统计数量 - */ - private Long power; -} diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/msgpushrecord/PushStatResponseVo.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/msgpushrecord/PushStatResponseVo.java deleted file mode 100644 index 7850b7b..0000000 --- a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/msgpushrecord/PushStatResponseVo.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.hnac.hzims.message.vo.msgpushrecord; - -import lombok.Data; - -import java.util.List; - -/** - * @Author WL - * @Version v1.0 - * @Serial 1.0 - * @Date 2023/6/29 14:18 - */ -@Data -public class PushStatResponseVo { - - /** - * 推送人名称 - */ - private String pusherName; - - /** - * 业务分类 - */ - private String businessClassify; - /** - * 业务分类名称 - */ - private String businessClassifyName; - /** - * 统计数量 - */ - private Integer count; -} diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/msgpushrecord/PushStatTypeVo.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/msgpushrecord/PushStatTypeVo.java deleted file mode 100644 index c7fc6a1..0000000 --- a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/msgpushrecord/PushStatTypeVo.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.hnac.hzims.message.vo.msgpushrecord; - -import lombok.Data; - -import java.util.List; - -/** - * 推送成功失败 Vo - * - * @Author WL - * @Version v1.0 - * @Serial 1.0 - * @Date 2023/4/7 15:35 - */ -@Data -public class PushStatTypeVo { - - - /** - * 业务分类 - */ - private String businessClassify; - - - /** - * 业务名称 - */ - private String businessClassifyName; - - /** - * 业务分类统计 - */ - private List pushStatList; -} diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/msgpushrecord/PushStatVo.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/msgpushrecord/PushStatVo.java deleted file mode 100644 index 8c2b335..0000000 --- a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/msgpushrecord/PushStatVo.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.hnac.hzims.message.vo.msgpushrecord; - -import com.hnac.hzims.message.enums.PushStatEnum; -import lombok.Data; - -/** - * @Author WL - * @Version v1.0 - * @Serial 1.0 - * @Date 2023/4/7 15:36 - */ -@Data -public class PushStatVo { - - /** - * 业务分类 - */ - private String businessClassify; - - - /** - * 业务分类 - */ - private String businessClassifyName; - - - /** - * 状态 - */ - private Integer status; - - /** - * 状态名称 - */ - private String statusName; - - - /** - * 统计数量 - */ - private Long power; -} diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/msgpushrecord/UserPushStatResponseVo.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/msgpushrecord/UserPushStatResponseVo.java deleted file mode 100644 index b40af0d..0000000 --- a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/msgpushrecord/UserPushStatResponseVo.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.hnac.hzims.message.vo.msgpushrecord; - -import lombok.Data; - -import javax.sound.sampled.Port; -import java.util.List; -import java.util.Map; -import java.util.Set; - -/** - * @Author WL - * @Version v1.0 - * @Serial 1.0 - * @Date 2023/6/29 13:58 - */ -@Data -public class UserPushStatResponseVo { - - /** - * 业务分类 - */ - private String businessClassify; - - /** - * 业务分类名称 - */ - private String businessClassifyName; - - /** - * 封装map - */ - private Map params; -} diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/msgpushrecord/UserPushStatTypeResponseVo.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/msgpushrecord/UserPushStatTypeResponseVo.java deleted file mode 100644 index 1536709..0000000 --- a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/msgpushrecord/UserPushStatTypeResponseVo.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.hnac.hzims.message.vo.msgpushrecord; - -import lombok.Data; - -import java.util.List; -import java.util.Set; - -/** - * @Author WL - * @Version v1.0 - * @Serial 1.0 - * @Date 2023/6/29 13:46 - */ -@Data -public class UserPushStatTypeResponseVo { - - /** - * 封装人员信息 - */ - private List userNames; - - - /** - * 封装业务分类对象 - */ - private List userPushStatResponseVos; - -} diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/msgpushrecord/UserPushStatTypeVo.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/msgpushrecord/UserPushStatTypeVo.java deleted file mode 100644 index 2ed9570..0000000 --- a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/msgpushrecord/UserPushStatTypeVo.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.hnac.hzims.message.vo.msgpushrecord; - -import lombok.Data; - -import java.util.List; - -/** - * @Author WL - * @Version v1.0 - * @Serial 1.0 - * @Date 2023/4/7 15:05 - */ -@Data -public class UserPushStatTypeVo { - - /** - * 推送人名称 - */ - private String pusherName; - - /** - * 推送业务分类数组 - */ - private List pushStatList; - - - - -} diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/msgpushrecord/UserPushStatVo.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/msgpushrecord/UserPushStatVo.java deleted file mode 100644 index c9a1c42..0000000 --- a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/msgpushrecord/UserPushStatVo.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.hnac.hzims.message.vo.msgpushrecord; - -import lombok.Data; - -/** - * @Author WL - * @Version v1.0 - * @Serial 1.0 - * @Date 2023/4/7 15:06 - */ -@Data -public class UserPushStatVo { - - - /** - * 推送人名称 - */ - private String pusherName; - - /** - * 业务分类 - */ - private String businessClassify; - - - /** - * 业务分类 名称 - */ - private String businessClassifyName; - - /** - * 统计数量 - */ - private Long power; -} diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/statistic/MsgPushStatisticVO.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/statistic/MsgPushStatisticVO.java deleted file mode 100644 index 7540810..0000000 --- a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/statistic/MsgPushStatisticVO.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.hnac.hzims.message.vo.statistic; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.io.Serializable; - -/** - * @author hx - */ -@Data -@ApiModel(value = "消息推送统计对象",description = "消息推送统计对象") -public class MsgPushStatisticVO implements Serializable { - - @ApiModelProperty("消息类型") - private String type; - -// @ApiModelProperty("业务关键字") -// private String businessClassify; -// -// @ApiModelProperty("所属机构") -// private String deptId; -// -// @ApiModelProperty("发送人") -// private String sender; - - @ApiModelProperty("发送消息总条数") - private Integer count; - - @ApiModelProperty("费用") - private Double cost; - -} diff --git a/hzims-service-api/pom.xml b/hzims-service-api/pom.xml index 83b22a5..2eae475 100644 --- a/hzims-service-api/pom.xml +++ b/hzims-service-api/pom.xml @@ -14,13 +14,11 @@ assets-api - topvision-api equipment-api basic-api safeproduct-api hzims-operational-api inspect-api - message-api ticket-api weather-api common-api diff --git a/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/repair/constants/WorkTaskConstants.java b/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/repair/constants/WorkTaskConstants.java new file mode 100644 index 0000000..c38c8bb --- /dev/null +++ b/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/repair/constants/WorkTaskConstants.java @@ -0,0 +1,14 @@ +package com.hnac.hzims.ticket.repair.constants; + + +/** + * @author ysj + */ +public interface WorkTaskConstants { + + String WORK_TASK_CLASSIFY = "work_task"; + + + String WORK_TASK_SUBJECT = "工作任务单"; + +} diff --git a/hzims-service-api/ticket-api/ticket-api.iml b/hzims-service-api/ticket-api/ticket-api.iml index 02fe1c6..1daccae 100644 --- a/hzims-service-api/ticket-api/ticket-api.iml +++ b/hzims-service-api/ticket-api/ticket-api.iml @@ -1,313 +1,8 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/hzims-service/assets/pom.xml b/hzims-service/assets/pom.xml index 593e6f0..1ad5834 100644 --- a/hzims-service/assets/pom.xml +++ b/hzims-service/assets/pom.xml @@ -31,11 +31,6 @@ com.hnac.hzims - message-api - compile - - - com.hnac.hzims equipment-api @@ -43,10 +38,6 @@ com.xuxueli xxl-job-core - - - - diff --git a/hzims-service/assets/src/main/java/com/hnac/hzims/spare/aspect/LimitRemindAspect.java b/hzims-service/assets/src/main/java/com/hnac/hzims/spare/aspect/LimitRemindAspect.java index a65e58a..ff94186 100644 --- a/hzims-service/assets/src/main/java/com/hnac/hzims/spare/aspect/LimitRemindAspect.java +++ b/hzims-service/assets/src/main/java/com/hnac/hzims/spare/aspect/LimitRemindAspect.java @@ -3,18 +3,10 @@ package com.hnac.hzims.spare.aspect; import com.baomidou.mybatisplus.core.toolkit.Assert; import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.google.common.collect.Lists; -import com.hnac.hzims.message.MessageConstants; -import com.hnac.hzims.message.dto.AppPushDto; -import com.hnac.hzims.message.dto.MessagePushRecordDto; -import com.hnac.hzims.message.dto.WsPushDto; -import com.hnac.hzims.message.fegin.IMessageClient; -import com.hnac.hzims.message.fegin.IPushMsgClient; import com.hnac.hzims.spare.entity.*; import com.hnac.hzims.spare.service.IWtSpBasicService; import com.hnac.hzims.spare.service.IWtSpTotalService; import com.hnac.hzims.spare.service.IWtSpWarehouseService; -import com.hnac.hzinfo.core.push.enums.PushAudienceType; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.aspectj.lang.JoinPoint; @@ -24,6 +16,9 @@ import org.aspectj.lang.annotation.Pointcut; import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.ObjectUtil; +import org.springblade.message.MessageConstants; +import org.springblade.message.dto.MessagePushRecordDto; +import org.springblade.message.fegin.IMessageClient; import org.springblade.system.feign.ISysClient; import org.springblade.system.user.cache.UserCache; import org.springblade.system.user.entity.User; @@ -42,7 +37,6 @@ import java.util.List; @AllArgsConstructor public class LimitRemindAspect { - private final IPushMsgClient pushMsgClient; private final IWtSpWarehouseService wtSpWarehouseService; private final IWtSpTotalService wtSpTotalService; private final IWtSpBasicService wtSpBasicService; @@ -112,22 +106,10 @@ public class LimitRemindAspect { }; Thread thread = new Thread(runnable); thread.start(); -// Callable c1 = new Callable() { -// -// @Override -// public Object call() throws Exception { -// //异步任务 -// pushWarehouseWarningV2(warehouseId, spRecordEntityList); -// return "success"; -// } -// }; -// Future f = new FutureTask(c1); -// System.out.println(f.get()); } catch (Exception e) { log.error(e.getMessage(), e.toString()); } } -// ExecutorService executorService = new ThreadPoolExecutor(1,1,1, TimeUnit.SECONDS,new LinkedBlockingDeque<>()); private void pushWarehouseWarningV2(Long warehouseId, List spRecordEntityList) { spRecordEntityList.forEach(spRecordEntity -> { @@ -194,106 +176,5 @@ public class LimitRemindAspect { message.setAccount(pusher.getId().toString()); message.setCreateUser(userId); messageClient.sendMessage(message); - - } - - //此接口已经弃用20230608 -// @Deprecated -// private void pushWarehouseWarning(Long warehouseId, List spRecordEntityList) { -// //开启线程池推送消息 -// executorService.execute(() -> spRecordEntityList.forEach(spRecordEntity -> { -// //查询该仓库是否有备品备件超出上下限 -// WtSpWarehouseEntity wtSpWarehouseEntity = wtSpWarehouseService.selectById(warehouseId); -// WtSpTotalEntity wtSpTotalEntity = wtSpTotalService.getOne(Wrappers.lambdaQuery() -// .eq(WtSpTotalEntity::getSpBasicId, spRecordEntity.getSpBasicId()) -// .eq(WtSpTotalEntity::getWarehouseId, warehouseId) -// .last("limit 1;") -// ); -// WtSpBasicEntity basicEntity = wtSpBasicService.getById(spRecordEntity.getSpBasicId()); -// //超出上限/下限发送消息提醒 -// log.info("仓库id为:{},库存为:{},上限为:{},下限为:{}", warehouseId, wtSpTotalEntity.getStock(), basicEntity.getUpperLimit(), basicEntity.getLowerLimit()); -// if (wtSpTotalEntity.getStock() > basicEntity.getUpperLimit() || wtSpTotalEntity.getStock() < basicEntity.getLowerLimit()) { -// User pusher = UserCache.getUser(wtSpWarehouseEntity.getManager()); -// if (ObjectUtil.isEmpty(pusher)) { -// return; -// } -// //完善推送信息 -// String alert; -// if (wtSpTotalEntity.getStock() > basicEntity.getUpperLimit()) { -// alert = String.format("%s内的(%s)已达到上限,目前仓库内的库存为:%s,上限值为:%s。请及时处理!", -// wtSpWarehouseEntity.getName(), -// basicEntity.getName(), -// wtSpTotalEntity.getStock(), -// basicEntity.getUpperLimit() -// ); -// } else { -// alert = String.format("%s内的(%s)已达到下限,目前仓库内的库存为:%s,下限值为:%s。请及时处理!", -// wtSpWarehouseEntity.getName(), -// basicEntity.getName(), -// wtSpTotalEntity.getStock(), -// basicEntity.getLowerLimit() -// ); -// } -// //推送web消息 -// CompletableFuture.supplyAsync(() -> { -// this.warningPushWeb(alert, pusher); -// return "推送成功"; -// }); -// //推送App消息 -// CompletableFuture.supplyAsync(() -> { -// this.warningPushApp(alert, pusher); -// return "推送成功"; -// }); -// } -// })); -// executorService.shutdown(); -// } - - /** - * 备品备件-预警app推送 - * - * @param alert 推送内容 - * @param pusher 推送人 - */ - private void warningPushApp(String alert, User pusher) { - //app推送 - AppPushDto appPushDto = new AppPushDto(); - appPushDto.setBusinessClassify(MessageConstants.BusinessClassifyEnum.ASSETS.getKey()); - appPushDto.setBusinessKey("assets-warning"); - appPushDto.setIsAll(true); - appPushDto.setContent(alert); - appPushDto.setSubject("库存预警"); - appPushDto.setTitle("库存预警"); - appPushDto.setAudienceType(PushAudienceType.TAG); - appPushDto.setTags(Lists.newArrayList(pusher.getId().toString())); - //FIXME 因feign接口请求头丢失 登录信息失效先启用未登陆方式 - appPushDto.setTenantId("200000"); - appPushDto.setCreateUser(1380746947515691009L); - appPushDto.setCreateDept(2000000101L); - appPushDto.setPushAlert(alert); - pushMsgClient.sendPush(appPushDto); - } - - /** - * 备品备件-预警web推送 - * - * @param alert 推送内容 - * @param pusher 推送人 - */ - private void warningPushWeb(String alert, User pusher) { - //web推送 - WsPushDto wsPushDto = new WsPushDto(); - wsPushDto.setBusinessClassify(MessageConstants.BusinessClassifyEnum.ASSETS.getKey()); - wsPushDto.setBusinessKey("assets-warning"); - wsPushDto.setContent(alert); - wsPushDto.setSubject("库存预警"); - wsPushDto.setSubject("备品备件预警信息"); - wsPushDto.setUserIdList(Lists.newArrayList(pusher.getId().toString())); - wsPushDto.setText(alert); - //FIXME 因feign接口请求头丢失 登录信息失效先启用未登陆方式 - wsPushDto.setTenantId("200000"); - wsPushDto.setCreateUser(1380746947515691009L); - wsPushDto.setCreateDept(2000000101L); - pushMsgClient.sendWebsocket(wsPushDto); } -} +} \ No newline at end of file diff --git a/hzims-service/assets/src/main/java/com/hnac/hzims/spare/controller/SpAllocationController.java b/hzims-service/assets/src/main/java/com/hnac/hzims/spare/controller/SpAllocationController.java index c192bdd..d78fd2d 100644 --- a/hzims-service/assets/src/main/java/com/hnac/hzims/spare/controller/SpAllocationController.java +++ b/hzims-service/assets/src/main/java/com/hnac/hzims/spare/controller/SpAllocationController.java @@ -6,7 +6,6 @@ import com.hnac.hzims.AssetsConstants; import com.hnac.hzims.common.logs.annotation.OperationAnnotation; import com.hnac.hzims.common.logs.enums.BusinessType; import com.hnac.hzims.common.logs.enums.OperatorType; -import com.hnac.hzims.message.MessageConstants; import com.hnac.hzims.spare.entity.SpAllocationEntity; import com.hnac.hzims.spare.service.ISpAllocationService; import com.hnac.hzims.spare.vo.SpAllocationVO; @@ -17,7 +16,6 @@ import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import lombok.AllArgsConstructor; import org.springblade.core.boot.ctrl.BladeController; - import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Query; import org.springblade.core.tool.api.R; @@ -25,7 +23,6 @@ import org.springblade.core.tool.utils.Func; import org.springframework.web.bind.annotation.*; import springfox.documentation.annotations.ApiIgnore; -import javax.annotation.Resource; import javax.validation.Valid; diff --git a/hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/impl/StockAlertServiceImpl.java b/hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/impl/StockAlertServiceImpl.java index ae165f1..84d8a23 100644 --- a/hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/impl/StockAlertServiceImpl.java +++ b/hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/impl/StockAlertServiceImpl.java @@ -1,6 +1,5 @@ package com.hnac.hzims.spare.service.impl; -import com.hnac.hzims.message.fegin.IPushMsgClient; import com.hnac.hzims.spare.service.IStockAlertService; import com.hnac.hzims.spare.service.IWtSpTotalService; import com.hnac.hzims.spare.vo.StockVo; @@ -23,7 +22,6 @@ public class StockAlertServiceImpl implements IStockAlertService { @NotNull private final IWtSpTotalService totalService; - private final IPushMsgClient pushMsgClient; /** * 库存告警消息推送 diff --git a/hzims-service/hzims-alarm/pom.xml b/hzims-service/hzims-alarm/pom.xml index 57e68a1..f29186b 100644 --- a/hzims-service/hzims-alarm/pom.xml +++ b/hzims-service/hzims-alarm/pom.xml @@ -44,11 +44,6 @@ hzims-operational-api - com.hnac.hzims - message-api - - - org.springframework.boot spring-boot-starter-data-redis diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/monitor/service/impl/AlarmSaveServiceImpl.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/monitor/service/impl/AlarmSaveServiceImpl.java index 4ca596c..556f288 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/monitor/service/impl/AlarmSaveServiceImpl.java +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/monitor/service/impl/AlarmSaveServiceImpl.java @@ -1,18 +1,15 @@ package com.hnac.hzims.alarm.monitor.service.impl; import com.alibaba.fastjson.JSON; -import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.hnac.hzims.alarm.config.constants.AlarmConstants; -import com.hnac.hzims.alarm.config.service.AlarmConfigService; import com.hnac.hzims.alarm.config.entity.AlarmEntity; +import com.hnac.hzims.alarm.config.service.AlarmConfigService; +import com.hnac.hzims.alarm.config.vo.AlarmHandleMarkVo; import com.hnac.hzims.alarm.monitor.service.AlarmSaveService; import com.hnac.hzims.alarm.show.service.AlarmHandleService; import com.hnac.hzims.alarm.show.service.AlarmService; -import com.hnac.hzims.alarm.config.vo.AlarmHandleMarkVo; -import com.hnac.hzims.message.entity.MessagePushRecordEntity; import com.hnac.hzims.operational.station.entity.StationEntity; import com.hnac.hzims.operational.station.feign.IStationClient; -import com.hnac.hzims.safeproduct.constants.RedisConstants; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springblade.core.tool.api.R; diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmHandleFlowServiceImpl.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmHandleFlowServiceImpl.java index eb59ac6..85289f1 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmHandleFlowServiceImpl.java +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmHandleFlowServiceImpl.java @@ -11,9 +11,6 @@ import com.hnac.hzims.alarm.show.mapper.AlarmHandleMapper; import com.hnac.hzims.alarm.show.service.AlarmHandleFlowService; import com.hnac.hzims.common.logs.utils.StringUtils; import com.hnac.hzims.fdp.feign.IFdpDiagnoseClient; -import com.hnac.hzims.message.MessageConstants; -import com.hnac.hzims.message.dto.BusinessMessageDTO; -import com.hnac.hzims.message.fegin.IMessageClient; import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -21,6 +18,9 @@ import org.springblade.core.log.exception.ServiceException; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springblade.core.tool.api.R; import org.springblade.flow.core.feign.IFlowClient; +import org.springblade.message.MessageConstants; +import org.springblade.message.dto.BusinessMessageDTO; +import org.springblade.message.fegin.IMessageClient; import org.springblade.system.feign.ISysClient; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmServiceImpl.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmServiceImpl.java index b83bf9f..0b3c547 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmServiceImpl.java +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmServiceImpl.java @@ -3,36 +3,31 @@ package com.hnac.hzims.alarm.show.service.impl; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; -import com.hnac.hzims.alarm.config.service.AlarmConfigService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.hnac.hzims.alarm.config.constants.AlarmConstants; import com.hnac.hzims.alarm.config.entity.AlarmEntity; +import com.hnac.hzims.alarm.config.service.AlarmConfigService; +import com.hnac.hzims.alarm.config.vo.AlarmCountVo; +import com.hnac.hzims.alarm.config.vo.ChildAlarmCountVo; import com.hnac.hzims.alarm.show.mapper.AlarmMapper; import com.hnac.hzims.alarm.show.service.AlarmHandleService; import com.hnac.hzims.alarm.show.service.AlarmService; import com.hnac.hzims.alarm.source.service.MessageService; -import com.hnac.hzims.alarm.config.vo.AlarmCountVo; -import com.hnac.hzims.alarm.config.vo.ChildAlarmCountVo; import com.hnac.hzims.equipment.entity.EmInfoEntity; import com.hnac.hzims.equipment.entity.EmVideoBandingEntity; import com.hnac.hzims.equipment.feign.IEmInfoClient; import com.hnac.hzims.equipment.feign.IEmVideoClient; -import com.hnac.hzims.message.dto.MailMessageDTO; -import com.hnac.hzims.message.fegin.IMessageClient; import com.hnac.hzims.operational.station.entity.StationEntity; import com.hnac.hzims.operational.station.feign.IStationClient; -import com.hnac.hzinfo.sdk.v5.device.DeviceDataClient; import com.hnac.hzinfo.sdk.v5.device.client.DeviceClient; import com.hnac.hzinfo.sdk.v5.device.vo.DeviceInstanceAttrVO; -import com.hnac.hzinfo.sdk.v5.project.ProjectClient; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springblade.core.log.exception.ServiceException; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.StringUtil; -import org.springblade.system.user.entity.User; import org.springblade.system.user.feign.IUserClient; import org.springframework.stereotype.Service; import org.springframework.util.Assert; @@ -59,9 +54,10 @@ public class AlarmServiceImpl extends ServiceImpl impl private final IStationClient stationClient; - private final IMessageClient messageClient; private final IEmInfoClient emInfoClient; + private final DeviceClient deviceClient; + private final IEmVideoClient emVideoClient; /** @@ -368,33 +364,4 @@ public class AlarmServiceImpl extends ServiceImpl impl } return new ArrayList<>(); } - - /** - * websocket断联发送邮件 - * @return - */ - - public void sendMailByNum(Integer num,Integer maxConnent,String name) { - if (num>=maxConnent){ - MailMessageDTO mailMessageDTO = new MailMessageDTO(); - mailMessageDTO.setDeptId(200000L); - mailMessageDTO.setDeptName("华自科技"); - mailMessageDTO.setBusinessClassify("system"); - mailMessageDTO.setBusinessKey("Mail"); - mailMessageDTO.setSubject("邮件发送"); - - mailMessageDTO.setContent(name+"websocket链接失败;"+"链接失败次数:"+num); - R> res = userClient.userListByRoleAlias("200000", "sendMail"); - if (!res.isSuccess()||CollectionUtil.isEmpty(res.getData())){ - log.error("消息发送失败:无对应用户"); - } - String userIds = res.getData().stream().map(s -> s.getId().toString()).collect(Collectors.joining(",")); - mailMessageDTO.setUserIds(userIds); - mailMessageDTO.setIsHtml(false); - R booleanR = messageClient.sendMailMsgByUsers(mailMessageDTO); - if (!booleanR.isSuccess()){ - log.error("消息发送失败:"+mailMessageDTO.getUserIds()+"--->"+booleanR.getMsg()); - } - } - } } \ No newline at end of file diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/source/service/impl/FdpAlarmServiceImpl.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/source/service/impl/FdpAlarmServiceImpl.java index 5a6844d..f0f557e 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/source/service/impl/FdpAlarmServiceImpl.java +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/source/service/impl/FdpAlarmServiceImpl.java @@ -7,7 +7,6 @@ import com.hnac.hzims.alarm.source.service.FdpAlarmService; import com.hnac.hzims.alarm.source.service.MessageService; import com.hnac.hzims.alarm.show.service.AlarmService; import com.hnac.hzims.alarm.config.vo.FdpAlarmVo; -import com.hnac.hzims.message.fegin.IMessageClient; import com.hnac.hzims.operational.station.entity.StationEntity; import com.hnac.hzims.operational.station.feign.IStationClient; import lombok.RequiredArgsConstructor; @@ -37,13 +36,14 @@ import static com.hnac.hzims.alarm.config.constants.AlarmConstants.*; @RequiredArgsConstructor public class FdpAlarmServiceImpl implements FdpAlarmService { - private final MessageService messageService; + private final IUserClient userClient; + private final ISysClient sysClient; - private final IMessageClient messageClient; private final AlarmService alarmService; + private final IStationClient stationClient; /** * 定时发送消息内容 diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/source/service/impl/MessageServiceImpl.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/source/service/impl/MessageServiceImpl.java index 0156355..ca5e946 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/source/service/impl/MessageServiceImpl.java +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/source/service/impl/MessageServiceImpl.java @@ -1,28 +1,21 @@ package com.hnac.hzims.alarm.source.service.impl; import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; -import com.hnac.hzims.alarm.config.constants.AlarmConstants; -import com.hnac.hzims.alarm.config.service.AlarmConfigService; import com.hnac.hzims.alarm.config.entity.AlarmEntity; import com.hnac.hzims.alarm.source.service.MessageService; import com.hnac.hzims.common.constant.CommonConstant; -import com.hnac.hzims.message.MessageConstants; -import com.hnac.hzims.message.dto.BusinessMessageDTO; -import com.hnac.hzims.message.dto.SmsImmediatelyPushDTO; -import com.hnac.hzims.message.dto.SmsPushDto; -import com.hnac.hzims.message.dto.WxMessageDTO; -import com.hnac.hzims.message.fegin.IMessageClient; import com.hnac.hzims.operational.station.entity.StationEntity; import com.hnac.hzims.operational.station.feign.IStationClient; -import lombok.AllArgsConstructor; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springblade.core.tool.api.R; -import org.springblade.core.tool.jackson.JsonUtil; import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.DateUtil; -import org.springblade.core.tool.utils.Func; -import org.springblade.core.tool.utils.StringUtil; +import org.springblade.message.MessageConstants; +import org.springblade.message.dto.BusinessMessageDTO; +import org.springblade.message.dto.SmsImmediatelyPushDTO; +import org.springblade.message.dto.WxMessageDTO; +import org.springblade.message.fegin.IMessageClient; import org.springblade.system.cache.DictCache; import org.springblade.system.feign.ISysClient; import org.springblade.system.user.entity.User; @@ -109,21 +102,13 @@ public class MessageServiceImpl implements MessageService { return; } List users =new ArrayList<>(); -// //通知站点项目经理这个角色 -// users = userClient.relationUserListByRoleAlias(station.getData().getTenantId(), station.getData().getRefDept(), PROJECT_MANAGER).getData(); -// if(CollectionUtil.isEmpty(users)){ -// log.error("短信发送失败:获取站点项目经理用户失败 : {}",entity); -// return; -// } - //写死传给固定用户 -// List phoneList=Arrays.asList("18351807087","18163793336","13725599914"); if (msgEnabled){ users = userClient.relationUserListByRoleAlias(station.getData().getTenantId(), station.getData().getRefDept(), PROJECT_MANAGER).getData(); if(CollectionUtil.isEmpty(users)){ log.error("短信发送失败:获取站点项目经理用户失败 : {}",entity); return; } - log.info("短信发送用户列表",users); + log.info("短信发送用户列表:{}",users); }else { List phoneList = Arrays.asList("18351807087", "18163793336", "18285121497"); for (String phone : phoneList) { @@ -132,7 +117,7 @@ public class MessageServiceImpl implements MessageService { users.add(userByPhone.getData().getUser()); } } - log.info("短信发送用户列表",users); + log.info("短信发送用户列表:{}",users); } SmsImmediatelyPushDTO push = SmsImmediatelyPushDTO.builder() .deptId(entity.getCreateDept()) @@ -175,7 +160,7 @@ public class MessageServiceImpl implements MessageService { return; } userList.addAll(result.getData()); - log.info("短信发送用户列表",userList); + log.info("短信发送用户列表:{}",userList); }else { //内测只推给对应的3个用户 List phoneList = Arrays.asList("18351807087", "18163793336", "18285121497"); @@ -185,14 +170,14 @@ public class MessageServiceImpl implements MessageService { userList.add(userByPhone.getData().getUser()); } } - log.info("短信发送用户列表",userList); + log.info("短信发送用户列表:{}",userList); } String userIds = userList.stream().map(o -> String.valueOf(o.getId())).distinct().collect(Collectors.joining(",")); WxMessageDTO message = new WxMessageDTO(); // 模板Id message.setTemplateId(wxPushTemplate); -// // 微信消息跳转地址 -// message.setSkipUrl("http://baidu.com"); + // 微信消息跳转地址 + //message.setSkipUrl("http://baidu.com"); // 机构Id message.setDeptId(station.getData().getRefDept()); // 业务关键字 @@ -204,10 +189,9 @@ public class MessageServiceImpl implements MessageService { // 微信参数键值对 HashMap map = new HashMap<>(); map.put("thing18",getTruncateString(entity.getStationName(), 20)); -// map.put("thing5",Optional.ofNullable(entity.getDeviceCode()).orElse("未知设备")); map.put("thing11",getTruncateString(entity.getAlarmContext(), 20)); map.put("time2",entity.getAlarmTime()); - map.put("thing14", DictCache.getValue("alarm_type", entity.getAlarmType())); + map.put("thing14", DictCache.getValue("alarm_type", String.valueOf(entity.getAlarmType()))); message.setMap(map); // 消息内容 message.setContent(entity.getAlarmContext()); diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/source/service/impl/SystemAlarmServiceImpl.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/source/service/impl/SystemAlarmServiceImpl.java index b829956..ea8862d 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/source/service/impl/SystemAlarmServiceImpl.java +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/source/service/impl/SystemAlarmServiceImpl.java @@ -1,25 +1,21 @@ package com.hnac.hzims.alarm.source.service.impl; import com.alibaba.fastjson.JSONObject; -import com.alibaba.fastjson.TypeReference; import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.hnac.hzims.alarm.config.constants.AlarmConstants; +import com.hnac.hzims.alarm.config.constants.AlarmHandleConstant; import com.hnac.hzims.alarm.config.entity.AlarmEntity; +import com.hnac.hzims.alarm.config.vo.SystemAlarmVo; +import com.hnac.hzims.alarm.show.service.AlarmService; import com.hnac.hzims.alarm.source.service.MessageService; import com.hnac.hzims.alarm.source.service.SystemAlarmService; -import com.hnac.hzims.alarm.show.service.AlarmService; -import com.hnac.hzims.alarm.config.vo.SystemAlarmVo; -import com.hnac.hzims.message.fegin.IMessageClient; -import com.hnac.hzims.alarm.config.constants.AlarmHandleConstant; import com.hnac.hzims.operational.station.entity.StationEntity; import com.hnac.hzims.operational.station.feign.IStationClient; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import org.apache.commons.collections4.MapUtils; import org.springblade.core.log.exception.ServiceException; import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.CollectionUtil; -import org.springblade.core.tool.utils.DateUtil; import org.springblade.system.feign.ISysClient; import org.springblade.system.user.feign.IUserClient; import org.springframework.stereotype.Service; @@ -39,12 +35,13 @@ import java.util.stream.Collectors; public class SystemAlarmServiceImpl implements SystemAlarmService { private final MessageService messageService; + private final IUserClient userClient; private final ISysClient sysClient; - private final IMessageClient messageClient; private final AlarmService alarmService; + private final IStationClient stationClient; /** diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/source/service/impl/VideoAlarmServiceImpl.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/source/service/impl/VideoAlarmServiceImpl.java index 5eecd34..061b57a 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/source/service/impl/VideoAlarmServiceImpl.java +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/source/service/impl/VideoAlarmServiceImpl.java @@ -3,13 +3,12 @@ package com.hnac.hzims.alarm.source.service.impl; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.hnac.hzims.alarm.config.constants.AlarmConstants; +import com.hnac.hzims.alarm.config.constants.AlarmHandleConstant; import com.hnac.hzims.alarm.config.entity.AlarmEntity; -import com.hnac.hzims.alarm.source.service.VideoAlarmService; import com.hnac.hzims.alarm.show.service.AlarmService; +import com.hnac.hzims.alarm.source.service.VideoAlarmService; import com.hnac.hzims.equipment.entity.EmInfoEntity; import com.hnac.hzims.equipment.feign.IEmInfoClient; -import com.hnac.hzims.message.fegin.IMessageClient; -import com.hnac.hzims.alarm.config.constants.AlarmHandleConstant; import com.hnac.hzims.operational.station.entity.StationEntity; import com.hnac.hzims.operational.station.feign.IStationClient; import com.hnac.hzinfo.datasearch.soe.ISoeClient; @@ -21,6 +20,7 @@ import lombok.extern.slf4j.Slf4j; import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.DateUtil; +import org.springblade.message.fegin.IMessageClient; import org.springframework.stereotype.Service; import java.util.ArrayList; diff --git a/hzims-service/hzims-basic/pom.xml b/hzims-service/hzims-basic/pom.xml index f92dad1..16958bf 100644 --- a/hzims-service/hzims-basic/pom.xml +++ b/hzims-service/hzims-basic/pom.xml @@ -49,11 +49,6 @@ hzims-operational-api - com.hnac.hzims - message-api - - - org.springframework.boot spring-boot-starter-data-redis diff --git a/hzims-service/hzims-scheduled/pom.xml b/hzims-service/hzims-scheduled/pom.xml index 15649e3..998ebfc 100644 --- a/hzims-service/hzims-scheduled/pom.xml +++ b/hzims-service/hzims-scheduled/pom.xml @@ -59,10 +59,6 @@ com.hnac.hzims - message-api - - - com.hnac.hzims ticket-api diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/BasicScheduledTask.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/BasicScheduledTask.java index 49b5768..f2f52b6 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/BasicScheduledTask.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/BasicScheduledTask.java @@ -6,12 +6,6 @@ import com.hnac.hzims.basic.entity.CertificatetEntity; import com.hnac.hzims.basic.entity.CertificatetNoticeEntity; import com.hnac.hzims.basic.entity.PersonManagemetEntity; import com.hnac.hzims.common.logs.utils.StringUtils; -import com.hnac.hzims.message.MessageConstants; -import com.hnac.hzims.message.dto.BusinessMessageDTO; -import com.hnac.hzims.message.entity.config.SmsConfigEntity; -import com.hnac.hzims.message.fegin.IMessageClient; -import com.hnac.hzims.message.fegin.IMessageConfigClient; -import com.hnac.hzims.scheduled.mapper.basic.PersonManagemetMapper; import com.hnac.hzims.scheduled.service.basic.IImsCertificatetNoticeService; import com.hnac.hzims.scheduled.service.basic.IImsCertificatetService; import com.hnac.hzims.scheduled.service.basic.IImsPresonManagementService; @@ -23,6 +17,11 @@ import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.DateUtil; import org.springblade.core.tool.utils.ObjectUtil; +import org.springblade.message.MessageConstants; +import org.springblade.message.dto.BusinessMessageDTO; +import org.springblade.message.entity.config.SmsConfigEntity; +import org.springblade.message.fegin.IMessageClient; +import org.springblade.message.fegin.IMessageConfigClient; import org.springblade.system.feign.ISysClient; import org.springblade.system.user.cache.UserCache; import org.springblade.system.user.entity.User; @@ -122,8 +121,8 @@ public class BasicScheduledTask { // //注意:通知人是创建人所在机构 BusinessMessageDTO message = new BusinessMessageDTO(); message.setBusinessClassify("system"); - message.setBusinessKey(MessageConstants.BusinessClassifyEnum.CERTIFICATETNOTICE.getKey()); - message.setSubject(MessageConstants.BusinessClassifyEnum.CERTIFICATETNOTICE.getDescription()); + message.setBusinessKey("certificatet-notice-message"); + message.setSubject("证书消息"); message.setTaskId(System.currentTimeMillis()); message.setTenantId("200000"); String countent = diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/DutyNoticeScheduledTask.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/DutyNoticeScheduledTask.java index f651a03..bba9fe6 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/DutyNoticeScheduledTask.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/DutyNoticeScheduledTask.java @@ -1,9 +1,6 @@ package com.hnac.hzims.scheduled.scheduled; import com.hnac.hzims.common.logs.utils.StringUtils; -import com.hnac.hzims.message.MessageConstants; -import com.hnac.hzims.message.dto.BusinessMessageDTO; -import com.hnac.hzims.message.fegin.IMessageClient; import com.hnac.hzims.scheduled.service.operation.business.impl.DutyServiceImpl; import com.xxl.job.core.biz.model.ReturnT; import com.xxl.job.core.handler.annotation.XxlJob; @@ -12,6 +9,9 @@ import org.springblade.core.log.exception.ServiceException; import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.DateUtil; import org.springblade.core.tool.utils.Func; +import org.springblade.message.MessageConstants; +import org.springblade.message.dto.BusinessMessageDTO; +import org.springblade.message.fegin.IMessageClient; import org.springblade.system.feign.ISysClient; import org.springblade.system.user.entity.User; import org.springblade.system.user.feign.IUserClient; diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/report/impl/ReportServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/report/impl/ReportServiceImpl.java index 3e5ebff..b7fc18e 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/report/impl/ReportServiceImpl.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/report/impl/ReportServiceImpl.java @@ -9,8 +9,6 @@ import com.hnac.hzims.common.logs.utils.StringUtils; import com.hnac.hzims.equipment.entity.EmInfoEntity; import com.hnac.hzims.equipment.entity.PlanGenerationEntity; import com.hnac.hzims.equipment.vo.RideDeviceVo; -import com.hnac.hzims.message.dto.MailPushDto; -import com.hnac.hzims.message.fegin.IPushMsgClient; import com.hnac.hzims.operational.main.constant.HomePageConstant; import com.hnac.hzims.operational.main.vo.AreaMonthReportVo; import com.hnac.hzims.operational.main.vo.MaintainVo; @@ -57,6 +55,8 @@ import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.DateUtil; import org.springblade.core.tool.utils.ObjectUtil; import org.springblade.core.tool.utils.StringUtil; +import org.springblade.message.dto.MailPushDto; +import org.springblade.message.fegin.IPushMsgClient; import org.springblade.system.entity.Dept; import org.springblade.system.feign.ISysClient; import org.springblade.system.user.entity.User; diff --git a/hzims-service/inspect/pom.xml b/hzims-service/inspect/pom.xml index 6957e38..4d1f307 100644 --- a/hzims-service/inspect/pom.xml +++ b/hzims-service/inspect/pom.xml @@ -47,10 +47,6 @@ com.hnac.hzims - message-api - - - com.hnac.hzims hzims-biz-common 4.0.0-SNAPSHOT diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/aspect/TaskGenerateAspect.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/aspect/TaskGenerateAspect.java index 816cfee..e534024 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/aspect/TaskGenerateAspect.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/aspect/TaskGenerateAspect.java @@ -4,8 +4,6 @@ import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.hnac.hzims.message.dto.PlanMsgRecordDto; -import com.hnac.hzims.message.fegin.IMessageClient; import com.hnac.hzinfo.inspect.config.RedisKeyConfig; import com.hnac.hzinfo.inspect.plan.entity.PlanEntity; import com.hnac.hzinfo.inspect.task.entity.TaskEntity; @@ -23,16 +21,14 @@ import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.DateUtil; import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.ObjectUtil; +import org.springblade.message.dto.PlanMsgRecordDto; +import org.springblade.message.fegin.IMessageClient; import org.springframework.beans.factory.annotation.Value; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Component; -import java.time.LocalDateTime; import java.time.ZoneOffset; -import java.time.format.DateTimeFormatter; -import java.util.HashMap; import java.util.List; -import java.util.Map; import java.util.Optional; /** diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/schedule/TaskSchedule.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/schedule/TaskSchedule.java index 8758e16..f96a0e8 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/schedule/TaskSchedule.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/schedule/TaskSchedule.java @@ -2,10 +2,6 @@ package com.hnac.hzinfo.inspect.task.schedule; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.google.common.collect.Lists; -import com.hnac.hzims.message.MessageConstants; -import com.hnac.hzims.message.dto.BusinessMessageDTO; -import com.hnac.hzims.message.dto.SmsImmediatelyPushDTO; -import com.hnac.hzims.message.fegin.IMessageClient; import com.hnac.hzinfo.inspect.config.RedisKeyConfig; import com.hnac.hzinfo.inspect.task.TaskContants; import com.hnac.hzinfo.inspect.task.entity.TaskEntity; @@ -14,15 +10,16 @@ import com.hnac.hzinfo.inspect.task.service.ITaskService; import com.hnac.hzinfo.inspect.task.service.ITaskUserService; import com.xxl.job.core.biz.model.ReturnT; import com.xxl.job.core.handler.annotation.XxlJob; -import lombok.AllArgsConstructor; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import org.apache.commons.collections4.MapUtils; import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.DateUtil; import org.springblade.core.tool.utils.Func; +import org.springblade.message.MessageConstants; +import org.springblade.message.dto.BusinessMessageDTO; +import org.springblade.message.dto.SmsImmediatelyPushDTO; +import org.springblade.message.fegin.IMessageClient; import org.springframework.beans.factory.annotation.Value; -import org.springframework.cglib.core.Local; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Component; @@ -30,10 +27,13 @@ import java.time.LocalDate; import java.time.LocalDateTime; import java.time.LocalTime; import java.time.ZoneOffset; -import java.util.*; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; import java.util.stream.Collectors; -import static com.hnac.hzinfo.inspect.task.schedule.XxlJobConstants.*; +import static com.hnac.hzinfo.inspect.task.schedule.XxlJobConstants.TASK_END_REMIND; /** * @ClassName TaskSchedule diff --git a/hzims-service/message/message.iml b/hzims-service/message/message.iml deleted file mode 100644 index 1daccae..0000000 --- a/hzims-service/message/message.iml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/hzims-service/message/pom.xml b/hzims-service/message/pom.xml deleted file mode 100644 index 666299e..0000000 --- a/hzims-service/message/pom.xml +++ /dev/null @@ -1,114 +0,0 @@ - - - - com.hnac.hzims - hzims-service - 4.0.0-SNAPSHOT - - 4.0.0 - message - jar - - - UTF-8 - - - - - org.springblade - blade-common - - - org.springblade - blade-system-api - - - - com.hnac.hzims - message-api - - - - org.springframework.boot - spring-boot-starter-thymeleaf - - - ognl - ognl - 3.1.12 - - - redis.clients - jedis - - - com.baomidou - dynamic-datasource-spring-boot-starter - 3.5.0 - - - com.xuxueli - xxl-job-core - - - - org.springframework.boot - spring-boot-starter-websocket - - - org.springframework.boot - spring-boot-starter-tomcat - - - - - org.eclipse.paho - org.eclipse.paho.client.mqttv3 - 1.2.5 - - - - - org.springframework.boot - spring-boot-starter-mail - - - - - cn.hutool - hutool-http - 5.7.16 - - - - - hzims-${project.name}-${project.version} - - - org.springframework.boot - spring-boot-maven-plugin - - - org.apache.maven.plugins - maven-source-plugin - - - com.spotify - dockerfile-maven-plugin - - ${docker.username} - ${docker.password} - ${docker.registry.url}/${docker.namespace}/${project.artifactId} - ${project.version} - true - - target/${project.build.finalName}.jar - - false - - - - - - diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/MessageApplication.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/MessageApplication.java deleted file mode 100644 index bda528f..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/MessageApplication.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.hnac.hzims.message; - -import org.mybatis.spring.annotation.MapperScan; - -import org.springblade.core.launch.BladeApplication; - -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.cloud.openfeign.EnableFeignClients; -import org.springframework.context.annotation.ComponentScan; -@SpringBootApplication(scanBasePackages = {"org.springblade", "com.hnac.*"}) -@MapperScan(basePackages = {"com.hnac.hzinfo.**.mapper","com.hnac.hzims.**.mapper"}) -@EnableFeignClients(basePackages = {"org.springblade", "com.hnac"}) -public class MessageApplication { - - public static void main(String[] args) { - BladeApplication.run(MessageConstants.APP_NAME, MessageApplication.class, args); - } -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/config/MailHealthIndicator.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/config/MailHealthIndicator.java deleted file mode 100644 index 22df0c2..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/config/MailHealthIndicator.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.hnac.hzims.message.config; - -import org.springframework.boot.actuate.health.Health; -import org.springframework.boot.actuate.health.HealthIndicator; -import org.springframework.stereotype.Component; - -/** - * @author hx - */ -@Component -public class MailHealthIndicator implements HealthIndicator { - @Override - public Health health() { - int errorCode = check(); - if (errorCode != 0) { - return Health.down().withDetail("Error Code", errorCode) .build(); - } - return Health.up().build(); - } - - int check(){ - //可以实现自定义的数据库检测逻辑 - return 0; - } -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/config/MessageFactory.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/config/MessageFactory.java deleted file mode 100644 index 898685e..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/config/MessageFactory.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.hnac.hzims.message.config; - -import com.hnac.hzims.message.MessageConstants; -import com.hnac.hzims.message.service.IMessageService; -import org.springblade.core.tool.utils.SpringUtil; - - -public class MessageFactory { - - /** @Author hx - * @Description 获取方法类型 - * @Date 2023/4/4 14:22 - * @Param [messageType] 消息类型 - * @return com.hnac.hzims.message.service.IMessageService - **/ - public static IMessageService getMessageSend(String messageType) { - if(MessageConstants.APP_PUSH.equals(messageType)) { - return SpringUtil.getBean("pushMessageService"); - } - else if(MessageConstants.SMS_PUSH.equals(messageType)) { - return SpringUtil.getBean("smsMessageService"); - } - else if(MessageConstants.MAIL_PUSH.equals(messageType)) { - return SpringUtil.getBean("mailMessageService"); - } - else if(MessageConstants.WS_PUSH.equals(messageType)) { - return SpringUtil.getBean("websocketService"); - } - else { - return null; - } - } - -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/config/MessageStrategy.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/config/MessageStrategy.java deleted file mode 100644 index 5e258fc..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/config/MessageStrategy.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.hnac.hzims.message.config; - -import lombok.Data; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.cloud.context.config.annotation.RefreshScope; -import org.springframework.stereotype.Component; - -/** - * @ClassName MessageStrategy - * @description: - * @author: hx - * @create: 2023-04-14 10:27 - * @Version 4.0 - **/ -@Data -@Component -@ConfigurationProperties("hzims.push-strategy") -public class MessageStrategy { - - private Integer concentrateDuration; - - private String concentrateUnit; - -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/config/ThreadPoolConfig.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/config/ThreadPoolConfig.java deleted file mode 100644 index 3d2a9a3..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/config/ThreadPoolConfig.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.hnac.hzims.message.config; - -import org.springframework.beans.factory.config.ConfigurableBeanFactory; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Scope; - -import java.util.concurrent.ExecutorService; -import java.util.concurrent.LinkedBlockingQueue; -import java.util.concurrent.ThreadPoolExecutor; -import java.util.concurrent.TimeUnit; - -/** - * @author hx - */ -@Configuration -public class ThreadPoolConfig { - - @Bean - public ExecutorService logExecutorService() { - return new ThreadPoolExecutor(2, 5, - 0L, TimeUnit.MILLISECONDS, - new LinkedBlockingQueue()); - } - - @Bean - public ExecutorService appMessagePushExecutor() { - return new ThreadPoolExecutor(1, 1, 0L, TimeUnit.SECONDS,new LinkedBlockingQueue()); - } -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/config/WebSocketConfig.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/config/WebSocketConfig.java deleted file mode 100644 index 3681458..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/config/WebSocketConfig.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.hnac.hzims.message.config; - -import com.hnac.hzims.message.ws.MessageHandler; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.web.socket.WebSocketHandler; -import org.springframework.web.socket.config.annotation.EnableWebSocket; -import org.springframework.web.socket.config.annotation.WebSocketConfigurer; -import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry; - -/** - * @author hx - */ -@Configuration -@EnableWebSocket -public class WebSocketConfig implements WebSocketConfigurer { - @Override - public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) { - registry.addHandler(myHandler(), "/ws/{uid}").setAllowedOrigins("*"); - } - - @Bean - public WebSocketHandler myHandler() { - return new MessageHandler(); - } -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/configure/controller/MailConfigController.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/configure/controller/MailConfigController.java deleted file mode 100644 index c3ec77e..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/configure/controller/MailConfigController.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.hnac.hzims.message.configure.controller; - -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; -import com.hnac.hzims.message.entity.config.MailConfigEntity; -import com.hnac.hzims.message.configure.service.IMailConfigService; -import com.hnac.hzims.message.vo.config.MailConfigVO; -import com.hnac.hzims.message.configure.wrapper.MailConfigWrapper; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import lombok.AllArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springblade.core.mp.support.Condition; -import org.springblade.core.mp.support.Query; -import org.springblade.core.tool.api.R; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; - -import javax.validation.Valid; -import javax.validation.constraints.NotNull; -import java.util.Arrays; - -/** - * @author hx - */ -@RestController -@Slf4j -@Api(value = "邮箱推送配置管理",tags = "邮箱推送配置管理") -@RequestMapping("/mail/config") -@AllArgsConstructor -@Validated -public class MailConfigController { - - private final IMailConfigService mailConfigService; - - @GetMapping("/queryPage") - @ApiOperation("分页查询") - @ApiOperationSupport(order = 1) - public R queryPage(MailConfigEntity entity, Query query) { - IPage page = mailConfigService.page(Condition.getPage(query),Condition.getQueryWrapper(new MailConfigEntity(),entity)); - page.setRecords(MailConfigWrapper.build().listVO(page.getRecords())); - return R.data(page); - } - - @PostMapping("/save") - @ApiOperation("新增") - @ApiOperationSupport(order = 2) - public R save(@Validated @RequestBody MailConfigEntity entity) { - return R.data(mailConfigService.save(entity)); - } - - @GetMapping("/detail/{id}") - @ApiOperation("查询详情") - @ApiOperationSupport(order = 3) - public R detail(@PathVariable @ApiParam(value = "主键Id",required = true) - @Valid @NotNull(message = "主键ID不能为空") Long id) { - MailConfigEntity mailConfigEntity = mailConfigService.getById(id); - return R.data(MailConfigWrapper.build().entityVO(mailConfigEntity)); - } - - @DeleteMapping("/delete/{ids}") - @ApiOperation("删除详情") - @ApiOperationSupport(order = 4) - public R delete(@PathVariable @ApiParam(value = "主键Id,多个按逗号分隔",required = true) - @Valid @NotNull(message = "主键ID不能为空") String ids) { - return R.status(mailConfigService.removeByIds(Arrays.asList(ids.split(",")))); - } - - @PutMapping("/update") - @ApiOperation("更新") - @ApiOperationSupport(order = 5) - public R update(@RequestBody @Validated MailConfigEntity entity){ - return R.status(mailConfigService.updateById(entity)); - } - - @GetMapping("/push/{id}") - @ApiOperation("推送") - @ApiOperationSupport(order = 6) - public R push(@PathVariable @ApiParam(value = "主键Id",required = true) - @Valid @NotNull(message = "主键ID不能为空") Long id){ - MailConfigEntity entity = new MailConfigEntity(); - entity.setId(id); - return mailConfigService.push(entity); - } -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/configure/controller/PushConfigController.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/configure/controller/PushConfigController.java deleted file mode 100644 index 032a9bb..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/configure/controller/PushConfigController.java +++ /dev/null @@ -1,84 +0,0 @@ -package com.hnac.hzims.message.configure.controller; - -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; -import com.hnac.hzims.message.entity.config.PushConfigEntity; -import com.hnac.hzims.message.configure.service.IPushConfigService; -import com.hnac.hzims.message.vo.config.PushConfigVO; -import com.hnac.hzims.message.configure.wrapper.PushConfigWrapper; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import lombok.AllArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springblade.core.boot.ctrl.BladeController; -import org.springblade.core.mp.support.Condition; -import org.springblade.core.mp.support.Query; -import org.springblade.core.tool.api.R; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; - -import javax.validation.Valid; -import javax.validation.constraints.NotNull; -import java.util.Arrays; - -/** - * @author hx - */ -@RestController -@RequestMapping("/push/config") -@Api(value = "app推送配置",tags = "app推送配置") -@AllArgsConstructor -@Slf4j -public class PushConfigController extends BladeController { - private final IPushConfigService pushConfigService; - - @GetMapping("/queryPage") - @ApiOperation("分页查询") - @ApiOperationSupport(order = 1) - public R queryPage(PushConfigEntity entity, Query query) { - IPage page = pushConfigService.page(Condition.getPage(query),Condition.getQueryWrapper(new PushConfigEntity(),entity)); - page.setRecords(PushConfigWrapper.build().listVO(page.getRecords())); - return R.data(page); - } - - @PostMapping("/save") - @ApiOperation("新增") - @ApiOperationSupport(order = 2) - public R save(@Validated @RequestBody PushConfigEntity entity) { - return R.data(pushConfigService.save(entity)); - } - - @GetMapping("/detail/{id}") - @ApiOperation("查询详情") - @ApiOperationSupport(order = 3) - public R detail(@PathVariable @ApiParam(value = "主键Id",required = true) - @Valid @NotNull(message = "主键ID不能为空") Long id) { - PushConfigEntity PushConfigEntity = pushConfigService.getById(id); - return R.data(PushConfigWrapper.build().entityVO(PushConfigEntity)); - } - - @DeleteMapping("/delete/{ids}") - @ApiOperation("删除详情") - @ApiOperationSupport(order = 4) - public R delete(@PathVariable @ApiParam(value = "主键Id,多个按逗号分隔",required = true) - @Valid @NotNull(message = "主键ID不能为空") String ids) { - return R.status(pushConfigService.removeByIds(Arrays.asList(ids.split(",")))); - } - - @PutMapping("/update") - @ApiOperation("更新") - @ApiOperationSupport(order = 5) - public R update(@RequestBody @Validated PushConfigEntity entity){ - return R.status(pushConfigService.updateById(entity)); - } - - @GetMapping("/push/{id}") - @ApiOperation("推送") - @ApiOperationSupport(order = 6) - public R push(@PathVariable @ApiParam(value = "主键Id",required = true) - @Valid @NotNull(message = "主键ID不能为空") Long id){ - PushConfigEntity entity = pushConfigService.getById(id); - return pushConfigService.push(entity); - } -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/configure/controller/SmsConfigController.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/configure/controller/SmsConfigController.java deleted file mode 100644 index 8f0b91b..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/configure/controller/SmsConfigController.java +++ /dev/null @@ -1,93 +0,0 @@ -package com.hnac.hzims.message.configure.controller; - -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; -import com.hnac.hzims.common.utils.Condition; -import com.hnac.hzims.message.constants.SmsConstants; -import com.hnac.hzims.message.entity.config.SmsConfigEntity; -import com.hnac.hzims.message.configure.service.ISmsConfigService; -import com.hnac.hzims.message.vo.config.SmsConfigVO; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import lombok.AllArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springblade.core.boot.ctrl.BladeController; -import org.springblade.core.log.exception.ServiceException; -import org.springblade.core.mp.support.Query; -import org.springblade.core.tool.api.R; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; - -import javax.validation.Valid; -import javax.validation.constraints.NotNull; -import java.util.Arrays; -import java.util.stream.Collectors; - -/** - * @author hx - */ -@RestController -@Slf4j -@Api(value = "短信推送配置管理",tags = "短信推送配置管理") -@RequestMapping("/sms/config") -@AllArgsConstructor -@Validated -public class SmsConfigController extends BladeController { - private final ISmsConfigService smsConfigService; - - @GetMapping("/queryPage") - @ApiOperation("分页查询") - @ApiOperationSupport(order = 1) - public R queryPage(SmsConfigEntity entity, Query query) { - IPage page = smsConfigService.page(Condition.getPage(query),Condition.getQueryWrapper(new SmsConfigEntity(),entity)); - page.setRecords(page.getRecords().parallelStream().map(e->smsConfigService.getCustomizePhones(e)).collect(Collectors.toList())); - return R.data(page); - } - - @PostMapping("/save") - @ApiOperation("新增") - @ApiOperationSupport(order = 2) - public R save(@Validated @RequestBody SmsConfigEntity entity) { - if(!smsConfigService.invalid(entity)) { - throw new ServiceException("校验失败,短信变量与定义的不符!"); - } - return R.data(smsConfigService.save(entity)); - } - - @GetMapping("/detail/{id}") - @ApiOperation("查询详情") - @ApiOperationSupport(order = 3) - public R detail(@PathVariable @ApiParam(value = "主键Id",required = true) - @Valid @NotNull(message = "主键ID不能为空") Long id) { - SmsConfigEntity smsConfigEntity = smsConfigService.getById(id); - return R.data(smsConfigService.getCustomizePhones(smsConfigEntity)); - } - - @DeleteMapping("/delete/{ids}") - @ApiOperation("删除详情") - @ApiOperationSupport(order = 4) - public R delete(@PathVariable @ApiParam(value = "主键Id,多个按逗号分隔",required = true) - @Valid @NotNull(message = "主键ID不能为空") String ids) { - return R.status(smsConfigService.removeByIds(Arrays.asList(ids.split(",")))); - } - - @PutMapping("/update") - @ApiOperation("更新") - @ApiOperationSupport(order = 5) - public R update(@RequestBody @Validated SmsConfigEntity entity){ - if(!smsConfigService.invalid(entity)) { - throw new ServiceException("校验失败,短信变量与定义的不符!"); - } - return R.status(smsConfigService.updateById(entity)); - } - - @GetMapping("/push/{id}/{pushType}/{pushTime}") - @ApiOperation("推送") - @ApiOperationSupport(order = 6) - public R push(@PathVariable @ApiParam(value = "主键Id", required = true) - @Valid @NotNull(message = "主键ID不能为空") Long id, @PathVariable String pushType, @PathVariable String pushTime){ - SmsConfigEntity entity = smsConfigService.getById(id); - return smsConfigService.push(entity, pushType, pushTime); - } -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/configure/controller/WsConfigController.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/configure/controller/WsConfigController.java deleted file mode 100644 index fc49b19..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/configure/controller/WsConfigController.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.hnac.hzims.message.configure.controller; - -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; -import com.hnac.hzims.message.entity.config.WsConfigEntity; -import com.hnac.hzims.message.configure.service.IWsConfigService; -import com.hnac.hzims.message.vo.config.WsConfigVO; -import com.hnac.hzims.message.configure.wrapper.WsConfigWrapper; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import lombok.AllArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springblade.core.boot.ctrl.BladeController; -import org.springblade.core.mp.support.Condition; -import org.springblade.core.mp.support.Query; -import org.springblade.core.tool.api.R; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; - -import javax.validation.Valid; -import javax.validation.constraints.NotNull; -import java.util.Arrays; - - -/** - * @author 86187 - */ -@RestController -@Slf4j -@Api(value = "web推送配置管理",tags = "web推送配置管理") -@RequestMapping("/ws/config") -@AllArgsConstructor -@Validated -public class WsConfigController extends BladeController { - private final IWsConfigService wsConfigService; - - @GetMapping("/queryPage") - @ApiOperation("分页查询") - @ApiOperationSupport(order = 1) - public R queryPage(WsConfigEntity entity, Query query) { - IPage page = wsConfigService.page(Condition.getPage(query),Condition.getQueryWrapper(new WsConfigEntity(),entity)); - page.setRecords(WsConfigWrapper.build().listVO(page.getRecords())); - return R.data(page); - } - - @PostMapping("/save") - @ApiOperation("新增") - @ApiOperationSupport(order = 2) - public R save(@Validated @RequestBody WsConfigEntity entity) { - return R.data(wsConfigService.save(entity)); - } - - @GetMapping("/detail/{id}") - @ApiOperation("查询详情") - @ApiOperationSupport(order = 3) - public R detail(@PathVariable @ApiParam(value = "主键Id",required = true) - @Valid @NotNull(message = "主键ID不能为空") Long id) { - WsConfigEntity WsConfigEntity = wsConfigService.getById(id); - return R.data(WsConfigWrapper.build().entityVO(WsConfigEntity)); - } - - @DeleteMapping("/delete/{ids}") - @ApiOperation("删除详情") - @ApiOperationSupport(order = 4) - public R delete(@PathVariable @ApiParam(value = "主键Id,多个按逗号分隔",required = true) - @Valid @NotNull(message = "主键ID不能为空") String ids) { - return R.status(wsConfigService.removeByIds(Arrays.asList(ids.split(",")))); - } - - @PutMapping("/update") - @ApiOperation("更新") - @ApiOperationSupport(order = 5) - public R update(@RequestBody @Validated WsConfigEntity entity){ - return R.status(wsConfigService.updateById(entity)); - } - - @GetMapping("/push/{id}") - @ApiOperation("推送") - @ApiOperationSupport(order = 6) - public R push(@PathVariable @ApiParam(value = "主键Id",required = true) - @Valid @NotNull(message = "主键ID不能为空") Long id){ - WsConfigEntity entity = wsConfigService.getById(id); - return wsConfigService.push(entity); - } -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/configure/feign/MessageConfigClient.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/configure/feign/MessageConfigClient.java deleted file mode 100644 index 06fdabd..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/configure/feign/MessageConfigClient.java +++ /dev/null @@ -1,93 +0,0 @@ -package com.hnac.hzims.message.configure.feign; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.hnac.hzims.message.configure.service.IMailConfigService; -import com.hnac.hzims.message.configure.service.IPushConfigService; -import com.hnac.hzims.message.configure.service.ISmsConfigService; -import com.hnac.hzims.message.configure.service.IWsConfigService; -import com.hnac.hzims.message.entity.config.MailConfigEntity; -import com.hnac.hzims.message.entity.config.PushConfigEntity; -import com.hnac.hzims.message.entity.config.SmsConfigEntity; -import com.hnac.hzims.message.entity.config.WsConfigEntity; -import com.hnac.hzims.message.entity.log.AppLogEntity; -import com.hnac.hzims.message.entity.log.MailLogEntity; -import com.hnac.hzims.message.entity.log.SmsLogEntity; -import com.hnac.hzims.message.entity.log.WsLogEntity; -import com.hnac.hzims.message.fegin.IMessageConfigClient; -import com.hnac.hzims.message.log.service.IAppLogService; -import com.hnac.hzims.message.log.service.IMailLogService; -import com.hnac.hzims.message.log.service.ISmsLogService; -import io.swagger.annotations.ApiParam; -import lombok.AllArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springblade.core.tool.api.R; -import org.springblade.core.tool.utils.CollectionUtil; -import org.springframework.web.bind.annotation.*; - -import javax.validation.Valid; -import javax.validation.constraints.NotNull; -import java.util.List; - -/** - * @author hx - */ -@RestController -@AllArgsConstructor -@Slf4j -public class MessageConfigClient implements IMessageConfigClient { - - private final IMailConfigService mailConfigService; - private final IPushConfigService pushConfigService; - private final ISmsConfigService smsConfigService; - private final IWsConfigService wsConfigService; - - @Override - @GetMapping(GET_MAIL_CONFIG_BY_BUSINESS_KEY) - public MailConfigEntity getMailConfigByBusinessKey(@Valid @NotNull @ApiParam("业务关键字") @RequestParam String businessKey) { - LambdaQueryWrapper wq = Wrappers.lambdaQuery() - .eq(MailLogEntity::getBusinessKey,businessKey); - List mailConfigEntityList = mailConfigService.list(wq); - return CollectionUtil.isNotEmpty(mailConfigEntityList) ? mailConfigEntityList.get(0) : null; - } - - @Override - @GetMapping(GET_APP_CONFIG_BY_BUSINESS_KEY) - public PushConfigEntity getAppConfigByBusinessKey(@Valid @NotNull @ApiParam("业务关键字") @RequestParam String businessKey) { - LambdaQueryWrapper wq = Wrappers.lambdaQuery() - .eq(AppLogEntity::getBusinessKey,businessKey); - List pushConfigEntityList = pushConfigService.list(wq); - return CollectionUtil.isNotEmpty(pushConfigEntityList) ? pushConfigEntityList.get(0) : null; - } - - @Override - @GetMapping(GET_SMS_CONFIG_BY_BUSINESS_KEY) - public SmsConfigEntity getSmsConfigByBusinessKey(@Valid @NotNull @ApiParam("业务关键字") @RequestParam String businessKey) { - LambdaQueryWrapper wq = Wrappers.lambdaQuery() - .eq(SmsLogEntity::getBusinessKey,businessKey); - List smsConfigEntityList = smsConfigService.list(wq); - return CollectionUtil.isNotEmpty(smsConfigEntityList) ? smsConfigEntityList.get(0) : null; - } - - @Override - @GetMapping(GET_WS_CONFIG_BY_BUSINESS_KEY) - public WsConfigEntity getWsConfigByBusinessKey(@Valid @NotNull @ApiParam("业务关键字") @RequestParam String businessKey) { - LambdaQueryWrapper wq = Wrappers.lambdaQuery() - .eq(WsConfigEntity::getBusinessKey,businessKey); - List wsConfigEntityList = wsConfigService.list(wq); - return CollectionUtil.isNotEmpty(wsConfigEntityList) ? wsConfigEntityList.get(0) : null; - } - - @Override - @PostMapping(PUSH_APP_MESSAGE_BY_CONFIG) - public R pushAppMessageByConfig(@RequestBody PushConfigEntity pushConfigEntity) { - return pushConfigService.push(pushConfigEntity); - } - - @Override - @PostMapping(PUSH_SMS_MESSAGE_BY_CONFIG) - public R pushSmsMessageByConfig(@RequestBody SmsConfigEntity smsConfigEntity) { - return smsConfigService.push(smsConfigEntity); - } - -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/configure/mapper/PushConfigMapper.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/configure/mapper/PushConfigMapper.java deleted file mode 100644 index adb1fab..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/configure/mapper/PushConfigMapper.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.hnac.hzims.message.configure.mapper; - -import com.hnac.hzims.message.entity.config.PushConfigEntity; -import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; - -/** - * @author hx - */ -public interface PushConfigMapper extends UserDataScopeBaseMapper { -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/configure/mapper/SmsConfigMapper.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/configure/mapper/SmsConfigMapper.java deleted file mode 100644 index 21471e3..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/configure/mapper/SmsConfigMapper.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.hnac.hzims.message.configure.mapper; - -import com.hnac.hzims.message.entity.config.SmsConfigEntity; -import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; - -/** - * @author hx - */ -public interface SmsConfigMapper extends UserDataScopeBaseMapper { -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/configure/mapper/WsConfigMapper.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/configure/mapper/WsConfigMapper.java deleted file mode 100644 index 74c5e89..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/configure/mapper/WsConfigMapper.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.hnac.hzims.message.configure.mapper; - -import com.hnac.hzims.message.entity.config.WsConfigEntity; -import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; - -/** - * @author hx - */ -public interface WsConfigMapper extends UserDataScopeBaseMapper { -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/configure/service/IMailConfigService.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/configure/service/IMailConfigService.java deleted file mode 100644 index c9015a5..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/configure/service/IMailConfigService.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.hnac.hzims.message.configure.service; - -import com.hnac.hzims.message.entity.config.MailConfigEntity; - -/** - * @author hx - */ -public interface IMailConfigService extends IMessageConfigService { - - -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/configure/service/IMessageConfigService.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/configure/service/IMessageConfigService.java deleted file mode 100644 index e0f628e..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/configure/service/IMessageConfigService.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.hnac.hzims.message.configure.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.hnac.hzims.message.entity.config.ConfigEntity; - -import org.springblade.core.tool.api.R; - -/** - * @author hx - */ -public interface IMessageConfigService extends IService { - - /** - * 推送消息 - * @param pushEntity - * @return - */ - R push(T pushEntity); - -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/configure/service/IPushConfigService.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/configure/service/IPushConfigService.java deleted file mode 100644 index 82fce21..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/configure/service/IPushConfigService.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.hnac.hzims.message.configure.service; - -import com.hnac.hzims.message.entity.config.PushConfigEntity; - -/** - * @author hx - */ -public interface IPushConfigService extends IMessageConfigService { - -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/configure/service/ISmsConfigService.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/configure/service/ISmsConfigService.java deleted file mode 100644 index cb2a6d3..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/configure/service/ISmsConfigService.java +++ /dev/null @@ -1,106 +0,0 @@ -package com.hnac.hzims.message.configure.service; - -import com.alibaba.fastjson.JSONObject; -import com.hnac.hzims.message.dto.SmsPushDto; -import com.hnac.hzims.message.entity.config.SmsConfigEntity; -import com.hnac.hzims.message.vo.config.SmsConfigVO; -import com.hnac.hzims.message.configure.wrapper.SmsConfigWrapper; -import org.springblade.core.tool.api.R; -import org.springblade.core.tool.utils.*; -import org.springblade.system.user.cache.UserCache; -import org.springblade.system.user.entity.User; - -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.atomic.AtomicBoolean; -import java.util.stream.Collectors; - -/** - * @author hx - */ -public interface ISmsConfigService extends IMessageConfigService{ - - /** - * 短信推送 分为即时推送 延时推送两种方式 - * @param entity 推送内容 - * @param pushType 推送类型 - * @param pushTime 推送时间(仅延时使用) - * @return - */ - R push(SmsConfigEntity entity, String pushType, String pushTime); - - /** - * 短信推送配置转换为推送对象 - * @param pushEntity 短信推送配置 - * @return - */ - default List convert(SmsConfigEntity pushEntity) { - return Arrays.stream(pushEntity.getPhones().split(",")) - .map(phone -> { - SmsPushDto smsPushDto = BeanUtil.copy(pushEntity,SmsPushDto.class); - smsPushDto.setPhones(Arrays.asList(pushEntity.getPhones().split(","))); - if(StringUtil.isNotBlank(pushEntity.getTemplateParam())){ - Map params = new HashMap<>(); - JSONObject jsonParams = JSONObject.parseObject(pushEntity.getTemplateParam()); - jsonParams.forEach((k,v)-> { - params.put(k, (String) v); - }); - smsPushDto.setParams(params); - } - smsPushDto.setCode(pushEntity.getResourceCode()); - return smsPushDto; - }).collect(Collectors.toList()); - } - - /** - * 获取手动填入手机号 - * @param entity - * @return - */ - default SmsConfigVO getCustomizePhones(SmsConfigEntity entity) { - SmsConfigVO smsConfigVO = SmsConfigWrapper.build().entityVO(entity); - if(ObjectUtil.isNotEmpty(smsConfigVO)){ - if(StringUtil.isEmpty(smsConfigVO.getPushers())){ - smsConfigVO.setCustomizePhones(smsConfigVO.getPhones()); - } - else{ - //获取选择推送人生成的手机号码 - List autoPhones = Arrays.stream(smsConfigVO.getPushers().split(",")) - .map(Long::parseLong) - .map(UserCache::getUser) - .filter(user -> ObjectUtil.isNotEmpty(user) && Func.isNotEmpty(user.getPhone())) - .map(User::getPhone) - .distinct() - .collect(Collectors.toList()); - //取差集即为手动填入的手机号码数据 - String customizePhones = Arrays.asList(smsConfigVO.getPhones().split(",")).stream().distinct() - .filter(phone-> CollectionUtil.isEmpty(autoPhones) || !autoPhones.contains(phone)) - .collect(Collectors.joining(",")); - if(StringUtil.isNotBlank(customizePhones)){ - smsConfigVO.setCustomizePhones(customizePhones); - } - } - } - return smsConfigVO; - } - - /** - * 校验新增/修改参数是否合法 - * @param entity - * @return - */ - default boolean invalid(SmsConfigEntity entity) { - AtomicBoolean isInvalid = new AtomicBoolean(true); - if(StringUtil.isNotBlank(entity.getContentVariables())) { - JSONObject content = JSONObject.parseObject(entity.getTemplateParam()); - Arrays.stream(entity.getContentVariables().split(",")).forEachOrdered(contentVariable -> { - if(!content.containsKey(contentVariable)) { - isInvalid.set(false); - } - }); - } - return isInvalid.get(); - } -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/configure/service/IWsConfigService.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/configure/service/IWsConfigService.java deleted file mode 100644 index e772803..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/configure/service/IWsConfigService.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.hnac.hzims.message.configure.service; - -import com.hnac.hzims.message.entity.config.WsConfigEntity; - -/** - * @author hx - */ -public interface IWsConfigService extends IMessageConfigService { - -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/configure/service/impl/MailConfigServiceImpl.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/configure/service/impl/MailConfigServiceImpl.java deleted file mode 100644 index ac1387f..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/configure/service/impl/MailConfigServiceImpl.java +++ /dev/null @@ -1,75 +0,0 @@ -package com.hnac.hzims.message.configure.service.impl; - -import com.alibaba.fastjson.JSONObject; -import com.google.common.collect.Lists; -import com.hnac.hzims.message.dto.MailPushDto; -import com.hnac.hzims.message.entity.config.MailConfigEntity; -import com.hnac.hzims.message.mapper.MailConfigMapper; -import com.hnac.hzims.message.configure.service.IMailConfigService; -import com.hnac.hzims.message.push.service.IPushService; -import com.hnac.hzims.message.service.IMessageService; -import com.hnac.hzims.message.utils.HtmlModule; -import lombok.extern.slf4j.Slf4j; -import org.springblade.core.log.exception.ServiceException; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import org.springblade.core.tool.api.R; -import org.springblade.core.tool.utils.BeanUtil; -import org.springblade.core.tool.utils.Func; -import org.springblade.core.tool.utils.StringUtil; -import org.springblade.system.user.cache.UserCache; -import org.springblade.system.user.entity.User; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.stereotype.Service; -import org.springframework.util.Assert; - -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -/** - * @author hx - */ -@Service("mailConfigService") -@Slf4j -public class MailConfigServiceImpl extends ServiceImpl implements IMailConfigService { - - @Autowired - @Qualifier("mailPushService") - private IPushService pushService; - - @Override - public R push(MailConfigEntity mailConfigEntity) { - Assert.isTrue(Func.isNotEmpty(mailConfigEntity.getId()),()->{ - throw new ServiceException("测试邮件推送传入Id不能为空"); - }); - MailConfigEntity entity = this.getById(mailConfigEntity.getId()); - MailPushDto mailPushDto = BeanUtil.copy(entity,MailPushDto.class); - //完善邮件推送对象 - List mailList = Lists.newArrayList(); - if(StringUtil.isNotBlank(entity.getMails())){ - mailList.addAll(Arrays.asList(entity.getMails().split(","))); - } - if(StringUtil.isNotBlank(entity.getPushers())){ - List emails = Arrays.stream(entity.getPushers().split(",")) - .map(pusher->UserCache.getUser(Long.valueOf(pusher))) - .map(User::getEmail).collect(Collectors.toList()); - mailList.addAll(emails); - } - mailList = mailList.stream().distinct().collect(Collectors.toList()); - mailPushDto.setToAccount(mailList.toArray(new String[mailList.size()])); - mailPushDto.setHtml(entity.isHtml()); - mailPushDto.setText(mailPushDto.getContent()); - if(entity.isHtml()){ - //封装邮件模板 - Map extras = new HashMap(2); - extras.put("templatePath",entity.getTemplateUrl()); - JSONObject jsonObject = JSONObject.parseObject(entity.getJsonObject()); - extras.put("parameters",jsonObject); - mailPushDto.setExtras(extras); - } - return pushService.send(mailPushDto); - } -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/configure/service/impl/PushConfigServiceImpl.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/configure/service/impl/PushConfigServiceImpl.java deleted file mode 100644 index 9084cc8..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/configure/service/impl/PushConfigServiceImpl.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.hnac.hzims.message.configure.service.impl; - -import com.hnac.hzims.message.dto.AppPushDto; -import com.hnac.hzims.message.entity.config.PushConfigEntity; -import com.hnac.hzims.message.configure.mapper.PushConfigMapper; -import com.hnac.hzims.message.push.service.IPushService; -import com.hnac.hzims.message.service.IMessageService; -import com.hnac.hzims.message.configure.service.IPushConfigService; -import com.hnac.hzinfo.core.push.enums.PlatformType; -import com.hnac.hzinfo.core.push.enums.PushAudienceType; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import org.springblade.core.tool.api.R; -import org.springblade.core.tool.utils.BeanUtil; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.stereotype.Service; - -import java.util.Arrays; -import java.util.List; -import java.util.Optional; -import java.util.stream.Collectors; - -/** - * @author hx - */ -@Service("pushConfigService") -public class PushConfigServiceImpl extends ServiceImpl implements IPushConfigService { - - @Autowired - @Qualifier("appPushService") - private IPushService pushService; - - @Override - public R push(PushConfigEntity pushEntity) { - AppPushDto dto = BeanUtil.copy(pushEntity,AppPushDto.class); - dto.setTags(Arrays.asList(pushEntity.getPushers().split(","))); - dto.setTitle(pushEntity.getSubject()); - dto.setPushAlert(pushEntity.getContent()); - dto.setAudienceType(PushAudienceType.TAG); - if(!pushEntity.getIsAll()){ - List platformTypes = Arrays.stream(pushEntity.getPlatformType().split(",")) - .map(type->{ - Optional exist = Arrays.stream(PlatformType.class.getEnumConstants()).filter(e->e.getValue().equals(type)).findFirst(); - return exist.isPresent() ? exist.get() : null; - }).collect(Collectors.toList()); - dto.setPlatformTypes(platformTypes.toArray(new PlatformType[platformTypes.size()])); - } - return pushService.send(dto); - } -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/configure/service/impl/SmsConfigServiceImpl.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/configure/service/impl/SmsConfigServiceImpl.java deleted file mode 100644 index 4360b09..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/configure/service/impl/SmsConfigServiceImpl.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.hnac.hzims.message.configure.service.impl; - -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONObject; -import com.hnac.hzims.message.MessageConstants; -import com.hnac.hzims.message.constants.SmsConstants; -import com.hnac.hzims.message.dto.SmsPushDto; -import com.hnac.hzims.message.entity.PushMessageEntity; -import com.hnac.hzims.message.entity.config.SmsConfigEntity; -import com.hnac.hzims.message.configure.mapper.SmsConfigMapper; -import com.hnac.hzims.message.push.service.IPushService; -import com.hnac.hzims.message.configure.service.ISmsConfigService; -import com.hnac.hzims.message.service.IPushMessageService; -import lombok.extern.slf4j.Slf4j; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import org.springblade.core.tool.api.R; -import org.springblade.core.tool.utils.BeanUtil; -import org.springblade.core.tool.utils.DateUtil; -import org.springblade.core.tool.utils.StringUtil; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.stereotype.Service; - -import java.time.LocalDateTime; -import java.time.format.DateTimeFormatter; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -/** - * @author hx - */ -@Service("smsConfigService") -@Slf4j -public class SmsConfigServiceImpl extends ServiceImpl implements ISmsConfigService { - - @Autowired - @Qualifier("smsPushService") - private IPushService pushService; - @Autowired - private IPushMessageService pushMessageService; - - @Override - public R push(SmsConfigEntity pushEntity) { - SmsPushDto smsPushDto = BeanUtil.copy(pushEntity,SmsPushDto.class); - smsPushDto.setPhones(Arrays.asList(pushEntity.getPhones().split(","))); - if(StringUtil.isNotBlank(pushEntity.getTemplateParam())){ - Map params = new HashMap<>(); - JSONObject jsonParams = JSONObject.parseObject(pushEntity.getTemplateParam()); - jsonParams.forEach((k,v)-> { - params.put(k, (String) v); - }); - smsPushDto.setParams(params); - } - smsPushDto.setCode(pushEntity.getResourceCode()); - log.info("短信推送内容为:{}",JSON.toJSONString(smsPushDto)); - return pushService.send(smsPushDto); - } - - @Override - public R push(SmsConfigEntity entity, String pushType, String pushTime) { - if(SmsConstants.PUSH_TYPE_IMMEDIATE.equals(pushType)) { - return this.push(entity); - } - else if (SmsConstants.PUSH_TYPE_DELAY.equals(pushType)) { - List smsPushDtoList = this.convert(entity); - List messageEntities = smsPushDtoList.stream().map(p -> { - PushMessageEntity pushMessageEntity = new PushMessageEntity(); - pushMessageEntity.setMessageType(MessageConstants.SMS_PUSH); - pushMessageEntity.setBusinessKey(entity.getBusinessKey()); - pushMessageEntity.setMessageContent(JSON.toJSONString(p)); - pushMessageEntity.setPushTime(LocalDateTime.parse(pushTime, DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATETIME))); - return pushMessageEntity; - }).collect(Collectors.toList()); - pushMessageService.saveBatch(messageEntities); - return R.success("消息保存成功,该消息将会延时推送!"); - } - return R.fail("请检查推送类型是否正确,推送失败!"); - } -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/configure/service/impl/WsConfigServiceImpl.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/configure/service/impl/WsConfigServiceImpl.java deleted file mode 100644 index c5c0dac..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/configure/service/impl/WsConfigServiceImpl.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.hnac.hzims.message.configure.service.impl; - -import com.hnac.hzims.message.dto.WsPushDto; -import com.hnac.hzims.message.entity.config.WsConfigEntity; -import com.hnac.hzims.message.configure.mapper.WsConfigMapper; -import com.hnac.hzims.message.push.service.IPushService; -import com.hnac.hzims.message.service.IMessageService; -import com.hnac.hzims.message.configure.service.IWsConfigService; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import org.springblade.core.tool.api.R; -import org.springblade.core.tool.utils.BeanUtil; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.stereotype.Service; - -import java.util.Arrays; -import java.util.stream.Collectors; - -/** - * @author hx - */ -@Service("wsConfigService") -public class WsConfigServiceImpl extends ServiceImpl implements IWsConfigService { - - @Autowired - @Qualifier("wsPushService") - private IPushService pushService; - - @Override - public R push(WsConfigEntity pushEntity) { - WsPushDto dto = BeanUtil.copy(pushEntity,WsPushDto.class); - dto.setAll(pushEntity.getIsAll()); - dto.setText(pushEntity.getContent()); - dto.setUserIdList(Arrays.stream(pushEntity.getPushers().split(",")).collect(Collectors.toList())); - return pushService.send(dto); - } - -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/configure/wrapper/MailConfigWrapper.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/configure/wrapper/MailConfigWrapper.java deleted file mode 100644 index 6af6093..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/configure/wrapper/MailConfigWrapper.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.hnac.hzims.message.configure.wrapper; - -import com.hnac.hzims.message.entity.config.MailConfigEntity; -import com.hnac.hzims.message.vo.config.MailConfigVO; -import org.springblade.core.mp.support.BaseEntityWrapper; -import org.springblade.core.tool.utils.BeanUtil; - -/** - * @author hx - */ -public class MailConfigWrapper extends BaseEntityWrapper { - - public static MailConfigWrapper build(){ - return new MailConfigWrapper(); - } - - @Override - public MailConfigVO entityVO(MailConfigEntity entity) { - MailConfigVO vo = BeanUtil.copy(entity,MailConfigVO.class); - return vo; - } - -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/configure/wrapper/PushConfigWrapper.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/configure/wrapper/PushConfigWrapper.java deleted file mode 100644 index f0c184d..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/configure/wrapper/PushConfigWrapper.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.hnac.hzims.message.configure.wrapper; - -import com.hnac.hzims.message.entity.config.PushConfigEntity; -import com.hnac.hzims.message.vo.config.PushConfigVO; -import org.springblade.core.mp.support.BaseEntityWrapper; -import org.springblade.core.tool.utils.BeanUtil; - -/** - * @author hx - */ -public class PushConfigWrapper extends BaseEntityWrapper { - - public static PushConfigWrapper build() { - return new PushConfigWrapper(); - } - - @Override - public PushConfigVO entityVO(PushConfigEntity entity) { - PushConfigVO vo = BeanUtil.copy(entity,PushConfigVO.class); - return vo; - } -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/configure/wrapper/SmsConfigWrapper.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/configure/wrapper/SmsConfigWrapper.java deleted file mode 100644 index 3d80667..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/configure/wrapper/SmsConfigWrapper.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.hnac.hzims.message.configure.wrapper; - -import com.hnac.hzims.message.entity.config.SmsConfigEntity; -import com.hnac.hzims.message.vo.config.SmsConfigVO; -import org.springblade.core.mp.support.BaseEntityWrapper; -import org.springblade.core.tool.utils.BeanUtil; - -/** - * @author hx - */ -public class SmsConfigWrapper extends BaseEntityWrapper { - - public static SmsConfigWrapper build(){ - return new SmsConfigWrapper(); - } - - @Override - public SmsConfigVO entityVO(SmsConfigEntity entity) { - SmsConfigVO smsConfigVO = BeanUtil.copy(entity,SmsConfigVO.class); - return smsConfigVO; - } -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/configure/wrapper/WsConfigWrapper.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/configure/wrapper/WsConfigWrapper.java deleted file mode 100644 index 9c87ebc..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/configure/wrapper/WsConfigWrapper.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.hnac.hzims.message.configure.wrapper; - -import com.hnac.hzims.message.entity.config.WsConfigEntity; -import com.hnac.hzims.message.vo.config.WsConfigVO; -import org.springblade.core.mp.support.BaseEntityWrapper; -import org.springblade.core.tool.utils.BeanUtil; - -/** - * @author hx - */ -public class WsConfigWrapper extends BaseEntityWrapper { - - public static WsConfigWrapper build(){ - return new WsConfigWrapper(); - } - - @Override - public WsConfigVO entityVO(WsConfigEntity entity) { - WsConfigVO vo = BeanUtil.copy(entity,WsConfigVO.class); - return vo; - } -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/controller/MessageController.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/controller/MessageController.java deleted file mode 100644 index f767c70..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/controller/MessageController.java +++ /dev/null @@ -1,80 +0,0 @@ -package com.hnac.hzims.message.controller; - -import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; -import com.hnac.hzims.message.dto.AppPushDto; -import com.hnac.hzims.message.dto.MailPushDto; -import com.hnac.hzims.message.dto.SmsPushDto; -import com.hnac.hzims.message.dto.WsPushDto; -import com.hnac.hzims.message.service.IMessageService; -import com.hnac.hzims.message.service.impl.MailMessageServiceImpl; -import com.hnac.hzims.message.service.impl.PushMessageServiceImpl; -import com.hnac.hzims.message.service.impl.SmsMessageServiceImpl; -import com.hnac.hzims.message.service.impl.WebsocketServiceImpl; -import com.hnac.hzims.message.utils.HtmlModule; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import lombok.AllArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springblade.core.boot.ctrl.BladeController; -import org.springblade.core.tool.api.R; -import org.springblade.core.tool.utils.SpringUtil; -import org.springframework.web.bind.annotation.*; - -import java.util.List; -import java.util.Map; - -/** - * @author hx - */ -@RestController -@RequestMapping("/message") -@Api(value = "消息推送管理",tags = "消息推送管理") -@AllArgsConstructor -@Slf4j -public class MessageController extends BladeController { - - @PostMapping("/sendMail") - @ApiOperation("发送邮件") - @ApiOperationSupport(order=1) - public R sendMail(@RequestBody MailPushDto mailPushDto){ - IMessageService messageService = SpringUtil.getBean(MailMessageServiceImpl.class); - if(mailPushDto.isHtml()){ - //若邮件内容为html 则从扩展参数内取出模板路径以及参数 - try { - String templatePath = (String) mailPushDto.getExtras().get("templatePath"); - Map parameters = (Map) mailPushDto.getExtras().get("parameters"); - String text = HtmlModule.buildHtml(parameters,templatePath); - mailPushDto.setHtml(true); - mailPushDto.setText(text); - } catch (Exception e) { - e.printStackTrace(); - } - } - return messageService.send(mailPushDto); - } - - @PostMapping("/sendSms") - @ApiOperation("发送短信") - @ApiOperationSupport(order=2) - public R sendSms(@RequestBody SmsPushDto smsPushDto){ - IMessageService messageService = SpringUtil.getBean(SmsMessageServiceImpl.class); - return messageService.send(smsPushDto); - } - - @PostMapping("/sendPush") - @ApiOperation("App推送") - @ApiOperationSupport(order=3) - public R sendPush(@RequestBody AppPushDto appPushDto){ - IMessageService messageService = SpringUtil.getBean(PushMessageServiceImpl.class); - return messageService.send(appPushDto); - } - - @PostMapping("/sendWebsocket") - @ApiOperation("websocket推送") - @ApiOperationSupport(order=4) - public R sendWebsocket(@RequestBody WsPushDto wsPushDto) { - IMessageService messageService = SpringUtil.getBean(WebsocketServiceImpl.class); - return messageService.send(wsPushDto); - } - -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/controller/MessagePushRecordController.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/controller/MessagePushRecordController.java deleted file mode 100644 index 0371b5d..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/controller/MessagePushRecordController.java +++ /dev/null @@ -1,134 +0,0 @@ -package com.hnac.hzims.message.controller; - -import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.core.toolkit.StringUtils; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; -import com.hnac.hzims.message.MessageConstants; -import com.hnac.hzims.message.entity.MessagePushRecordEntity; -import com.hnac.hzims.message.service.IMessagePushRecordService; -import com.hnac.hzims.message.vo.UnreadMessageVO; -import com.hnac.hzinfo.log.annotation.Business; -import com.hnac.hzinfo.log.annotation.Operate; -import com.hnac.hzinfo.log.contants.BusinessType; -import com.hnac.hzinfo.log.contants.Risk; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import lombok.AllArgsConstructor; -import org.springblade.core.boot.ctrl.BladeController; -import org.springblade.core.mp.support.Query; -import org.springblade.core.secure.utils.AuthUtil; -import org.springblade.core.tool.api.R; -import org.springblade.core.tool.utils.Func; -import org.springframework.web.bind.annotation.*; - -import java.time.LocalDateTime; -import java.util.List; - -@RestController -@RequestMapping("/message/record") -@Api(value = "消息推送记录", tags = "消息推送记录") -@AllArgsConstructor -@Business(module = MessageConstants.APP_NAME,value = "消息中心管理",ignore = false) -public class MessagePushRecordController extends BladeController { - - private final IMessagePushRecordService messagePushRecordService; - - @PostMapping("/save") - @ApiOperation("保存消息推送") - @ApiOperationSupport(order = 1) - @Operate(label = "保存消息推送记录",type = BusinessType.INSERT,risk = Risk.LOW,ignore = false) - public R save(@RequestBody MessagePushRecordEntity request) { - return R.status(messagePushRecordService.save(request)); - } - - @PostMapping("/update") - @ApiOperation("更新消息推送记录") - @ApiOperationSupport(order = 2) - @Operate(label = "保存消息推送记录",type = BusinessType.UPDATE,risk = Risk.LOW,ignore = false) - public R update(@RequestBody MessagePushRecordEntity request) { - return R.status(messagePushRecordService.updateById(request)); - } - - @GetMapping("/list") - @ApiOperation("查询消息推送记录列表") - @ApiOperationSupport(order = 3) - @Operate(label = "查询消息推送记录列表",type = BusinessType.QUERY,ignore = false) - public R> list(MessagePushRecordEntity request) { - return R.data(messagePushRecordService.listNoUserScope(request)); - } - - @GetMapping("/listPage") - @ApiOperation("分页查询消息推送记录列表") - @ApiOperationSupport(order = 4) - @Operate(label = "查询消息推送记录分页列表",type = BusinessType.QUERY,ignore = false) - public R> listPage(MessagePushRecordEntity request, Query query) { - return R.data(messagePushRecordService.listPageNoUserScope(request, query)); - } - - @GetMapping("/send/{id}") - @ApiOperation("推送消息记录") - @ApiOperationSupport(order = 5) - @Operate(label = "根据消息记录发送消息",type = BusinessType.UPDATE,risk = Risk.LOW,ignore = false) - public R send(@PathVariable @ApiParam("消息记录ID") Long id) { - return R.data(messagePushRecordService.send(id)); - } - - @GetMapping("/readMessage/{id}") - @ApiOperation("读取消息") - @ApiOperationSupport(order = 6) - @Operate(label = "将消息设为已读",type = BusinessType.UPDATE,risk = Risk.LOW,ignore = false) - public R readMessage(@PathVariable @ApiParam("消息记录ID") String id) { - MessagePushRecordEntity record = messagePushRecordService.getById(id); - if (!(Long.parseLong(record.getPusher()) == AuthUtil.getUserId())) { - return R.fail("当前登录人不是消息接收人,修改状态失败"); - } - LambdaUpdateWrapper eq = Wrappers.lambdaUpdate() - .set(MessagePushRecordEntity::getStatus, MessageConstants.CONFIRM) - .set(MessagePushRecordEntity::getRespondTime, LocalDateTime.now()) - .in(MessagePushRecordEntity::getId, Func.toLongList(",", id)); - return R.status(messagePushRecordService.update(eq)); - } - - @GetMapping("/readMessageBatch") - @ApiOperation("批量处理消息") - @ApiOperationSupport(order = 7) - @Operate(label = "批量将消息设为已读",type = BusinessType.UPDATE,risk = Risk.LOW,ignore = false) - public R readMessageBatch(@RequestParam(required = false) String businessClassify,@RequestParam(required = false) String type) { - LambdaUpdateWrapper eq = Wrappers.lambdaUpdate() - .set(MessagePushRecordEntity::getStatus, MessageConstants.CONFIRM) - .set(MessagePushRecordEntity::getRespondTime, LocalDateTime.now()) - .eq(MessagePushRecordEntity::getPusher, AuthUtil.getUserId()) - .eq(MessagePushRecordEntity::getStatus, MessageConstants.PUSH_SUCCESS) - .eq(Func.isNotEmpty(businessClassify),MessagePushRecordEntity::getBusinessClassify,businessClassify) - .eq(StringUtils.isNotBlank(type),MessagePushRecordEntity::getType,type); - return R.status(messagePushRecordService.update(eq)); - } - - @GetMapping("/getPersonalUnreadMessage") - @ApiOperation("获取当前登录人待办消息") - @ApiOperationSupport(order = 8) - @Operate(label = "获取当前登录人待办消息",type = BusinessType.QUERY) - public R> getPersonalUnreadMessage() { - List personalUnreadMessage = messagePushRecordService.getPersonalUnreadMessage(); - return R.data(personalUnreadMessage); - } - - @GetMapping("/getPersonalAppUnreadMessage") - @ApiOperation("获取当前登录人APP待办消息") - @ApiOperationSupport(order = 9) - @Operate(label = "获取当前登录人APP待办消息",type = BusinessType.QUERY) - public R> getPersonalAppUnreadMessage() { - List personalUnreadMessage = messagePushRecordService.getPersonalAppUnreadMessage(); - return R.data(personalUnreadMessage); - } - - @PostMapping("/sendMessage") - @ApiOperation("消息推送") - @ApiOperationSupport(order = 10) - public R sendMessage(@RequestBody MessagePushRecordEntity request) { - return R.status(messagePushRecordService.saveAndSend(request)); - } -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/controller/MessageTemplateController.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/controller/MessageTemplateController.java deleted file mode 100644 index 6fbf291..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/controller/MessageTemplateController.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.hnac.hzims.message.controller; - - -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; -import com.hnac.hzims.common.logs.annotation.OperationAnnotation; -import com.hnac.hzims.common.logs.enums.BusinessType; -import com.hnac.hzims.common.logs.enums.OperatorType; -import com.hnac.hzims.message.entity.config.MessageTemplateEntity; -import com.hnac.hzims.message.service.IMessageTemplateService; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import lombok.AllArgsConstructor; -import org.springblade.core.boot.ctrl.BladeController; -import org.springblade.core.log.exception.ServiceException; -import org.springblade.core.mp.support.Query; -import org.springblade.core.tool.api.R; -import org.springblade.core.tool.utils.Func; -import org.springframework.util.Assert; -import org.springframework.web.bind.annotation.*; - -import java.util.List; - -@RestController -@AllArgsConstructor -@RequestMapping("/message/template") -@Api(value = "消息模板管理",tags = "消息模板管理") -public class MessageTemplateController extends BladeController { - - private final IMessageTemplateService messageTemplateService; - - @PostMapping("/save") - @ApiOperation("保存消息模板") - @ApiOperationSupport(order = 1) - public R save(@RequestBody MessageTemplateEntity request) { - return R.status(messageTemplateService.save(request)); - } - - @GetMapping("/list") - @ApiOperation("查询列表") - @ApiOperationSupport(order = 2) - public R> list(MessageTemplateEntity request) { - return R.data(messageTemplateService.list(request)); - } - - @GetMapping("/listPage") - @ApiOperation("分页查询") - @ApiOperationSupport(order = 3) - @OperationAnnotation( - moduleName = "消息管理", - title = "消息模版配置",operatorType = OperatorType.MOBILE,businessType = BusinessType.GENCODE, - action = "分页查询消息模版配置列表") - public R> listPage(MessageTemplateEntity request, Query query) { - return R.data(messageTemplateService.listPage(request,query)); - } - - @DeleteMapping("/delete/{ids}") - @ApiOperation("删除消息模板") - @ApiOperationSupport(order = 4) - public R delete(@PathVariable String ids) { - return R.status(messageTemplateService.removeByIds(Func.toLongList(",",ids))); - } - - @PutMapping("/update") - @ApiOperation("修改消息模板") - @ApiOperationSupport(order = 5) - public R update(@RequestBody MessageTemplateEntity request) { - Assert.isTrue(Func.isNotEmpty(request.getId()),() -> { - throw new ServiceException("消息模板编辑时传入ID不能为空"); - }); - return R.status(messageTemplateService.updateById(request)); - } -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/controller/web/MessageStatisticsController.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/controller/web/MessageStatisticsController.java deleted file mode 100644 index dc0acc4..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/controller/web/MessageStatisticsController.java +++ /dev/null @@ -1,98 +0,0 @@ -package com.hnac.hzims.message.controller.web; - -import com.hnac.hzims.message.MessageConstants; -import com.hnac.hzims.message.service.IMessagePushRecordService; -import com.hnac.hzims.message.vo.msgpushrecord.*; -import com.hnac.hzinfo.log.annotation.Business; -import com.hnac.hzinfo.log.annotation.Operate; -import com.hnac.hzinfo.log.contants.BusinessType; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springblade.core.tool.api.R; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; -import java.util.List; - -/** - * 消息统计页面 - * @Author dfy - * @Version v1.0 - * @Serial 1.0 - * @Date 2023/4/7 8:41 - */ -@Slf4j -@RestController -@RequiredArgsConstructor -@RequestMapping("/message/statistics") -@Business(module = MessageConstants.APP_NAME,value = "消息推送统计管理",ignore = false) -public class MessageStatisticsController { - - - private final IMessagePushRecordService messagePushRecordService; - - - /** - * 短信推送统计 - * @return - */ - @GetMapping("/smsPushStat") - @Operate(label = "过去一年消息记录类型分组统计图",type = BusinessType.QUERY,ignore = false) - public R smsPushStat(MessagePushRecordEntityVo vo) { - log.info("短信推送统计"); - List messagePushRecordVos = messagePushRecordService.smsPushStat(vo); - log.info("短信推送统计 返回的数据: {}",messagePushRecordVos); - return R.data(messagePushRecordVos); - } - - - - /** - * 业务类型统计 - */ - @GetMapping("/businessTypeStat") - public R businessTypeStat(MessagePushRecordEntityVo vo) { - log.info("业务类型统计"); - List messagePushRecordVos = messagePushRecordService.businessTypeStat(vo); - log.info("业务类型统计 返回的数据: {}",messagePushRecordVos); - return R.data(messagePushRecordVos); - } - - - /** - * 人员发送统计 - */ - @GetMapping("/userPushStatWithMessgae") - public R userPushStatWithMessgae(MessagePushRecordEntityVo vo) { - log.info("人员发送统计"); - List messagePushRecordVos = messagePushRecordService.userPushStat(vo); - log.info("人员发送统计 返回的数据: {}",messagePushRecordVos); - return R.data(messagePushRecordVos); - } - - - /** - * 新人员发送统计 - */ - @GetMapping("/userPushStat") - @Operate(label = "过去一年消息记录推送人员分组统计图",type = BusinessType.QUERY,ignore = false) - public R userPushStat(MessagePushRecordEntityVo vo) { - log.info("人员发送统计"); - UserPushStatTypeResponseVo messagePushRecordVos = messagePushRecordService.newUserPushStat(vo); - log.info("人员发送统计 返回的数据: {}",messagePushRecordVos); - return R.data(messagePushRecordVos); - } - - - /** - * 推送成功失败统计 - */ - @GetMapping("/pushStat") - @Operate(label = "过去一年消息记录推送结果分组统计图",type = BusinessType.QUERY,ignore = false) - public R pushStat(MessagePushRecordEntityVo vo) { - List messagePushRecordVos = messagePushRecordService.pushStat(vo); - log.info("推送成功失败统计 返回的数据: {}",messagePushRecordVos); - return R.data(messagePushRecordVos); - } - -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/dto/MsgPushRecordDTO.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/dto/MsgPushRecordDTO.java deleted file mode 100644 index c6248ac..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/dto/MsgPushRecordDTO.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.hnac.hzims.message.dto; - -import lombok.Data; -import lombok.EqualsAndHashCode; -import com.hnac.hzims.message.entity.MsgPushRecordEntity; - -/** - * 模型DTO - * - * @author xiashandong - * @created 2021-06-28 08:38 - **/ -@Data -@EqualsAndHashCode(callSuper = true) -public class MsgPushRecordDTO extends MsgPushRecordEntity { - - private static final long serialVersionUID = 1L; - -} \ No newline at end of file diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/dto/MsgSmsRecordDTO.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/dto/MsgSmsRecordDTO.java deleted file mode 100644 index 5ffd6fd..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/dto/MsgSmsRecordDTO.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.hnac.hzims.message.dto; - -import lombok.Data; -import lombok.EqualsAndHashCode; -import com.hnac.hzims.message.entity.MsgSmsRecordEntity; - -/** - * 模型DTO - * - * @author xiashandong - * @created 2021-06-28 08:38 - **/ -@Data -@EqualsAndHashCode(callSuper = true) -public class MsgSmsRecordDTO extends MsgSmsRecordEntity { - - private static final long serialVersionUID = 1L; - -} \ No newline at end of file diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/dto/MsgUpdateStatusDTO.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/dto/MsgUpdateStatusDTO.java deleted file mode 100644 index a178e5c..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/dto/MsgUpdateStatusDTO.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.hnac.hzims.message.dto; - -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import com.fasterxml.jackson.databind.ser.std.NullSerializer; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.EqualsAndHashCode; - -@Data -@EqualsAndHashCode -public class MsgUpdateStatusDTO { - private static final long serialVersionUID = 1L; - - - /** - * 推送目标账户ID - */ - @ApiModelProperty(value = "消息ID") - private Long id; - -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/dto/MsgWsRecordDTO.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/dto/MsgWsRecordDTO.java deleted file mode 100644 index c73ad8c..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/dto/MsgWsRecordDTO.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.hnac.hzims.message.dto; - -import lombok.Data; -import lombok.EqualsAndHashCode; -import com.hnac.hzims.message.entity.MsgWsRecordEntity; - -/** - * 模型DTO - * - * @author xiashandong - * @created 2021-06-28 08:38 - **/ -@Data -@EqualsAndHashCode(callSuper = true) -public class MsgWsRecordDTO extends MsgWsRecordEntity { - - private static final long serialVersionUID = 1L; - -} \ No newline at end of file diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/dto/MsgWsRecordHistoryDTO.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/dto/MsgWsRecordHistoryDTO.java deleted file mode 100644 index 1aa7165..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/dto/MsgWsRecordHistoryDTO.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.hnac.hzims.message.dto; - -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.EqualsAndHashCode; -import com.hnac.hzims.message.entity.MsgWsRecordHistoryEntity; - -import java.util.Date; - -/** - * 模型DTO - * - * @author xiashandong - * @created 2021-06-28 16:45 - **/ -@Data -@EqualsAndHashCode(callSuper = true) -public class MsgWsRecordHistoryDTO extends MsgWsRecordHistoryEntity { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty(value = "查询开始时间") - private Date beginTime; - - @ApiModelProperty(value = "查询结束时间") - private Date endTime; - - -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/dto/PushMessageDTO.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/dto/PushMessageDTO.java deleted file mode 100644 index b3c271a..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/dto/PushMessageDTO.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.hnac.hzims.message.dto; - -import com.hnac.hzims.message.entity.PushMessageEntity; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.io.Serializable; -import java.time.LocalDateTime; - -/** - * @author hx - */ -@Data -@EqualsAndHashCode -public class PushMessageDTO extends PushMessageEntity implements Serializable { - - @ApiModelProperty("开始时间") - private LocalDateTime startTime; - - @ApiModelProperty("结束时间") - private LocalDateTime endTime; - -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/fegin/MessageClient.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/fegin/MessageClient.java deleted file mode 100644 index 4259974..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/fegin/MessageClient.java +++ /dev/null @@ -1,226 +0,0 @@ -package com.hnac.hzims.message.fegin; - -import com.alibaba.fastjson.JSON; -import com.baomidou.mybatisplus.core.toolkit.IdWorker; -import com.hnac.hzims.common.invalid.Create; -import com.hnac.hzims.message.MessageConstants; -import com.hnac.hzims.message.dto.*; -import com.hnac.hzims.message.entity.MessagePushRecordEntity; -import com.hnac.hzims.message.entity.config.MessageTemplateEntity; -import com.hnac.hzims.message.service.IMessagePushRecordService; -import com.hnac.hzims.message.service.IMessageService; -import com.hnac.hzims.message.service.IMessageTemplateService; -import com.hnac.hzims.message.service.impl.SmsMessageServiceImpl; -import lombok.AllArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springblade.core.boot.ctrl.BladeController; -import org.springblade.core.log.exception.ServiceException; -import org.springblade.core.secure.utils.AuthUtil; -import org.springblade.core.tool.api.R; -import org.springblade.core.tool.utils.BeanUtil; -import org.springblade.core.tool.utils.Func; -import org.springblade.core.tool.utils.ObjectUtil; -import org.springblade.core.tool.utils.SpringUtil; -import org.springblade.system.feign.ISysClient; -import org.springblade.system.user.cache.UserCache; -import org.springblade.system.user.entity.User; -import org.springframework.util.Assert; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; - -import javax.validation.Valid; -import java.time.LocalDateTime; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import java.util.stream.Collectors; - -/** - * @author hx - */ -@RestController -@AllArgsConstructor -@Slf4j -public class MessageClient extends BladeController implements IMessageClient{ - - private final IMessagePushRecordService recordService; - private final IMessageTemplateService messageTemplateService; - private final ISysClient sysClient; - - @Override - @PostMapping(SEND_SMS_MESSAGE) - public R sendSmsMessage(@RequestBody SmsPushDto pushDto) { - IMessageService messageService = SpringUtil.getBean(SmsMessageServiceImpl.class); - return messageService.send(pushDto); - } - - @Override - @PostMapping(SEND_MESSAGE) - public R sendMessage(@RequestBody @Valid MessagePushRecordDto request) { - long messageId = IdWorker.getId(); - // 可能存在多种推送类型 - request.getTypes().forEach(type -> { - MessagePushRecordEntity entity = BeanUtil.copy(request,MessagePushRecordEntity.class); - entity.setDeptName(Func.isNotEmpty(entity.getDeptName()) ? entity.getDeptName() : this.getDeptNameById(entity.getDeptId())); - entity.setType(type); - if(Func.isEmpty(AuthUtil.getUserId())) { - entity.setCreateUser(request.getCreateUser()); - entity.setCreateDept(request.getCreateDept()); - } - entity.setMessageId(messageId); - recordService.saveAndSend(entity); - }); - return R.success("推送成功!"); - } - - @GetMapping(GET_TEMPLATE_BY_ID) - @Override - public R getMsgTemplateById(@RequestParam Long id) { - return R.data(messageTemplateService.getById(id)); - } - - @Override - public R sendWxMessage(WxMessageDTO request) { - // 微信消息推送记录保存 - List messages = Func.toLongList(request.getUserIds()).stream().map(userId -> { - MessagePushRecordEntity entity = BeanUtil.copy(request, MessagePushRecordEntity.class); - entity.setDeptName(Func.isNotEmpty(entity.getDeptName()) ? entity.getDeptName() : this.getDeptNameById(entity.getDeptId())); - entity.setMessageId(IdWorker.getId()); - entity.setPusher(userId.toString()); - entity.setPusherName(Optional.ofNullable(UserCache.getUser(userId)).map(User::getName).orElse(null)); - entity.setPushType(MessageConstants.IMMEDIATELY); - entity.setAccount(userId.toString()); - entity.setPlanTime(LocalDateTime.now()); - entity.setType(MessageConstants.WX_PUSH); - entity.setCreateDept(entity.getDeptId()); - return entity; - }).collect(Collectors.toList()); - boolean isSave = recordService.saveBatch(messages); - if(isSave){ - return R.data(recordService.sendWxMessageByUser(request,messages)); - } - return R.data(false); - } - - @PostMapping(PLAN_SEND_MESSAGE) - @Override - public R planSendMessage(@RequestBody @Valid PlanMsgRecordDto request) { - MessageTemplateEntity template = messageTemplateService.getById(request.getTemplateId()); - Assert.isTrue(ObjectUtil.isNotEmpty(template),() -> { - throw new ServiceException("获取消息模板失败,请检查消息模板是否删除!"); - }); - long messageId = IdWorker.getId(); - if(Func.isNotEmpty(template.getType())) { - Func.toStrList(",",template.getType()).forEach(type -> { - MessagePushRecordEntity entity = BeanUtil.copy(template,MessagePushRecordEntity.class); - entity.setId(null); - entity.setType(type); - entity.setTaskId(request.getTaskId()); - entity.setMessageId(messageId); - entity.setTemplateId(request.getTemplateId()); - entity.setDeptId(request.getDeptId()); - entity.setDeptName(Func.isNotEmpty(entity.getDeptName()) ? entity.getDeptName() : this.getDeptNameById(entity.getDeptId())); - entity.setCreateUser(request.getCreateUser()); - entity.setResourceCode(request.getResourceCode()); - entity.setCreateDept(request.getDeptId()); - entity.setPlanTime(request.getPlanTime()); - entity.setPushType(MessageConstants.PLAN); - entity.setPusher(request.getReceiver().toString()); - entity.setPusherName(Optional.ofNullable(UserCache.getUser(request.getReceiver())).map(User::getName).orElse("")); - entity.setAccount(request.getReceiver().toString()); - entity.setContent(request.getContent()); - entity.setSmsParam(request.getSmsParam()); - if(Func.isNotEmpty(request.getTenantId())) { - entity.setTenantId(request.getTenantId()); - } - Assert.isTrue(recordService.saveAndSend(entity),()-> { - throw new ServiceException("消息保存失败!"); - }); - }); - } - return R.success("推送成功!"); - } - - @Override - @PostMapping(value = SEND_APP_AND_WS_MSG , produces="application/json; charset=UTF-8") - public R sendAppAndWsMsgByUsers(@RequestBody @Validated(Create.class) BusinessMessageDTO request) { - return R.status(recordService.sendAppAndWsMsgByUsers(request)); - } - - @Override - @PostMapping(SEND_MAIL_MSG_BY_USERS) - public R sendMailMsgByUsers(@RequestBody MailMessageDTO request) { - // 保存消息记录 - List pushRecords = Func.toLongList(request.getUserIds()).stream().map(userId -> { - MessagePushRecordEntity record = BeanUtil.copy(request, MessagePushRecordEntity.class); - long messageId = IdWorker.getId(); - record.setDeptName(Func.isNotEmpty(record.getDeptName()) ? record.getDeptName() : this.getDeptNameById(record.getDeptId())); - record.setMessageId(messageId); - record.setPusher(userId.toString()); - record.setPusherName(Optional.ofNullable(UserCache.getUser(userId)).map(User::getName).orElse(null)); - record.setType(MessageConstants.MAIL_PUSH); - record.setPushType(MessageConstants.IMMEDIATELY); - record.setPlanTime(LocalDateTime.now()); - record.setCreateDept(record.getDeptId()); - record.setStatus(MessageConstants.NOT_PUSH); - return record; - }).collect(Collectors.toList()); - if(recordService.saveBatch(pushRecords)) { - return R.status(recordService.sendMailMsgByUsers(pushRecords)); - } - else { - return R.data(false); - } - } - - @Override - @PostMapping(SEND_SMS_IMMEDIATELY_MSG) - public R sendSmsImmediatelyMsg(@RequestBody SmsImmediatelyPushDTO smsImmediatelyPushDTO) { - try { - for (Long pushId : Func.toLongList(",", smsImmediatelyPushDTO.getPusher())) { - User user = UserCache.getUser(pushId); - MessagePushRecordEntity record = BeanUtil.copy(smsImmediatelyPushDTO, MessagePushRecordEntity.class); - record.setMessageId(IdWorker.getId()); - record.setPusherName(user.getRealName()); - record.setPusher(pushId.toString()); - record.setPushType(MessageConstants.IMMEDIATELY); - record.setDeptName(Func.isNotEmpty(record.getDeptName()) ? record.getDeptName() : this.getDeptNameById(record.getDeptId())); - record.setPlanTime(LocalDateTime.now()); - record.setType(MessageConstants.SMS_PUSH); - record.setCreateDept(record.getDeptId()); - record.setUpdateUser(smsImmediatelyPushDTO.getCreateUser()); - record.setStatus(MessageConstants.NOT_PUSH); - Map params = smsImmediatelyPushDTO.getParams(); - int maxSize=35; - params.replaceAll((k, v) -> getTruncateString(v, maxSize)); - record.setSmsParam(JSON.toJSONString(params)); - Boolean flag = recordService.sendSmsImmediatelyMsg(record); - if (!flag) { - log.error("短信推送失败,参数:{}", JSON.toJSONString(record)); - } - } - return R.data(true); - }catch (Exception e){ - log.error(e.getMessage()); - return R.data(false); - } - } - - private String getTruncateString(String ruleDefName, int maxSize) { - if (ruleDefName.length()<= maxSize){ - return ruleDefName; - }else { - return ruleDefName.substring(0, maxSize - 3) + "..."; - } - } - - /** - * 根据机构ID获取机构名称 - * @param deptId 机构ID - * @return 机构名称 - */ - private String getDeptNameById(Long deptId) { - return Optional.ofNullable(sysClient.getDeptName(deptId)).filter(r -> r.isSuccess()).map(R::getData).orElse(null); - } - -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/log/aspect/LogAspect.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/log/aspect/LogAspect.java deleted file mode 100644 index 5771137..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/log/aspect/LogAspect.java +++ /dev/null @@ -1,219 +0,0 @@ -package com.hnac.hzims.message.log.aspect; - -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONObject; -import com.hnac.hzims.message.MessageConstants; -import com.hnac.hzims.message.dto.AppPushDto; -import com.hnac.hzims.message.dto.MailPushDto; -import com.hnac.hzims.message.dto.SmsPushDto; -import com.hnac.hzims.message.dto.WsPushDto; -import com.hnac.hzims.message.entity.MsgMailRecordEntity; -import com.hnac.hzims.message.entity.MsgPushRecordEntity; -import com.hnac.hzims.message.entity.MsgSmsRecordEntity; -import com.hnac.hzims.message.entity.MsgWsRecordEntity; -import com.hnac.hzims.message.entity.log.AppLogEntity; -import com.hnac.hzims.message.entity.log.MailLogEntity; -import com.hnac.hzims.message.entity.log.SmsLogEntity; -import com.hnac.hzims.message.log.service.IAppLogService; -import com.hnac.hzims.message.log.service.IMailLogService; -import com.hnac.hzims.message.log.service.IMessageLogService; -import com.hnac.hzims.message.log.service.ISmsLogService; -import com.hnac.hzims.message.service.*; -import lombok.AllArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.aspectj.lang.ProceedingJoinPoint; -import org.aspectj.lang.annotation.Around; -import org.aspectj.lang.annotation.Aspect; -import org.aspectj.lang.annotation.Pointcut; -import org.aspectj.lang.reflect.MethodSignature; - -import org.springblade.core.secure.utils.AuthUtil; -import org.springblade.core.tool.api.R; -import org.springblade.core.tool.utils.*; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.stereotype.Component; - -import java.lang.reflect.Method; -import java.util.concurrent.Executor; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.ThreadPoolExecutor; - -/** - * @author hx - */ -@Aspect -@Component -@Slf4j -public class LogAspect { - - @Autowired - private IMailLogService mailLogService; - - @Autowired - private IAppLogService appLogService; - - @Autowired - private ISmsLogService smsLogService; - - @Autowired - private ExecutorService logExecutorService; - - - @Pointcut("@annotation(com.hnac.hzims.message.log.aspect.SaveLog)") - public void logPointCut() { - } - - @Around("logPointCut()") - public Object around(ProceedingJoinPoint point) { - Object result = this.saveMessageLog(point); - return result; - } - - /*** - * 保存消息推送日志 - * @param joinPoint 连接点 - */ - private Object saveMessageLog(ProceedingJoinPoint joinPoint) { - MethodSignature signature = (MethodSignature) joinPoint.getSignature(); - Method method = signature.getMethod(); - SaveLog saveLog = method.getAnnotation(SaveLog.class); - Object[] args = joinPoint.getArgs(); - String errorLog = ""; - Object result = null; - try { - //执行方法 - result = joinPoint.proceed(); - } catch (Throwable throwable) { - log.error("message-log",throwable.getMessage()); - throwable.printStackTrace(); - errorLog = throwable.getMessage(); - } - switch(saveLog.type()) { - case MessageConstants.APP_PUSH: - //app推送 - this.savePushMessage(args[0],result,errorLog); - break; - case MessageConstants.SMS_PUSH: - //短信推送 - this.saveSmsMessage(args[0],result,errorLog); - break; - case MessageConstants.WS_PUSH: - //websocket推送 - this.saveWebsocketMessage(args[0],result,errorLog); - break; - case MessageConstants.MAIL_PUSH: - //邮件推送 - this.saveMailMessage(args[0],result,errorLog); - break; - default: - break; - } - return result; - } - - /*** - * 保存websocket推送日志 - * @param arg 参数 - * @param result 结果 - * @param errorLog 错误日志 - */ - private void saveWebsocketMessage(Object arg, Object result, String errorLog) { - IMsgWsRecordService recordService = SpringUtil.getBean(IMsgWsRecordService.class); - WsPushDto wsPushDto = JSONObject.parseObject(JSON.toJSONString(arg),WsPushDto.class); - MsgWsRecordEntity recordEntity = MsgWsRecordEntity.builder() - .businessKey(wsPushDto.getBusinessKey()) - .businessClassify(wsPushDto.getBusinessClassify()) - .subject(wsPushDto.getSubject()) - .content(wsPushDto.getContent()) - .userIds(String.join(",",wsPushDto.getUserIdList())) - .isAll(wsPushDto.isAll()) - .parameters(JSON.toJSONString(arg)) - .response(ObjectUtil.isNotEmpty(result) ? JSON.toJSONString(result) : null) - .errorLog(errorLog) - .success(StringUtil.isBlank(errorLog)) - .build(); - //处理未登陆情况 - if(ObjectUtil.isEmpty(AuthUtil.getUser())){ - recordEntity.setTenantId(wsPushDto.getTenantId()); - recordEntity.setCreateUser(wsPushDto.getCreateUser()); - recordEntity.setCreateTime(DateUtil.now()); - } - recordService.save(recordEntity); - } - - /** - * 保存app推送日志 - * @param arg 参数 - * @param result 结果 - * @param errorLog 错误信息 - */ - private void savePushMessage(Object arg, Object result, String errorLog) { - logExecutorService.execute(()->{ - AppPushDto appPushDto = JSONObject.parseObject(JSON.toJSONString(arg),AppPushDto.class); - AppLogEntity appLogEntity = appLogService.pushConvertLog(appPushDto); - //补充日志中推送推送结果以及错误日志 - appLogEntity.setErrorLog(errorLog); - R r = JSONObject.parseObject(JSON.toJSONString(result),R.class); - appLogEntity.setParams(JSON.toJSONString(arg)); - appLogEntity.setResult(JSON.toJSONString(r)); - appLogEntity.setIsSuccess(r.isSuccess()); - //处理未登陆情况 - if(ObjectUtil.isEmpty(AuthUtil.getUser())){ - appLogEntity.setTenantId(appPushDto.getTenantId()); - appLogEntity.setCreateUser(appPushDto.getCreateUser()); - appLogEntity.setCreateTime(DateUtil.now()); - } - appLogService.save(appLogEntity); - }); - } - - /*** - * 保存短信推送日志 - * @param arg 参数 - * @param result 结果 - * @param errorLog 错误信息 - */ - private void saveSmsMessage(Object arg, Object result,String errorLog) { - SmsPushDto smsPushDto = JSONObject.parseObject(JSON.toJSONString(arg),SmsPushDto.class); - SmsLogEntity smsLogEntity = smsLogService.pushConvertLog(smsPushDto); - R r = JSONObject.parseObject(JSON.toJSONString(result),R.class); - smsLogEntity.setErrorLog(errorLog); - smsLogEntity.setResult(JSON.toJSONString(r)); - smsLogEntity.setParams(JSON.toJSONString(arg)); - smsLogEntity.setIsSuccess(r.isSuccess()); - //处理未登陆情况 - if(ObjectUtil.isEmpty(AuthUtil.getUser())){ - smsLogEntity.setTenantId(smsPushDto.getTenantId()); - smsLogEntity.setCreateUser(smsPushDto.getCreateUser()); - smsLogEntity.setCreateTime(DateUtil.now()); - } - smsLogService.save(smsLogEntity); - } - - /*** - * 保存邮件发送日志 - * @param arg 参数 - * @param result 结果 - * @param errorLog 错误信息 - */ - private void saveMailMessage(Object arg, Object result,String errorLog) { - logExecutorService.execute(()->{ - MailPushDto mailPushDto = JSONObject.parseObject(JSON.toJSONString(arg),MailPushDto.class); - MailLogEntity mailLogEntity = mailLogService.pushConvertLog(mailPushDto); - //补充日志中推送推送结果以及错误日志 - mailLogEntity.setErrorLog(errorLog); - R r = JSONObject.parseObject(JSON.toJSONString(result),R.class); - mailLogEntity.setResult(JSON.toJSONString(r)); - mailLogEntity.setParams(JSON.toJSONString(arg)); - mailLogEntity.setIsSuccess(r.isSuccess()); - //处理未登陆情况 - if(ObjectUtil.isEmpty(AuthUtil.getUser())){ - mailLogEntity.setTenantId(mailPushDto.getTenantId()); - mailLogEntity.setCreateUser(mailPushDto.getCreateUser()); - mailLogEntity.setCreateTime(DateUtil.now()); - } - mailLogService.save(mailLogEntity); - }); - } -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/log/aspect/SaveLog.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/log/aspect/SaveLog.java deleted file mode 100644 index ef133c6..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/log/aspect/SaveLog.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.hnac.hzims.message.log.aspect; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * @author hx - */ -@Retention(RetentionPolicy.RUNTIME) -@Target(value = {ElementType.METHOD}) -public @interface SaveLog { - /** - * 日志保存类型 - * @return - */ - String type() default ""; -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/log/mapper/AppLogMapper.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/log/mapper/AppLogMapper.java deleted file mode 100644 index 227a37a..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/log/mapper/AppLogMapper.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.hnac.hzims.message.log.mapper; - -import com.hnac.hzims.message.dto.statistic.MsgPushStatisticDto; -import com.hnac.hzims.message.entity.log.AppLogEntity; -import com.hnac.hzims.message.vo.statistic.MsgPushStatisticVO; -import org.apache.ibatis.annotations.Param; -import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; - -/** - * @author hx - */ -public interface AppLogMapper extends UserDataScopeBaseMapper { - - /** - * 获取app推送统计 - * @param statisticDto - * @return - */ - MsgPushStatisticVO getAppPushStatistic(@Param("statisticDto") MsgPushStatisticDto statisticDto); - -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/log/mapper/AppLogMapper.xml b/hzims-service/message/src/main/java/com/hnac/hzims/message/log/mapper/AppLogMapper.xml deleted file mode 100644 index 4bbe247..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/log/mapper/AppLogMapper.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/log/mapper/MailLogMapper.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/log/mapper/MailLogMapper.java deleted file mode 100644 index e819a79..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/log/mapper/MailLogMapper.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.hnac.hzims.message.log.mapper; - -import com.hnac.hzims.message.dto.statistic.MsgPushStatisticDto; -import com.hnac.hzims.message.entity.log.MailLogEntity; -import com.hnac.hzims.message.vo.statistic.MsgPushStatisticVO; -import org.apache.ibatis.annotations.Param; -import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; - -/** - * @author hx - */ -public interface MailLogMapper extends UserDataScopeBaseMapper { - - /** - * 获取邮箱推送统计 - * @param statisticDto - * @return - */ - MsgPushStatisticVO getMailPushStatistic(@Param("statisticDto") MsgPushStatisticDto statisticDto); -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/log/mapper/MailLogMapper.xml b/hzims-service/message/src/main/java/com/hnac/hzims/message/log/mapper/MailLogMapper.xml deleted file mode 100644 index 47a85a2..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/log/mapper/MailLogMapper.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/log/mapper/SmsLogMapper.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/log/mapper/SmsLogMapper.java deleted file mode 100644 index 5cbf3e3..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/log/mapper/SmsLogMapper.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.hnac.hzims.message.log.mapper; - -import com.hnac.hzims.message.dto.statistic.MsgPushStatisticDto; -import com.hnac.hzims.message.entity.log.SmsLogEntity; -import com.hnac.hzims.message.vo.statistic.MsgPushStatisticVO; -import org.apache.ibatis.annotations.Param; -import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; - -/** - * @author hx - */ -public interface SmsLogMapper extends UserDataScopeBaseMapper { - - /** - * 获取短信推送统计 - * @param statisticDto - * @return - */ - MsgPushStatisticVO getSmsPushStatistic(@Param("statisticDto") MsgPushStatisticDto statisticDto); - -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/log/mapper/SmsLogMapper.xml b/hzims-service/message/src/main/java/com/hnac/hzims/message/log/mapper/SmsLogMapper.xml deleted file mode 100644 index b6cac86..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/log/mapper/SmsLogMapper.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/log/service/IAppLogService.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/log/service/IAppLogService.java deleted file mode 100644 index 0382821..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/log/service/IAppLogService.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.hnac.hzims.message.log.service; - -import com.hnac.hzims.message.dto.AppPushDto; -import com.hnac.hzims.message.dto.statistic.MsgPushStatisticDto; -import com.hnac.hzims.message.entity.log.AppLogEntity; -import com.hnac.hzinfo.core.push.enums.PlatformType; -import org.springblade.core.log.exception.ServiceException; - -import org.springblade.core.tool.utils.BeanUtil; -import org.springblade.core.tool.utils.CollectionUtil; -import org.springblade.core.tool.utils.ObjectUtil; -import org.springframework.util.Assert; - -import javax.xml.ws.Service; -import java.util.Arrays; -import java.util.List; -import java.util.stream.Collectors; - -/** - * @author hx - */ -public interface IAppLogService extends IMessageLogService { - - - - /** - * 将app推送对象 转换为日志对象 - * @param pushDto app推送对象 - * @return - */ - @Override - default AppLogEntity pushConvertLog(AppPushDto pushDto) { - Assert.isTrue(ObjectUtil.isNotEmpty(pushDto),()->{ - throw new ServiceException("app推送对象 转换为日志对象时,app推送对象不能为空"); - }); - AppLogEntity appLogEntity = BeanUtil.copy(pushDto,AppLogEntity.class); - //排除对数据权限的影响 - appLogEntity.setCreateDept(null); - appLogEntity.setCreateTime(null); - appLogEntity.setCreateUser(null); - appLogEntity.setUpdateUser(null); - appLogEntity.setUpdateTime(null); - Assert.isTrue(CollectionUtil.isNotEmpty(pushDto.getTags()),()-> { -// log.error("message-pushConvertLog","app推送 推送人不能为空"); - throw new ServiceException("app推送 推送人不能为空"); - }); - appLogEntity.setPusher(pushDto.getTags().stream().collect(Collectors.joining(","))); - String platformTypes = ""; - if(pushDto.getIsAll()){ - platformTypes = Arrays.stream(PlatformType.values()).map(PlatformType::getValue).collect(Collectors.joining(",")); - } - else { - platformTypes = Arrays.stream(pushDto.getPlatformTypes()).map(PlatformType::getValue).collect(Collectors.joining(",")); - } - appLogEntity.setPlatformType(platformTypes); - return appLogEntity; - } - -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/log/service/IMailLogService.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/log/service/IMailLogService.java deleted file mode 100644 index f76269c..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/log/service/IMailLogService.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.hnac.hzims.message.log.service; - -import com.hnac.hzims.message.dto.MailPushDto; -import com.hnac.hzims.message.entity.log.MailLogEntity; -import com.hnac.hzims.message.service.IMessageService; -import org.springblade.core.log.exception.ServiceException; -import org.springblade.core.tool.utils.BeanUtil; -import org.springblade.core.tool.utils.ObjectUtil; -import org.springframework.util.Assert; - -import java.util.Arrays; -import java.util.stream.Collectors; - -/** - * @author hx - */ -public interface IMailLogService extends IMessageLogService { - - /** - * 邮件推送对象转换为邮箱日志对象 - * @param mailPushDto 邮件推送对象 - * @return 邮箱日志对象 - */ - @Override - default MailLogEntity pushConvertLog(MailPushDto mailPushDto){ - Assert.isTrue(ObjectUtil.isNotEmpty(mailPushDto),()->{ - throw new ServiceException("邮件推送对象转换为邮箱日志对象时,邮件推送对象不能为空"); - }); - MailLogEntity mailLogEntity = BeanUtil.copy(mailPushDto,MailLogEntity.class); - mailLogEntity.setEmail(Arrays.stream(mailPushDto.getToAccount()).collect(Collectors.joining(","))); - mailLogEntity.setCreateDept(null); - mailLogEntity.setCreateTime(null); - mailLogEntity.setCreateUser(null); - mailLogEntity.setUpdateUser(null); - mailLogEntity.setUpdateTime(null); - return mailLogEntity; - } - -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/log/service/IMessageLogService.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/log/service/IMessageLogService.java deleted file mode 100644 index a03dabd..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/log/service/IMessageLogService.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.hnac.hzims.message.log.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.hnac.hzims.message.dto.MailPushDto; -import com.hnac.hzims.message.dto.PushDto; -import com.hnac.hzims.message.dto.statistic.MsgPushStatisticDto; -import com.hnac.hzims.message.entity.log.MailLogEntity; -import com.hnac.hzims.message.entity.log.MessageLogEntity; - - -import java.util.List; - -/** - * @author hx - */ -public interface IMessageLogService extends IService { - /** - * 推送对象转换为日志 - * @param pushDto - * @return - */ - T pushConvertLog(E pushDto); - -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/log/service/ISmsLogService.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/log/service/ISmsLogService.java deleted file mode 100644 index bcf3820..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/log/service/ISmsLogService.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.hnac.hzims.message.log.service; - -import com.alibaba.fastjson.JSON; -import com.hnac.hzims.message.dto.SmsPushDto; -import com.hnac.hzims.message.entity.log.SmsLogEntity; -import org.springblade.core.tool.utils.BeanUtil; -import org.springblade.core.tool.utils.CollectionUtil; - -import java.util.stream.Collectors; - -/** - * @author hx - */ -public interface ISmsLogService extends IMessageLogService { - - /** - * 短信推送对象转换为日志对象 - * @param pushDto 短信推送对象 - * @return - */ - @Override - default SmsLogEntity pushConvertLog(SmsPushDto pushDto) { - SmsLogEntity smsLogEntity = BeanUtil.copy(pushDto,SmsLogEntity.class); - smsLogEntity.setCreateDept(null); - smsLogEntity.setCreateTime(null); - smsLogEntity.setCreateUser(null); - smsLogEntity.setUpdateUser(null); - smsLogEntity.setUpdateTime(null); - smsLogEntity.setPusher(pushDto.getPhones().stream().collect(Collectors.joining(","))); - smsLogEntity.setPhones(pushDto.getPhones().stream().collect(Collectors.joining(","))); - if(CollectionUtil.isNotEmpty(pushDto.getParams())){ - smsLogEntity.setParamsJson(JSON.toJSONString(pushDto.getParams())); - } - return smsLogEntity; - } - -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/log/service/impl/AppLogServiceImpl.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/log/service/impl/AppLogServiceImpl.java deleted file mode 100644 index a076453..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/log/service/impl/AppLogServiceImpl.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.hnac.hzims.message.log.service.impl; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.hnac.hzims.message.dto.statistic.MsgPushStatisticDto; -import com.hnac.hzims.message.entity.log.AppLogEntity; -import com.hnac.hzims.message.log.mapper.AppLogMapper; -import com.hnac.hzims.message.log.service.IAppLogService; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import org.springblade.core.tool.utils.Func; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * @author hx - */ -@Service("appLogService") -public class AppLogServiceImpl extends ServiceImpl implements IAppLogService { - -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/log/service/impl/MailLogServiceImpl.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/log/service/impl/MailLogServiceImpl.java deleted file mode 100644 index cee7c99..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/log/service/impl/MailLogServiceImpl.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.hnac.hzims.message.log.service.impl; - -import com.hnac.hzims.message.dto.statistic.MsgPushStatisticDto; -import com.hnac.hzims.message.entity.log.MailLogEntity; -import com.hnac.hzims.message.log.mapper.MailLogMapper; -import com.hnac.hzims.message.log.service.IMailLogService; -import lombok.AllArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * @author hx - */ -@Service("mailLogService") -@Slf4j -@AllArgsConstructor -public class MailLogServiceImpl extends ServiceImpl - implements IMailLogService { - -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/log/service/impl/SmsLogServiceImpl.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/log/service/impl/SmsLogServiceImpl.java deleted file mode 100644 index 60bdce7..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/log/service/impl/SmsLogServiceImpl.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.hnac.hzims.message.log.service.impl; - -import com.hnac.hzims.message.entity.config.SmsConfigEntity; -import com.hnac.hzims.message.entity.log.SmsLogEntity; -import com.hnac.hzims.message.log.mapper.SmsLogMapper; -import com.hnac.hzims.message.log.service.ISmsLogService; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import org.springframework.stereotype.Service; - -/** - * @author hx - */ -@Service("smsLogService") -public class SmsLogServiceImpl extends ServiceImpl implements ISmsLogService { - -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/MailConfigMapper.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/MailConfigMapper.java deleted file mode 100644 index c5b3eba..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/MailConfigMapper.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.hnac.hzims.message.mapper; - -import com.hnac.hzims.message.entity.config.MailConfigEntity; -import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; - -/** - * @author hx - */ -public interface MailConfigMapper extends UserDataScopeBaseMapper { -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/MessagePushRecordMapper.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/MessagePushRecordMapper.java deleted file mode 100644 index 4d76dc3..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/MessagePushRecordMapper.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.hnac.hzims.message.mapper; - -import com.hnac.hzims.message.entity.MessagePushRecordEntity; -import com.hnac.hzims.message.vo.msgpushrecord.*; -import org.apache.ibatis.annotations.Param; -import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; - -import java.util.List; -import java.util.Set; - -public interface MessagePushRecordMapper extends UserDataScopeBaseMapper { - - /** - * 根据type统计数量 - * @return - */ - List smsPushStat(@Param("vo") MessagePushRecordEntityVo vo); - - - /** - * 业务类型统计 - * @return - */ - List businessTypeStat(@Param("vo") MessagePushRecordEntityVo vo); - - - /** - * 人员发送统计 - * @return - */ - List userPushStat(@Param("vo") MessagePushRecordEntityVo vo); - - - /** - * 推送成功失败统计 - * @return - */ - List pushStat(@Param("vo") MessagePushRecordEntityVo vo); - - - /** - * 查询出状态信息 - * @return - */ - List selectByStatus(); - - - /** - * 新人员发送统计 - * @param vo - * @return - */ - List selectUserPushStat(@Param("vo") MessagePushRecordEntityVo vo); -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/MessagePushRecordMapper.xml b/hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/MessagePushRecordMapper.xml deleted file mode 100644 index 948c915..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/MessagePushRecordMapper.xml +++ /dev/null @@ -1,154 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/MessageTemplateMapper.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/MessageTemplateMapper.java deleted file mode 100644 index e7d191a..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/MessageTemplateMapper.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.hnac.hzims.message.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.hnac.hzims.message.entity.config.MessageTemplateEntity; -import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; - -public interface MessageTemplateMapper extends BaseMapper { - -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/MprNoAurhScopeMapper.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/MprNoAurhScopeMapper.java deleted file mode 100644 index e491ee6..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/MprNoAurhScopeMapper.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.hnac.hzims.message.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.hnac.hzims.message.entity.MessagePushRecordEntity; - -/** - * @author hx - * @description 消息记录-无数据权限mapper - */ -public interface MprNoAurhScopeMapper extends BaseMapper { - -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/MsgMailRecordMapper.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/MsgMailRecordMapper.java deleted file mode 100644 index 0d15a68..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/MsgMailRecordMapper.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.hnac.hzims.message.mapper; - -import com.hnac.hzims.message.entity.MsgMailRecordEntity; -import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; - -/** - * @author hx - */ -public interface MsgMailRecordMapper extends UserDataScopeBaseMapper { - -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/MsgPushRecordMapper.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/MsgPushRecordMapper.java deleted file mode 100644 index e5ed623..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/MsgPushRecordMapper.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.hnac.hzims.message.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.hnac.hzims.message.entity.MsgPushRecordEntity; - -/** - * - * Mapper 接口 - * - * @author xiashandong - * @created 2021-06-28 08:38 - **/ -public interface MsgPushRecordMapper extends BaseMapper { - -} \ No newline at end of file diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/MsgPushRecordMapper.xml b/hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/MsgPushRecordMapper.xml deleted file mode 100644 index 0e09fad..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/MsgPushRecordMapper.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/MsgSmsRecordMapper.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/MsgSmsRecordMapper.java deleted file mode 100644 index 1c62c03..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/MsgSmsRecordMapper.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.hnac.hzims.message.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.hnac.hzims.message.entity.MsgSmsRecordEntity; - -/** - * - * Mapper 接口 - * - * @author xiashandong - * @created 2021-06-28 08:38 - **/ -public interface MsgSmsRecordMapper extends BaseMapper { - -} \ No newline at end of file diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/MsgSmsRecordMapper.xml b/hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/MsgSmsRecordMapper.xml deleted file mode 100644 index 5a7d145..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/MsgSmsRecordMapper.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/MsgWsRecordHistoryMapper.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/MsgWsRecordHistoryMapper.java deleted file mode 100644 index 9909c25..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/MsgWsRecordHistoryMapper.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.hnac.hzims.message.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.hnac.hzims.message.entity.MsgWsRecordHistoryEntity; - -/** - * - * Mapper 接口 - * - * @author xiashandong - * @created 2021-06-28 16:45 - **/ -public interface MsgWsRecordHistoryMapper extends BaseMapper { - -} \ No newline at end of file diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/MsgWsRecordHistoryMapper.xml b/hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/MsgWsRecordHistoryMapper.xml deleted file mode 100644 index 8afd63d..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/MsgWsRecordHistoryMapper.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/MsgWsRecordMapper.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/MsgWsRecordMapper.java deleted file mode 100644 index 2114b1e..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/MsgWsRecordMapper.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.hnac.hzims.message.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.hnac.hzims.message.entity.MsgWsRecordEntity; -import com.hnac.hzims.message.vo.UnreadMsgCountVO; - -import java.util.List; - -/** - * - * Mapper 接口 - * - * @author xiashandong - * @created 2021-06-28 08:38 - **/ -public interface MsgWsRecordMapper extends BaseMapper { - - List countUnread(Long userId); -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/MsgWsRecordMapper.xml b/hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/MsgWsRecordMapper.xml deleted file mode 100644 index c52173d..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/MsgWsRecordMapper.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/PushMessageMapper.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/PushMessageMapper.java deleted file mode 100644 index 0ecc374..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/PushMessageMapper.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.hnac.hzims.message.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.hnac.hzims.message.entity.PushMessageEntity; - -/** - * @author hx - */ -public interface PushMessageMapper extends BaseMapper { - -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/push/feign/PushMsgClient.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/push/feign/PushMsgClient.java deleted file mode 100644 index 9a838db..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/push/feign/PushMsgClient.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.hnac.hzims.message.push.feign; - -import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; -import com.hnac.hzims.message.dto.AppPushDto; -import com.hnac.hzims.message.dto.MailPushDto; -import com.hnac.hzims.message.dto.SmsPushDto; -import com.hnac.hzims.message.dto.WsPushDto; -import com.hnac.hzims.message.fegin.IPushMsgClient; -import com.hnac.hzims.message.push.service.IPushService; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import lombok.AllArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springblade.core.tool.api.R; -import org.springblade.core.tool.utils.SpringUtil; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -/** - * @author hx - */ -@RestController -@RequestMapping("/feign/message") -@Api(value = "消息推送管理",tags = "消息推送-feign") -@AllArgsConstructor -@Slf4j -public class PushMsgClient implements IPushMsgClient { - - @Override - @PostMapping("/sendSms") - @ApiOperation("发送短信") - @ApiOperationSupport(order=1) - public R sendSms(SmsPushDto smsPushDto) { - IPushService pushService = SpringUtil.getBean("smsPushService"); - return pushService.send(smsPushDto); - } - - @Override - @PostMapping("/sendMail") - @ApiOperation("发送邮件") - @ApiOperationSupport(order=2) - public R sendMail(MailPushDto mailPushDto) { - IPushService pushService = SpringUtil.getBean("mailPushService"); - return pushService.send(mailPushDto); - } - - @Override - @PostMapping("/sendPush") - @ApiOperation("App推送") - @ApiOperationSupport(order=3) - public R sendPush(AppPushDto appPushDto) { - IPushService pushService = SpringUtil.getBean("appPushService"); - return pushService.send(appPushDto); - } - - @Override - @PostMapping("/sendWebsocket") - @ApiOperation("websocket推送") - @ApiOperationSupport(order=4) - public R sendWebsocket(WsPushDto wsPushDto) { - IPushService pushService = SpringUtil.getBean("wsPushService"); - return pushService.send(wsPushDto); - } - -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/push/service/IPushService.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/push/service/IPushService.java deleted file mode 100644 index f0b4a21..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/push/service/IPushService.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.hnac.hzims.message.push.service; - -import com.hnac.hzims.message.dto.PushDto; -import org.springblade.core.tool.api.R; - -/** - * @author hx - */ -public interface IPushService { - /** - * 推送消息 - * @param pushDto 消息推送 - * @return - */ - R send(T pushDto); -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/push/service/impl/AppPushServiceImpl.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/push/service/impl/AppPushServiceImpl.java deleted file mode 100644 index 4c9f65a..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/push/service/impl/AppPushServiceImpl.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.hnac.hzims.message.push.service.impl; - -import com.hnac.hzims.message.MessageConstants; -import com.hnac.hzims.message.dto.AppPushDto; -import com.hnac.hzims.message.log.aspect.SaveLog; -import com.hnac.hzims.message.push.service.IPushService; -import com.hnac.hzinfo.core.push.enums.PlatformType; -import com.hnac.hzinfo.core.push.model.PushAudience; -import com.hnac.hzinfo.core.push.model.PushInfo; -import com.hnac.hzinfo.core.push.model.PushPlatform; -import lombok.AllArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springblade.core.secure.utils.AuthUtil; -import org.springblade.core.tool.api.R; -import org.springblade.core.tool.utils.ObjectUtil; -import org.springblade.resource.feign.IPushClient; -import org.springblade.resource.vo.PushInfoVO; -import org.springframework.stereotype.Service; - -import java.util.Arrays; -import java.util.concurrent.atomic.AtomicReference; - -/** - * @author hx - */ -@Service("appPushService") -@Slf4j -@AllArgsConstructor -public class AppPushServiceImpl implements IPushService { - - private final IPushClient pushClient; - - @Override - @SaveLog(type = MessageConstants.APP_PUSH) - public R send(AppPushDto appPushDto) { - PushAudience audience = PushAudience.newBuilder().addPushAudienceType(appPushDto.getAudienceType(), appPushDto.getTags()).build(); - AtomicReference platform = new AtomicReference<>(); - AtomicReference pushInfo = new AtomicReference<>(); - PushInfoVO pushInfoVO = new PushInfoVO(); - pushInfoVO.setTenantId(ObjectUtil.isNotEmpty(AuthUtil.getTenantId()) ? AuthUtil.getTenantId() : appPushDto.getTenantId()); - if(appPushDto.getIsAll()){ - appPushDto.setPlatformTypes(new PlatformType[]{PlatformType.Android, PlatformType.IOS}); - } - Arrays.stream(appPushDto.getPlatformTypes()).forEach(platformType -> { - if(PlatformType.Android.equals(platformType)) { - //安卓推送 - platform.set(PushPlatform.newBuilder().addPlatformType(PlatformType.Android).build()); - pushInfo.set(new PushInfo("ops-push-android", appPushDto.getTitle(), appPushDto.getPushAlert(), - "", null, platform.get(), audience)); - pushInfoVO.setPushInfo(pushInfo.get()); - try{ - pushClient.tenantPush(pushInfoVO); - } - catch(Exception e){ - e.printStackTrace(); - } - } - else if(PlatformType.IOS.equals(platformType)) { - //IOS推送 - platform.set(PushPlatform.newBuilder().addPlatformType(PlatformType.IOS).build()); - pushInfo.set(new PushInfo("ops-push-ios", appPushDto.getTitle(), appPushDto.getPushAlert(), - "", null, platform.get(), audience)); - pushInfoVO.setPushInfo(pushInfo.get()); - try{ - pushClient.tenantPush(pushInfoVO); - } - catch(Exception e) { - e.printStackTrace(); - } - } - }); - return R.success("推送成功"); - } -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/push/service/impl/MailPushServiceImpl.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/push/service/impl/MailPushServiceImpl.java deleted file mode 100644 index 61235f2..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/push/service/impl/MailPushServiceImpl.java +++ /dev/null @@ -1,95 +0,0 @@ -package com.hnac.hzims.message.push.service.impl; - -import com.hnac.hzims.message.MessageConstants; -import com.hnac.hzims.message.dto.MailPushDto; -import com.hnac.hzims.message.log.aspect.SaveLog; -import com.hnac.hzims.message.push.service.IPushService; -import com.hnac.hzims.message.utils.HtmlModule; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springblade.core.log.exception.ServiceException; -import org.springblade.core.tool.api.R; -import org.springblade.core.tool.utils.CollectionUtil; -import org.springblade.core.tool.utils.ObjectUtil; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.mail.javamail.JavaMailSender; -import org.springframework.mail.javamail.MimeMessageHelper; -import org.springframework.stereotype.Service; -import org.springframework.web.multipart.MultipartFile; - -import javax.mail.MessagingException; -import javax.mail.internet.MimeMessage; -import java.util.Map; - -/** - * @author hx - */ -@Service("mailPushService") -@Slf4j -@RequiredArgsConstructor -public class MailPushServiceImpl implements IPushService { - - @Autowired - private final JavaMailSender mailSender; - - @Value("${spring.mail.username}") - private String fromAccount; - - @Override - @SaveLog(type = MessageConstants.MAIL_PUSH) - public R send(MailPushDto mailPushDto) { - this.fillMailSendContent(mailPushDto); - mailPushDto.setFromAccount(fromAccount); - //创建复杂有限发送对象 - MimeMessage mimeMessage = mailSender.createMimeMessage(); - MimeMessageHelper messageHelper = null; - try { - messageHelper = new MimeMessageHelper(mimeMessage, true); - // 设置发件人邮箱(若配置默认邮箱则不用再设置) - messageHelper.setFrom(mailPushDto.getFromAccount()); - // 设置收件人邮箱 - if(ObjectUtil.isNotEmpty(mailPushDto.getToAccount()) && mailPushDto.getToAccount().length>0){ - messageHelper.setTo(mailPushDto.getToAccount()); - } - // 设置抄报人邮箱(可以不填写) - if(ObjectUtil.isNotEmpty(mailPushDto.getCcAccount()) && mailPushDto.getCcAccount().length>0){ - messageHelper.setCc(mailPushDto.getCcAccount()); - } - // 设置密送人邮箱(可以不填写) - //messageHelper.setBcc("575814158@qq.com"); - // 设置邮件主题 - messageHelper.setSubject(mailPushDto.getSubject()); - messageHelper.setText(mailPushDto.getText(),mailPushDto.isHtml()); - //填充附件 - if(CollectionUtil.isNotEmpty(mailPushDto.getAppendix())){ - for (MultipartFile appendix : mailPushDto.getAppendix()) { - messageHelper.addAttachment(appendix.getName(),appendix); - } - } - //发送邮件 - mailSender.send(mimeMessage); - //TODO 推送日志待处理 - } catch (MessagingException e) { - e.printStackTrace(); - throw new ServiceException(e.getMessage()); - } - return R.success("发送成功!"); - } - - private void fillMailSendContent(MailPushDto mailPushDto){ - if(mailPushDto.isHtml()){ - //若邮件内容为html 则从扩展参数内取出模板路径以及参数 - try { - String templatePath = (String) mailPushDto.getExtras().get("templatePath"); - Map parameters = (Map) mailPushDto.getExtras().get("parameters"); - String text = HtmlModule.buildHtml(parameters,templatePath); - mailPushDto.setHtml(true); - mailPushDto.setText(text); - } catch (Exception e) { - e.printStackTrace(); - } - } - } -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/push/service/impl/SmsPushServiceImpl.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/push/service/impl/SmsPushServiceImpl.java deleted file mode 100644 index 25408b3..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/push/service/impl/SmsPushServiceImpl.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.hnac.hzims.message.push.service.impl; - -import com.alibaba.fastjson.JSON; -import com.hnac.hzims.message.MessageConstants; -import com.hnac.hzims.message.dto.SmsPushDto; -import com.hnac.hzims.message.log.aspect.SaveLog; -import com.hnac.hzims.message.push.service.IPushService; -import lombok.AllArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springblade.core.log.exception.ServiceException; -import org.springblade.core.sms.model.SmsResponse; -import org.springblade.core.tool.api.R; -import org.springblade.core.tool.utils.Func; -import org.springblade.resource.feign.ISmsClient; -import org.springframework.stereotype.Service; - -/** - * @author hx - */ -@Service("smsPushService") -@Slf4j -@AllArgsConstructor -public class SmsPushServiceImpl implements IPushService { - - private final ISmsClient smsClient; - - @Override - @SaveLog(type = MessageConstants.SMS_PUSH) - public R send(SmsPushDto pushDto) { - R response = smsClient.sendMessage( - pushDto.getTenantId(), - pushDto.getCode(), - JSON.toJSONString(pushDto.getParams()), - Func.join(pushDto.getPhones()) - ); - if(!response.isSuccess()){ - throw new ServiceException("短信发送失败;报错信息为:"+response.getMsg()); - } - //TODO 统计日志 - return R.data(JSON.toJSONString(response.getData())); - } -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/push/service/impl/WsPushServiceImpl.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/push/service/impl/WsPushServiceImpl.java deleted file mode 100644 index 6fea542..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/push/service/impl/WsPushServiceImpl.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.hnac.hzims.message.push.service.impl; - -import com.alibaba.fastjson.JSON; -import com.hnac.hzims.message.MessageConstants; -import com.hnac.hzims.message.dto.WsPushDto; -import com.hnac.hzims.message.log.aspect.SaveLog; -import com.hnac.hzims.message.push.service.IPushService; -import com.hnac.hzims.message.vo.WsMessageVO; -import com.hnac.hzims.message.ws.SessionManager; -import lombok.AllArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springblade.core.tool.api.R; -import org.springblade.core.tool.utils.CollectionUtil; -import org.springblade.core.tool.utils.ObjectUtil; -import org.springframework.data.redis.core.RedisTemplate; -import org.springframework.stereotype.Service; -import org.springframework.web.socket.TextMessage; -import org.springframework.web.socket.WebSocketSession; - -import java.io.IOException; -import java.time.LocalDateTime; -import java.util.concurrent.TimeUnit; - -/** - * @author hx - */ -@Service("wsPushService") -@AllArgsConstructor -@Slf4j -public class WsPushServiceImpl implements IPushService { - - private final RedisTemplate redisTemplate; - - @Override - @SaveLog(type = MessageConstants.WS_PUSH) - public R send(WsPushDto wsPushDto) { - //完善推送消息内容体 - WsMessageVO wsMessageVO = WsMessageVO.builder() - .businessClassify(wsPushDto.getBusinessClassify()) - .businessClassifyName(MessageConstants.BusinessClassifyEnum.getClassifyDesByKey(wsPushDto.getBusinessClassify())) - .businessKey(wsPushDto.getBusinessKey()) - .content(wsPushDto.getContent()) - .subject(wsPushDto.getSubject()) - .pushTime(LocalDateTime.now()) - .content(wsPushDto.getText()) - .build(); - log.info("推送内容为:{}", JSON.toJSONString(wsMessageVO)); - TextMessage message = new TextMessage(JSON.toJSONString(wsMessageVO)); - //在线用户全量推送 - if(wsPushDto.isAll() && CollectionUtil.isNotEmpty(SessionManager.SESSION_POOL)){ - SessionManager.SESSION_POOL.forEach((s, webSocketSession) -> { - try { - webSocketSession.sendMessage(message); - } catch (IOException e) { - e.printStackTrace(); - } - }); - } - //指定用户推送 - else{ - wsPushDto.getUserIdList().forEach(userId -> { - WebSocketSession webSocketSession = SessionManager.SESSION_POOL.get(userId); - if(ObjectUtil.isNotEmpty(webSocketSession)){ - log.info("===={}:websocket推送====",userId); - try { - webSocketSession.sendMessage(message); - } catch (IOException e) { - e.printStackTrace(); - } - } - else { - //存在未上线的用户时 需将消息缓存起来 在用户上线时推送 - String key = String.format("%s:%s",MessageConstants.WS_MESSAGE_KEY,userId); - redisTemplate.opsForList().leftPush(key,message); - redisTemplate.expire(key,24, TimeUnit.HOURS); - } - }); - } - return R.success("推送成功"); - } -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/schedule/MessagePushSchedule.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/schedule/MessagePushSchedule.java deleted file mode 100644 index 9e31568..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/schedule/MessagePushSchedule.java +++ /dev/null @@ -1,199 +0,0 @@ -package com.hnac.hzims.message.schedule; - -import com.alibaba.fastjson.JSON; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; -import com.baomidou.mybatisplus.core.toolkit.IdWorker; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.google.common.collect.Lists; -import com.hnac.hzims.common.constant.CommonConstant; -import com.hnac.hzims.common.utils.DateUtil; -import com.hnac.hzims.message.MessageConstants; -import com.hnac.hzims.message.config.MessageFactory; -import com.hnac.hzims.message.config.MessageStrategy; -import com.hnac.hzims.message.entity.MessagePushRecordEntity; -import com.hnac.hzims.message.entity.config.MessageTemplateEntity; -import com.hnac.hzims.message.service.IMessagePushRecordService; -import com.hnac.hzims.message.service.IMessageService; -import com.hnac.hzims.message.service.IMessageTemplateService; -import com.hnac.hzims.message.service.impl.PushMessageServiceImpl; -import com.hnac.hzinfo.core.push.model.PushResponse; -import com.xxl.job.core.biz.model.ReturnT; -import com.xxl.job.core.handler.annotation.XxlJob; -import com.xxl.job.core.log.XxlJobLogger; -import lombok.AllArgsConstructor; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springblade.core.tool.api.R; -import org.springblade.core.tool.utils.CollectionUtil; -import org.springblade.core.tool.utils.Func; -import org.springblade.core.tool.utils.SpringUtil; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.data.redis.core.RedisTemplate; -import org.springframework.stereotype.Component; - -import java.time.LocalDate; -import java.time.LocalDateTime; -import java.time.LocalTime; -import java.time.format.DateTimeFormatter; -import java.util.*; -import java.util.stream.Collectors; - -import static com.hnac.hzims.message.constants.XxlJobConstants.PUSH_MESSAGE_BY_NOTICE; -import static com.hnac.hzims.message.constants.XxlJobConstants.PUSH_APP_MESSAGE; - -/** - * @ClassName MessagePushSchedule - * @description: 消息推送 - * @author: hx - * @create: 2023-04-04 14:31 - * @Version 4.0 - **/ -@Component -@RequiredArgsConstructor -@Slf4j -public class MessagePushSchedule { - private final IMessageTemplateService templateService; - private final IMessagePushRecordService recordService; - private final MessageStrategy messageStrategy; - private final RedisTemplate redisTemplate; - - @Value("${hzims.message.redis-key.app-push}") - private String appPushRedisKey; - - @XxlJob(PUSH_MESSAGE_BY_NOTICE) - public ReturnT pushSmsMessageByNotice(String params) { - // 获取消息模板 - List templateList = templateService.list(); - templateList.forEach(template -> { - LocalDateTime endTime = DateUtil.plus(LocalDateTime.now(), messageStrategy.getConcentrateDuration(), messageStrategy.getConcentrateUnit()); - endTime = DateUtil.plus(endTime, template.getAdvanceDuration(), template.getAdvanceTimeUnit()); - LambdaQueryWrapper lqw = Wrappers.lambdaQuery() - .eq(MessagePushRecordEntity::getStatus, MessageConstants.NOT_PUSH) - .eq(MessagePushRecordEntity::getTemplateId,template.getId()) - .ge(MessagePushRecordEntity::getPlanTime, LocalDateTime.of(LocalDate.now(), LocalTime.MIN)) - .le(MessagePushRecordEntity::getPlanTime, endTime); - List list = recordService.list(lqw); - if(CollectionUtil.isEmpty(list) || list.size() == 0) { - return; - } - this.sendMessage(list); - }); - return ReturnT.SUCCESS; - } - - @XxlJob(PUSH_APP_MESSAGE) - public ReturnT pushAppMessage(String params) { - Set appPushKeys = redisTemplate.keys(appPushRedisKey + "*"); - PushMessageServiceImpl pushMessageService = SpringUtil.getBean(PushMessageServiceImpl.class); - appPushKeys.forEach(appPushKey -> { - // 从redis-key中拆分出消息推送人 - Long pusher = Optional.ofNullable(appPushKey.replace(appPushRedisKey+":","")).map(Func::toLong).orElse(null); - if(Func.isNotEmpty(pusher)) { - List records = (List) redisTemplate.opsForList().range(appPushKey,0,-1); - if(CollectionUtil.isNotEmpty(records)) { - Map> listMap = records.stream().filter(record -> Func.isNotEmpty(record.getSubject())) - .collect(Collectors.groupingBy(MessagePushRecordEntity::getSubject)); - listMap.forEach((subject,list) -> { - try { - String content = list.stream().map(MessagePushRecordEntity::getContent).collect(Collectors.joining("\r\n")); - ArrayList pushers = Lists.newArrayList(pusher.toString()); - R androidPush = pushMessageService.sendAndroidMsg(subject, content, pushers, CommonConstant.TENANT_ID); - R iosPush = pushMessageService.sendIOSMsg(subject, content, pushers, CommonConstant.TENANT_ID); - LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate() - .in(MessagePushRecordEntity::getId, list.stream().map(MessagePushRecordEntity::getId).collect(Collectors.toList())); - String faultResult = ""; - if(!androidPush.isSuccess()) { - updateWrapper.set(MessagePushRecordEntity::getStatus,MessageConstants.PUSH_FAILED); - faultResult += "ANDROID消息推送失败,推送结果为:"+androidPush.getMsg()+";"; - XxlJobLogger.log("ANDROID消息推送失败,subject为"+subject+";list为:"+JSON.toJSONString(list)); - } - if(!iosPush.isSuccess()) { - updateWrapper.set(MessagePushRecordEntity::getStatus,MessageConstants.PUSH_FAILED); - faultResult += "IOS消息推送失败,推送结果为:"+androidPush.getMsg()+";"; - XxlJobLogger.log("IOS消息推送失败,subject为"+subject+";list为:"+JSON.toJSONString(list)); - } - else { - updateWrapper.set(MessagePushRecordEntity::getStatus, MessageConstants.PUSH_SUCCESS); - updateWrapper.set(MessagePushRecordEntity::getPushTime, LocalDateTime.now()); - } - updateWrapper.set(MessagePushRecordEntity::getFaultResult,faultResult); - recordService.update(updateWrapper); - } catch (Exception e) { - throw new RuntimeException(e); - } - }); - } - records.forEach(record -> redisTemplate.opsForList().remove(appPushKey,0,record)); - } - }); - return ReturnT.SUCCESS; - } - - - /** @Author hx - * @Description 消息集中推送 - * @Date 2023/4/4 15:31 - * @Param [list] 消息推送记录 - * @return void - **/ - private void sendMessage(List list) { - Map> typeGroup = list.stream().collect(Collectors.groupingBy(MessagePushRecordEntity::getType)); - typeGroup.forEach((type,typeList) -> { - Map> collect = typeList.stream().collect(Collectors.groupingBy(MessagePushRecordEntity::getAccount)); - IMessageService service = MessageFactory.getMessageSend(type); - collect.forEach((account,records) -> { - MessagePushRecordEntity request = records.get(0); - // 完善推送内容 - request.setContent(this.getPushContent(type,records)); - XxlJobLogger.log("推送类型为:"+type+",消息推送内容为:"+request.getContent()); - if(MessageConstants.SMS_PUSH.equals(type)) { - request.setSmsParam(request.getContent()); - } - request.setMessageId(IdWorker.getId()); - try { - Boolean flag = service.send(request); - List ids = records.stream().map(MessagePushRecordEntity::getId).collect(Collectors.toList()); - // 更新消息推送状态 - LambdaUpdateWrapper lwq = Wrappers.lambdaUpdate() - .set(MessagePushRecordEntity::getStatus, flag ? MessageConstants.PUSH_SUCCESS : MessageConstants.PUSH_FAILED) - .set(MessagePushRecordEntity::getPushTime,LocalDateTime.now()) - .in(MessagePushRecordEntity::getId, ids); - recordService.update(lwq); - } - catch (Exception e) { - e.printStackTrace(); - } - }); - }); - } - - /** @Author hx - * @Description 获取群推送内容 - * @Date 2023/4/4 16:06r - * @Param [type, list] - * @return java.lang.String - **/ - private String getPushContent(String type,List list) { - if(MessageConstants.APP_PUSH.equals(type) || MessageConstants.WS_PUSH.equals(type)) { - return list.stream().map(MessagePushRecordEntity::getContent).collect(Collectors.joining("\r\n")); - } - else if(MessageConstants.SMS_PUSH.equals(type)) { - DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); - Map params = new HashMap<>(); - Optional min = list.stream().min(Comparator.comparing(MessagePushRecordEntity::getPlanTime)); - Optional max = list.stream().max(Comparator.comparing(MessagePushRecordEntity::getPlanTime)); - params.put("one",df.format(min.get().getPlanTime())); - params.put("two",df.format(max.get().getPlanTime())); - params.put("three",String.valueOf(list.size())); -// list.stream().map(MessagePushRecordEntity::getSmsParam).forEachOrdered(param -> { -// JSONObject paramJson = JSONObject.parseObject(param); -// paramJson.forEach((k,v) -> { -// params.put(k, params.containsKey(k) && Func.isNotEmpty(params.get(k)) ? params.get(k) + "," + v : (String) v); -// }); -// }); - return JSON.toJSONString(params); - } - return null; - } -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/schedule/MessagePushScheduleOld.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/schedule/MessagePushScheduleOld.java deleted file mode 100644 index 00862dc..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/schedule/MessagePushScheduleOld.java +++ /dev/null @@ -1,130 +0,0 @@ -package com.hnac.hzims.message.schedule; - -import cn.hutool.core.map.MapUtil; -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; -import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.hnac.hzims.common.utils.DateUtil; -import com.hnac.hzims.message.configure.service.ISmsConfigService; -import com.hnac.hzims.message.dto.PushMessageDTO; -import com.hnac.hzims.message.dto.SmsPushDto; -import com.hnac.hzims.message.entity.PushMessageEntity; -import com.hnac.hzims.message.entity.config.SmsConfigEntity; -import com.hnac.hzims.message.push.service.IPushService; -import com.hnac.hzims.message.service.IPushMessageService; -import com.xxl.job.core.biz.model.ReturnT; -import com.xxl.job.core.handler.annotation.XxlJob; -import com.xxl.job.core.log.XxlJobLogger; -import lombok.extern.slf4j.Slf4j; -import org.springblade.core.tool.api.R; -import org.springblade.core.tool.utils.CollectionUtil; -import org.springblade.core.tool.utils.Func; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.stereotype.Component; - -import java.time.LocalDateTime; -import java.util.*; -import java.util.stream.Collectors; - -import static com.hnac.hzims.message.constants.XxlJobConstants.*; - -/** - * 消息中心定时推送任务调度 - * @author hx - */ -@Component -@Slf4j -public class MessagePushScheduleOld { - @Autowired - private ISmsConfigService smsConfigService; - @Autowired - private IPushMessageService pushMessageService; - @Autowired - @Qualifier("smsPushService") - private IPushService pushService; - - public static final String MESSAGE_ID = "messageId"; - - /** - * 消息推送根据推送人分时段推送任务调度 - * @param params 暂不支持参数参入执行调度任务 - * @return - */ - @XxlJob(PUSH_SMS_MESSAGE_BY_NOTICE) - public ReturnT pushSmsMessageByNotice(String params) { - List list = smsConfigService.list(); - list.stream().filter(e -> Func.isNotEmpty(e.getDuration()) && Func.isNotEmpty(e.getTimeUnit())).forEach(smsConfigEntity -> { - //查询出规定时段内的短信数量统一发送 - // 获取配置的时间范围内的消息 - LocalDateTime endTime = DateUtil.plus(LocalDateTime.now(), smsConfigEntity.getDuration(), smsConfigEntity.getTimeUnit()); - PushMessageDTO pushMessageDTO = new PushMessageDTO(); - pushMessageDTO.setStartTime(LocalDateTime.now()); - pushMessageDTO.setEndTime(endTime); - pushMessageDTO.setBusinessKey(smsConfigEntity.getBusinessKey()); - pushMessageDTO.setIsPush(false); - List pushMessageList = pushMessageService.list(pushMessageDTO); - XxlJobLogger.log("开始推送短信,推送条数为:"+pushMessageList.size()); - // 获取推送消息内容体 根据用户拆分出多条短信推送 - List splitSmsList = this.transform(pushMessageList); - if(CollectionUtil.isEmpty(splitSmsList)) { - return; - } - this.push(splitSmsList,smsConfigEntity); - - }); - return ReturnT.SUCCESS; - } - - /** - * 推送短信 - * @param splitSmsList 短信内容 - * @param configEntity 短信配置 - */ - private void push(List splitSmsList,SmsConfigEntity configEntity) { - Map> phoneMap = splitSmsList.stream().collect(Collectors.groupingBy(sms -> sms.getString("phones"))); - phoneMap.forEach((phone,messages) -> { - String messageIds = messages.stream().map(message -> message.getString(MESSAGE_ID)).collect(Collectors.joining(",")); - List smsPushDtoList = JSONArray.parseArray(JSON.toJSONString(messages), SmsPushDto.class); - SmsPushDto templatePush = smsPushDtoList.get(0); - Map params = new HashMap<>(); - Arrays.stream(configEntity.getContentVariables().split(",")).forEachOrdered(contentVariable ->{ - String value = smsPushDtoList.stream().map(SmsPushDto::getParams) - .map(pm -> MapUtil.getStr(pm,contentVariable)).collect(Collectors.joining(",")); - params.put(contentVariable,value); - }); - templatePush.setParams(params); - XxlJobLogger.log(">>>>>>>>>>开始推送消息,推送内容为:"+JSONObject.toJSONString(templatePush)+"<<<<<<<<<<"); - LambdaUpdateWrapper pushLU = Wrappers.lambdaUpdate() - .set(PushMessageEntity::getIsPush, true) - .in(PushMessageEntity::getId, messageIds.split(",")); - pushMessageService.update(pushLU); - R pushResult = pushService.send(templatePush); - LambdaUpdateWrapper successLU = Wrappers.lambdaUpdate(); - if(pushResult.isSuccess()) { - successLU.set(PushMessageEntity::getIsSuccess,true); - } - else { - successLU.set(PushMessageEntity::getIsSuccess,false); - } - successLU.in(PushMessageEntity::getId, messageIds.split(",")); - pushMessageService.update(successLU); - }); - } - - /** - * 获取推送消息内容体 根据用户拆分出多条短信推送 - * @param pushMessageList - * @return - */ - private List transform(List pushMessageList) { - return pushMessageList.stream().map(m -> { - JSONObject object = JSONObject.parseObject(m.getMessageContent()); - object.put(MESSAGE_ID,m.getId()); - return object; - }).filter(object -> Func.isNotEmpty(object.getString("phones"))).collect(Collectors.toList()); - } - -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/IMessagePushRecordService.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/service/IMessagePushRecordService.java deleted file mode 100644 index e4d5172..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/IMessagePushRecordService.java +++ /dev/null @@ -1,142 +0,0 @@ -package com.hnac.hzims.message.service; - -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.service.IService; -import com.hnac.hzims.message.dto.BusinessMessageDTO; -import com.hnac.hzims.message.dto.WxMessageDTO; -import com.hnac.hzims.message.entity.MessagePushRecordEntity; -import com.hnac.hzims.message.vo.UnreadMessageVO; -import com.hnac.hzims.message.vo.msgpushrecord.*; - -import org.springblade.core.mp.support.Query; -import org.springblade.core.tool.api.R; -import org.springframework.web.bind.annotation.RequestBody; - -import java.util.List; -import java.util.Map; - -public interface IMessagePushRecordService extends IService { - - /** - * 查询消息推送记录列表 - * @param request 查询条件 - * @return 消息记录列表 - */ - List list(MessagePushRecordEntity request); - - /** - * 查询消息推送记录列表 - 无数据权限 - * @param request - * @return - */ - List listNoUserScope(MessagePushRecordEntity request); - - /** - * 分页查询消息推送记录列表 - * @param request 查询条件 - * @param query 分页 - * @return 消息记录列表 - */ - IPage listPage(MessagePushRecordEntity request, Query query); - - /** - * 分页查询消息推送记录列表 - 无数据权限 - * @param request 查询条件 - * @param query 分页 - * @return 消息记录列表 - */ - IPage listPageNoUserScope(MessagePushRecordEntity request, Query query); - - /** @Author hx - * @Description 根据ID发送短信 - * @Date 2023/4/4 17:37 - * @Param ids 消息记录ID - * @return - **/ - Boolean send(Long id); - - /** @Author hx - * @Description 保存并推送消息 - * @Date 2023/4/6 20:14 - * @Param request 消息推送记录 - * @return - **/ - Boolean saveAndSend(MessagePushRecordEntity request); - - - /** - * 短信推送统计 - */ - List smsPushStat(MessagePushRecordEntityVo vo); - - - /** - * 业务类型统计 - * @return - */ - List businessTypeStat(MessagePushRecordEntityVo vo); - - - /** - * 人员发送统计 - * @return - */ - List userPushStat(MessagePushRecordEntityVo vo); - - - /** - * 推送成功失败统计 - * @return - */ - List pushStat(MessagePushRecordEntityVo vo); - - - /** @Author hx - * @Description 获取当前登录人待办消息 - * @Date 2023/4/11 19:27 - * @return - **/ - List getPersonalUnreadMessage(); - - /** @Author hx - * @Description 获取当前登录人APP待办消息 - * @Date 2023/4/19 18:20 - * @return - **/ - List getPersonalAppUnreadMessage(); - - Boolean sendWxMessageByUser(WxMessageDTO message,List records); - - Boolean sendMailMsgByUsers(List request); - - - /** - * 新人员发送统计 - * @param vo - * @return - */ - UserPushStatTypeResponseVo newUserPushStat(MessagePushRecordEntityVo vo); - - /** - * 推送即时短信 - * @param record 短信内容 - * @return 推送结果 - */ - Boolean sendSmsImmediatelyMsg(MessagePushRecordEntity record); - - /** - * 推送即时消息 - * @param record 消息内容 - * @return 推送结果 - */ - Boolean sendImmediatelyMSg(MessagePushRecordEntity record); - - /** - * 推送事务消息(即时推送,APP消息存入redis进行消费推送) - * @param request 事务消息 - * @return 推送结果 - */ - Boolean sendAppAndWsMsgByUsers(BusinessMessageDTO request); - - -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/IMessageService.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/service/IMessageService.java deleted file mode 100644 index 0c5a7d1..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/IMessageService.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.hnac.hzims.message.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.hnac.hzims.message.dto.PushDto; -import com.hnac.hzims.message.entity.MessagePushRecordEntity; -import org.springblade.core.tool.api.R; -import org.springblade.core.tool.utils.Func; -import org.springblade.core.tool.utils.ObjectUtil; -import org.springblade.system.user.cache.UserCache; -import org.springblade.system.user.entity.User; -import static com.hnac.hzims.message.MessageConstants.*; - -/** - * @author hx - */ -public interface IMessageService { - - /** - * 推送信息 - * @param pushObject - * @return - */ - R send(T pushObject); - - boolean send(MessagePushRecordEntity request); - - /** @Author hx - * @Description 根据消息接受人获取推送账号 - * @Date 2023/4/14 15:09 - * @Param pusher 消息接收人 - * @return - **/ - default String getAccountByPusher(Long pusher,String type) { - User user = UserCache.getUser(pusher); - if(ObjectUtil.isNotEmpty(user)) { - switch(type) { - case MAIL_PUSH: - return user.getEmail(); - case SMS_PUSH: - return user.getPhone(); - default: - break; - } - } - return Long.toString(pusher); - } - -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/IMessageTemplateService.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/service/IMessageTemplateService.java deleted file mode 100644 index ce142bc..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/IMessageTemplateService.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.hnac.hzims.message.service; - -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.service.IService; -import com.hnac.hzims.message.entity.config.MessageTemplateEntity; - -import org.springblade.core.mp.support.Query; - -import java.util.List; - -public interface IMessageTemplateService extends IService { - - /** - * 查询消息模板列表 - * @param req 查询条件 - * @return 消息模板列表 - */ - List list(MessageTemplateEntity req); - - - /** - * 分页查询消息 - * @param req 查询条件 - * @param query 分页条件 - * @return 消息模板分页查询结果 - */ - IPage listPage(MessageTemplateEntity req, Query query); - -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/IMsgMailRecordService.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/service/IMsgMailRecordService.java deleted file mode 100644 index deb7437..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/IMsgMailRecordService.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.hnac.hzims.message.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.hnac.hzims.message.entity.MsgMailRecordEntity; - - -/** - * @author hx - */ -public interface IMsgMailRecordService extends IService { - -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/IMsgPushRecordService.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/service/IMsgPushRecordService.java deleted file mode 100644 index 3611f8f..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/IMsgPushRecordService.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.hnac.hzims.message.service; - -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.service.IService; -import com.hnac.hzims.message.dto.MsgPushRecordDTO; -import com.hnac.hzims.message.entity.MsgPushRecordEntity; -import com.hnac.hzims.message.vo.MsgPushRecordVO; - -import org.springblade.core.mp.support.Query; -import org.springblade.core.tool.api.R; - - /** - * 服务类 - * - * @author xiashandong - * @created 2021-06-28 08:38 - **/ -public interface IMsgPushRecordService extends IService { - - R doSave(MsgPushRecordDTO req); - - R detail(Long id); - - R> list(MsgPushRecordDTO req, Query query); - -} \ No newline at end of file diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/IMsgSmsRecordService.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/service/IMsgSmsRecordService.java deleted file mode 100644 index 00335b4..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/IMsgSmsRecordService.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.hnac.hzims.message.service; - -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.service.IService; -import com.hnac.hzims.message.dto.MsgSmsRecordDTO; -import com.hnac.hzims.message.entity.MsgSmsRecordEntity; -import com.hnac.hzims.message.vo.MsgSmsRecordVO; - -import org.springblade.core.mp.support.Query; -import org.springblade.core.tool.api.R; - - /** - * 服务类 - * - * @author xiashandong - * @created 2021-06-28 08:38 - **/ -public interface IMsgSmsRecordService extends IService { - - R doSave(MsgSmsRecordDTO req); - - R detail(Long id); - - R> list(MsgSmsRecordDTO req, Query query); - -} \ No newline at end of file diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/IMsgWsRecordHistoryService.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/service/IMsgWsRecordHistoryService.java deleted file mode 100644 index 1ce6fd9..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/IMsgWsRecordHistoryService.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.hnac.hzims.message.service; - -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.service.IService; -import com.hnac.hzims.message.dto.MsgWsRecordHistoryDTO; -import com.hnac.hzims.message.entity.MsgWsRecordHistoryEntity; -import com.hnac.hzims.message.vo.MsgWsRecordHistoryVO; - -import org.springblade.core.mp.support.Query; -import org.springblade.core.tool.api.R; - - /** - * 服务类 - * - * @author xiashandong - * @created 2021-06-28 16:45 - **/ -public interface IMsgWsRecordHistoryService extends IService { - - R doSave(MsgWsRecordHistoryDTO req); - - R detail(Long id); - - R> list(MsgWsRecordHistoryDTO req, Query query); - -} \ No newline at end of file diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/IMsgWsRecordService.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/service/IMsgWsRecordService.java deleted file mode 100644 index f475409..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/IMsgWsRecordService.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.hnac.hzims.message.service; - -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.service.IService; -import com.hnac.hzims.message.dto.MsgUpdateStatusDTO; -import com.hnac.hzims.message.dto.MsgWsRecordDTO; -import com.hnac.hzims.message.entity.MsgWsRecordEntity; -import com.hnac.hzims.message.vo.MsgWsRecordVO; -import com.hnac.hzims.message.vo.UnreadMsgCountVO; - -import org.springblade.core.mp.support.Query; -import org.springblade.core.tool.api.R; - -import java.util.List; - -/** - * 服务类 - * - * @author xiashandong - * @created 2021-06-28 08:38 - **/ -public interface IMsgWsRecordService extends IService { - - R doSave(MsgWsRecordDTO req); - - R doUpdateById(MsgWsRecordDTO req); - - R detail(Long id); - - R> list(MsgWsRecordDTO req, Query query); - - List countUnread(Long userId); - - R setMsgRead(MsgUpdateStatusDTO dto); -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/IPushMessageService.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/service/IPushMessageService.java deleted file mode 100644 index 986a84d..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/IPushMessageService.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.hnac.hzims.message.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.hnac.hzims.message.dto.PushMessageDTO; -import com.hnac.hzims.message.entity.PushMessageEntity; -import com.hnac.hzims.message.entity.config.SmsConfigEntity; - - -import java.util.List; - -/** - * @author hx - */ -public interface IPushMessageService extends IService { - - /** - * 获取短信推送列表 - * @param pushMessageDTO 推送消息筛选条件 - * @return - */ - List list(PushMessageDTO pushMessageDTO); - -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/PushService.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/service/PushService.java deleted file mode 100644 index 1023edb..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/PushService.java +++ /dev/null @@ -1,203 +0,0 @@ -package com.hnac.hzims.message.service; - -import com.alibaba.fastjson.JSONObject; -import com.hnac.hzims.message.dto.MsgPushRecordDTO; -import com.hnac.hzims.message.dto.MsgWsRecordDTO; -import com.hnac.hzims.message.dto.MsgWsRecordHistoryDTO; -import com.hnac.hzims.message.req.PushExtrasReq; -import com.hnac.hzims.message.req.PushReq; -import com.hnac.hzims.message.ws.SessionManager; -import com.hnac.hzinfo.core.push.enums.PushAudienceType; -import com.hnac.hzinfo.core.push.model.PushAudience; -import com.hnac.hzinfo.core.push.model.PushInfo; -import com.hnac.hzinfo.core.push.model.PushPlatform; -import lombok.AllArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springblade.core.tool.api.R; -import org.springblade.core.tool.utils.BeanUtil; -import org.springblade.resource.feign.IPushClient; -import org.springblade.resource.vo.PushInfoVO; -import org.springframework.stereotype.Service; -import org.springframework.util.CollectionUtils; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.socket.TextMessage; -import org.springframework.web.socket.WebSocketSession; - -import java.io.IOException; -import java.util.List; -import java.util.stream.Collectors; - -/** - * @author xiashandong - * @created 2021/6/24 14:45 - **/ -@Slf4j -@AllArgsConstructor -@Service -public class PushService { - private final IPushClient pushClient; - private final IMsgPushRecordService pushRecordService; - private final IMsgWsRecordService wsRecordService; - private final IMsgWsRecordHistoryService wsRecordHistoryService; - - /** - * 根据userId推送消息 - * - * @param userIds - * @param req - */ - public void sendByUserId(List userIds, PushExtrasReq req, String tenantId, Long createDept, Long createUser) { - this.sendPushMessage(req, userIds, null, false, tenantId, createDept, createUser); - this.sendWsMessage(req, userIds, false, tenantId, createDept, createUser); - } - - /** - * 根据标签推送消息 - * - * @param tags - * @param req - */ - public void sendByTags(List tags, PushReq req) { - this.sendPushMessage(req, null, tags, false, null , null, null); - } - - /** - * 推送广播消息 - * - * @param req - */ - public void sendAll(PushExtrasReq req) { - this.sendPushMessage(req, null, null, true,null , null, null); - this.sendWsMessage(req, null, true, null, null, null); - } - - /** - * 推送push消息 - * - * @param req - * @param userIds - * @param tags - * @param isAll - */ - private void sendPushMessage(PushReq req, List userIds, List tags, boolean isAll, String tenantId, Long createDept, Long createUser ) { - PushPlatform platform = PushPlatform.all();//默认推送给所有平台 - PushAudience audience = null;//目标标签 - if (!CollectionUtils.isEmpty(userIds)) { - audience = PushAudience.newBuilder().setAll(false).addPushAudienceType(PushAudienceType.TAG, userIds).build(); - } else if (!CollectionUtils.isEmpty(tags)) { - audience = PushAudience.newBuilder().setAll(false).addPushAudienceType(PushAudienceType.TAG, tags).build(); - } else if (isAll) { - audience = PushAudience.newBuilder().setAll(true).build(); - } - PushInfo pushInfo = null; - R r = null; - try { - pushInfo = new PushInfo(req.getCode(), req.getTitle(), req.getPushAlert(), "", null, platform, audience); - PushInfoVO pushInfoVO = new PushInfoVO(); - pushInfoVO.setTenantId(tenantId); - pushInfoVO.setPushInfo(pushInfo); - r = pushClient.tenantPush(pushInfoVO); - } catch (Exception ex) { - log.info("推送push消息失败!", ex); - this.savePushLog(2, pushInfo, r, isAll, tags, userIds, JSONObject.toJSONString(ex),tenantId,createDept,createUser); - } finally { - //记录错误日志 - if (!r.isSuccess()) { - this.savePushLog(3, pushInfo, r, isAll, tags, userIds, null, tenantId, createDept, createUser); - } - //记录成功日志 - else { - this.savePushLog(1, pushInfo, r, isAll, tags, userIds, null, tenantId, createDept, createUser); - } - } - } - - private void savePushLog(int status, PushInfo req, R r, boolean isAll, List tags, List userIds, String errorLog, String tenantId, Long createDept, Long createUser ) { - pushRecordService.doSave(new MsgPushRecordDTO() {{ - setStatus(status); - //setIsAll(isAll); - setParameters(JSONObject.toJSONString(req)); - setResponse(JSONObject.toJSONString(r)); - setErrorLog(errorLog); - setTenantId(tenantId); - setCreateDept(createDept); - setCreateUser(createUser); - if (!CollectionUtils.isEmpty(tags)) { - setTags(tags.stream().collect(Collectors.joining(",", ",", ","))); - } - if (!CollectionUtils.isEmpty(userIds)) { - setTags(userIds.stream().collect(Collectors.joining(",", ",", ","))); - } - }}); - } - - /** - * 发送websocket消息 - */ - private void sendWsMessage(PushExtrasReq req, List userIds, boolean isAll, String tenantId, Long createDept,Long createUser) { - if (isAll) { - for (WebSocketSession session : SessionManager.SESSION_POOL.values()) { - this.sendWsMessage(session, req, tenantId, createDept, createUser); - } - } else { - for (String userId : userIds) { - this.sendWsMessage(userId, req, tenantId, createDept, createUser); - } - } - } - - private void sendWsMessage(String userId, PushExtrasReq req, String tenantId, Long createDept,Long createUser) { - WebSocketSession session = SessionManager.get(userId); - if (session != null) { - this.sendWsMessage(session, req, tenantId, createDept, createUser); - } else { - //记录未发送消息 - this.saveWsLog(3, userId, req, null, tenantId, createDept, createUser); - } - } - - private void sendWsMessage(WebSocketSession session, PushExtrasReq req, String tenantId, Long createDept,Long createUser) { - String userId = session.getAttributes().get("userId").toString(); - boolean isSuccess = true; - try { - String msg = JSONObject.toJSONString(req); - session.sendMessage(new TextMessage(msg)); - } catch (IOException ex) { - isSuccess = false; - log.info("推送websocket消息失败!", ex); - this.saveWsLog(2, userId, req, JSONObject.toJSONString(ex), tenantId, createDept, createUser); - } finally { - if (isSuccess) { - this.saveWsLog(1, userId, req, null, tenantId, createDept, createUser); - } - } - } - - private void saveWsLog(int status, String userId, PushExtrasReq req, String errorLog, String tenantId, Long createDept,Long createUser) { - if (status != 1) { - wsRecordService.doSave(new MsgWsRecordDTO() {{ - setStatus(status); -// setUserId(Long.valueOf(userId)); -// setClassify(req.getBusinessClassify()); -// setReqBody(JSONObject.toJSONString(req));//req.getExtras() -// setTitle(req.getTitle()); - setErrorLog(errorLog); - setTenantId(tenantId); - setCreateDept(createDept); - setCreateUser(createUser); - }}); - } else { - wsRecordHistoryService.doSave(new MsgWsRecordHistoryDTO() {{ - setStatus(4);//已读状态 - setUserId(Long.valueOf(userId)); - setClassify(req.getBusinessClassify()); - setReqBody(JSONObject.toJSONString(req));//req.getExtras() - setTitle(req.getTitle()); - setErrorLog(errorLog); - setTenantId(tenantId); - setCreateDept(createDept); - setCreateUser(createUser); - }}); - } - } -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/SmsService.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/service/SmsService.java deleted file mode 100644 index 5cb336d..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/SmsService.java +++ /dev/null @@ -1,90 +0,0 @@ -package com.hnac.hzims.message.service; - -import com.alibaba.fastjson.JSONObject; -import com.hnac.hzims.common.logs.utils.StringUtils; -import com.hnac.hzims.message.dto.MsgSmsRecordDTO; -import com.hnac.hzims.message.req.SmsReq; -import lombok.AllArgsConstructor; -import lombok.extern.slf4j.Slf4j; - -import org.springblade.core.sms.model.SmsResponse; -import org.springblade.core.tool.api.R; -import org.springblade.core.tool.utils.Func; -import org.springblade.resource.feign.ISmsClient; -import org.springframework.stereotype.Service; -import org.springframework.util.CollectionUtils; - -import java.util.stream.Collectors; - -/** - * @author xiashandong - * @created 2021/6/24 16:27 - **/ -@Slf4j -@AllArgsConstructor -@Service -public class SmsService { - private final ISmsClient smsClient; - private final IMsgSmsRecordService smsRecordService; - - /** - * 发送短信 - * - * @param req request - */ - public void sendMessage(SmsReq req) { - String phones = null; - String params = null; - R r = null; - try { - phones = req.getPhones().stream().collect(Collectors.joining(",")); - params = CollectionUtils.isEmpty(req.getParams()) ? StringUtils.EMPTY : JSONObject.toJSONString(req.getParams()); - if(Func.isNotEmpty(req.getTenantId())){ - r = smsClient.sendMessage(req.getTenantId(), req.getCode(), params, phones); - } - else{ - r = smsClient.sendMessage(req.getCode(), params, phones); - } - } catch (Exception ex) { - log.error(String.format("发送短信失败!(phones=%s)", phones), ex); - this.saveLog(3, req, r, JSONObject.toJSONString(ex)); - } finally { - //记录错误日志 - if (!r.isSuccess()) { - this.saveLog(2, req, r); - } - //记录成功日志 - else { - this.saveLog(1, req, r); - } - } - } - - private void saveLog(int status, SmsReq req, R resp) { - this.saveLog(status, req, resp, null); - } - - private void saveLog(int status, SmsReq req, R resp, String errorLog) { - String phones = req.getPhones().stream().collect(Collectors.joining(",", ",", ",")); - String params = CollectionUtils.isEmpty(req.getParams()) ? StringUtils.EMPTY : JSONObject.toJSONString(req.getParams()); - - smsRecordService.doSave(new MsgSmsRecordDTO() {{ - setStatus(status); - setSmsCode(req.getCode()); - setPhones(phones); - setParameters(JSONObject.toJSONString(req)); - setResponse(JSONObject.toJSONString(resp)); - setErrorLog(errorLog); - if(Func.isNotEmpty(req.getTenantId())){ - setTenantId(req.getTenantId()); - } - if(Func.isNotEmpty(req.getCreateDept())){ - setCreateDept(req.getCreateDept()); - } - if(Func.isNotEmpty(req.getCreateUser())){ - setCreateUser(req.getCreateUser()); - } - }}); - } - -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/MailMessageServiceImpl.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/MailMessageServiceImpl.java deleted file mode 100644 index 53dc85f..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/MailMessageServiceImpl.java +++ /dev/null @@ -1,121 +0,0 @@ -package com.hnac.hzims.message.service.impl; - -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONObject; -import com.hnac.hzims.message.MessageConstants; -import com.hnac.hzims.message.entity.MessagePushRecordEntity; -import com.hnac.hzims.message.log.aspect.SaveLog; -import com.hnac.hzims.message.dto.MailPushDto; -import com.hnac.hzims.message.dto.PushDto; -import com.hnac.hzims.message.service.IMessageService; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springblade.core.log.exception.ServiceException; -import org.springblade.core.tool.api.R; -import org.springblade.core.tool.utils.CollectionUtil; -import org.springblade.core.tool.utils.Func; -import org.springblade.core.tool.utils.ObjectUtil; -import org.springblade.core.tool.utils.StringUtil; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.mail.javamail.JavaMailSender; -import org.springframework.mail.javamail.MimeMessageHelper; -import org.springframework.stereotype.Service; -import org.springframework.util.Assert; -import org.springframework.web.multipart.MultipartFile; - -import javax.mail.MessagingException; -import javax.mail.internet.MimeMessage; - -/** - * @author hx - */ -@Service("mailMessageService") -@RequiredArgsConstructor -@Slf4j -public class MailMessageServiceImpl implements IMessageService { - - private final JavaMailSender mailSender; - - @Value("${spring.mail.username}") - private String fromAccount; - - @Override - @SaveLog(type = MessageConstants.MAIL_PUSH) - public R send(T pushObject) { - MailPushDto mailPushDto = JSONObject.parseObject(JSON.toJSONString(pushObject),MailPushDto.class); - mailPushDto.setFromAccount(fromAccount); - //创建复杂有限发送对象 - MimeMessage mimeMessage = mailSender.createMimeMessage(); - MimeMessageHelper messageHelper = null; - try { - messageHelper = new MimeMessageHelper(mimeMessage, true); - // 设置发件人邮箱(若配置默认邮箱则不用再设置) - messageHelper.setFrom(mailPushDto.getFromAccount()); - // 设置收件人邮箱 - if(ObjectUtil.isNotEmpty(mailPushDto.getToAccount()) && mailPushDto.getToAccount().length>0){ - messageHelper.setTo(mailPushDto.getToAccount()); - } - // 设置抄报人邮箱(可以不填写) - if(ObjectUtil.isNotEmpty(mailPushDto.getCcAccount()) && mailPushDto.getCcAccount().length>0){ - messageHelper.setCc(mailPushDto.getCcAccount()); - } - // 设置密送人邮箱(可以不填写) - //messageHelper.setBcc("575814158@qq.com"); - // 设置邮件主题 - messageHelper.setSubject(mailPushDto.getSubject()); - messageHelper.setText(mailPushDto.getText(),mailPushDto.isHtml()); - //填充附件 - if(CollectionUtil.isNotEmpty(mailPushDto.getAppendix())){ - for (MultipartFile appendix : mailPushDto.getAppendix()) { - messageHelper.addAttachment(appendix.getName(),appendix); - } - } - //发送邮件 - mailSender.send(mimeMessage); - } catch (MessagingException e) { - e.printStackTrace(); - throw new ServiceException(e.getMessage()); - } - return R.success("发送成功!"); - } - - @Override - public boolean send(MessagePushRecordEntity request) { - String account = getAccountByPusher(Long.parseLong(request.getPusher()), request.getType()); - Assert.isTrue(Func.isNotEmpty(account) && StringUtil.isNotBlank(account) , () -> { - throw new ServiceException("未查询到相关用户,邮件推送失败!"); - }); - // 创建复杂有限发送对象 - MimeMessage mimeMessage = mailSender.createMimeMessage(); - MimeMessageHelper messageHelper; - try { - messageHelper = new MimeMessageHelper(mimeMessage, true); - // 设置发件人邮箱(若配置默认邮箱则不用再设置) - messageHelper.setFrom(fromAccount); - // 设置收件人邮箱 - messageHelper.setTo(account); - // 设置抄报人邮箱(可以不填写) - if(StringUtil.isNotBlank(request.getCcAccount())) { - messageHelper.setCc(request.getCcAccount()); - } - // 设置密送人邮箱(可以不填写) - //messageHelper.setBcc("575814158@qq.com"); - // 设置邮件主题 - messageHelper.setSubject(request.getSubject()); - messageHelper.setText(request.getContent(),request.getIsHtml()); - //填充附件 - if(CollectionUtil.isNotEmpty(request.getAppendix())){ - for (MultipartFile appendix : request.getAppendix()) { - messageHelper.addAttachment(appendix.getName(),appendix); - } - } - //发送邮件 - mailSender.send(mimeMessage); - } catch (MessagingException e) { - e.printStackTrace(); - throw new ServiceException(e.getMessage()); - } - return true; - } - -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/MessagePushRecordServiceImpl.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/MessagePushRecordServiceImpl.java deleted file mode 100644 index 66e42b9..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/MessagePushRecordServiceImpl.java +++ /dev/null @@ -1,647 +0,0 @@ -package com.hnac.hzims.message.service.impl; - -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; -import com.baomidou.mybatisplus.core.toolkit.IdWorker; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.google.common.collect.Lists; -import com.hnac.hzims.common.constant.CommonConstant; -import com.hnac.hzims.common.utils.CacheUtil; -import com.hnac.hzims.common.utils.DateUtil; -import com.hnac.hzims.message.MessageConstants; -import com.hnac.hzims.message.config.MessageFactory; -import com.hnac.hzims.message.constants.DictKeyConstants; -import com.hnac.hzims.message.dto.BusinessMessageDTO; -import com.hnac.hzims.message.dto.WxMessageDTO; -import com.hnac.hzims.message.entity.MessagePushRecordEntity; -import com.hnac.hzims.message.enums.PushStatEnum; -import com.hnac.hzims.message.mapper.MessagePushRecordMapper; -import com.hnac.hzims.message.mapper.MprNoAurhScopeMapper; -import com.hnac.hzims.message.service.IMessagePushRecordService; -import com.hnac.hzims.message.service.IMessageService; -import com.hnac.hzims.message.vo.UnreadMessageVO; -import com.hnac.hzims.message.vo.msgpushrecord.*; -import com.hnac.hzinfo.core.push.model.PushResponse; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springblade.core.log.exception.ServiceException; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.hnac.hzims.common.utils.Condition; -import org.springblade.core.mp.support.Query; -import org.springblade.core.secure.utils.AuthUtil; -import org.springblade.core.tool.api.R; -import org.springblade.core.tool.utils.BeanUtil; -import org.springblade.core.tool.utils.Func; -import org.springblade.core.tool.utils.SpringUtil; -import org.springblade.system.cache.DictCache; -import org.springblade.system.entity.Dict; -import org.springblade.system.feign.ISysClient; -import org.springblade.system.user.cache.UserCache; -import org.springblade.system.user.entity.User; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.data.redis.core.RedisTemplate; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.util.Assert; - -import javax.validation.Valid; -import java.time.*; -import java.time.format.DateTimeFormatter; -import java.util.*; -import java.util.concurrent.FutureTask; -import java.util.stream.Collectors; -import java.util.stream.IntStream; - -@Service -@RequiredArgsConstructor -@Slf4j -public class MessagePushRecordServiceImpl extends ServiceImpl implements IMessagePushRecordService { - - private final MprNoAurhScopeMapper noAurhScopeMapper; - private final IMessageService smsMessageService; - private final ISysClient sysClient; - private final RedisTemplate redisTemplate; - @Value("${hzims.message.redis-key.app-push}") - private String appPushRedisKey; - - @Override - public List list(MessagePushRecordEntity request) { - return this.list(this.getQueryWrapper(request)); - } - - @Override - public List listNoUserScope(MessagePushRecordEntity request) { - return noAurhScopeMapper.selectList(this.getQueryWrapper(request)); - } - - @Override - public IPage listPage(MessagePushRecordEntity request, Query query) { - return this.page(Condition.getPage(query), this.getQueryWrapper(request)); - } - - @Override - public IPage listPageNoUserScope(MessagePushRecordEntity request, Query query) { - return noAurhScopeMapper.selectPage(Condition.getPage(query), this.getQueryWrapper(request)); - } - - /** - * @return java.lang.Boolean 推送结果 - * @Author hx - * @Description 根据ID发送短信 - * @Date 2023/4/12 10:22 - * @Param [id] 短信记录ID - **/ - @Override - public Boolean send(Long id) { - MessagePushRecordEntity record = this.getById(id); - IMessageService messageSend = MessageFactory.getMessageSend(record.getType()); - Boolean result = messageSend.send(record); - Assert.isTrue(result, () -> { - throw new ServiceException("发送消息失败!"); - }); - // 更新推送状态以及推送时间 - LambdaUpdateWrapper luw = Wrappers.lambdaUpdate().set(MessagePushRecordEntity::getPushTime, LocalDateTime.now()).set(MessagePushRecordEntity::getStatus, MessageConstants.PUSH_SUCCESS).eq(MessagePushRecordEntity::getId, id); - return this.update(luw); - } - - /** - * @return java.lang.Boolean 推送结果 - * @Author hx - * @Description 保存并推送消息 - * @Date 2023/4/12 10:23 - * @Param [request] 消息记录 - **/ - @Override - public Boolean saveAndSend(MessagePushRecordEntity request) { - LocalDateTime now = LocalDateTime.now(); - request.setStatus(MessageConstants.NOT_PUSH); - if (MessageConstants.IMMEDIATELY.equals(request.getPushType())) { - request.setPlanTime(now); - request.setPushTime(now); - // 立即推送消息 - return this.sendImmediatelyMSg(request); - } else if (MessageConstants.PLAN.equals(request.getPushType())) { - return this.save(request); - } else { - throw new ServiceException("推送类型只能为即时推送或计划推送"); - } - } - - /** - * 获取 QueryWrapper - * - * @param request 查询条件 - * @return QueryWrapper - */ - private LambdaQueryWrapper getQueryWrapper(MessagePushRecordEntity request) { - LambdaQueryWrapper lambda = Condition.getQueryWrapper(MessagePushRecordEntity.class,request); - if(Func.isNotEmpty(request.getStartTime())) { - lambda.ge(MessagePushRecordEntity::getPushTime, LocalDateTime.of(request.getStartTime(), LocalTime.MIN)); - } - if(Func.isNotEmpty(request.getEndTime())) { - lambda.le(MessagePushRecordEntity::getPushTime, LocalDateTime.of(request.getEndTime(), LocalTime.MAX)); - } - lambda.eq(Func.isNotEmpty(request.getStatus()),MessagePushRecordEntity::getStatus,request.getStatus()); - lambda.orderByDesc(MessagePushRecordEntity::getPushTime); - return lambda; - } - - /** - * 短信推送统计 - */ - @Override - public List smsPushStat(MessagePushRecordEntityVo vo) { - List result = Lists.newArrayList(); - //根据type统计数量 - List messagePushRecordVos = baseMapper.smsPushStat(vo); - List types = DictCache.getList(DictKeyConstants.MESSAGE_TYPE); - List lastYearMonths = this.getLastYearMonths(); - types.forEach(dict -> { - MessagePushRecordTypeVo typeVO = new MessagePushRecordTypeVo(); - typeVO.setType(dict.getDictKey()); - typeVO.setTypeName(dict.getDictValue()); - List recordVOList = lastYearMonths.stream().map(yearMonth -> { - MessagePushRecordVo recordVO = new MessagePushRecordVo(); - recordVO.setYear(yearMonth.getYear()); - recordVO.setMonth(yearMonth.getMonthValue()); - recordVO.setStrMonth(yearMonth); - Long power = messagePushRecordVos.stream().filter(group -> group.getType().equals(dict.getDictKey()) && yearMonth.equals(group.getStrMonth())).findFirst().map(MessagePushRecordVo::getPower).orElse(0L); - recordVO.setPower(power); - return recordVO; - }).collect(Collectors.toList()); - typeVO.setMessagePushRecordList(recordVOList); - result.add(typeVO); - }); - return result; - } - - /** - * 获取从当前月份开始过去一年内的月份 - * @return 过去一年的月份 - */ - private List getLastYearMonths () { - YearMonth now = YearMonth.now(); - return IntStream.iterate(0,index -> index + 1).limit(12).mapToObj(index -> now.minusMonths(index)).collect(Collectors.toList()); - } - - /** - * 业务类型统计 - * - * @return - */ - @Override - public List businessTypeStat(MessagePushRecordEntityVo vo) { - List businessTypeStatVos = baseMapper.businessTypeStat(vo); - List classifies = DictCache.getList(DictKeyConstants.BUSINESS_CLASSIFY); - return classifies.stream().map(dict -> { - BusinessTypeStatVo result = new BusinessTypeStatVo(); - result.setBusinessClassify(dict.getDictKey()); - result.setBusinessClassifyName(dict.getDictValue()); - result.setPower(businessTypeStatVos.stream().filter(stat -> dict.getDictKey().equals(stat.getBusinessClassify())).map(BusinessTypeStatVo::getPower).findFirst().orElse(0L)); - return result; - }).collect(Collectors.toList()); - } - - /** - * 人员发送统计 - * - * @return - */ - @Override - public List userPushStat(MessagePushRecordEntityVo vo) { - List userPushStatTypeVos = baseMapper.userPushStat(vo); - //添加业务类型名称 - userPushStatTypeVos.forEach(item -> { - List pushStatList = item.getPushStatList(); - pushStatList.forEach(pushStat -> { - String businessClassify = pushStat.getBusinessClassify(); - String businessTypeName = this.getBusinessClassifyByName(businessClassify); - pushStat.setBusinessClassifyName(businessTypeName); - }); - }); - return userPushStatTypeVos; - } - - - /** - * 新人员发送统计 - * - * @param vo - * @return - */ - @Override - public UserPushStatTypeResponseVo newUserPushStat(MessagePushRecordEntityVo vo) { - UserPushStatTypeResponseVo pushStatList = new UserPushStatTypeResponseVo(); - List results = new ArrayList<>(); - List pushStat = baseMapper.selectUserPushStat(vo); - List list = pushStat.stream().map(item -> item.getPusherName()).distinct().collect(Collectors.toList()); - pushStatList.setUserNames(list); - //封装业务分类对象 - Map> collect = pushStat.stream().collect(Collectors.groupingBy(PushStatResponseVo::getBusinessClassify)); - // - for (Map.Entry> entry : collect.entrySet()) { - List arrayList = Lists.newArrayList(list); - UserPushStatResponseVo userPushStatTypeResponseVo = new UserPushStatResponseVo(); - //存储key - userPushStatTypeResponseVo.setBusinessClassify(entry.getKey()); - userPushStatTypeResponseVo.setBusinessClassifyName(this.getBusinessClassifyByName(entry.getKey())); - TreeMap treeMap = new TreeMap<>(); - //存储业务分类 - List pushStatResponseVos = entry.getValue(); - for (PushStatResponseVo pushStatResponseVo : pushStatResponseVos) { - arrayList.remove(pushStatResponseVo.getPusherName()); - treeMap.put(pushStatResponseVo.getPusherName(),pushStatResponseVo.getCount()); - } - //如果不存在设为0 - for (String name : arrayList) { - treeMap.put(name,0); - } - userPushStatTypeResponseVo.setParams(treeMap); - results.add(userPushStatTypeResponseVo); - } - pushStatList.setUserPushStatResponseVos(results); - - return pushStatList; - } - - @Override - public Boolean sendSmsImmediatelyMsg(MessagePushRecordEntity record) { - // 完善推送Account - record.setAccount(smsMessageService.getAccountByPusher(Long.parseLong(record.getPusher()),record.getType())); - SmsMessageServiceImpl smsService = SpringUtil.getBean(SmsMessageServiceImpl.class); - if(this.saveOrUpdate(record)) { - R sendResult = smsService.sendSmsByRecord(record); - if(sendResult.isSuccess()) { - record.setStatus(MessageConstants.PUSH_SUCCESS); - record.setPushTime(LocalDateTime.now()); - } - else { - record.setStatus(MessageConstants.PUSH_FAILED); - record.setFaultResult(sendResult.getMsg()); - } - this.updateById(record); - } - return true; - } - - /** - * 推送APP即时消息 - * @param record 消息记录 - * @param isEmergent 是否紧急 若紧急则直接推送 若不紧急则存入redis进行消费 - * @return 推送结果 - */ - private Boolean sendAppImmediatelyMsg(MessagePushRecordEntity record, boolean isEmergent) { - if(this.saveOrUpdate(record)) { - PushMessageServiceImpl pushService = SpringUtil.getBean(PushMessageServiceImpl.class); - if(isEmergent) { - ArrayList pushers = Lists.newArrayList(record.getPusher()); - R androidPush = pushService.sendAndroidMsg(record.getSubject(), record.getContent(), pushers, CommonConstant.TENANT_ID); - R iosPush = pushService.sendIOSMsg(record.getSubject(), record.getContent(), pushers, CommonConstant.TENANT_ID); - String faultResult = ""; - if(!androidPush.isSuccess()) { - record.setStatus(MessageConstants.PUSH_FAILED); - faultResult += "ANDROID消息推送失败,推送结果为:"+androidPush.getMsg()+";"; - } - if(!iosPush.isSuccess()) { - record.setStatus(MessageConstants.PUSH_FAILED); - faultResult += "IOS消息推送失败,推送结果为:"+androidPush.getMsg()+";"; - } - else { - record.setStatus(MessageConstants.PUSH_SUCCESS); - } - record.setFaultResult(faultResult); - this.updateById(record); - } - else { - if(!pushService.send(record)) { - record.setStatus(MessageConstants.PUSH_FAILED); - } - } - this.updateById(record); - } - return true; - } - - private Boolean sendWsImmediatelyMsg(MessagePushRecordEntity record) { - if(this.saveOrUpdate(record)) { - WebsocketServiceImpl wsService = SpringUtil.getBean(WebsocketServiceImpl.class); - if(wsService.send(record)) { - record.setStatus(MessageConstants.PUSH_SUCCESS); - record.setPushTime(LocalDateTime.now()); - } - else { - record.setStatus(MessageConstants.PUSH_FAILED); - } - this.updateById(record); - } - return true; - } - - - @Override - public Boolean sendImmediatelyMSg(MessagePushRecordEntity record) { - Assert.isTrue(MessageConstants.IMMEDIATELY.equals(record.getPushType()),() -> { - throw new ServiceException("该消息记录推送类型错误,只能为即时推送!"); - }); - switch(record.getType()) { - case MessageConstants.APP_PUSH: - return this.sendAppImmediatelyMsg(record,false); - case MessageConstants.WX_PUSH: - break; - case MessageConstants.WS_PUSH: - return this.sendWsImmediatelyMsg(record); - case MessageConstants.SMS_PUSH: - return this.sendSmsImmediatelyMsg(record); - default: - break; - } - return true; - } - - @Override - public Boolean sendAppAndWsMsgByUsers(BusinessMessageDTO request) { - // 保存消息记录 - List pushRecords = this.convert(request); - if(this.saveBatch(pushRecords)) { - // 推送消息 - WebsocketServiceImpl wsMessageService = SpringUtil.getBean(WebsocketServiceImpl.class); - pushRecords.forEach(record -> { - if(MessageConstants.APP_PUSH.equals(record.getType())) { - // APP消息存入redis中进行消费 - this.sendAppImmediatelyMsg(record,request.isEmergent()); - } else if (MessageConstants.WS_PUSH.equals(record.getType())) { - // WEB消息调用接口直接进行推送 - if(wsMessageService.send(record)) { - record.setPushTime(LocalDateTime.now()); - record.setStatus(MessageConstants.PUSH_SUCCESS); - } - else { - record.setStatus(MessageConstants.PUSH_FAILED); - } - this.updateById(record); - } - }); - return true; - } - return false; - } - - private List convert(BusinessMessageDTO request) { - return Func.toLongList(request.getUserIds()).stream().flatMap(userId -> { - long messageId = IdWorker.getId(); - return Lists.newArrayList(MessageConstants.APP_PUSH, MessageConstants.WS_PUSH).stream().map(messageType -> { - MessagePushRecordEntity record = BeanUtil.copy(request, MessagePushRecordEntity.class); - record.setDeptName(Func.isNotEmpty(record.getDeptName()) ? record.getDeptName() : this.getDeptNameById(record.getDeptId())); - record.setMessageId(messageId); - record.setPusher(userId.toString()); - record.setPusherName(Optional.ofNullable(UserCache.getUser(userId)).map(User::getName).orElse(null)); - record.setPushType(MessageConstants.IMMEDIATELY); - record.setAccount(userId.toString()); - record.setPlanTime(LocalDateTime.now()); - record.setType(messageType); - record.setCreateDept(record.getDeptId()); - record.setStatus(MessageConstants.NOT_PUSH); - return record; - }); - }).collect(Collectors.toList()); - } - - /** - * 根据机构ID获取机构名称 - * @param deptId 机构ID - * @return 机构名称 - */ - private String getDeptNameById(Long deptId) { - return Optional.ofNullable(sysClient.getDeptName(deptId)).filter(r -> r.isSuccess()).map(R::getData).orElse(null); - } - - /** - * 推送成功失败统计 - * - * @return - */ - @Override - public List pushStat(MessagePushRecordEntityVo vo) { - List pushStatTypeVos = baseMapper.pushStat(vo); - List classifies = DictCache.getList(DictKeyConstants.BUSINESS_CLASSIFY); - return classifies.stream().map(dict -> { - PushStatTypeVo typeVO = new PushStatTypeVo(); - typeVO.setBusinessClassify(dict.getDictKey()); - typeVO.setBusinessClassifyName(dict.getDictValue()); - List pushStatVoList = Arrays.stream(MessageConstants.MessagePushResultEnum.class.getEnumConstants()).map(pushResultTypeEnums -> { - PushStatVo statVo = new PushStatVo(); - statVo.setStatus(pushResultTypeEnums.getKey()); - statVo.setStatusName(pushResultTypeEnums.getValue()); - statVo.setBusinessClassify(dict.getDictKey()); - statVo.setBusinessClassifyName(dict.getDictValue()); - Optional statVO = pushStatTypeVos.stream().filter(group -> dict.getDictKey().equals(group.getBusinessClassify())) - .flatMap(group -> group.getPushStatList().stream()).filter(stat -> stat.getStatus().equals(pushResultTypeEnums.getKey())).findFirst(); - statVo.setPower(statVO.map(PushStatVo::getPower).orElse(0L)); - return statVo; - }).collect(Collectors.toList()); - typeVO.setPushStatList(pushStatVoList); - return typeVO; - }).collect(Collectors.toList()); - } - - @Override - public List getPersonalUnreadMessage() { - QueryWrapper query = Wrappers.query(); - query.select("business_classify businessClassify,count(0) todoNum"); - query.eq("pusher", AuthUtil.getUserId()); - query.eq("type", MessageConstants.WS_PUSH); - query.in("status", Lists.newArrayList(MessageConstants.PUSH_SUCCESS)); - query.groupBy("business_classify"); - List> list = noAurhScopeMapper.selectMaps(query); - return list.stream().map(map -> { - UnreadMessageVO unreadMessageVO = Func.toBean(map, UnreadMessageVO.class); - unreadMessageVO.setBusinessName(DictCache.getValue("businessClassify", unreadMessageVO.getBusinessClassify())); - return unreadMessageVO; - }).collect(Collectors.toList()); - } - - @Override - public List getPersonalAppUnreadMessage() { - QueryWrapper query = Wrappers.query(); - query.select("business_classify businessClassify,count(0) todoNum"); - query.eq("pusher", AuthUtil.getUserId()); - query.eq("type", MessageConstants.APP_PUSH); - query.in("status", Lists.newArrayList(MessageConstants.PUSH_SUCCESS)); - query.groupBy("business_classify"); - List> list = noAurhScopeMapper.selectMaps(query); - return list.stream().map(map -> { - UnreadMessageVO unreadMessageVO = Func.toBean(map, UnreadMessageVO.class); - unreadMessageVO.setBusinessName(DictCache.getValue("businessClassify", unreadMessageVO.getBusinessClassify())); - return unreadMessageVO; - }).collect(Collectors.toList()); - } - - @Override - public Boolean sendWxMessageByUser(WxMessageDTO message,List records) { - - WxMessageServiceImpl service = SpringUtil.getBean(WxMessageServiceImpl.class); - boolean isSend = service.send(message); - if (isSend) { - this.update(Wrappers.lambdaUpdate() - .set(MessagePushRecordEntity::getPushTime, LocalDateTime.now()) - .set(MessagePushRecordEntity::getStatus, MessageConstants.PUSH_SUCCESS) - .in(MessagePushRecordEntity::getId, records.stream().map(MessagePushRecordEntity::getId).collect(Collectors.toList()))); - }else{ - this.update(Wrappers.lambdaUpdate() - .set(MessagePushRecordEntity::getPushTime, LocalDateTime.now()) - .set(MessagePushRecordEntity::getStatus, MessageConstants.PUSH_FAILED) - .in(MessagePushRecordEntity::getId, records.stream().map(MessagePushRecordEntity::getId).collect(Collectors.toList()))); - } - return isSend; - } - - @Override - public Boolean sendMailMsgByUsers(List request) { - MailMessageServiceImpl service = SpringUtil.getBean(MailMessageServiceImpl.class); - request.forEach(record -> { - boolean sendFlag = service.send(record); - if (sendFlag) { - this.update(Wrappers.lambdaUpdate() - .set(MessagePushRecordEntity::getPushTime, LocalDateTime.now()) - .set(MessagePushRecordEntity::getStatus, MessageConstants.PUSH_SUCCESS) - .set(MessagePushRecordEntity::getAccount,service.getAccountByPusher(Long.parseLong(record.getPusher()), record.getType())) - .in(MessagePushRecordEntity::getId, record.getId()) - ); - } - }); - return true; - } - - - /** - * 状态 ===> 状态名称 - * - * @param key 状态 - */ - private String getStatusByName(Integer key) { - String value = null; - switch (key) { - case 0: - value = PushStatEnum.UNPUSHED.getValue(); - break; - case 1: - value = PushStatEnum.SUCCESS.getValue(); - break; - case 2: - value = PushStatEnum.FAIL.getValue(); - break; - case 3: - value = PushStatEnum.CONFIRMED.getValue(); - break; - default: - value = DictCache.getValue("messageStatus", key); - if (value == null) { - log.error("状态异常,没有这状态"); - value = String.valueOf(key); - } - break; - } - return value; - } - - - /** - * type ===> typeName - * - * @param key 状态 - */ - private String getTypeByName(String key) { - String value = null; - switch (key) { - case "appPush": - value = "app推送"; - break; - case "smsPush": - value = "短信推送"; - break; - case "websocketPush": - value = "web推送"; - break; - case "mailPush": - value = "邮件推送"; - break; - default: - value = DictCache.getValue("messageType", key); - if (value == null) { - log.error("状态异常,没有这状态"); - value = key; - } - break; - } - return value; - } - - - /** - * 业务分类 ===> 业务分类名称 - * - * @param key 状态 - */ - private String getBusinessClassifyByName(String key) { - key = key == null ? "" : key; - String value = null; - switch (key) { - case "system": - value = "系统通知"; - break; - case "business": - value = "事务消息"; - break; - case "dailyRemind": - value = "日常提醒"; - break; - case "inspect": - value = "巡检消息"; - break; - case "warning": - value = "告警消息"; - default: - value = DictCache.getValue("businessClassify", key); - if (value == null) { - log.error("状态业务分类,没有这状态"); - value = key; - } - break; - } - return value; - } - - - /** - * 现在的月份减去3个 按当前时间推12个月 - */ - private int getCurrentMonth(String strMonth) { - DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM"); - //获取年月 - YearMonth yearMonth = YearMonth.parse(strMonth, dateTimeFormatter); - //减去3个月 - //YearMonth month = yearMonth.minusMonths(3); - return yearMonth.getMonthValue(); - } - - - /** - * 往前推12个月,获取以往12个月的数据 - */ - private List getPreviousMonth() { - List month = new ArrayList<>(); - YearMonth today = YearMonth.now(); - for (int i = 0; i <= 11; i++) { - YearMonth localDate = today.minusMonths(i); - month.add(localDate); - } - return month; - } - -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/MessageTemplateServiceImpl.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/MessageTemplateServiceImpl.java deleted file mode 100644 index 2a9a5f8..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/MessageTemplateServiceImpl.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.hnac.hzims.message.service.impl; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.hnac.hzims.common.utils.Condition; -import com.hnac.hzims.message.entity.config.MessageTemplateEntity; -import com.hnac.hzims.message.mapper.MessageTemplateMapper; -import com.hnac.hzims.message.service.IMessageTemplateService; -import com.hnac.hzims.message.wrapper.MessageTemplateWrapper; -import groovy.util.logging.Slf4j; -import lombok.AllArgsConstructor; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import org.springblade.core.mp.support.Query; -import org.springblade.core.tool.utils.CollectionUtil; -import org.springblade.core.tool.utils.Func; -import org.springframework.stereotype.Service; - -import java.util.List; - -@Service -@AllArgsConstructor -@Slf4j -public class MessageTemplateServiceImpl extends ServiceImpl implements IMessageTemplateService { - @Override - public List list(MessageTemplateEntity req) { - List record = this.list(this.getQueryWrapper(req)); - return MessageTemplateWrapper.build().listVO(record); - } - - @Override - public IPage listPage(MessageTemplateEntity req, Query query) { - IPage page = this.page(Condition.getPage(query), this.getQueryWrapper(req)); - return page.setRecords(MessageTemplateWrapper.build().listVO(page.getRecords())); - } - - /** - * 根据查询条件获取消息模板QueryWrapper - * @param req 查询条件 - * @return 消息模板QueryWrapper - */ - private LambdaQueryWrapper getQueryWrapper(MessageTemplateEntity req) { - LambdaQueryWrapper lambda = Condition.getQueryWrapper(req).lambda(); - if(Func.isNotEmpty(req.getStatus())) { - lambda.eq(MessageTemplateEntity::getStatus,req.getStatus()); - } - return lambda; - } -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/MsgMailRecordServiceImpl.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/MsgMailRecordServiceImpl.java deleted file mode 100644 index 7d142f1..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/MsgMailRecordServiceImpl.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.hnac.hzims.message.service.impl; - -import com.hnac.hzims.message.entity.MsgMailRecordEntity; -import com.hnac.hzims.message.mapper.MsgMailRecordMapper; -import com.hnac.hzims.message.service.IMsgMailRecordService; -import lombok.extern.slf4j.Slf4j; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import org.springframework.stereotype.Service; - -/** - * @author hx - */ -@Service -@Slf4j -public class MsgMailRecordServiceImpl extends ServiceImpl implements IMsgMailRecordService { - -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/MsgPushRecordServiceImpl.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/MsgPushRecordServiceImpl.java deleted file mode 100644 index a6f4820..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/MsgPushRecordServiceImpl.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.hnac.hzims.message.service.impl; - -import com.baomidou.mybatisplus.core.conditions.Wrapper; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.hnac.hzims.message.dto.MsgPushRecordDTO; -import com.hnac.hzims.message.entity.MsgPushRecordEntity; -import com.hnac.hzims.message.entity.PushMessageEntity; -import com.hnac.hzims.message.mapper.MsgPushRecordMapper; -import com.hnac.hzims.message.mapper.PushMessageMapper; -import com.hnac.hzims.message.service.IMsgPushRecordService; -import com.hnac.hzims.message.service.IPushMessageService; -import com.hnac.hzims.message.vo.MsgPushRecordVO; -import com.hnac.hzims.message.wrapper.MsgPushRecordWrapper; -import lombok.extern.slf4j.Slf4j; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import org.springblade.core.mp.support.Condition; -import org.springblade.core.mp.support.Query; -import org.springblade.core.tool.api.R; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -/** - * @author xiashandong - * @created 2021-06-28 08:38 - **/ -@Service -public class MsgPushRecordServiceImpl extends ServiceImpl implements IMsgPushRecordService { - @Autowired - private MsgPushRecordMapper mapper; - - @Override - public R doSave(MsgPushRecordDTO req) { - return R.status(super.save(req)); - } - - @Override - public R detail(Long id) { - MsgPushRecordEntity detail = super.getById(id); - return R.data(MsgPushRecordWrapper.build().entityVO(detail)); - } - - @Override - public R> list(MsgPushRecordDTO req, Query query) { - Wrapper queryWrapper = new LambdaQueryWrapper() {{ - orderByDesc(MsgPushRecordEntity::getCreateTime); - }}; - - IPage pages = super.page(Condition.getPage(query), queryWrapper); - pages.setRecords(MsgPushRecordWrapper.build().listVO(pages.getRecords())); - return R.data(pages); - } -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/MsgSmsRecordServiceImpl.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/MsgSmsRecordServiceImpl.java deleted file mode 100644 index 8ca3679..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/MsgSmsRecordServiceImpl.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.hnac.hzims.message.service.impl; - -import com.baomidou.mybatisplus.core.conditions.Wrapper; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.hnac.hzims.message.dto.MsgSmsRecordDTO; -import com.hnac.hzims.message.entity.MsgSmsRecordEntity; -import com.hnac.hzims.message.mapper.MsgSmsRecordMapper; -import com.hnac.hzims.message.service.IMsgSmsRecordService; -import com.hnac.hzims.message.vo.MsgSmsRecordVO; -import com.hnac.hzims.message.wrapper.MsgSmsRecordWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import org.springblade.core.mp.support.Condition; -import org.springblade.core.mp.support.Query; -import org.springblade.core.tool.api.R; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -/** - * @author xiashandong - * @created 2021-06-28 08:38 - **/ -@Service -public class MsgSmsRecordServiceImpl extends ServiceImpl implements IMsgSmsRecordService { - @Autowired - private MsgSmsRecordMapper mapper; - - @Override - public R doSave(MsgSmsRecordDTO req) { - return R.status(super.save(req)); - } - - @Override - public R detail(Long id) { - MsgSmsRecordEntity detail = super.getById(id); - return R.data(MsgSmsRecordWrapper.build().entityVO(detail)); - } - - @Override - public R> list(MsgSmsRecordDTO req, Query query) { - Wrapper queryWrapper = new LambdaQueryWrapper() {{ - orderByDesc(MsgSmsRecordEntity::getCreateTime); - }}; - - IPage pages = super.page(Condition.getPage(query), queryWrapper); - pages.setRecords(MsgSmsRecordWrapper.build().listVO(pages.getRecords())); - return R.data(pages); - } -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/MsgWsRecordHistoryServiceImpl.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/MsgWsRecordHistoryServiceImpl.java deleted file mode 100644 index 9d31b04..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/MsgWsRecordHistoryServiceImpl.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.hnac.hzims.message.service.impl; - -import com.baomidou.mybatisplus.core.conditions.Wrapper; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.hnac.hzims.common.logs.utils.StringUtils; -import com.hnac.hzims.message.dto.MsgWsRecordHistoryDTO; -import com.hnac.hzims.message.entity.MsgWsRecordHistoryEntity; -import com.hnac.hzims.message.mapper.MsgWsRecordHistoryMapper; -import com.hnac.hzims.message.service.IMsgWsRecordHistoryService; -import com.hnac.hzims.message.vo.MsgWsRecordHistoryVO; -import com.hnac.hzims.message.wrapper.MsgWsRecordHistoryWrapper; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import org.springblade.core.mp.support.Condition; -import org.springblade.core.mp.support.Query; -import org.springblade.core.tool.api.R; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -/** - * @author xiashandong - * @created 2021-06-28 16:45 - **/ -@Service -public class MsgWsRecordHistoryServiceImpl extends ServiceImpl implements IMsgWsRecordHistoryService { - @Autowired - private MsgWsRecordHistoryMapper mapper; - - @Override - public R doSave(MsgWsRecordHistoryDTO req) { - return R.status(super.save(req)); - } - - @Override - public R detail(Long id) { - MsgWsRecordHistoryEntity detail = super.getById(id); - return R.data(MsgWsRecordHistoryWrapper.build().entityVO(detail)); - } - - @Override - public R> list(MsgWsRecordHistoryDTO req, Query query) { - Wrapper queryWrapper = new LambdaQueryWrapper() {{ - orderByDesc(MsgWsRecordHistoryEntity::getCreateTime); - if(StringUtils.isNotBlank(req.getTitle())) { - like(MsgWsRecordHistoryEntity::getTitle, req.getTitle()); - } - if (req.getUserId() != null) { - eq(MsgWsRecordHistoryEntity::getUserId, req.getUserId()); - } - if (req.getStatus() != null) { - eq(MsgWsRecordHistoryEntity::getStatus, req.getStatus()); - } - if (StringUtils.isNotBlank(req.getClassify())) { - eq(MsgWsRecordHistoryEntity::getClassify, req.getClassify()); - } - if (null != req.getBeginTime()) { - ge(MsgWsRecordHistoryEntity::getCreateTime, req.getBeginTime()); - } - if(null != req.getEndTime()) { - le(MsgWsRecordHistoryEntity::getCreateTime, req.getEndTime()); - } - }}; - - IPage pages = super.page(Condition.getPage(query), queryWrapper); - pages.setRecords(MsgWsRecordHistoryWrapper.build().listVO(pages.getRecords())); - return R.data(pages); - } -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/MsgWsRecordServiceImpl.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/MsgWsRecordServiceImpl.java deleted file mode 100644 index 9cfc5ee..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/MsgWsRecordServiceImpl.java +++ /dev/null @@ -1,110 +0,0 @@ -package com.hnac.hzims.message.service.impl; - -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.hnac.hzims.message.dto.MsgUpdateStatusDTO; -import com.hnac.hzims.message.dto.MsgWsRecordDTO; -import com.hnac.hzims.message.dto.MsgWsRecordHistoryDTO; -import com.hnac.hzims.message.entity.MsgWsRecordEntity; -import com.hnac.hzims.message.mapper.MsgWsRecordMapper; -import com.hnac.hzims.message.service.IMsgWsRecordHistoryService; -import com.hnac.hzims.message.service.IMsgWsRecordService; -import com.hnac.hzims.message.vo.MsgWsRecordVO; -import com.hnac.hzims.message.vo.UnreadMsgCountVO; -import com.hnac.hzims.message.wrapper.MsgWsRecordWrapper; -import lombok.AllArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import org.springblade.core.mp.support.Query; -import org.springblade.core.tool.api.R; -import org.springblade.core.tool.utils.BeanUtil; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * @author xiashandong - * @created 2021-06-28 08:38 - **/ -@AllArgsConstructor -@Slf4j -@Service -public class MsgWsRecordServiceImpl extends ServiceImpl implements IMsgWsRecordService { - private final MsgWsRecordMapper mapper; - private final IMsgWsRecordHistoryService historyService; - - @Override - public R doSave(MsgWsRecordDTO req) { - return R.status(super.save(req)); - } - - @Override - public R doUpdateById(MsgWsRecordDTO req) { - MsgWsRecordEntity entity = super.getById(req.getId()); - if (entity == null) { - throw new RuntimeException("记录(id=" + req.getId() + ")不存在!"); - } - - //已读状态则将记录迁移至history表 - if (req.getStatus() == 4) { - MsgWsRecordHistoryDTO recordHistory = BeanUtil.copy(req, MsgWsRecordHistoryDTO.class); - recordHistory.setStatus(4); - historyService.doSave(recordHistory); - boolean flag = super.removeById(req.getId()); - return R.status(flag); - } else { - boolean flag = super.updateById(req); - return R.status(flag); - } - } - - @Override - public R detail(Long id) { - MsgWsRecordEntity detail = super.getById(id); - return R.data(MsgWsRecordWrapper.build().entityVO(detail)); - } - - @Override - public R> list(MsgWsRecordDTO req, Query query) { -// Wrapper queryWrapper = new LambdaQueryWrapper() {{ -// orderByDesc(MsgWsRecordEntity::getCreateTime); -// if(StringUtils.isNotBlank(req.getTitle())) { -// like(MsgWsRecordEntity::getTitle, req.getTitle()); -// } -// if (req.getUserId() != null) { -// eq(MsgWsRecordEntity::getUserId, req.getUserId()); -// } -// if (req.getStatus() != null) { -// eq(MsgWsRecordEntity::getStatus, req.getStatus()); -// } -// if (StringUtils.isNotBlank(req.getClassify())) { -// eq(MsgWsRecordEntity::getClassify, req.getClassify()); -// } -// }}; -// -// IPage pages = super.page(Condition.getPage(query), queryWrapper); -// pages.setRecords(MsgWsRecordWrapper.build().listVO(pages.getRecords())); -// return R.data(pages); - return null; - } - - @Override - public List countUnread(Long userId) { - return baseMapper.countUnread(userId); - } - - @Override - public R setMsgRead(MsgUpdateStatusDTO dto) { - MsgWsRecordEntity entity = super.getById(dto.getId()); - if (entity == null) { - throw new RuntimeException("记录(id=" + dto.getId() + ")不存在!"); - } - - MsgWsRecordHistoryDTO recordHistory = BeanUtil.copy(entity, MsgWsRecordHistoryDTO.class); - recordHistory.setStatus(4); - historyService.doSave(recordHistory); - boolean flag = super.removeById(entity.getId()); - return R.status(flag); - - } - -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/PushMessageServiceImpl.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/PushMessageServiceImpl.java deleted file mode 100644 index d847666..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/PushMessageServiceImpl.java +++ /dev/null @@ -1,154 +0,0 @@ -package com.hnac.hzims.message.service.impl; - -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONObject; -import com.google.common.collect.Lists; -import com.hnac.hzims.message.MessageConstants; -import com.hnac.hzims.message.entity.MessagePushRecordEntity; -import com.hnac.hzims.message.log.aspect.SaveLog; -import com.hnac.hzims.message.dto.AppPushDto; -import com.hnac.hzims.message.dto.PushDto; -import com.hnac.hzims.message.service.IMessageService; -import com.hnac.hzinfo.core.push.enums.PlatformType; -import com.hnac.hzinfo.core.push.enums.PushAudienceType; -import com.hnac.hzinfo.core.push.model.PushAudience; -import com.hnac.hzinfo.core.push.model.PushInfo; -import com.hnac.hzinfo.core.push.model.PushPlatform; -import com.hnac.hzinfo.core.push.model.PushResponse; -import lombok.AllArgsConstructor; -import lombok.RequiredArgsConstructor; -import org.springblade.core.log.exception.ServiceException; - -import org.springblade.core.secure.utils.AuthUtil; -import org.springblade.core.tool.api.R; -import org.springblade.core.tool.utils.Func; -import org.springblade.core.tool.utils.ObjectUtil; -import org.springblade.resource.feign.IPushClient; -import org.springblade.resource.vo.PushInfoVO; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.data.redis.core.RedisTemplate; -import org.springframework.stereotype.Service; -import org.springframework.util.Assert; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.concurrent.Callable; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.FutureTask; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicReference; - -/** - * @author hx - */ -@Service("pushMessageService") -@RequiredArgsConstructor -public class PushMessageServiceImpl implements IMessageService { - - private final IPushClient pushClient; - private final ExecutorService appMessagePushExecutor; - private final RedisTemplate redisTemplate; - @Value("${hzims.message.redis-key.app-push}") - private String appPushRedisKey; - - @Override - @SaveLog(type = MessageConstants.APP_NAME) - public R send(T pushObject) { - AppPushDto appPushDto = JSONObject.parseObject(JSON.toJSONString(pushObject),AppPushDto.class); - PushAudience audience = PushAudience.newBuilder().addPushAudienceType(appPushDto.getAudienceType(), appPushDto.getTags()).build(); - AtomicReference platform = new AtomicReference<>(); - AtomicReference pushInfo = new AtomicReference<>(); - PushInfoVO pushInfoVO = new PushInfoVO(); - pushInfoVO.setTenantId(ObjectUtil.isNotEmpty(AuthUtil.getTenantId()) ? AuthUtil.getTenantId() : appPushDto.getTenantId()); - if(appPushDto.getIsAll()){ - appPushDto.setPlatformTypes(new PlatformType[]{PlatformType.Android, PlatformType.IOS}); - } - Arrays.stream(appPushDto.getPlatformTypes()).forEach(platformType -> { - if(PlatformType.Android.equals(platformType)) { - //安卓推送 - platform.set(PushPlatform.newBuilder().addPlatformType(PlatformType.Android).build()); - pushInfo.set(new PushInfo("ops-push-android", appPushDto.getTitle(), appPushDto.getPushAlert(), - "", null, platform.get(), audience)); - pushInfoVO.setPushInfo(pushInfo.get()); - try{ - pushClient.tenantPush(pushInfoVO); - } - catch(Exception e){ - e.printStackTrace(); - } - } - else if(PlatformType.IOS.equals(platformType)) { - //IOS推送 - platform.set(PushPlatform.newBuilder().addPlatformType(PlatformType.IOS).build()); - pushInfo.set(new PushInfo("ops-push-ios", appPushDto.getTitle(), appPushDto.getPushAlert(), - "", null, platform.get(), audience)); - pushInfoVO.setPushInfo(pushInfo.get()); - try{ - pushClient.tenantPush(pushInfoVO); - } - catch(Exception e) { - e.printStackTrace(); - } - } - }); - return R.success("推送成功"); - } - - @Override - public boolean send(MessagePushRecordEntity request) { - // App消息推送因腾讯云推送限制同一标签一段时间内无法推送多条消息,现将app推送改造成由redis定时推送 - Long pushResult = redisTemplate.opsForList().leftPush(appPushRedisKey.concat(":").concat(request.getPusher()), request); - return Func.isNotEmpty(pushResult); - } - - - - /** - * 发送APP安卓消息 - * @param subject 消息主题 - * @param content 消息内容 - * @param userIds 发送人员 - * @param tenantId 租户ID - * @return 推送结果 - */ - public synchronized R sendAndroidMsg(String subject,String content,List userIds,String tenantId) { - PushInfoVO pushInfoVO = new PushInfoVO(); - PushPlatform pushPlatform = PushPlatform.newBuilder().addPlatformType(PlatformType.Android).build(); - PushAudience pushAudience = PushAudience.newBuilder().addPushAudienceType(PushAudienceType.TAG, userIds).build(); - PushInfo pushInfo = new PushInfo("ops-push-android", subject, content,"", null, pushPlatform, pushAudience); - pushInfoVO.setPushInfo(pushInfo); - pushInfoVO.setTenantId(tenantId); - R pushResponseR = pushClient.tenantPush(pushInfoVO); - try { - TimeUnit.SECONDS.sleep(1); - } catch (InterruptedException e) { - throw new RuntimeException(e); - } - return pushResponseR; - } - - /** - * 发送IOS安卓消息 - * @param subject 消息主题 - * @param content 消息内容 - * @param userIds 发送人员 - * @param tenantId 租户ID - * @return 推送结果 - */ - public synchronized R sendIOSMsg(String subject,String content,List userIds,String tenantId) { - PushInfoVO pushInfoVO = new PushInfoVO(); - PushPlatform pushPlatform = PushPlatform.newBuilder().addPlatformType(PlatformType.IOS).build(); - PushAudience pushAudience = PushAudience.newBuilder().addPushAudienceType(PushAudienceType.TAG, userIds).build(); - PushInfo pushInfo = new PushInfo("ops-push-ios", subject, content,"", null, pushPlatform, pushAudience); - pushInfoVO.setPushInfo(pushInfo); - pushInfoVO.setTenantId(tenantId); - R pushResponseR = pushClient.tenantPush(pushInfoVO); - try { - TimeUnit.SECONDS.sleep(1); - } catch (InterruptedException e) { - throw new RuntimeException(e); - } - return pushResponseR; - } -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/PushMessagesServiceImpl.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/PushMessagesServiceImpl.java deleted file mode 100644 index cb44ed9..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/PushMessagesServiceImpl.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.hnac.hzims.message.service.impl; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.hnac.hzims.common.utils.Condition; -import com.hnac.hzims.common.utils.DateUtil; -import com.hnac.hzims.message.dto.PushMessageDTO; -import com.hnac.hzims.message.entity.PushMessageEntity; -import com.hnac.hzims.message.mapper.PushMessageMapper; -import com.hnac.hzims.message.service.IPushMessageService; -import lombok.extern.slf4j.Slf4j; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import org.springblade.core.tool.utils.Func; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * @author hx - */ -@Slf4j -@Service -public class PushMessagesServiceImpl extends ServiceImpl implements IPushMessageService { - - @Override - public List list(PushMessageDTO pushMessageDTO) { - LambdaQueryWrapper queryWrapper = Condition.getQueryWrapper(new PushMessageEntity(), pushMessageDTO); - if(Func.isNotEmpty(pushMessageDTO.getStartTime())) { - queryWrapper.ge(PushMessageEntity::getPushTime,pushMessageDTO.getStartTime()); - } - if(Func.isNotEmpty(pushMessageDTO.getEndTime())) { - queryWrapper.le(PushMessageEntity::getPushTime,pushMessageDTO.getEndTime()); - } - return this.list(queryWrapper); - } - -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/SmsMessageServiceImpl.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/SmsMessageServiceImpl.java deleted file mode 100644 index be5d801..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/SmsMessageServiceImpl.java +++ /dev/null @@ -1,87 +0,0 @@ -package com.hnac.hzims.message.service.impl; - -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONObject; -import com.hnac.hzims.message.MessageConstants; -import com.hnac.hzims.message.dto.PushDto; -import com.hnac.hzims.message.dto.SmsPushDto; -import com.hnac.hzims.message.entity.MessagePushRecordEntity; -import com.hnac.hzims.message.log.aspect.SaveLog; -import com.hnac.hzims.message.service.IMessageService; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springblade.core.log.exception.ServiceException; -import org.springblade.core.secure.utils.AuthUtil; -import org.springblade.core.sms.model.SmsResponse; -import org.springblade.core.tool.api.R; -import org.springblade.core.tool.utils.Func; -import org.springblade.core.tool.utils.StringUtil; -import org.springblade.resource.feign.ISmsClient; -import org.springframework.stereotype.Service; -import org.springframework.util.Assert; -import org.springframework.util.ObjectUtils; - -/** - * @author hx - */ -@Service("smsMessageService") -@RequiredArgsConstructor -@Slf4j -public class SmsMessageServiceImpl implements IMessageService { - - private final ISmsClient smsClient; - - @Override - @SaveLog(type = MessageConstants.APP_NAME) - public R send(T pushObject) { - SmsPushDto pushDto = JSONObject.parseObject(JSON.toJSONString(pushObject),SmsPushDto.class); - R response = smsClient.sendMessage( - pushDto.getTenantId(), - pushDto.getCode(), - JSON.toJSONString(pushDto.getParams()), - Func.join(pushDto.getPhones()) - ); - if(!response.isSuccess()){ - throw new ServiceException("短信发送失败;报错信息为:"+response.getMsg()); - } - return response; - } - - @Override - public boolean send(MessagePushRecordEntity request) { - String account = this.getAccountByPusher(Long.parseLong(request.getPusher()), request.getType()); - Assert.isTrue(Func.isNotEmpty(account) && StringUtil.isNotBlank(account) ,() -> { - throw new ServiceException("未查询到相关用户,短信推送失败!"); - }); - R response = smsClient.sendMessage( - Func.isNotEmpty(AuthUtil.getTenantId()) ? AuthUtil.getTenantId() : request.getTenantId(), - request.getResourceCode(), - request.getSmsParam(), - account - ); - if(ObjectUtils.isEmpty(response.getData())) { - Assert.isTrue(response.isSuccess(), () -> { - throw new ServiceException(response.getMsg()); - }); - return response.isSuccess(); - }else { - Assert.isTrue(response.getData().isSuccess(), () -> { - throw new ServiceException(response.getMsg()); - }); - return response.getData().isSuccess(); - } - } - - public R sendSmsByRecord(MessagePushRecordEntity request) { - String account = this.getAccountByPusher(Long.parseLong(request.getPusher()), request.getType()); - if(Func.isNotEmpty(account) && StringUtil.isNotBlank(account)) { - return smsClient.sendMessage( - Func.isNotEmpty(AuthUtil.getTenantId()) ? AuthUtil.getTenantId() : request.getTenantId(), - request.getResourceCode(), - request.getSmsParam(), - account - ); - } - return R.fail("未查询到相关用户,短信推送失败!"); - } -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/WebsocketServiceImpl.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/WebsocketServiceImpl.java deleted file mode 100644 index 419da82..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/WebsocketServiceImpl.java +++ /dev/null @@ -1,110 +0,0 @@ -package com.hnac.hzims.message.service.impl; - -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONObject; -import com.hnac.hzims.message.MessageConstants; -import com.hnac.hzims.message.entity.MessagePushRecordEntity; -import com.hnac.hzims.message.log.aspect.SaveLog; -import com.hnac.hzims.message.dto.PushDto; -import com.hnac.hzims.message.dto.WsPushDto; -import com.hnac.hzims.message.service.IMessageService; -import com.hnac.hzims.message.vo.WsMessageVO; -import com.hnac.hzims.message.ws.SessionManager; -import lombok.AllArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springblade.core.tool.api.R; -import org.springblade.core.tool.utils.CollectionUtil; -import org.springblade.core.tool.utils.ObjectUtil; -import org.springframework.beans.factory.config.ConfigurableBeanFactory; -import org.springframework.context.annotation.Scope; -import org.springframework.data.redis.core.RedisTemplate; -import org.springframework.stereotype.Service; -import org.springframework.web.socket.TextMessage; -import org.springframework.web.socket.WebSocketSession; -import java.io.IOException; -import java.time.LocalDateTime; -import java.util.List; -import java.util.concurrent.TimeUnit; - -/** - * @author hx - */ -@Service("websocketService") -@Slf4j -@AllArgsConstructor -@Scope(value = ConfigurableBeanFactory.SCOPE_SINGLETON) -public class WebsocketServiceImpl implements IMessageService { - - private final RedisTemplate redisTemplate; - - @Override - @SaveLog(type = MessageConstants.WS_PUSH) - public R send(T pushObject) { - WsPushDto wsPushDto = JSONObject.parseObject(JSON.toJSONString(pushObject),WsPushDto.class); - //完善推送消息内容体 - WsMessageVO wsMessageVO = WsMessageVO.builder() - .businessClassify(wsPushDto.getBusinessClassify()) - .businessClassifyName(MessageConstants.BusinessClassifyEnum.getClassifyDesByKey(wsPushDto.getBusinessClassify())) - .businessKey(wsPushDto.getBusinessKey()) - .content(wsPushDto.getContent()) - .subject(wsPushDto.getSubject()) - .pushTime(LocalDateTime.now()) - .content(wsPushDto.getText()) - .build(); - log.info("推送内容为:{}",JSON.toJSONString(wsMessageVO)); - TextMessage message = new TextMessage(JSON.toJSONString(wsMessageVO)); - //在线用户全量推送 - if(wsPushDto.isAll() && CollectionUtil.isNotEmpty(SessionManager.SESSION_POOL)){ - SessionManager.SESSION_POOL.forEach((s, webSocketSession) -> { - try { - webSocketSession.sendMessage(message); - } catch (IOException e) { - e.printStackTrace(); - } - }); - } - //指定用户推送 - else{ - wsPushDto.getUserIdList().forEach(userId -> { - WebSocketSession webSocketSession = SessionManager.SESSION_POOL.get(userId); - if(ObjectUtil.isNotEmpty(webSocketSession)){ - log.info("===={}:websocket推送====",userId); - try { - webSocketSession.sendMessage(message); - } catch (IOException e) { - e.printStackTrace(); - } - } - else { - //存在未上线的用户时 需将消息缓存起来 在用户上线时推送 - String key = String.format("%s:%s",MessageConstants.WS_MESSAGE_KEY,userId); - redisTemplate.opsForList().leftPush(key,message); - redisTemplate.expire(key,24, TimeUnit.HOURS); - } - }); - } - return R.success("推送成功"); - } - - @Override - public boolean send(MessagePushRecordEntity request) { - String userId = request.getAccount(); - request.setPushTime(LocalDateTime.now()); - WebSocketSession webSocketSession = SessionManager.SESSION_POOL.get(userId); - TextMessage message = new TextMessage(JSON.toJSONString(request)); - if(ObjectUtil.isNotEmpty(webSocketSession)){ - try { - webSocketSession.sendMessage(message); - } catch (IOException e) { - e.printStackTrace(); - } - } - else { - //存在未上线的用户时 需将消息缓存起来 在用户上线时推送 - String key = String.format("%s:%s",MessageConstants.WS_MESSAGE_KEY,userId); - redisTemplate.opsForList().leftPush(key,message); - redisTemplate.expire(key,24, TimeUnit.HOURS); - } - return true; - } -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/WxMessageServiceImpl.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/WxMessageServiceImpl.java deleted file mode 100644 index 3d08b6e..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/WxMessageServiceImpl.java +++ /dev/null @@ -1,107 +0,0 @@ -package com.hnac.hzims.message.service.impl; - -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONObject; -import com.hnac.hzims.message.MessageConstants; -import com.hnac.hzims.message.dto.AppPushDto; -import com.hnac.hzims.message.dto.PushDto; -import com.hnac.hzims.message.dto.WxMessageDTO; -import com.hnac.hzims.message.entity.MessagePushRecordEntity; -import com.hnac.hzims.message.log.aspect.SaveLog; -import com.hnac.hzims.message.service.IMessageService; -import com.hnac.hzinfo.core.push.enums.PlatformType; -import com.hnac.hzinfo.core.push.enums.PushAudienceType; -import com.hnac.hzinfo.core.push.model.PushAudience; -import com.hnac.hzinfo.core.push.model.PushInfo; -import com.hnac.hzinfo.core.push.model.PushPlatform; -import com.hnac.hzinfo.core.push.model.PushResponse; -import lombok.AllArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.apache.poi.ss.formula.functions.T; -import org.springblade.core.log.exception.ServiceException; - -import org.springblade.core.secure.utils.AuthUtil; -import org.springblade.core.tool.api.R; -import org.springblade.core.tool.utils.Func; -import org.springblade.core.tool.utils.ObjectUtil; -import org.springblade.resource.feign.IPushClient; -import org.springblade.resource.vo.PushInfoVO; -import org.springblade.system.entity.PushTemplate; -import org.springblade.system.feign.IWxPushClient; -import org.springblade.system.vo.WxPushFeignVO; -import org.springframework.stereotype.Service; - -import java.io.*; -import java.net.HttpURLConnection; -import java.net.MalformedURLException; -import java.net.ProtocolException; -import java.net.URL; -import java.nio.charset.StandardCharsets; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.FutureTask; -import java.util.concurrent.atomic.AtomicReference; -import java.util.stream.Collectors; - -/** - * @author hx - */ -@Service("wxMessageService") -@Slf4j -@AllArgsConstructor -public class WxMessageServiceImpl implements IMessageService { - - private final IPushClient pushClient; - private final IWxPushClient wxPushClient; - private final ExecutorService appMessagePushExecutor; - - @Override - @SaveLog(type = MessageConstants.APP_NAME) - public R send(T pushObject) { - - return R.success("推送成功"); - } - - @Override - public boolean send(MessagePushRecordEntity request) { - return false; - } - - /** - * 发送APP消息(多人) - * @param subject 消息主题 - * @param content 消息内容 - * @param userIds 用户ID列表 - * @param tenantId 租户ID - * @return - */ - public boolean sendByUsers(String subject, String content, List userIds,String tenantId) throws Exception { - return false; - } - - public boolean send(WxMessageDTO message) { - PushTemplate template = new PushTemplate(); - template.setTemplateId(message.getTemplateId()); - template.setSkipUrl(message.getSkipUrl()); - Map map = message.getMap(); - map.replaceAll((key,value)->getTruncateString(value.toString(),27)); - template.setMap(map); - template.setUserIds(Arrays.stream(message.getUserIds().split(",")).collect(Collectors.toList())); - template.setTenantId("200000"); - R result = wxPushClient.sendPushTemplateByUserId(template); - if(result.isSuccess()&&ObjectUtil.isNotEmpty(result.getData())){ - return true; - } - return false; - } - - private String getTruncateString(String ruleDefName, int maxSize) { - if (ruleDefName.length()<= maxSize){ - return ruleDefName; - }else { - return ruleDefName.substring(0, maxSize - 3) + "..."; - } - } -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/statistics/controller/MsgPushStatisticController.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/statistics/controller/MsgPushStatisticController.java deleted file mode 100644 index 57448ff..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/statistics/controller/MsgPushStatisticController.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.hnac.hzims.message.statistics.controller; - -import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; -import com.hnac.hzims.common.statistics.Charts; -import com.hnac.hzims.message.dto.statistic.MsgPushStatisticDto; -import com.hnac.hzims.message.statistics.service.IMsgPushStatisticService; -import com.hnac.hzims.message.vo.statistic.MsgPushStatisticVO; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import lombok.AllArgsConstructor; -import org.springblade.core.boot.ctrl.BladeController; -import org.springblade.core.tool.api.R; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import java.util.List; - -/** - * @author hx - */ -@RestController -@RequestMapping("/message/statistic") -@Api(value = "消息推送统计",tags = "消息推送统计") -@AllArgsConstructor -public class MsgPushStatisticController extends BladeController { - - private final IMsgPushStatisticService msgPushStatisticService; - - @GetMapping("/getMsgPushStatistic") - @ApiOperation("消息统计汇总") - @ApiOperationSupport(order = 1) - public R> getMsgPushStatistic(@Validated MsgPushStatisticDto msgPushStatisticDto) { - return R.data(msgPushStatisticService.getMsgPushStatistic(msgPushStatisticDto)); - } - - public R getMsgPushStat(MsgPushStatisticDto req) { - return R.data(msgPushStatisticService.getMsgPushStat(req)); - } - -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/statistics/mapper/MsgPushStatisticMapper.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/statistics/mapper/MsgPushStatisticMapper.java deleted file mode 100644 index b126de4..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/statistics/mapper/MsgPushStatisticMapper.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.hnac.hzims.message.statistics.mapper; - -import com.hnac.hzims.message.vo.statistic.MsgPushStatisticVO; - -/** - * @author hx - */ -public interface MsgPushStatisticMapper { - -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/statistics/service/IMsgPushStatisticService.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/statistics/service/IMsgPushStatisticService.java deleted file mode 100644 index bd6019f..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/statistics/service/IMsgPushStatisticService.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.hnac.hzims.message.statistics.service; - -import com.hnac.hzims.common.statistics.Charts; -import com.hnac.hzims.common.utils.DateUtil; -import com.hnac.hzims.message.MessageConstants; -import com.hnac.hzims.message.dto.statistic.MsgPushStatisticDto; -import com.hnac.hzims.message.vo.statistic.MsgPushStatisticVO; -import org.springblade.core.log.exception.ServiceException; -import org.springblade.core.tool.utils.Func; -import org.springblade.core.tool.utils.ObjectUtil; -import org.springframework.util.Assert; - -import java.time.LocalDate; -import java.time.LocalDateTime; -import java.time.LocalTime; -import java.time.format.DateTimeFormatter; -import java.util.List; - -/** - * @author hx - */ -public interface IMsgPushStatisticService { - - /** - * 获取消息推送统计 - * @param msgPushStatisticDto - * @return - */ - List getMsgPushStatistic(MsgPushStatisticDto msgPushStatisticDto); - - Charts getMsgPushStat(MsgPushStatisticDto req); - - /** - * 处理年、月、日查询日期格式 填充开始时间以及结束时间 - * @param msgPushStatisticDto - */ - default void fillInquireDate(MsgPushStatisticDto msgPushStatisticDto) { - String[] assertNotNull = {msgPushStatisticDto.getDateType(),msgPushStatisticDto.getDate()}; - Assert.isTrue(Func.isNotEmpty(assertNotNull),()->{ - throw new ServiceException("统计消息推送时,查询条件必须包括dateType&date"); - }); - MessageConstants.LogInquireDateEnum dateEnum = MessageConstants.LogInquireDateEnum.getClassifyDesByKey(msgPushStatisticDto.getDateType()); - DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd"); - DateTimeFormatter df1 = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); - switch (dateEnum) { - case YEAR: - msgPushStatisticDto.setStartDate(df.format(DateUtil.getFirstDayByYear(msgPushStatisticDto.getDate()))); - msgPushStatisticDto.setEndDate(df.format(DateUtil.getLastDayByYear(msgPushStatisticDto.getDate()))); - break; - case MONTH: - msgPushStatisticDto.setStartDate(df.format(DateUtil.getFirstDayByYearMonth(msgPushStatisticDto.getDate()))); - msgPushStatisticDto.setEndDate(df.format(DateUtil.getLastDayByYearMonth(msgPushStatisticDto.getDate()))); - break; - case DAY: - LocalDate day = LocalDate.parse(msgPushStatisticDto.getDate()); - LocalDateTime minDay = LocalDateTime.of(day.getYear(),day.getMonth(),day.getDayOfMonth(), LocalTime.MIN.getHour(),LocalTime.MIN.getMinute(),LocalTime.MIN.getSecond()); - LocalDateTime maxDay = LocalDateTime.of(day.getYear(),day.getMonth(),day.getDayOfMonth(), LocalTime.MAX.getHour(),LocalTime.MAX.getMinute(),LocalTime.MAX.getSecond()); - msgPushStatisticDto.setStartDate(df1.format(minDay)); - msgPushStatisticDto.setEndDate(df1.format(maxDay)); - break; - default: break; - } - } - -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/statistics/service/impl/MsgPushStatisticServiceImpl.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/statistics/service/impl/MsgPushStatisticServiceImpl.java deleted file mode 100644 index 26b84d8..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/statistics/service/impl/MsgPushStatisticServiceImpl.java +++ /dev/null @@ -1,93 +0,0 @@ -package com.hnac.hzims.message.statistics.service.impl; - -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.google.common.collect.Lists; -import com.hnac.hzims.common.statistics.Charts; -import com.hnac.hzims.common.utils.DateUtil; -import com.hnac.hzims.message.MessageConstants; -import com.hnac.hzims.message.constants.DictKeyConstants; -import com.hnac.hzims.message.dto.statistic.MsgPushStatisticDto; -import com.hnac.hzims.message.entity.MessagePushRecordEntity; -import com.hnac.hzims.message.log.mapper.AppLogMapper; -import com.hnac.hzims.message.log.mapper.MailLogMapper; -import com.hnac.hzims.message.log.mapper.SmsLogMapper; -import com.hnac.hzims.message.service.IMessagePushRecordService; -import com.hnac.hzims.message.statistics.service.IMsgPushStatisticService; -import com.hnac.hzims.message.vo.statistic.MsgPushStatisticVO; -import lombok.AllArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springblade.core.tool.utils.CollectionUtil; -import org.springblade.core.tool.utils.ObjectUtil; -import org.springblade.system.cache.DictCache; -import org.springblade.system.entity.Dict; -import org.springframework.stereotype.Service; - -import java.text.DateFormat; -import java.time.YearMonth; -import java.time.format.DateTimeFormatter; -import java.util.List; -import java.util.function.Function; -import java.util.stream.Collectors; -import java.util.stream.IntStream; - -/** - * @author hx - */ -@Service -@AllArgsConstructor -@Slf4j -public class MsgPushStatisticServiceImpl implements IMsgPushStatisticService { - - private final AppLogMapper appLogMapper; - private final MailLogMapper mailLogMapper; - private final SmsLogMapper smsLogMapper; - private final IMessagePushRecordService messagePushRecordService; - - @Override - public List getMsgPushStatistic(MsgPushStatisticDto msgPushStatisticDto) { - List result = Lists.newArrayList(); - //填充开始-结束时间 - this.fillInquireDate(msgPushStatisticDto); - //获取app推送统计 - MsgPushStatisticVO appPushStatisticVO = appLogMapper.getAppPushStatistic(msgPushStatisticDto); - if(ObjectUtil.isNotEmpty(appPushStatisticVO)){ - appPushStatisticVO.setType(MessageConstants.APP_PUSH); - result.add(appPushStatisticVO); - } - //FIXME 获取邮件推送统计(暂不统计) - /*MsgPushStatisticVO mailPushStatisticVO = mailLogMapper.getMailPushStatistic(msgPushStatisticDto); - mailPushStatisticVO.setType(MessageConstants.MAIL_PUSH); - result.add(mailPushStatisticVO);*/ - //获取短信推送统计 - MsgPushStatisticVO mailPushStatisticVO = smsLogMapper.getSmsPushStatistic(msgPushStatisticDto); - if(ObjectUtil.isNotEmpty(mailPushStatisticVO)){ - mailPushStatisticVO.setType(MessageConstants.SMS_PUSH); - result.add(mailPushStatisticVO); - } - return result; - } - - @Override - public Charts getMsgPushStat(MsgPushStatisticDto req) { - List types = DictCache.getList(DictKeyConstants.MESSAGE_TYPE); - Charts charts = new Charts(); - if(CollectionUtil.isNotEmpty(types)) { - charts.setLegends(types.stream().map(Dict::getDictValue).collect(Collectors.toList())); - charts.setXAxis(this.getFullMonth()); - Function> getCountByType = messageType -> { - - return Lists.newArrayList(); - }; - charts.setSeries(types.stream().map(Dict::getDictKey).map(getCountByType).collect(Collectors.toList())); - } - return charts; - } - - private List getFullMonth() { - YearMonth now = YearMonth.now(); - return IntStream.iterate(0, index -> index + 1).limit(12) - .mapToObj(index -> now.minusMonths(index)) - .map(yearMonth -> yearMonth.format(DateUtil.monthFormatter)) - .collect(Collectors.toList()); - } -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/utils/HtmlModule.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/utils/HtmlModule.java deleted file mode 100644 index 002fd9c..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/utils/HtmlModule.java +++ /dev/null @@ -1,121 +0,0 @@ -package com.hnac.hzims.message.utils; - -import com.alibaba.fastjson.JSON; -import lombok.AllArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; -import org.thymeleaf.TemplateEngine; -import org.thymeleaf.context.Context; - -import java.io.*; -import java.net.URL; -import java.nio.charset.StandardCharsets; -import java.util.Map; -import java.util.concurrent.atomic.AtomicReference; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -/** - * 专门用来解析生成PDF文档的html自定义模板 - */ -@Slf4j -@AllArgsConstructor -public class HtmlModule { - - - - /** - * 读取resource资源下的html模板文件 - * 保留head部分,循环生成body部分 - * @param modules - * @param templatePath - * @return - * @throws Exception - */ - public static String buildHtml(Map modules, String templatePath) throws Exception { - //Context是给thymeleaf模版提供变量的。 - Context context = new Context(); - modules.forEach((k,v)->{ - context.setVariable(k, v); - }); - TemplateEngine templateEngine = new TemplateEngine(); - String html = templateEngine.process(readToString(templatePath), context); - log.info(html); - return html; - } - - /** - * 判断一个字符串是否为url - * @param str String 字符串 - * @return boolean 是否为url - * @author peng1 chen - * **/ - public static boolean isURL(String str){ - //转换为小写 - str = str.toLowerCase(); - String regex = "^((https|http|ftp|rtsp|mms)?://)" //https、http、ftp、rtsp、mms - + "?(([0-9a-z_!~*'().&=+$%-]+: )?[0-9a-z_!~*'().&=+$%-]+@)?" //ftp的user@ - + "(([0-9]{1,3}\\.){3}[0-9]{1,3}" // IP形式的URL- 例如:199.194.52.184 - + "|" // 允许IP和DOMAIN(域名) - + "([0-9a-z_!~*'()-]+\\.)*" // 域名- www. - + "([0-9a-z][0-9a-z-]{0,61})?[0-9a-z]\\." // 二级域名 - + "[a-z]{2,6})" // first level domain- .com or .museum - + "(:[0-9]{1,5})?" // 端口号最大为65535,5位数 - + "((/?)|" // a slash isn't required if there is no file name - + "(/[0-9a-z_!~*'().;?:@&=+$,%#-]+)+/?)$"; - return str.matches(regex); - } - - /** - * 读取文件到String中,指定以UTF-8格式读取 - * @param filePath - * @return - * @throws IOException - */ - public static String readToString(String filePath) throws IOException { - InputStream is; - if(isURL(filePath)){ - URL u = new URL(filePath); - is = u.openStream(); - } - else{ - is = new FileInputStream(filePath); - } - StringBuffer buffer = new StringBuffer(); - BufferedReader reader = null; - String line; // 用来保存每行读取的内容 - try{ - reader = new BufferedReader(new InputStreamReader(is, StandardCharsets.UTF_8)); - // 读取第一行 - line = reader.readLine(); - // 如果 line 为空说明读完了 - while (line != null) { - // 将读到的内容添加到 buffer 中 - buffer.append(line); - // 读取下一行 - line = reader.readLine(); - } - } - finally { - reader.close(); - is.close(); - } - return buffer.toString(); - } - - /** - * 查找html内容里的标签内容 - * @param html - * @param regex - * @return - */ - public static String findInString(String html, String regex) { - Pattern pattern = Pattern.compile(regex); - Matcher matcher = pattern.matcher(html); - if (matcher.find()) { - return matcher.group(); - } - return null; - } - -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/web/MsgPushRecordController.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/web/MsgPushRecordController.java deleted file mode 100644 index 512478b..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/web/MsgPushRecordController.java +++ /dev/null @@ -1,84 +0,0 @@ -package com.hnac.hzims.message.web; - -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; -import com.hnac.hzims.message.dto.MsgPushRecordDTO; -import com.hnac.hzims.message.service.IMsgPushRecordService; -import com.hnac.hzims.message.vo.MsgPushRecordVO; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import lombok.AllArgsConstructor; -import org.springblade.core.boot.ctrl.BladeController; -import org.springblade.core.mp.support.Query; -import org.springblade.core.tool.api.R; -import org.springblade.core.tool.utils.Func; -import org.springframework.web.bind.annotation.*; - -import javax.validation.Valid; - - /** - * 消息推送日志 - * - * @author xiashandong - * @created 2021-06-28 08:38 - **/ -@RestController -@AllArgsConstructor -@RequestMapping("/msg/push/record") -@Api(value = "极光消息推送日志", tags = "极光消息推送日志") -public class MsgPushRecordController extends BladeController { - - private final IMsgPushRecordService service; - - /** - * 删除 - */ - @PostMapping("/remove") - @ApiOperationSupport(order = 10) - @ApiOperation(value = "逻辑删除") - public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { - return R.status(service.removeByIds(Func.toLongList(ids))); - } - - /** - * 新增 - */ - @PostMapping("/save") - @ApiOperationSupport(order = 20) - @ApiOperation(value = "新增") - public R save(@Valid @RequestBody MsgPushRecordDTO req) { - return service.doSave(req); - } - - /** - * 修改 - */ - @PostMapping("/update") - @ApiOperationSupport(order = 30) - @ApiOperation(value = "修改") - public R update(@Valid @RequestBody MsgPushRecordDTO req) { - return R.status(service.updateById(req)); - } - - /** - * 详情 - */ - @GetMapping("/detail") - @ApiOperationSupport(order = 40) - @ApiOperation(value = "详情") - public R detail(@RequestParam Long id) { - return service.detail(id); - } - - /** - * 分页 - */ - @GetMapping("/list") - @ApiOperationSupport(order = 50) - @ApiOperation(value = "分页 查询参数:!!!查询条件为空,需要请找后端配置!!!") - public R> list(MsgPushRecordDTO req, Query query) { - return service.list(req, query); - } - -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/web/MsgSmsRecordController.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/web/MsgSmsRecordController.java deleted file mode 100644 index f55d1e5..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/web/MsgSmsRecordController.java +++ /dev/null @@ -1,84 +0,0 @@ -package com.hnac.hzims.message.web; - -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; -import com.hnac.hzims.message.dto.MsgSmsRecordDTO; -import com.hnac.hzims.message.service.IMsgSmsRecordService; -import com.hnac.hzims.message.vo.MsgSmsRecordVO; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import lombok.AllArgsConstructor; -import org.springblade.core.boot.ctrl.BladeController; -import org.springblade.core.mp.support.Query; -import org.springblade.core.tool.api.R; -import org.springblade.core.tool.utils.Func; -import org.springframework.web.bind.annotation.*; - -import javax.validation.Valid; - - /** - * 短信推送日志 - * - * @author xiashandong - * @created 2021-06-28 08:38 - **/ -@RestController -@AllArgsConstructor -@RequestMapping("/msg/sms/record") -@Api(value = "短信推送日志", tags = "短信推送日志") -public class MsgSmsRecordController extends BladeController { - - private final IMsgSmsRecordService service; - - /** - * 删除 - */ - @PostMapping("/remove") - @ApiOperationSupport(order = 10) - @ApiOperation(value = "逻辑删除") - public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { - return R.status(service.removeByIds(Func.toLongList(ids))); - } - - /** - * 新增 - */ - @PostMapping("/save") - @ApiOperationSupport(order = 20) - @ApiOperation(value = "新增") - public R save(@Valid @RequestBody MsgSmsRecordDTO req) { - return service.doSave(req); - } - - /** - * 修改 - */ - @PostMapping("/update") - @ApiOperationSupport(order = 30) - @ApiOperation(value = "修改") - public R update(@Valid @RequestBody MsgSmsRecordDTO req) { - return R.status(service.updateById(req)); - } - - /** - * 详情 - */ - @GetMapping("/detail") - @ApiOperationSupport(order = 40) - @ApiOperation(value = "详情") - public R detail(@RequestParam Long id) { - return service.detail(id); - } - - /** - * 分页 - */ - @GetMapping("/list") - @ApiOperationSupport(order = 50) - @ApiOperation(value = "分页 查询参数:!!!查询条件为空,需要请找后端配置!!!") - public R> list(MsgSmsRecordDTO req, Query query) { - return service.list(req, query); - } - -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/web/MsgWsRecordController.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/web/MsgWsRecordController.java deleted file mode 100644 index 20d6e4a..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/web/MsgWsRecordController.java +++ /dev/null @@ -1,101 +0,0 @@ -package com.hnac.hzims.message.web; - -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; -import com.hnac.hzims.message.dto.MsgUpdateStatusDTO; -import com.hnac.hzims.message.dto.MsgWsRecordDTO; -import com.hnac.hzims.message.service.IMsgWsRecordService; -import com.hnac.hzims.message.vo.MsgWsRecordVO; -import com.hnac.hzims.message.vo.UnreadMsgCountVO; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import lombok.AllArgsConstructor; -import org.springblade.core.boot.ctrl.BladeController; -import org.springblade.core.mp.support.Query; -import org.springblade.core.tool.api.R; -import org.springblade.core.tool.utils.Func; -import org.springframework.web.bind.annotation.*; - -import javax.validation.Valid; -import java.util.List; - -/** - * websocket消息推送日志 - * - * @author xiashandong - * @created 2021-06-28 08:38 - **/ -@RestController -@AllArgsConstructor -@RequestMapping("/msg/ws/record") -@Api(value = "未读消息推送日志", tags = "未读消息推送日志") -public class MsgWsRecordController extends BladeController { - - private final IMsgWsRecordService service; - - /** - * 删除 - */ - @PostMapping("/remove") - @ApiOperationSupport(order = 10) - @ApiOperation(value = "逻辑删除") - public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { - return R.status(service.removeByIds(Func.toLongList(ids))); - } - - /** - * 新增 - */ - @PostMapping("/save") - @ApiOperationSupport(order = 20) - @ApiOperation(value = "新增") - public R save(@Valid @RequestBody MsgWsRecordDTO req) { - return service.doSave(req); - } - - /** - * 修改 - */ - @PostMapping("/update") - @ApiOperationSupport(order = 30) - @ApiOperation(value = "修改") - public R update(@Valid @RequestBody MsgWsRecordDTO req) { - return service.doUpdateById(req); - } - - @PostMapping("/updateStatus") - @ApiOperationSupport(order = 30) - @ApiOperation(value = "更新消息状态") - public R updateStatus(@Valid @RequestBody MsgUpdateStatusDTO dto) { - return service.setMsgRead(dto); - } - /** - * 详情 - */ - @GetMapping("/detail") - @ApiOperationSupport(order = 40) - @ApiOperation(value = "详情") - public R detail(@RequestParam Long id) { - return service.detail(id); - } - - /** - * 分页 - */ - @GetMapping("/list") - @ApiOperationSupport(order = 50) - @ApiOperation(value = "分页 查询参数:status,userId,classify") - public R> list(MsgWsRecordDTO req, Query query) { - return service.list(req, query); - } - - @GetMapping("/countUnread/{userId}") - @ApiOperationSupport(order = 60) - @ApiOperation(value = "按业务分类统计个人未读消息") - public R> countUnread(@PathVariable Long userId) { - //List list = service.countUnread(userId); - return R.data(null); - } - -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/web/MsgWsRecordHistoryController.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/web/MsgWsRecordHistoryController.java deleted file mode 100644 index 05a9952..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/web/MsgWsRecordHistoryController.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.hnac.hzims.message.controller; - -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; -import com.hnac.hzims.message.dto.MsgWsRecordHistoryDTO; -import com.hnac.hzims.message.service.IMsgWsRecordHistoryService; -import com.hnac.hzims.message.vo.MsgWsRecordHistoryVO; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import lombok.AllArgsConstructor; -import org.springblade.core.boot.ctrl.BladeController; -import org.springblade.core.mp.support.Query; -import org.springblade.core.tool.api.R; -import org.springblade.core.tool.utils.Func; -import org.springframework.web.bind.annotation.*; - -/** - * websocket消息推送日志 - * - * @author xiashandong - * @created 2021-06-28 16:45 - **/ -@RestController -@AllArgsConstructor -@RequestMapping("/msg/ws/record/history") -@Api(value = "历史消息推送日志", tags = "历史消息推送日志") -public class MsgWsRecordHistoryController extends BladeController { - - private final IMsgWsRecordHistoryService service; - - /** - * 删除 - */ - @PostMapping("/remove") - @ApiOperationSupport(order = 10) - @ApiOperation(value = "逻辑删除") - public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { - return R.status(service.removeByIds(Func.toLongList(ids))); - } -// -// /** -// * 新增 -// */ -// @PostMapping("/save") -// @ApiOperationSupport(order = 20) -// @ApiOperation(value = "新增") -// public R save(@Valid @RequestBody MsgWsRecordHistoryDTO req) { -// return service.doSave(req); -// } -// -// /** -// * 修改 -// */ -// @PostMapping("/update") -// @ApiOperationSupport(order = 30) -// @ApiOperation(value = "修改") -// public R update(@Valid @RequestBody MsgWsRecordHistoryDTO req) { -// return R.status(service.updateById(req)); -// } - - /** - * 详情 - */ - @GetMapping("/detail") - @ApiOperationSupport(order = 40) - @ApiOperation(value = "详情") - public R detail(@RequestParam Long id) { - return service.detail(id); - } - - /** - * 分页 - */ - @GetMapping("/list") - @ApiOperationSupport(order = 50) - @ApiOperation(value = "分页 查询参数:status,userId,classify") - public R> list(MsgWsRecordHistoryDTO req, Query query) { - return service.list(req, query); - } - -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/web/TestWsController.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/web/TestWsController.java deleted file mode 100644 index d33a3ad..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/web/TestWsController.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.hnac.hzims.message.web; - -import com.alibaba.fastjson.JSONObject; -import com.hnac.hzims.message.ws.SessionManager; -import lombok.AllArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springblade.core.tool.api.R; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.socket.TextMessage; -import org.springframework.web.socket.WebSocketSession; - -import java.io.IOException; - -/** - * @author xiashandong - * @created 2021/6/28 9:10 - **/ -@Slf4j -@AllArgsConstructor -@RestController -@RequestMapping("/test/ws") -public class TestWsController { - - @RequestMapping("/send") - public R send(@RequestParam("to") String userId, @RequestBody Object body) throws IOException { - WebSocketSession session = SessionManager.SESSION_POOL.get(userId); - if (session != null) { - session.sendMessage(new TextMessage(JSONObject.toJSONString(body))); - } - - return R.data("OK"); - } -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/wrapper/MessageTemplateWrapper.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/wrapper/MessageTemplateWrapper.java deleted file mode 100644 index 31ba882..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/wrapper/MessageTemplateWrapper.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.hnac.hzims.message.wrapper; - -import com.hnac.hzims.message.entity.config.MessageTemplateEntity; -import org.springblade.core.mp.support.BaseEntityWrapper; -import org.springblade.system.cache.DictCache; -import org.springblade.system.user.cache.UserCache; -import org.springblade.system.user.entity.User; - -import java.util.Optional; - -/** - * @ClassName MessageTemplateWrapper - * @description: - * @author: hx - * @create: 2023-04-06 17:30 - * @Version 4.0 - **/ -public class MessageTemplateWrapper extends BaseEntityWrapper { - - public static MessageTemplateWrapper build() { - return new MessageTemplateWrapper(); - } - - @Override - public MessageTemplateEntity entityVO(MessageTemplateEntity entity) { - User user = UserCache.getUser(entity.getCreateUser()); - entity.setCreatorName(Optional.ofNullable(user).map(User::getName).orElse(entity.getCreateUser().toString())); - return entity; - } -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/wrapper/MsgPushRecordWrapper.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/wrapper/MsgPushRecordWrapper.java deleted file mode 100644 index 0f9c31c..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/wrapper/MsgPushRecordWrapper.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.hnac.hzims.message.wrapper; - -import com.hnac.hzims.message.entity.MsgPushRecordEntity; -import com.hnac.hzims.message.vo.MsgPushRecordVO; -import org.springblade.core.mp.support.BaseEntityWrapper; -import org.springblade.core.tool.utils.BeanUtil; -import org.springblade.system.user.cache.UserCache; -import org.springblade.system.user.entity.User; - -/** - * 包装类,返回视图层所需的字段 - * - * @author xiashandong - * @created 2021-06-28 08:38 - **/ -public class MsgPushRecordWrapper extends BaseEntityWrapper { - - public static MsgPushRecordWrapper build() { - return new MsgPushRecordWrapper(); - } - - @Override - public MsgPushRecordVO entityVO(MsgPushRecordEntity entity) { - MsgPushRecordVO vo = BeanUtil.copy(entity, MsgPushRecordVO.class); - User createUser = UserCache.getUser(entity.getCreateUser()); - User updateUser = UserCache.getUser(entity.getUpdateUser()); - vo.setCreateUserName(createUser.getRealName()); - vo.setUpdateUserName(updateUser.getRealName()); - return vo; - } - -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/wrapper/MsgSmsRecordWrapper.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/wrapper/MsgSmsRecordWrapper.java deleted file mode 100644 index 6d24c06..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/wrapper/MsgSmsRecordWrapper.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.hnac.hzims.message.wrapper; - -import com.hnac.hzims.message.entity.MsgSmsRecordEntity; -import com.hnac.hzims.message.vo.MsgSmsRecordVO; -import org.springblade.core.mp.support.BaseEntityWrapper; -import org.springblade.core.tool.utils.BeanUtil; -import org.springblade.system.user.cache.UserCache; -import org.springblade.system.user.entity.User; - -/** - * - * 包装类,返回视图层所需的字段 - * - * @author xiashandong - * @created 2021-06-28 08:38 - **/ -public class MsgSmsRecordWrapper extends BaseEntityWrapper { - - public static MsgSmsRecordWrapper build() { - return new MsgSmsRecordWrapper(); - } - - @Override - public MsgSmsRecordVO entityVO(MsgSmsRecordEntity entity) { - MsgSmsRecordVO vo = BeanUtil.copy(entity, MsgSmsRecordVO.class); - User createUser = UserCache.getUser(entity.getCreateUser()); - User updateUser = UserCache.getUser(entity.getUpdateUser()); - vo.setCreateUserName(createUser.getRealName()); - vo.setUpdateUserName(updateUser.getRealName()); - return vo; - } - -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/wrapper/MsgWsRecordHistoryWrapper.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/wrapper/MsgWsRecordHistoryWrapper.java deleted file mode 100644 index 0b7942b..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/wrapper/MsgWsRecordHistoryWrapper.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.hnac.hzims.message.wrapper; - -import com.hnac.hzims.message.entity.MsgWsRecordHistoryEntity; -import com.hnac.hzims.message.vo.MsgWsRecordHistoryVO; -import org.springblade.core.mp.support.BaseEntityWrapper; -import org.springblade.core.tool.utils.BeanUtil; -import org.springblade.system.user.cache.UserCache; -import org.springblade.system.user.entity.User; - -/** - * 包装类,返回视图层所需的字段 - * - * @author xiashandong - * @created 2021-06-28 16:45 - **/ -public class MsgWsRecordHistoryWrapper extends BaseEntityWrapper { - - public static MsgWsRecordHistoryWrapper build() { - return new MsgWsRecordHistoryWrapper(); - } - - @Override - public MsgWsRecordHistoryVO entityVO(MsgWsRecordHistoryEntity entity) { - MsgWsRecordHistoryVO vo = BeanUtil.copy(entity, MsgWsRecordHistoryVO.class); - User createUser = UserCache.getUser(entity.getCreateUser()); - User updateUser = UserCache.getUser(entity.getUpdateUser()); - vo.setCreateUserName(createUser.getRealName()); - vo.setUpdateUserName(updateUser.getRealName()); - return vo; - } - -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/wrapper/MsgWsRecordWrapper.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/wrapper/MsgWsRecordWrapper.java deleted file mode 100644 index aa8952e..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/wrapper/MsgWsRecordWrapper.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.hnac.hzims.message.wrapper; - -import com.hnac.hzims.message.entity.MsgWsRecordEntity; -import com.hnac.hzims.message.vo.MsgWsRecordVO; -import org.springblade.core.mp.support.BaseEntityWrapper; -import org.springblade.core.tool.utils.BeanUtil; -import org.springblade.system.user.cache.UserCache; -import org.springblade.system.user.entity.User; - -/** - * 包装类,返回视图层所需的字段 - * - * @author xiashandong - * @created 2021-06-28 08:38 - **/ -public class MsgWsRecordWrapper extends BaseEntityWrapper { - - public static MsgWsRecordWrapper build() { - return new MsgWsRecordWrapper(); - } - - @Override - public MsgWsRecordVO entityVO(MsgWsRecordEntity entity) { - MsgWsRecordVO vo = BeanUtil.copy(entity, MsgWsRecordVO.class); - User createUser = UserCache.getUser(entity.getCreateUser()); - if(null != entity.getUpdateUser()) { - User updateUser = UserCache.getUser(entity.getUpdateUser()); - vo.setUpdateUserName(updateUser.getRealName()); - } - vo.setCreateUserName(createUser.getRealName()); - return vo; - } - -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/ws/MessageHandler.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/ws/MessageHandler.java deleted file mode 100644 index 34ec8e0..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/ws/MessageHandler.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.hnac.hzims.message.ws; - -import lombok.extern.slf4j.Slf4j; -import org.springframework.web.socket.CloseStatus; -import org.springframework.web.socket.TextMessage; -import org.springframework.web.socket.WebSocketSession; -import org.springframework.web.socket.handler.TextWebSocketHandler; - -import javax.websocket.Session; -import java.util.concurrent.ConcurrentHashMap; - -/** - * @author xiashandong - */ -@Slf4j -public class MessageHandler extends TextWebSocketHandler { - - @Override - public void afterConnectionEstablished(WebSocketSession session) { - String[] split = session.getUri().toString().split("/"); - String uid = split[split.length - 1]; - session.getAttributes().put("userId", uid); - SessionManager.add(uid, session); - log.info("sessionId: " + session.getId()); - log.info("uri: " + session.getUri()); - log.info("session connection successful!"); - } - - @Override - public void afterConnectionClosed(WebSocketSession session, CloseStatus status) { - String[] split = session.getUri().toString().split("/"); - String uid = split[split.length - 1]; - SessionManager.removeAndClose(uid); - log.info("sessionId: " + session.getId()); - log.info("uri: " + session.getUri()); - log.info("session closed successful!"); - } - - @Override - protected void handleTextMessage(WebSocketSession session, TextMessage message) { - log.info("message handle successful!"); - } -} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/ws/SessionManager.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/ws/SessionManager.java deleted file mode 100644 index fc866bd..0000000 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/ws/SessionManager.java +++ /dev/null @@ -1,91 +0,0 @@ -package com.hnac.hzims.message.ws; - -import com.hnac.hzims.message.MessageConstants; -import lombok.AllArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springblade.core.tool.utils.CollectionUtil; -import org.springblade.core.tool.utils.SpringUtil; -import org.springframework.data.redis.core.RedisTemplate; -import org.springframework.web.socket.TextMessage; -import org.springframework.web.socket.WebSocketSession; - -import java.io.IOException; -import java.util.List; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.locks.Lock; -import java.util.concurrent.locks.ReentrantLock; - -/** - * @author xiashandong - * @created 2021/6/23 16:11 - **/ -@Slf4j -@AllArgsConstructor -public class SessionManager { - - /** ws会话池 **/ - public static ConcurrentHashMap SESSION_POOL = new ConcurrentHashMap<>(); - - private static final Lock lock = new ReentrantLock(); - - /** - * 添加会话 - * @param uid 标记 - * @param session 会话对象 - */ - public static void add(String uid, WebSocketSession session) { - if (SESSION_POOL.containsKey(uid)) { - SessionManager.removeAndClose(uid); - } - SESSION_POOL.put(uid, session); - log.info("添加 WebSocketSession 会话成功,uid=" + uid); - /* - 查询该用户是否有历史消息未推送 - 推送成功删除消息 - */ - lock.lock(); - try{ - String key = String.format("%s:%s", MessageConstants.WS_MESSAGE_KEY,uid); - RedisTemplate redisTemplate = SpringUtil.getBean("redisTemplate"); - List messageList = (List) redisTemplate.opsForList().range(key,0,-1); - if(CollectionUtil.isNotEmpty(messageList)){ - for (TextMessage message : messageList) { - session.sendMessage(message); - log.info("推送消息成功,uid为:{};消息内容为:{}" ,uid, message); - redisTemplate.opsForList().remove(key,1,message); - } - } - } - catch (Exception e) { - e.printStackTrace(); - } - finally { - lock.unlock(); - } - } - - /** - * 获取ws会话 - * @param uid - */ - public static WebSocketSession get(String uid) { - return SESSION_POOL.get(uid); - } - - /** - * 移除ws会话并关闭会话 - * @param uid - */ - public static void removeAndClose(String uid) { - WebSocketSession session = SESSION_POOL.get(uid); - if (session != null) { - try { - //关闭连接 - session.close(); - } catch (IOException ex) { - throw new RuntimeException("关闭ws会话失败!", ex); - } - } - SESSION_POOL.remove(uid); - } -} diff --git a/hzims-service/message/src/main/resources/db/1.0.0.sql b/hzims-service/message/src/main/resources/db/1.0.0.sql deleted file mode 100644 index a21a289..0000000 --- a/hzims-service/message/src/main/resources/db/1.0.0.sql +++ /dev/null @@ -1,521 +0,0 @@ --- ---------------------------- --- TABLE STRUCTURE FOR BLADE_MODULE_VERSION --- ---------------------------- -CREATE TABLE IF NOT EXISTS `BLADE_MODULE_VERSION` ( - `MODULE_NAME` VARCHAR(64) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL, - `VERSION` VARCHAR(8) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL, - `HISTORY` VARCHAR(300) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL, - PRIMARY KEY (`MODULE_NAME`) USING BTREE -) ENGINE = INNODB CHARACTER SET = UTF8 COLLATE = UTF8_GENERAL_CI ROW_FORMAT = DYNAMIC; - --- ---------------------------- --- TABLE STRUCTURE FOR HZ_MSG_PUSH_RECORD --- ---------------------------- -CREATE TABLE IF NOT EXISTS `HZ_MSG_PUSH_RECORD` ( - `ID` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID', - `BUSINESS_KEY` VARCHAR(100) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '业务模块', - `BUSINESS_CLASSIFY` VARCHAR(100) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '业务关键字', - `SUBJECT` VARCHAR(255) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '主题', - `TAGS` VARCHAR(200) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL DEFAULT '' COMMENT '标签集合,多个标签用逗号隔开', - `CONTENT` VARCHAR(2000) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL, - `SUCCESS` TINYINT(4) NOT NULL DEFAULT 0 COMMENT '是否推送成功', - `PARAMETERS` VARCHAR(2000) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '请求参数', - `RESPONSE` VARCHAR(2000) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL DEFAULT '' COMMENT '响应内容', - `ERROR_LOG` LONGTEXT CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL COMMENT '错误日志', - `TENANT_ID` VARCHAR(12) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '租户ID', - `STATUS` TINYINT(4) NULL DEFAULT NULL COMMENT '状态 1=成功 2=报错 3=接口返回异常', - `CREATE_TIME` DATETIME NOT NULL COMMENT '创建时间', - `UPDATE_TIME` DATETIME NULL DEFAULT NULL COMMENT '更新时间', - `CREATE_USER` BIGINT(20) NOT NULL COMMENT '创建人', - `UPDATE_USER` BIGINT(20) NULL DEFAULT NULL COMMENT '更新人', - `IS_DELETED` TINYINT(4) NOT NULL DEFAULT 0 COMMENT '是否删除', - `CREATE_DEPT` BIGINT(20) NULL DEFAULT NULL, - PRIMARY KEY (`ID`) USING BTREE, - INDEX `IDX_IS_DELETED_STATUS`(`STATUS`, `IS_DELETED`) USING BTREE, - INDEX `IDX_TAGS`(`TAGS`) USING BTREE, - INDEX `IDX_IS_ALL`(`SUCCESS`) USING BTREE -) ENGINE = INNODB AUTO_INCREMENT = 1 CHARACTER SET = UTF8 COLLATE = UTF8_GENERAL_CI COMMENT = '消息推送日志' ROW_FORMAT = DYNAMIC; - --- ---------------------------- --- TABLE STRUCTURE FOR HZ_MSG_PUSH_RECORD_COPY1 --- ---------------------------- -CREATE TABLE IF NOT EXISTS `HZ_MSG_PUSH_RECORD_COPY1` ( - `ID` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID', - `TAGS` VARCHAR(200) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL DEFAULT '' COMMENT '标签集合,多个标签用逗号隔开', - `IS_ALL` TINYINT(4) NOT NULL DEFAULT 0 COMMENT '是否推送所有 0=否 1=是', - `REQ_BODY` VARCHAR(2000) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '请求参数', - `RESP_BODY` VARCHAR(2000) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL DEFAULT '' COMMENT '响应内容', - `ERROR_LOG` LONGTEXT CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL COMMENT '错误日志', - `TENANT_ID` VARCHAR(12) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '租户ID', - `STATUS` TINYINT(4) NULL DEFAULT NULL COMMENT '状态 1=成功 2=报错 3=接口返回异常', - `CREATE_TIME` DATETIME NOT NULL COMMENT '创建时间', - `UPDATE_TIME` DATETIME NULL DEFAULT NULL COMMENT '更新时间', - `CREATE_USER` BIGINT(20) NOT NULL COMMENT '创建人', - `UPDATE_USER` BIGINT(20) NULL DEFAULT NULL COMMENT '更新人', - `IS_DELETED` TINYINT(4) NOT NULL DEFAULT 0 COMMENT '是否删除', - `CREATE_DEPT` BIGINT(20) NULL DEFAULT NULL, - PRIMARY KEY (`ID`) USING BTREE, - INDEX `IDX_IS_DELETED_STATUS`(`STATUS`, `IS_DELETED`) USING BTREE, - INDEX `IDX_TAGS`(`TAGS`) USING BTREE, - INDEX `IDX_IS_ALL`(`IS_ALL`) USING BTREE -) ENGINE = INNODB AUTO_INCREMENT = 2412442561386623978 CHARACTER SET = UTF8 COLLATE = UTF8_GENERAL_CI COMMENT = '消息推送日志' ROW_FORMAT = DYNAMIC; - --- ---------------------------- --- TABLE STRUCTURE FOR HZ_MSG_SMS_RECORD --- ---------------------------- -CREATE TABLE IF NOT EXISTS `HZ_MSG_SMS_RECORD` ( - `ID` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID', - `BUSINESS_KEY` VARCHAR(100) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '业务模块', - `BUSINESS_CLASSIFY` VARCHAR(100) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '业务关键字', - `SUBJECT` VARCHAR(255) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '主题', - `CONTENT` VARCHAR(2000) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '内容', - `SMS_CODE` VARCHAR(50) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '平台资源模块提供的CODE', - `PHONES` VARCHAR(200) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '手机号码', - `PARAMETERS` VARCHAR(2000) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '请求参数', - `RESPONSE` VARCHAR(2000) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL DEFAULT '' COMMENT '响应内容', - `SUCCESS` TINYINT(4) NULL DEFAULT NULL COMMENT '是否推送成功', - `ERROR_LOG` LONGTEXT CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL COMMENT '错误日志', - `TENANT_ID` VARCHAR(12) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '租户ID', - `STATUS` TINYINT(4) NULL DEFAULT NULL COMMENT '状态 1=成功 2=失败 3=校验未通过', - `CREATE_TIME` DATETIME NOT NULL COMMENT '创建时间', - `UPDATE_TIME` DATETIME NULL DEFAULT NULL COMMENT '更新时间', - `CREATE_USER` BIGINT(20) NOT NULL COMMENT '创建人', - `UPDATE_USER` BIGINT(20) NULL DEFAULT NULL COMMENT '更新人', - `IS_DELETED` TINYINT(4) NOT NULL DEFAULT 0 COMMENT '是否删除', - `CREATE_DEPT` BIGINT(20) NULL DEFAULT NULL, - PRIMARY KEY (`ID`) USING BTREE, - INDEX `IDX_IS_DELETED_STATUS`(`STATUS`, `IS_DELETED`) USING BTREE, - INDEX `IDX_SMS_CODE`(`SMS_CODE`) USING BTREE, - INDEX `IDX_PHONE`(`PHONES`) USING BTREE -) ENGINE = INNODB AUTO_INCREMENT = 1 CHARACTER SET = UTF8 COLLATE = UTF8_GENERAL_CI COMMENT = '短信推送日志' ROW_FORMAT = DYNAMIC; - --- ---------------------------- --- TABLE STRUCTURE FOR HZ_MSG_SMS_RECORD_COPY1 --- ---------------------------- -CREATE TABLE IF NOT EXISTS `HZ_MSG_SMS_RECORD_COPY1` ( - `ID` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID', - `SMS_CODE` VARCHAR(50) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '平台资源模块提供的CODE', - `PHONES` VARCHAR(200) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '手机号码', - `REQ_BODY` VARCHAR(2000) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '请求参数', - `RESP_BODY` VARCHAR(2000) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL DEFAULT '' COMMENT '响应内容', - `ERROR_LOG` LONGTEXT CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL COMMENT '错误日志', - `TENANT_ID` VARCHAR(12) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '租户ID', - `STATUS` TINYINT(4) NULL DEFAULT NULL COMMENT '状态 1=成功 2=失败 3=校验未通过', - `CREATE_TIME` DATETIME NOT NULL COMMENT '创建时间', - `UPDATE_TIME` DATETIME NULL DEFAULT NULL COMMENT '更新时间', - `CREATE_USER` BIGINT(20) NOT NULL COMMENT '创建人', - `UPDATE_USER` BIGINT(20) NULL DEFAULT NULL COMMENT '更新人', - `IS_DELETED` TINYINT(4) NOT NULL DEFAULT 0 COMMENT '是否删除', - `CREATE_DEPT` BIGINT(20) NULL DEFAULT NULL, - PRIMARY KEY (`ID`) USING BTREE, - INDEX `IDX_IS_DELETED_STATUS`(`STATUS`, `IS_DELETED`) USING BTREE, - INDEX `IDX_SMS_CODE`(`SMS_CODE`) USING BTREE, - INDEX `IDX_PHONE`(`PHONES`) USING BTREE -) ENGINE = INNODB AUTO_INCREMENT = 1471810757107675139 CHARACTER SET = UTF8 COLLATE = UTF8_GENERAL_CI COMMENT = '短信推送日志' ROW_FORMAT = DYNAMIC; - -ALTER TABLE `hzims_app_log` MODIFY COLUMN `TYPE` tinyint(4) NULL DEFAULT NULL COMMENT '消息类型' AFTER `BUSINESS_CLASSIFY`; - --- ---------------------------- --- TABLE STRUCTURE FOR HZ_MSG_WS_RECORD_COPY1 --- ---------------------------- -CREATE TABLE IF NOT EXISTS `HZ_MSG_WS_RECORD_COPY1` ( - `ID` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID', - `USER_ID` BIGINT(20) NOT NULL COMMENT '推送目标账户ID', - `CLASSIFY` VARCHAR(30) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '业务分类', - `REQ_BODY` VARCHAR(2000) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '请求参数', - `ERROR_LOG` LONGTEXT CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL COMMENT '错误日志', - `TENANT_ID` VARCHAR(12) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '租户ID', - `STATUS` TINYINT(4) NULL DEFAULT NULL COMMENT '状态 1=成功 2=报错 3=未读 4=已读', - `CREATE_TIME` DATETIME NOT NULL COMMENT '创建时间', - `UPDATE_TIME` DATETIME NULL DEFAULT NULL COMMENT '更新时间', - `CREATE_USER` BIGINT(20) NOT NULL COMMENT '创建人', - `UPDATE_USER` BIGINT(20) NULL DEFAULT NULL COMMENT '更新人', - `IS_DELETED` TINYINT(4) NOT NULL DEFAULT 0 COMMENT '是否删除', - `CREATE_DEPT` BIGINT(20) NULL DEFAULT NULL, - `TITLE` VARCHAR(100) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '标题', - PRIMARY KEY (`ID`) USING BTREE, - INDEX `IDX_USER_ID`(`USER_ID`) USING BTREE, - INDEX `IDX_IS_DELETED_STATUS`(`IS_DELETED`, `STATUS`) USING BTREE -) ENGINE = INNODB AUTO_INCREMENT = 1531903445261381634 CHARACTER SET = UTF8 COLLATE = UTF8_GENERAL_CI COMMENT = 'WEBSOCKET消息推送日志' ROW_FORMAT = DYNAMIC; - --- ---------------------------- --- TABLE STRUCTURE FOR HZ_MSG_WS_RECORD_HISTORY --- ---------------------------- -CREATE TABLE IF NOT EXISTS `HZ_MSG_WS_RECORD_HISTORY` ( - `ID` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID', - `USER_ID` BIGINT(20) NOT NULL COMMENT '推送目标账户ID', - `CLASSIFY` VARCHAR(30) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '业务分类', - `REQ_BODY` VARCHAR(2000) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '请求参数', - `ERROR_LOG` LONGTEXT CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL COMMENT '错误日志', - `TENANT_ID` VARCHAR(12) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '租户ID', - `STATUS` TINYINT(4) NULL DEFAULT NULL COMMENT '状态 1=成功 2=报错 3=未读 4=已读', - `CREATE_TIME` DATETIME NOT NULL COMMENT '创建时间', - `UPDATE_TIME` DATETIME NULL DEFAULT NULL COMMENT '更新时间', - `CREATE_USER` BIGINT(20) NOT NULL COMMENT '创建人', - `UPDATE_USER` BIGINT(20) NULL DEFAULT NULL COMMENT '更新人', - `IS_DELETED` TINYINT(4) NOT NULL DEFAULT 0 COMMENT '是否删除', - `CREATE_DEPT` BIGINT(20) NULL DEFAULT NULL, - `TITLE` VARCHAR(100) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '标题', - PRIMARY KEY (`ID`) USING BTREE, - INDEX `IDX_USER_ID`(`USER_ID`) USING BTREE, - INDEX `IDX_IS_DELETED_STATUS`(`IS_DELETED`, `STATUS`) USING BTREE -) ENGINE = INNODB AUTO_INCREMENT = 1 CHARACTER SET = UTF8 COLLATE = UTF8_GENERAL_CI COMMENT = 'WEBSOCKET消息推送日志' ROW_FORMAT = DYNAMIC; - --- ---------------------------- --- TABLE STRUCTURE FOR HZIMS_APP_LOG --- ---------------------------- -CREATE TABLE IF NOT EXISTS `HZIMS_APP_LOG` ( - `ID` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID', - `BUSINESS_KEY` VARCHAR(100) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '业务关键字', - `BUSINESS_CLASSIFY` VARCHAR(100) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '业务分类。系统通知:SYSTEM,事务消息:BUSINESS,日常提醒:DAILYREMIND,巡检消息:INSPECT', - `TYPE` TINYINT(4) NULL DEFAULT NULL COMMENT '消息类型', - `SUBJECT` VARCHAR(255) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '主题', - `CONTENT` VARCHAR(1000) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '内容', - `PUSHER` VARCHAR(255) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '推送人', - `PARAMS` VARCHAR(1000) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '消息推送请求参数', - `ERROR_LOG` TINYTEXT CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL COMMENT '错误日志', - `RESULT` VARCHAR(255) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '推送结果', - `IS_SUCCESS` TINYINT(4) NULL DEFAULT NULL COMMENT '是否推送成功', - `IS_ALL` TINYINT(4) NULL DEFAULT NULL COMMENT '是否推送全平台', - `PLATFORM_TYPE` VARCHAR(255) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '推送类型', - `TENANT_ID` VARCHAR(12) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '租户ID', - `CREATE_DEPT` BIGINT(20) NULL DEFAULT NULL COMMENT '创建单位', - `CREATE_USER` BIGINT(20) NOT NULL COMMENT '创建人', - `CREATE_TIME` DATETIME NOT NULL COMMENT '创建时间', - `UPDATE_USER` BIGINT(20) NULL DEFAULT NULL COMMENT '修改人', - `UPDATE_TIME` DATETIME NULL DEFAULT NULL COMMENT '修改时间', - `STATUS` TINYINT(4) NULL DEFAULT NULL COMMENT '业务状态', - `IS_DELETED` TINYINT(4) NOT NULL DEFAULT 0 COMMENT '是否删除 0-正常 1-删除', - PRIMARY KEY (`ID`) USING BTREE -) ENGINE = INNODB AUTO_INCREMENT = 1632275505505910787 CHARACTER SET = UTF8 COLLATE = UTF8_GENERAL_CI ROW_FORMAT = DYNAMIC; - --- ---------------------------- --- TABLE STRUCTURE FOR HZIMS_MAIL_CONFIG --- ---------------------------- -CREATE TABLE IF NOT EXISTS `HZIMS_MAIL_CONFIG` ( - `ID` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID', - `BUSINESS_KEY` VARCHAR(100) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '业务关键字', - `BUSINESS_CLASSIFY` VARCHAR(100) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '业务分类。系统通知:SYSTEM,事务消息:BUSINESS,日常提醒:DAILYREMIND,巡检消息:INSPECT', - `TYPE` TINYINT(4) NULL DEFAULT NULL COMMENT '消息类型', - `SUBJECT` VARCHAR(255) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '主题', - `CONTENT` VARCHAR(1000) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '内容', - `PUSHERS` VARCHAR(255) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '推送人', - `MAILS` VARCHAR(255) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '发送邮箱账号', - `IS_HTML` TINYINT(4) NULL DEFAULT NULL COMMENT '是否为HTML模板推送', - `TEMPLATE_URL` VARCHAR(100) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT 'HTML模板路径', - `TEMPLATE_FILE_NAME` VARCHAR(255) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT 'HTML模板文件名', - `JSON_OBJECT` VARCHAR(1000) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT 'HTML模板填充数据对象JSON字符串', - `TENANT_ID` VARCHAR(12) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '租户ID', - `CREATE_DEPT` BIGINT(20) NULL DEFAULT NULL COMMENT '创建单位', - `CREATE_USER` BIGINT(20) NOT NULL COMMENT '创建人', - `CREATE_TIME` DATETIME NOT NULL COMMENT '创建时间', - `UPDATE_USER` BIGINT(20) NULL DEFAULT NULL COMMENT '修改人', - `UPDATE_TIME` DATETIME NULL DEFAULT NULL COMMENT '修改时间', - `STATUS` TINYINT(4) NULL DEFAULT NULL COMMENT '业务状态', - `IS_DELETED` TINYINT(4) NOT NULL DEFAULT 0 COMMENT '是否删除 0-正常 1-删除', - `DURATION` MEDIUMINT(9) NULL DEFAULT NULL COMMENT '多长时间内的推送', - `TIME_UNIT` VARCHAR(50) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '时间单位', - PRIMARY KEY (`ID`) USING BTREE -) ENGINE = INNODB AUTO_INCREMENT = 1659153459628224515 CHARACTER SET = UTF8 COLLATE = UTF8_GENERAL_CI ROW_FORMAT = DYNAMIC; - --- ---------------------------- --- TABLE STRUCTURE FOR HZIMS_MAIL_LOG --- ---------------------------- -CREATE TABLE IF NOT EXISTS `HZIMS_MAIL_LOG` ( - `ID` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID', - `BUSINESS_KEY` VARCHAR(100) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '业务关键字', - `BUSINESS_CLASSIFY` VARCHAR(100) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '业务分类。系统通知:SYSTEM,事务消息:BUSINESS,日常提醒:DAILYREMIND,巡检消息:INSPECT', - `TYPE` TINYINT(4) NULL DEFAULT NULL COMMENT '消息类型', - `SUBJECT` VARCHAR(255) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '主题', - `CONTENT` VARCHAR(1000) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '内容', - `PUSHER` VARCHAR(255) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '推送人', - `PARAMS` VARCHAR(255) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '消息推送请求参数', - `ERROR_LOG` TINYTEXT CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL COMMENT '错误日志', - `RESULT` VARCHAR(255) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '推送结果', - `IS_SUCCESS` TINYINT(4) NULL DEFAULT NULL COMMENT '是否推送成功', - `EMAIL` VARCHAR(255) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '推送邮箱', - `TENANT_ID` VARCHAR(12) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '租户ID', - `CREATE_DEPT` BIGINT(20) NULL DEFAULT NULL COMMENT '创建单位', - `CREATE_USER` BIGINT(20) NOT NULL COMMENT '创建人', - `CREATE_TIME` DATETIME NOT NULL COMMENT '创建时间', - `UPDATE_USER` BIGINT(20) NULL DEFAULT NULL COMMENT '修改人', - `UPDATE_TIME` DATETIME NULL DEFAULT NULL COMMENT '修改时间', - `STATUS` TINYINT(4) NULL DEFAULT NULL COMMENT '业务状态', - `IS_DELETED` TINYINT(4) NOT NULL DEFAULT 0 COMMENT '是否删除 0-正常 1-删除', - PRIMARY KEY (`ID`) USING BTREE -) ENGINE = INNODB AUTO_INCREMENT = 1 CHARACTER SET = UTF8 COLLATE = UTF8_GENERAL_CI ROW_FORMAT = DYNAMIC; - --- ---------------------------- --- TABLE STRUCTURE FOR HZIMS_MESSAGE_PUSH_RECORD --- ---------------------------- -CREATE TABLE IF NOT EXISTS `HZIMS_MESSAGE_PUSH_RECORD` ( - `ID` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID', - `TASK_ID` BIGINT(20) NOT NULL COMMENT '消息类型', - `TEMPLATE_ID` BIGINT(20) NULL DEFAULT NULL COMMENT '消息模板ID', - `PUSHER` VARCHAR(100) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '推送人', - `PUSHER_NAME` VARCHAR(255) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '推送人名称', - `CONTENT` VARCHAR(1000) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '内容', - `PLAN_TIME` DATETIME NULL DEFAULT NULL COMMENT '计划推送时间', - `PUSH_TIME` DATETIME NULL DEFAULT NULL COMMENT '实际推送时间', - `TYPE` VARCHAR(20) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '消息类型', - `BUSINESS_KEY` VARCHAR(100) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '业务关键字', - `BUSINESS_CLASSIFY` VARCHAR(100) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '业务分类。系统通知:SYSTEM,事务消息:BUSINESS,日常提醒:DAILYREMIND,巡检消息:INSPECT', - `SUBJECT` VARCHAR(255) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '主题', - `CONCENTRATED_DURATION` MEDIUMINT(9) NULL DEFAULT NULL COMMENT '集中推送时长', - `CONCENTRATED_TIME_UNIT` VARCHAR(50) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '集中推送单位', - `ADVANCE_DURATION` MEDIUMINT(9) NULL DEFAULT NULL COMMENT '提前推送时长', - `ADVANCE_TIME_UNIT` VARCHAR(50) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '提前推送单位', - `TENANT_ID` VARCHAR(12) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '租户ID', - `CREATE_DEPT` BIGINT(20) NULL DEFAULT NULL COMMENT '创建单位', - `CREATE_USER` BIGINT(20) NOT NULL COMMENT '创建人', - `CREATE_TIME` DATETIME NOT NULL COMMENT '创建时间', - `UPDATE_USER` BIGINT(20) NULL DEFAULT NULL COMMENT '修改人', - `UPDATE_TIME` DATETIME NULL DEFAULT NULL COMMENT '修改时间', - `STATUS` TINYINT(4) NULL DEFAULT 0 COMMENT '业务状态(0 未推送,1 推送成功,2 推送失败,3 已确认)', - `IS_DELETED` TINYINT(4) NOT NULL DEFAULT 0 COMMENT '是否删除 0-正常 1-删除', - `RESPOND_TIME` DATETIME NULL DEFAULT NULL COMMENT '响应时间', - `RESPOND_REMARK` VARCHAR(1000) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '响应说明', - `RESOURCE_CODE` VARCHAR(100) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '资源编码', - `ACCOUNT` VARCHAR(100) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '推送账号:手机号,邮箱', - `DEPT_ID` BIGINT(20) NULL DEFAULT NULL COMMENT '机构ID', - `DEPT_NAME` VARCHAR(255) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '机构ID', - `MESSAGE_ID` BIGINT(20) NULL DEFAULT NULL COMMENT '消息ID', - `PUSH_TYPE` VARCHAR(2) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '推送类型,0:即时推送,1:计划推送', - `SMS_PARAM` VARCHAR(255) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '阿里云短信模板参数', - PRIMARY KEY (`ID`) USING BTREE -) ENGINE = INNODB AUTO_INCREMENT = 1759475661027692546 CHARACTER SET = UTF8 COLLATE = UTF8_GENERAL_CI COMMENT = '消息推送记录' ROW_FORMAT = DYNAMIC; - --- ---------------------------- --- TABLE STRUCTURE FOR HZIMS_MESSAGE_TEMPLATE --- ---------------------------- -CREATE TABLE IF NOT EXISTS `HZIMS_MESSAGE_TEMPLATE` ( - `ID` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '消息类型', - `TYPE` VARCHAR(50) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '主键ID', - `BUSINESS_KEY` VARCHAR(100) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '业务关键字', - `BUSINESS_CLASSIFY` VARCHAR(100) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '业务分类。系统通知:SYSTEM,事务消息:BUSINESS,日常提醒:DAILYREMIND,巡检消息:INSPECT', - `SUBJECT` VARCHAR(255) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '主题', - `CONCENTRATED_DURATION` MEDIUMINT(9) NULL DEFAULT NULL COMMENT '集中推送时长', - `CONCENTRATED_TIME_UNIT` VARCHAR(50) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '集中推送单位', - `ADVANCE_DURATION` MEDIUMINT(9) NULL DEFAULT NULL COMMENT '提前推送时长', - `ADVANCE_TIME_UNIT` VARCHAR(50) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '提前推送单位', - `TENANT_ID` VARCHAR(12) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '租户ID', - `CREATE_DEPT` BIGINT(20) NULL DEFAULT NULL COMMENT '创建单位', - `CREATE_USER` BIGINT(20) NOT NULL COMMENT '创建人', - `CREATE_TIME` DATETIME NOT NULL COMMENT '创建时间', - `UPDATE_USER` BIGINT(20) NULL DEFAULT NULL COMMENT '修改人', - `UPDATE_TIME` DATETIME NULL DEFAULT NULL COMMENT '修改时间', - `STATUS` TINYINT(4) NULL DEFAULT NULL COMMENT '业务状态', - `IS_DELETED` TINYINT(4) NOT NULL DEFAULT 0 COMMENT '是否删除 0-正常 1-删除', - PRIMARY KEY (`ID`) USING BTREE -) ENGINE = INNODB AUTO_INCREMENT = 1654674468043325442 CHARACTER SET = UTF8 COLLATE = UTF8_GENERAL_CI COMMENT = '消息推送模板' ROW_FORMAT = DYNAMIC; - --- ---------------------------- --- TABLE STRUCTURE FOR HZIMS_MSG_MAIL_RECORD --- ---------------------------- -CREATE TABLE IF NOT EXISTS `HZIMS_MSG_MAIL_RECORD` ( - `ID` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID', - `BUSINESS_KEY` VARCHAR(100) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL DEFAULT '' COMMENT '业务关键字', - `BUSINESS_CLASSIFY` VARCHAR(100) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL DEFAULT '' COMMENT '业务分类', - `SUBJECT` VARCHAR(255) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '主题', - `CONTENT` VARCHAR(2000) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '内容', - `TO_ACCOUNTS` VARCHAR(255) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '发送邮箱,按逗号分隔', - `SUCCESS` TINYINT(4) NOT NULL DEFAULT 0 COMMENT '是否发送成功', - `PARAMETERS` TEXT CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '发送参数', - `RESPONSE` TEXT CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL COMMENT '响应内容', - `ERROR_LOG` LONGTEXT CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL COMMENT '错误日志', - `TENANT_ID` VARCHAR(12) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '租户ID', - `STATUS` TINYINT(4) NULL DEFAULT NULL COMMENT '状态 1=成功 2=报错 3=接口返回异常', - `CREATE_TIME` DATETIME NOT NULL COMMENT '创建时间', - `UPDATE_TIME` DATETIME NULL DEFAULT NULL COMMENT '更新时间', - `CREATE_USER` BIGINT(20) NOT NULL COMMENT '创建人', - `UPDATE_USER` BIGINT(20) NULL DEFAULT NULL COMMENT '更新人', - `IS_DELETED` TINYINT(4) NOT NULL DEFAULT 0 COMMENT '是否删除', - `CREATE_DEPT` BIGINT(20) NULL DEFAULT NULL, - PRIMARY KEY (`ID`) USING BTREE -) ENGINE = INNODB AUTO_INCREMENT = 1 CHARACTER SET = UTF8 COLLATE = UTF8_GENERAL_CI COMMENT = '邮件发送记录' ROW_FORMAT = DYNAMIC; - --- ---------------------------- --- TABLE STRUCTURE FOR HZIMS_PUSH_CONFIG --- ---------------------------- -CREATE TABLE IF NOT EXISTS `HZIMS_PUSH_CONFIG` ( - `ID` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID', - `BUSINESS_KEY` VARCHAR(100) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '业务关键字', - `BUSINESS_CLASSIFY` VARCHAR(100) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '业务分类。系统通知:SYSTEM,事务消息:BUSINESS,日常提醒:DAILYREMIND,巡检消息:INSPECT', - `TYPE` TINYINT(4) NULL DEFAULT NULL COMMENT '消息类型', - `SUBJECT` VARCHAR(255) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '主题', - `CONTENT` VARCHAR(1000) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '内容', - `PUSHERS` VARCHAR(255) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '推送人', - `IS_ALL` TINYINT(4) NULL DEFAULT NULL COMMENT '是否推送全平台', - `PLATFORM_TYPE` VARCHAR(50) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '推送类型', - `TENANT_ID` VARCHAR(12) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '租户ID', - `CREATE_DEPT` BIGINT(20) NULL DEFAULT NULL COMMENT '创建单位', - `CREATE_USER` BIGINT(20) NOT NULL COMMENT '创建人', - `CREATE_TIME` DATETIME NOT NULL COMMENT '创建时间', - `UPDATE_USER` BIGINT(20) NULL DEFAULT NULL COMMENT '修改人', - `UPDATE_TIME` DATETIME NULL DEFAULT NULL COMMENT '修改时间', - `STATUS` TINYINT(4) NULL DEFAULT NULL COMMENT '业务状态', - `IS_DELETED` TINYINT(4) NOT NULL DEFAULT 0 COMMENT '是否删除 0-正常 1-删除', - `DURATION` MEDIUMINT(9) NULL DEFAULT NULL COMMENT '多长时间内的推送', - `TIME_UNIT` VARCHAR(50) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '时间单位', - PRIMARY KEY (`ID`) USING BTREE -) ENGINE = INNODB AUTO_INCREMENT = 1563050030925991939 CHARACTER SET = UTF8 COLLATE = UTF8_GENERAL_CI ROW_FORMAT = DYNAMIC; - --- ---------------------------- --- TABLE STRUCTURE FOR HZIMS_PUSH_MESSAGE --- ---------------------------- -CREATE TABLE IF NOT EXISTS `HZIMS_PUSH_MESSAGE` ( - `ID` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID', - `MESSAGE_TYPE` VARCHAR(20) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '消息类型', - `BUSINESS_KEY` VARCHAR(100) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '业务KEY值', - `MESSAGE_CONTENT` VARCHAR(2000) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '消息推送内容体', - `IS_PUSH` TINYINT(4) NULL DEFAULT 0 COMMENT '是否推送', - `IS_SUCCESS` TINYINT(4) NULL DEFAULT NULL COMMENT '是否推送', - `PUSH_TIME` DATETIME NULL DEFAULT NULL COMMENT '推送时间', - `TENANT_ID` VARCHAR(12) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '租户ID', - `CREATE_DEPT` BIGINT(20) NULL DEFAULT NULL COMMENT '创建单位', - `CREATE_USER` BIGINT(20) NOT NULL COMMENT '创建人', - `CREATE_TIME` DATETIME NOT NULL COMMENT '创建时间', - `UPDATE_USER` BIGINT(20) NULL DEFAULT NULL COMMENT '修改人', - `UPDATE_TIME` DATETIME NULL DEFAULT NULL COMMENT '修改时间', - `STATUS` TINYINT(4) NULL DEFAULT NULL COMMENT '业务状态', - `IS_DELETED` TINYINT(4) NOT NULL DEFAULT 0 COMMENT '是否删除 0-正常 1-删除', - PRIMARY KEY (`ID`) USING BTREE -) ENGINE = INNODB AUTO_INCREMENT = 1 CHARACTER SET = UTF8 COLLATE = UTF8_GENERAL_CI ROW_FORMAT = DYNAMIC; - -CREATE TABLE IF NOT EXISTS `hzims_message_push_record` ( - `ID` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID', - `TASK_ID` bigint(20) NOT NULL COMMENT '消息类型', - `TEMPLATE_ID` bigint(20) NULL DEFAULT NULL COMMENT '消息模板ID', - `PUSHER` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '推送人', - `PUSHER_NAME` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '推送人名称', - `CONTENT` varchar(1000) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '内容', - `PLAN_TIME` datetime(0) NULL DEFAULT NULL COMMENT '计划推送时间', - `PUSH_TIME` datetime(0) NULL DEFAULT NULL COMMENT '实际推送时间', - `TYPE` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '消息类型', - `BUSINESS_KEY` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '业务关键字', - `BUSINESS_CLASSIFY` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '业务分类。系统通知:system,事务消息:business,日常提醒:dailyRemind,巡检消息:inspect', - `SUBJECT` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '主题', - `CONCENTRATED_DURATION` mediumint(9) NULL DEFAULT NULL COMMENT '集中推送时长', - `CONCENTRATED_TIME_UNIT` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '集中推送单位', - `ADVANCE_DURATION` mediumint(9) NULL DEFAULT NULL COMMENT '提前推送时长', - `ADVANCE_TIME_UNIT` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '提前推送单位', - `TENANT_ID` varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '租户ID', - `CREATE_DEPT` bigint(20) NULL DEFAULT NULL COMMENT '创建单位', - `CREATE_USER` bigint(20) NOT NULL COMMENT '创建人', - `CREATE_TIME` datetime(0) NOT NULL COMMENT '创建时间', - `UPDATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '修改人', - `UPDATE_TIME` datetime(0) NULL DEFAULT NULL COMMENT '修改时间', - `STATUS` tinyint(4) NULL DEFAULT 0 COMMENT '业务状态(0 未推送,1 推送成功,2 推送失败,3 已确认)', - `IS_DELETED` tinyint(4) NOT NULL DEFAULT 0 COMMENT '是否删除 0-正常 1-删除', - `RESPOND_TIME` datetime(0) NULL DEFAULT NULL COMMENT '响应时间', - `RESPOND_REMARK` varchar(1000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '响应说明', - `RESOURCE_CODE` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '资源编码', - `ACCOUNT` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '推送账号:手机号,邮箱', - `DEPT_ID` bigint(20) NULL DEFAULT NULL COMMENT '机构ID', - `DEPT_NAME` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '机构ID', - `MESSAGE_ID` bigint(20) NULL DEFAULT NULL COMMENT '消息ID', - `PUSH_TYPE` varchar(2) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '推送类型,0:即时推送,1:计划推送', - `SMS_PARAM` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '阿里云短信模板参数', - PRIMARY KEY (`ID`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '消息推送记录' ROW_FORMAT = Dynamic; - -CREATE TABLE IF NOT EXISTS `hzims_message_template` ( - `ID` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '消息类型', - `TYPE` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '主键ID', - `BUSINESS_KEY` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '业务关键字', - `BUSINESS_CLASSIFY` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '业务分类。系统通知:system,事务消息:business,日常提醒:dailyRemind,巡检消息:inspect', - `SUBJECT` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '主题', - `CONCENTRATED_DURATION` mediumint(9) NULL DEFAULT NULL COMMENT '集中推送时长', - `CONCENTRATED_TIME_UNIT` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '集中推送单位', - `ADVANCE_DURATION` mediumint(9) NULL DEFAULT NULL COMMENT '提前推送时长', - `ADVANCE_TIME_UNIT` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '提前推送单位', - `TENANT_ID` varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '租户ID', - `CREATE_DEPT` bigint(20) NULL DEFAULT NULL COMMENT '创建单位', - `CREATE_USER` bigint(20) NOT NULL COMMENT '创建人', - `CREATE_TIME` datetime(0) NOT NULL COMMENT '创建时间', - `UPDATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '修改人', - `UPDATE_TIME` datetime(0) NULL DEFAULT NULL COMMENT '修改时间', - `STATUS` tinyint(4) NULL DEFAULT NULL COMMENT '业务状态', - `IS_DELETED` tinyint(4) NOT NULL DEFAULT 0 COMMENT '是否删除 0-正常 1-删除', - PRIMARY KEY (`ID`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '消息推送模板' ROW_FORMAT = Dynamic; - --- ---------------------------- --- TABLE STRUCTURE FOR HZIMS_SMS_LOG --- ---------------------------- -CREATE TABLE IF NOT EXISTS `HZIMS_SMS_LOG` ( - `ID` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID', - `BUSINESS_KEY` VARCHAR(100) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '业务关键字', - `BUSINESS_CLASSIFY` VARCHAR(100) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '业务分类。系统通知:SYSTEM,事务消息:BUSINESS,日常提醒:DAILYREMIND,巡检消息:INSPECT', - `TYPE` TINYINT(4) NULL DEFAULT NULL COMMENT '消息类型', - `SUBJECT` VARCHAR(255) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '主题', - `CONTENT` VARCHAR(1000) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '内容', - `PUSHER` VARCHAR(255) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '推送人', - `PARAMS` VARCHAR(1000) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '消息推送请求参数', - `ERROR_LOG` TINYTEXT CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL COMMENT '错误日志', - `RESULT` VARCHAR(255) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '推送结果', - `IS_SUCCESS` TINYINT(4) NULL DEFAULT NULL COMMENT '是否推送成功', - `PHONES` VARCHAR(255) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '接受短信的手机号', - `PARAMS_JSON` VARCHAR(255) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '短信模板参数', - `TENANT_ID` VARCHAR(12) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '租户ID', - `CREATE_DEPT` BIGINT(20) NULL DEFAULT NULL COMMENT '创建单位', - `CREATE_USER` BIGINT(20) NOT NULL COMMENT '创建人', - `CREATE_TIME` DATETIME NOT NULL COMMENT '创建时间', - `UPDATE_USER` BIGINT(20) NULL DEFAULT NULL COMMENT '修改人', - `UPDATE_TIME` DATETIME NULL DEFAULT NULL COMMENT '修改时间', - `STATUS` TINYINT(4) NULL DEFAULT NULL COMMENT '业务状态', - `IS_DELETED` TINYINT(4) NOT NULL DEFAULT 0 COMMENT '是否删除 0-正常 1-删除', - PRIMARY KEY (`ID`) USING BTREE -) ENGINE = INNODB AUTO_INCREMENT = 1612776146498326531 CHARACTER SET = UTF8 COLLATE = UTF8_GENERAL_CI ROW_FORMAT = DYNAMIC; - -ALTER TABLE `hzims_push_config` MODIFY COLUMN `TIME_UNIT` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '时间单位' AFTER `DURATION`; - -CREATE TABLE IF NOT EXISTS `hzims_push_message` ( - `ID` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID', - `MESSAGE_TYPE` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '消息类型', - `BUSINESS_KEY` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '业务key值', - `MESSAGE_CONTENT` varchar(2000) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '消息推送内容体', - `IS_PUSH` tinyint(4) NULL DEFAULT 0 COMMENT '是否推送', - `IS_SUCCESS` tinyint(4) NULL DEFAULT NULL COMMENT '是否推送', - `PUSH_TIME` datetime(0) NULL DEFAULT NULL COMMENT '推送时间', - `TENANT_ID` varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '租户ID', - `CREATE_DEPT` bigint(20) NULL DEFAULT NULL COMMENT '创建单位', - `CREATE_USER` bigint(20) NOT NULL COMMENT '创建人', - `CREATE_TIME` datetime(0) NOT NULL COMMENT '创建时间', - `UPDATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '修改人', - `UPDATE_TIME` datetime(0) NULL DEFAULT NULL COMMENT '修改时间', - `STATUS` tinyint(4) NULL DEFAULT NULL COMMENT '业务状态', - `IS_DELETED` tinyint(4) NOT NULL DEFAULT 0 COMMENT '是否删除 0-正常 1-删除', - PRIMARY KEY (`ID`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; - -ALTER TABLE `hzims_sms_config` MODIFY COLUMN `CONTENT_VARIABLES` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '短信模板参数变量定义' AFTER `IS_DELETED`; - -ALTER TABLE `hzims_sms_config` MODIFY COLUMN `TIME_UNIT` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '时间单位' AFTER `DURATION`; - -ALTER TABLE `hzims_ws_config` ADD COLUMN `DURATION` mediumint(9) NULL DEFAULT NULL COMMENT '多长时间内的推送' AFTER `IS_DELETED`; - --- ---------------------------- --- TABLE STRUCTURE FOR HZIMS_WS_CONFIG --- ---------------------------- -CREATE TABLE IF NOT EXISTS `HZIMS_WS_CONFIG` ( - `ID` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID', - `BUSINESS_KEY` VARCHAR(100) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '业务关键字', - `BUSINESS_CLASSIFY` VARCHAR(100) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '业务分类。系统通知:SYSTEM,事务消息:BUSINESS,日常提醒:DAILYREMIND,巡检消息:INSPECT', - `TYPE` TINYINT(4) NULL DEFAULT NULL COMMENT '消息类型', - `SUBJECT` VARCHAR(255) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '主题', - `CONTENT` VARCHAR(1000) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '内容', - `PUSHERS` VARCHAR(255) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '推送人', - `IS_ALL` TINYINT(4) NULL DEFAULT NULL COMMENT '是否推送在线用户;1:推送在线用户,0:指定用户推送', - `TENANT_ID` VARCHAR(12) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NOT NULL COMMENT '租户ID', - `CREATE_DEPT` BIGINT(20) NULL DEFAULT NULL COMMENT '创建单位', - `CREATE_USER` BIGINT(20) NOT NULL COMMENT '创建人', - `CREATE_TIME` DATETIME NOT NULL COMMENT '创建时间', - `UPDATE_USER` BIGINT(20) NULL DEFAULT NULL COMMENT '修改人', - `UPDATE_TIME` DATETIME NULL DEFAULT NULL COMMENT '修改时间', - `STATUS` TINYINT(4) NULL DEFAULT NULL COMMENT '业务状态', - `IS_DELETED` TINYINT(4) NOT NULL DEFAULT 0 COMMENT '是否删除 0-正常 1-删除', - `DURATION` MEDIUMINT(9) NULL DEFAULT NULL COMMENT '多长时间内的推送', - `TIME_UNIT` VARCHAR(50) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '时间单位', - PRIMARY KEY (`ID`) USING BTREE -) ENGINE = INNODB AUTO_INCREMENT = 1533986977405845507 CHARACTER SET = UTF8 COLLATE = UTF8_GENERAL_CI ROW_FORMAT = DYNAMIC; \ No newline at end of file diff --git a/hzims-service/message/src/main/resources/db/2.0.0.sql b/hzims-service/message/src/main/resources/db/2.0.0.sql deleted file mode 100644 index ac22225..0000000 --- a/hzims-service/message/src/main/resources/db/2.0.0.sql +++ /dev/null @@ -1,2 +0,0 @@ -alter table `hzims_message_push_record` add column `fault_result` varchar(1000) comment '推送失败信息'; -alter table `hzims_message_push_record` MODIFY `TASK_ID` BIGINT(20) NULL; \ No newline at end of file diff --git a/hzims-service/message/src/main/resources/dict/dict.sql b/hzims-service/message/src/main/resources/dict/dict.sql deleted file mode 100644 index a8ac9cc..0000000 --- a/hzims-service/message/src/main/resources/dict/dict.sql +++ /dev/null @@ -1,28 +0,0 @@ -INSERT INTO `BLADEX`.`BLADE_DICT` (`ID`, `PARENT_ID`, `CODE`, `DICT_KEY`, `DICT_VALUE`, `SORT`, `REMARK`, `IS_SEALED`, `IS_DELETED`, `DICT_TYPE`, `APP_ID`, `APP_CODE`) VALUES (1412293116405358593, 0, 'MESSAGECLASSIFY', '-1', '消息业务分类', 200, '', 0, 0, 0, -1, 'HZIMS-MESSAGE'); -INSERT INTO `BLADEX`.`BLADE_DICT` (`ID`, `PARENT_ID`, `CODE`, `DICT_KEY`, `DICT_VALUE`, `SORT`, `REMARK`, `IS_SEALED`, `IS_DELETED`, `DICT_TYPE`, `APP_ID`, `APP_CODE`) VALUES (1532279291869634562, 0, 'BUSINESSCLASSIFY', '-1', '业务分类', 101, '', 0, 0, 0, -1, 'HZIMS-MESSAGE'); -INSERT INTO `BLADEX`.`BLADE_DICT` (`ID`, `PARENT_ID`, `CODE`, `DICT_KEY`, `DICT_VALUE`, `SORT`, `REMARK`, `IS_SEALED`, `IS_DELETED`, `DICT_TYPE`, `APP_ID`, `APP_CODE`) VALUES (1532279476934909953, 1532279291869634562, 'BUSINESSCLASSIFY', 'SYSTEM', '系统通知', 1, '', 0, 0, 0, -1, 'HZIMS-MESSAGE'); -INSERT INTO `BLADEX`.`BLADE_DICT` (`ID`, `PARENT_ID`, `CODE`, `DICT_KEY`, `DICT_VALUE`, `SORT`, `REMARK`, `IS_SEALED`, `IS_DELETED`, `DICT_TYPE`, `APP_ID`, `APP_CODE`) VALUES (1532281503811346433, 1532279291869634562, 'BUSINESSCLASSIFY', 'BUSINESS', '事务消息', 2, '', 0, 0, 0, -1, 'HZIMS-MESSAGE'); -INSERT INTO `BLADEX`.`BLADE_DICT` (`ID`, `PARENT_ID`, `CODE`, `DICT_KEY`, `DICT_VALUE`, `SORT`, `REMARK`, `IS_SEALED`, `IS_DELETED`, `DICT_TYPE`, `APP_ID`, `APP_CODE`) VALUES (1532281763979829249, 1532279291869634562, 'BUSINESSCLASSIFY', 'DAILYREMIND', '日常提醒', 3, '', 0, 0, 0, -1, 'HZIMS-MESSAGE'); -INSERT INTO `BLADEX`.`BLADE_DICT` (`ID`, `PARENT_ID`, `CODE`, `DICT_KEY`, `DICT_VALUE`, `SORT`, `REMARK`, `IS_SEALED`, `IS_DELETED`, `DICT_TYPE`, `APP_ID`, `APP_CODE`) VALUES (1532281877184094210, 1532279291869634562, 'BUSINESSCLASSIFY', 'INSPECT', '巡检消息', 4, '', 0, 0, 0, -1, 'HZIMS-MESSAGE'); -INSERT INTO `BLADEX`.`BLADE_DICT` (`ID`, `PARENT_ID`, `CODE`, `DICT_KEY`, `DICT_VALUE`, `SORT`, `REMARK`, `IS_SEALED`, `IS_DELETED`, `DICT_TYPE`, `APP_ID`, `APP_CODE`) VALUES (1592363904612401154, 0, 'TIMEUNIT', '-1', '消息推送时间单位', 3, '', 0, 0, 0, -1, 'HZIMS-MESSAGE'); -INSERT INTO `BLADEX`.`BLADE_DICT` (`ID`, `PARENT_ID`, `CODE`, `DICT_KEY`, `DICT_VALUE`, `SORT`, `REMARK`, `IS_SEALED`, `IS_DELETED`, `DICT_TYPE`, `APP_ID`, `APP_CODE`) VALUES (1592364310415507458, 1592363904612401154, 'TIMEUNIT', 'YEAR', '年', 1, '', 0, 0, 0, -1, 'HZIMS-MESSAGE'); -INSERT INTO `BLADEX`.`BLADE_DICT` (`ID`, `PARENT_ID`, `CODE`, `DICT_KEY`, `DICT_VALUE`, `SORT`, `REMARK`, `IS_SEALED`, `IS_DELETED`, `DICT_TYPE`, `APP_ID`, `APP_CODE`) VALUES (1592364366254276609, 1592363904612401154, 'TIMEUNIT', 'MONTH', '月', 2, '', 0, 0, 0, -1, 'HZIMS-MESSAGE'); -INSERT INTO `BLADEX`.`BLADE_DICT` (`ID`, `PARENT_ID`, `CODE`, `DICT_KEY`, `DICT_VALUE`, `SORT`, `REMARK`, `IS_SEALED`, `IS_DELETED`, `DICT_TYPE`, `APP_ID`, `APP_CODE`) VALUES (1592364421291933697, 1592363904612401154, 'TIMEUNIT', 'DAY', '日', 3, '', 0, 0, 0, -1, 'HZIMS-MESSAGE'); -INSERT INTO `BLADEX`.`BLADE_DICT` (`ID`, `PARENT_ID`, `CODE`, `DICT_KEY`, `DICT_VALUE`, `SORT`, `REMARK`, `IS_SEALED`, `IS_DELETED`, `DICT_TYPE`, `APP_ID`, `APP_CODE`) VALUES (1592364497384996866, 1592363904612401154, 'TIMEUNIT', 'HOUR', '时', 4, '', 0, 0, 0, -1, 'HZIMS-MESSAGE'); -INSERT INTO `BLADEX`.`BLADE_DICT` (`ID`, `PARENT_ID`, `CODE`, `DICT_KEY`, `DICT_VALUE`, `SORT`, `REMARK`, `IS_SEALED`, `IS_DELETED`, `DICT_TYPE`, `APP_ID`, `APP_CODE`) VALUES (1592364546408022017, 1592363904612401154, 'TIMEUNIT', 'MINUTER', '分', 5, '', 0, 0, 0, -1, 'HZIMS-MESSAGE'); -INSERT INTO `BLADEX`.`BLADE_DICT` (`ID`, `PARENT_ID`, `CODE`, `DICT_KEY`, `DICT_VALUE`, `SORT`, `REMARK`, `IS_SEALED`, `IS_DELETED`, `DICT_TYPE`, `APP_ID`, `APP_CODE`) VALUES (1592364625483235329, 1592363904612401154, 'TIMEUNIT', 'SECOND', '秒', 6, '', 0, 0, 0, -1, 'HZIMS-MESSAGE'); -INSERT INTO `BLADEX`.`BLADE_DICT` (`ID`, `PARENT_ID`, `CODE`, `DICT_KEY`, `DICT_VALUE`, `SORT`, `REMARK`, `IS_SEALED`, `IS_DELETED`, `DICT_TYPE`, `APP_ID`, `APP_CODE`) VALUES (1643863738239016961, 0, 'MESSAGETYPE', '-1', '消息类型', 4, '', 0, 0, 0, -1, 'HZIMS-MESSAGE'); -INSERT INTO `BLADEX`.`BLADE_DICT` (`ID`, `PARENT_ID`, `CODE`, `DICT_KEY`, `DICT_VALUE`, `SORT`, `REMARK`, `IS_SEALED`, `IS_DELETED`, `DICT_TYPE`, `APP_ID`, `APP_CODE`) VALUES (1643864073741393922, 1643863738239016961, 'MESSAGETYPE', 'APPPUSH', 'APP推送', 1, '', 0, 0, 0, -1, 'HZIMS-MESSAGE'); -INSERT INTO `BLADEX`.`BLADE_DICT` (`ID`, `PARENT_ID`, `CODE`, `DICT_KEY`, `DICT_VALUE`, `SORT`, `REMARK`, `IS_SEALED`, `IS_DELETED`, `DICT_TYPE`, `APP_ID`, `APP_CODE`) VALUES (1643864127436873730, 1643863738239016961, 'MESSAGETYPE', 'SMSPUSH', '短信推送', 2, '', 0, 0, 0, -1, 'HZIMS-MESSAGE'); -INSERT INTO `BLADEX`.`BLADE_DICT` (`ID`, `PARENT_ID`, `CODE`, `DICT_KEY`, `DICT_VALUE`, `SORT`, `REMARK`, `IS_SEALED`, `IS_DELETED`, `DICT_TYPE`, `APP_ID`, `APP_CODE`) VALUES (1643864182193512450, 1643863738239016961, 'MESSAGETYPE', 'WEBSOCKETPUSH', 'WEB推送', 3, '', 0, 0, 0, -1, 'HZIMS-MESSAGE'); -INSERT INTO `BLADEX`.`BLADE_DICT` (`ID`, `PARENT_ID`, `CODE`, `DICT_KEY`, `DICT_VALUE`, `SORT`, `REMARK`, `IS_SEALED`, `IS_DELETED`, `DICT_TYPE`, `APP_ID`, `APP_CODE`) VALUES (1643864236228730881, 1643863738239016961, 'MESSAGETYPE', 'MAILPUSH', '邮件推送', 4, '', 0, 0, 0, -1, 'HZIMS-MESSAGE'); -INSERT INTO `BLADEX`.`BLADE_DICT` (`ID`, `PARENT_ID`, `CODE`, `DICT_KEY`, `DICT_VALUE`, `SORT`, `REMARK`, `IS_SEALED`, `IS_DELETED`, `DICT_TYPE`, `APP_ID`, `APP_CODE`) VALUES (1644519305194332162, 0, 'MESSAGESTATUS', '-1', '消息状态', 118, '', 0, 0, 0, -1, 'HZIMS-MESSAGE'); -INSERT INTO `BLADEX`.`BLADE_DICT` (`ID`, `PARENT_ID`, `CODE`, `DICT_KEY`, `DICT_VALUE`, `SORT`, `REMARK`, `IS_SEALED`, `IS_DELETED`, `DICT_TYPE`, `APP_ID`, `APP_CODE`) VALUES (1644519463822909442, 1644519305194332162, 'MESSAGESTATUS', '0', '未推送', 1, '', 0, 0, 0, -1, 'HZIMS-MESSAGE'); -INSERT INTO `BLADEX`.`BLADE_DICT` (`ID`, `PARENT_ID`, `CODE`, `DICT_KEY`, `DICT_VALUE`, `SORT`, `REMARK`, `IS_SEALED`, `IS_DELETED`, `DICT_TYPE`, `APP_ID`, `APP_CODE`) VALUES (1644519505505902594, 1644519305194332162, 'MESSAGESTATUS', '1', '推送成功', 2, '', 0, 0, 0, -1, 'HZIMS-MESSAGE'); -INSERT INTO `BLADEX`.`BLADE_DICT` (`ID`, `PARENT_ID`, `CODE`, `DICT_KEY`, `DICT_VALUE`, `SORT`, `REMARK`, `IS_SEALED`, `IS_DELETED`, `DICT_TYPE`, `APP_ID`, `APP_CODE`) VALUES (1644519587701678081, 1644519305194332162, 'MESSAGESTATUS', '2', '推送失败', 3, '', 0, 0, 0, -1, 'HZIMS-MESSAGE'); -INSERT INTO `BLADEX`.`BLADE_DICT` (`ID`, `PARENT_ID`, `CODE`, `DICT_KEY`, `DICT_VALUE`, `SORT`, `REMARK`, `IS_SEALED`, `IS_DELETED`, `DICT_TYPE`, `APP_ID`, `APP_CODE`) VALUES (1644519736347811841, 1644519305194332162, 'MESSAGESTATUS', '3', '已确认', 4, '', 0, 0, 0, -1, 'HZIMS-MESSAGE'); -INSERT INTO `BLADEX`.`BLADE_DICT` (`ID`, `PARENT_ID`, `CODE`, `DICT_KEY`, `DICT_VALUE`, `SORT`, `REMARK`, `IS_SEALED`, `IS_DELETED`, `DICT_TYPE`, `APP_ID`, `APP_CODE`) VALUES (1646311806007861249, 1532279291869634562, 'BUSINESSCLASSIFY', 'WARNING', '告警消息', 5, '', 0, 0, 0, -1, 'HZIMS-MESSAGE'); -INSERT INTO `BLADEX`.`BLADE_DICT` (`ID`, `PARENT_ID`, `CODE`, `DICT_KEY`, `DICT_VALUE`, `SORT`, `REMARK`, `IS_SEALED`, `IS_DELETED`, `DICT_TYPE`, `APP_ID`, `APP_CODE`) VALUES (1646696048818679809, 1532279291869634562, 'BUSINESSCLASSIFY', 'DUTY', '值班消息', 6, '', 0, 0, 0, -1, 'HZIMS-MESSAGE'); -INSERT INTO `BLADEX`.`BLADE_DICT` (`ID`, `PARENT_ID`, `CODE`, `DICT_KEY`, `DICT_VALUE`, `SORT`, `REMARK`, `IS_SEALED`, `IS_DELETED`, `DICT_TYPE`, `APP_ID`, `APP_CODE`) VALUES (1646696133489094658, 1532279291869634562, 'BUSINESSCLASSIFY', 'SAFE', '安全消息', 7, '', 0, 0, 0, -1, 'HZIMS-MESSAGE'); -INSERT INTO `BLADEX`.`BLADE_DICT` (`ID`, `PARENT_ID`, `CODE`, `DICT_KEY`, `DICT_VALUE`, `SORT`, `REMARK`, `IS_SEALED`, `IS_DELETED`, `DICT_TYPE`, `APP_ID`, `APP_CODE`) VALUES (1646697275589685249, 1532279291869634562, 'BUSINESSCLASSIFY', 'ACCESS', '检修消息', 8, '', 0, 0, 0, -1, 'HZIMS-MESSAGE'); -INSERT INTO `BLADEX`.`BLADE_DICT` (`ID`, `PARENT_ID`, `CODE`, `DICT_KEY`, `DICT_VALUE`, `SORT`, `REMARK`, `IS_SEALED`, `IS_DELETED`, `DICT_TYPE`, `APP_ID`, `APP_CODE`) VALUES (1687006487674667010, 1412293116405358593, 'MESSAGECLASSIFY', 'ASSETS', '资产管理', 9, '', 0, 0, 0, -1, 'HZIMS-MESSAGE'); diff --git a/hzims-service/message/src/main/resources/template/template.yml b/hzims-service/message/src/main/resources/template/template.yml deleted file mode 100644 index 63d6bc0..0000000 --- a/hzims-service/message/src/main/resources/template/template.yml +++ /dev/null @@ -1,75 +0,0 @@ -#服务器端口 -server: - port: 8215 - -#oss配置 -oss: - endpoint: "${hzinfo.oss.endpoint}" - access-key: "${hzinfo.oss.access-key}" - secret-key: "${hzinfo.oss.secret-key}" - -#数据源配置 -spring: - #排除DruidDataSourceAutoConfigure - autoconfigure: - exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure - datasource: - dynamic: - #设置默认的数据源或者数据源组,默认值即为master - primary: master - datasource: - master: - url: jdbc:mysql://${hzinfo.db.busines.ip}:${hzinfo.db.busines.port}/prod_hzims_message?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&tinyInt1isBit=false&allowMultiQueries=true&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true - username: ${hzinfo.db.busines.username} - password: ${hzinfo.db.busines.password} - mail: - enabled: true - host: "smtp.qq.com" - username: "503684646@qq.com" - password: "vfqsqlojaiqrbjgj" - port: 587 - default-encoding: "UTF-8" - properties: - mail: - smtp: - socketFactoryClass: "javax.net.ssl.SSLSocketFactory" - debug: false -# -# datasource: -# url: "jdbc:mysql://${hzinfo.db.busines.ip}:${hzinfo.db.busines.port}/hzims?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true" -# username: "${hzinfo.db.busines.username}" -# password: "${hzinfo.db.busines.password}" - - -#mybatis-plus配置 -mybatis-plus: - mapper-locations: classpath:com/hnac/hzims/**/mapper/*Mapper.xml - #实体扫描,多个package用逗号或者分号分隔 - typeAliasesPackage: com.hnac.hzims.**.entity - -#swagger扫描路径配置 -swagger: - base-packages: com.hnac.hzims.message,org.springbalde,com.hnac - -xxl: - job: - accessToken: '' - admin: - addresses: "http://${hzims.server.ip}:7009/xxl-job-admin" - executor: - appname: hzims-message - ip: "${hzims.server.ip}" - logpath: /data/applogs/xxl-job/jobhandler - logretentiondays: -1 - port: 28215 - - -hzims: - # 推送策略 - push-strategy: - concentrateDuration: 10 - concentrateUnit: minuter - message: - redis-key: - # APP消息推送记录存入redis的key - app-push: hzims:message:appPush \ No newline at end of file diff --git a/hzims-service/operational/pom.xml b/hzims-service/operational/pom.xml index f542203..6f51eae 100644 --- a/hzims-service/operational/pom.xml +++ b/hzims-service/operational/pom.xml @@ -55,10 +55,6 @@ com.hnac.hzims - message-api - - - com.hnac.hzims ticket-api diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/AccessPlanV4ServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/AccessPlanV4ServiceImpl.java index 8a7147c..99fd9b3 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/AccessPlanV4ServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/AccessPlanV4ServiceImpl.java @@ -7,9 +7,6 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.hnac.hzims.common.logs.utils.StringUtils; -import com.hnac.hzims.message.MessageConstants; -import com.hnac.hzims.message.dto.BusinessMessageDTO; -import com.hnac.hzims.message.fegin.IMessageClient; import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse; import com.hnac.hzims.operational.access.constants.AccessConstants; import com.hnac.hzims.operational.access.dto.*; @@ -41,6 +38,9 @@ import org.springblade.flow.core.entity.BladeFlow; import org.springblade.flow.core.feign.IFlowClient; import org.springblade.flow.core.utils.FlowUtil; import org.springblade.flow.core.utils.TaskUtil; +import org.springblade.message.MessageConstants; +import org.springblade.message.dto.BusinessMessageDTO; +import org.springblade.message.fegin.IMessageClient; import org.springblade.system.feign.ISysClient; import org.springblade.system.user.cache.UserCache; import org.springblade.system.user.entity.User; diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/AccessTaskV4ServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/AccessTaskV4ServiceImpl.java index b46179f..18cbe09 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/AccessTaskV4ServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/AccessTaskV4ServiceImpl.java @@ -1,14 +1,10 @@ package com.hnac.hzims.operational.access.service.impl; -import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.TypeReference; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.hnac.hzims.common.logs.utils.StringUtils; -import com.hnac.hzims.message.MessageConstants; -import com.hnac.hzims.message.dto.BusinessMessageDTO; -import com.hnac.hzims.message.fegin.IMessageClient; import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse; import com.hnac.hzims.operational.access.dto.AccessTaskV4DTO; import com.hnac.hzims.operational.access.dto.OperAccessStatisticsDTO; @@ -37,6 +33,9 @@ import org.springblade.flow.core.entity.BladeFlow; import org.springblade.flow.core.feign.IFlowClient; import org.springblade.flow.core.utils.FlowUtil; import org.springblade.flow.core.utils.TaskUtil; +import org.springblade.message.MessageConstants; +import org.springblade.message.dto.BusinessMessageDTO; +import org.springblade.message.fegin.IMessageClient; import org.springblade.system.feign.ISysClient; import org.springblade.system.user.cache.UserCache; import org.springblade.system.user.entity.User; diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/OperAccessPlanServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/OperAccessPlanServiceImpl.java index 003595c..184304c 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/OperAccessPlanServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/OperAccessPlanServiceImpl.java @@ -1,14 +1,13 @@ package com.hnac.hzims.operational.access.service.impl; -import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.hnac.hzims.common.logs.utils.StringUtils; import com.hnac.hzims.equipment.feign.IEmInfoClient; -import com.hnac.hzims.message.req.PushExtrasReq; import com.hnac.hzims.operational.access.constants.AccessConstants; import com.hnac.hzims.operational.access.dto.*; import com.hnac.hzims.operational.access.entity.*; @@ -33,10 +32,8 @@ import com.hnac.hzims.ticket.workTicket.entity.WorkTicketTemplateEntity; import com.hnac.hzims.ticket.workTicket.feign.IWorkTicketTemplateClient; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; - import org.apache.commons.lang3.RandomUtils; import org.springblade.core.log.exception.ServiceException; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Query; import org.springblade.core.secure.utils.AuthUtil; @@ -537,36 +534,6 @@ public class OperAccessPlanServiceImpl extends ServiceImpl> rRoleAlias = userClient.userListByRoleAlias("200000",role); - log.info("消息发送人:{}", JSON.toJSONString(rRoleAlias)); - if(rRoleAlias.isSuccess()){ - List userList = rRoleAlias.getData(); - userList.forEach(user -> { - //messagePushClient.sendMessage(user.getId().toString(),pushExtrasReq); - }); - } - } - } - - - /** * 检修计划开票 * @param entity 檢修計劃 * @param templateEntity 工作票模板 diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/controller/DeviceDataController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/controller/DeviceDataController.java index 89e98c5..a448691 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/controller/DeviceDataController.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/controller/DeviceDataController.java @@ -42,11 +42,4 @@ public class DeviceDataController { public R> history(AnalyzeDataCondition analyzeDataCondition) { return service.history(analyzeDataCondition); } - - @ApiOperation("微信消息推送测试") - @PostMapping("/sendWxMessage") - @ApiOperationSupport(order = 1) - public R sendWxMessage() { - return service.sendWxMessage(); - } } \ No newline at end of file diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/DeviceDataService.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/DeviceDataService.java index c69fe0a..d82e126 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/DeviceDataService.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/DeviceDataService.java @@ -1,7 +1,6 @@ package com.hnac.hzims.operational.census.service; -import com.hnac.hzims.operational.census.vo.RealVo; import com.hnac.hzinfo.datasearch.analyse.domain.AnalyzeDataCondition; import com.hnac.hzinfo.datasearch.analyse.domain.AnalyzeDataList; import com.hnac.hzinfo.datasearch.analyse.domain.FieldsData; @@ -19,6 +18,4 @@ public interface DeviceDataService { R> real(RealDataSearchPO search); R> history(AnalyzeDataCondition analyzeDataCondition); - - R sendWxMessage(); } \ No newline at end of file diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/impl/DeviceDataServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/impl/DeviceDataServiceImpl.java index b7a4e7b..1f0dc70 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/impl/DeviceDataServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/impl/DeviceDataServiceImpl.java @@ -1,10 +1,6 @@ package com.hnac.hzims.operational.census.service.impl; -import com.hnac.hzims.message.dto.WxMessageDTO; -import com.hnac.hzims.message.fegin.IMessageClient; import com.hnac.hzims.operational.census.service.DeviceDataService; -import com.hnac.hzims.operational.census.vo.RealVo; -import com.hnac.hzinfo.datasearch.PointData; import com.hnac.hzinfo.datasearch.analyse.domain.AnalyzeDataCondition; import com.hnac.hzinfo.datasearch.analyse.domain.AnalyzeDataList; import com.hnac.hzinfo.datasearch.analyse.domain.FieldsData; @@ -13,25 +9,13 @@ import com.hnac.hzinfo.datasearch.real.po.RealDataSearchPO; import com.hnac.hzinfo.sdk.analyse.AnalyseDataSearchClient; import com.hnac.hzinfo.sdk.core.response.HzPage; import com.hnac.hzinfo.sdk.core.response.Result; -import io.swagger.annotations.ApiModelProperty; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import org.apache.commons.collections4.MapUtils; import org.springblade.core.log.exception.ServiceException; -import org.springblade.core.mp.support.QueryField; -import org.springblade.core.mp.support.SqlCondition; import org.springblade.core.tool.api.R; -import org.springblade.core.tool.utils.CollectionUtil; -import org.springblade.core.tool.utils.StringUtil; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Service; -import javax.validation.constraints.NotNull; -import java.util.HashMap; import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; /** * @author ysj @@ -45,8 +29,6 @@ public class DeviceDataServiceImpl implements DeviceDataService { private final AnalyseDataSearchClient analyseDataSearchClient; - private final IMessageClient messageClient; - /** * 实时数据 * @param search @@ -72,44 +54,4 @@ public class DeviceDataServiceImpl implements DeviceDataService { Result> result = analyseDataSearchClient.getAnalyzeDataByAnalyzeCode(analyzeDataCondition); return R.data(result.getData()); } - - /** - * 微信消息推送测试 - * @return - */ - @Override - public R sendWxMessage() { - WxMessageDTO message = new WxMessageDTO(); - // 模板Id - message.setTemplateId("hIgINCsjpG-gyCKh8wzwBWjR-hkbjkNLFTXQEsnR_Z8"); - // 微信消息跳转地址 - message.setSkipUrl("http://baidu.com"); - // 机构Id - message.setDeptId(200000010709L); - // 业务关键字 - message.setBusinessKey("wx_message_test"); - // 业务分类关键字 - message.setBusinessClassify("wx_message_test"); - // 任务Id - message.setTaskId(1686044105416650753L); - // 微信参数键值对 - HashMap map = new HashMap<>(); - map.put("thing18","云南维西拉波洛水电站"); - map.put("thing5","1号机组"); - map.put("thing11","拉波洛电站数据_1号机组PLC.(D182)机组故障_分"); - map.put("thing14","故障"); - map.put("time2","2023-08-28 16:08:19"); - message.setMap(map); - // 消息内容 - message.setContent("杨胜军在测试微信消息推送"); - // 消息主题 - message.setSubject("微信公众号推送消息测试"); - // 推送用户 - message.setUserIds("1678930425282785281,1696056255481344002,1696073993931157505"); - // 创建用户 - message.setCreateUser(1394936547620040706L); - // 租户Id - message.setTenantId("200000"); - return messageClient.sendWxMessage(message); - } } \ No newline at end of file diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/DefectCheckServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/DefectCheckServiceImpl.java index 8e916a1..4c48585 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/DefectCheckServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/DefectCheckServiceImpl.java @@ -8,9 +8,6 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.hnac.hzims.common.logs.utils.StringUtils; -import com.hnac.hzims.message.MessageConstants; -import com.hnac.hzims.message.dto.BusinessMessageDTO; -import com.hnac.hzims.message.fegin.IMessageClient; import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse; import com.hnac.hzims.operational.defect.constants.TreatMethodConstant; import com.hnac.hzims.operational.defect.entity.OperAppearanceEntity; @@ -39,6 +36,9 @@ import org.springblade.core.tool.utils.ObjectUtil; import org.springblade.flow.core.entity.BladeFlow; import org.springblade.flow.core.feign.IFlowClient; import org.springblade.flow.core.utils.FlowUtil; +import org.springblade.message.MessageConstants; +import org.springblade.message.dto.BusinessMessageDTO; +import org.springblade.message.fegin.IMessageClient; import org.springblade.system.cache.DictCache; import org.springblade.system.feign.ISysClient; import org.springblade.system.user.cache.UserCache; diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/scheduled/DutyRecCreateTask.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/scheduled/DutyRecCreateTask.java index 54fa3fd..8e6bc50 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/scheduled/DutyRecCreateTask.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/scheduled/DutyRecCreateTask.java @@ -16,17 +16,6 @@ public class DutyRecCreateTask { @Autowired private IImsDutyRecService recService; - /** - * 交接班消息提醒 - * - * @return - * @throws Exception - */ -// @XxlJob(TASK_VALUE_MESSAGE_REMINDING_CREATE) -// public ReturnT messageRemonding(String param) throws Exception { -// recService.messageRemonding(); -// return new ReturnT<>("SUCCESS"); -// } @XxlJob(TASK_VALUE_MESSAGE_REMINDING_CREATE) public ReturnT messageRemondingV2(String param) throws Exception { @@ -34,5 +23,4 @@ public class DutyRecCreateTask { return new ReturnT<>("SUCCESS"); } - } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyRecServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyRecServiceImpl.java index 1c77997..2ec88ae 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyRecServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyRecServiceImpl.java @@ -9,10 +9,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.google.common.collect.Lists; -import com.hnac.hzims.message.MessageConstants; -import com.hnac.hzims.message.dto.MessagePushRecordDto; -import com.hnac.hzims.message.fegin.IMessageClient; -import com.hnac.hzims.message.req.PushExtrasReq; import com.hnac.hzims.monitor.utils.DateUtils; import com.hnac.hzims.operational.OperationalConstants; import com.hnac.hzims.operational.duty.DutyContants; @@ -50,6 +46,9 @@ import org.springblade.flow.core.constant.ProcessConstant; import org.springblade.flow.core.entity.BladeFlow; import org.springblade.flow.core.feign.IFlowClient; import org.springblade.flow.core.utils.TaskUtil; +import org.springblade.message.MessageConstants; +import org.springblade.message.dto.MessagePushRecordDto; +import org.springblade.message.fegin.IMessageClient; import org.springblade.system.feign.ISysClient; import org.springblade.system.user.cache.UserCache; import org.springblade.system.user.entity.User; @@ -334,18 +333,10 @@ public class ImsDutyRecServiceImpl extends ServiceImpl userR = userClient.userInfoById(handGroupManagerId); if (userR.isSuccess()) { String userName = ""; - PushExtrasReq req = new PushExtrasReq(); - log.info("--------------------------req:" + req, groupEntityManagerId, userName, date); if (ObjectUtil.isNotEmpty(userR.getData()) && StringUtil.isNotBlank(userR.getData().getRealName())) { userName = userR.getData().getRealName(); - log.info("--------------------------req2:" + req, groupEntityManagerId, userName, date); } String format = DateUtil.format(date, PATTERN_DATETIME); - /*remondingCarry(req, OperationalConstants.RecTypeEnum.HAND_REMIND.getVal(), - groupEntity.getManagerId(), userName, null, - format, groupEntity.getTenantId(), groupEntity.getCreateDept(), groupEntity.getCreateUser());*/ - log.info("--------------------------req3:" + req, groupEntityManagerId, userName, date); - } } @@ -630,120 +621,6 @@ public class ImsDutyRecServiceImpl extends ServiceImpl list = imsDutyMainService.list(new LambdaQueryWrapper() {{ - eq(ImsDutyMainEntity::getStatus, JoinStatus.DUTY_ING.getStatus()); - }}); - if (CollectionUtil.isNotEmpty(list)) { - for (ImsDutyMainEntity entity : list) { - ImsDutyGroupEntity groupEntity = imsDutyGroupService.getById(entity.getDutyGroupId()); - ImsDutyClassEntity classEntity = imsDutyClassService.getById(entity.getClassId()); - if (ObjectUtil.isNotEmpty(groupEntity) && ObjectUtil.isNotEmpty(classEntity)) { - String userName = ""; - if (null != groupEntity.getManagerId()) { - userName = userClient.userInfoById(groupEntity.getManagerId()).getData().getName(); - } - PushExtrasReq req = new PushExtrasReq(); - if (null != entity.getPreDutyId()) { - ImsDutyRecEntity one = this.getOne(new LambdaQueryWrapper() {{ - eq(ImsDutyRecEntity::getDutyId, entity.getId()); - }}); - ImsDutyMainEntity carryMainentity = imsDutyMainService.getOne(new LambdaQueryWrapper() {{ - eq(ImsDutyMainEntity::getPreDutyId, entity.getPreDutyId()); - }}); - ImsDutyGroupEntity carryGroupEntity = imsDutyGroupService.getById(carryMainentity.getDutyGroupId()); - if (ObjectUtil.isEmpty(one)) { - String format = DateUtil.format(entity.getDutyDate(), DateUtil.PATTERN_DATE); - format += " " + classEntity.getEndTime(); - Long differMinute = DateUtils.getDifferMinute(format); - if (differMinute == -15) { // 提醒交班 - remondingHead(req, OperationalConstants.RecTypeEnum.HAND_REMIND.getVal(), groupEntity.getManagerId()); - } else if (differMinute == 1) {//延时交班提醒 - //提醒站长 接班人 交班人 - Long admin = userClient.userByAccount(entity.getTenantId(), "admin").getData().getId(); - remondingStation(req, admin, userName, classEntity);//提醒站长 - remondingCarry(req, OperationalConstants.RecTypeEnum.HAND_DELAY.getVal(), carryGroupEntity.getManagerId(), userName, classEntity, null);//提醒接班人 - remondingHead(req, OperationalConstants.RecTypeEnum.HAND_DELAY.getVal(), groupEntity.getManagerId());//提醒交班人 - } - } else { - ImsDutyClassEntity classEntity1 = imsDutyClassService.getById(carryMainentity.getClassId()); - String format = DateUtil.format(carryMainentity.getDutyDate(), DateUtil.PATTERN_DATE); - format += " " + classEntity1.getStartTime(); - Long differMinute = DateUtils.getDifferMinute(format); - if (differMinute > 0 && one.getDelayStatus() == 0) { - ImsDutyGroupEntity groupEntity1 = imsDutyGroupService.getById(carryMainentity.getDutyGroupId()); - //提醒站长 接班人 交班人 - Long admin = userClient.userByAccount(entity.getTenantId(), "admin").getData().getId(); - remondingStation(req, admin, groupEntity1.getManagerId().toString(), classEntity);//提醒站长 - remondingCarry(req, 2, carryGroupEntity.getManagerId(), groupEntity1.getManagerId().toString(), classEntity, null);//提醒接班人 - } - } - } - } - } - } - }*/ - - - /** - * 消息提醒 - */ - //20230414已弃用,改用V2 -// @Override -// public void messageRemonding() { -// List list = imsDutyMainService.list(new LambdaQueryWrapper() {{ -// eq(ImsDutyMainEntity::getStatus, JoinStatus.DUTY_ING.getStatus()); -// }}); -// if (CollectionUtil.isNotEmpty(list)) { -// for (ImsDutyMainEntity entity : list) { -// ImsDutyGroupEntity groupEntity = imsDutyGroupService.getById(entity.getDutyGroupId()); -// ImsDutyClassEntity classEntity = imsDutyClassService.getById(entity.getClassId()); -// if (ObjectUtil.isNotEmpty(groupEntity) && ObjectUtil.isNotEmpty(classEntity)) { -// String userName = ""; -// if (null != groupEntity.getManagerId()) { -// userName = userClient.userInfoById(groupEntity.getManagerId()).getData().getName(); -// } -// PushExtrasReq req = new PushExtrasReq(); -// if (null != entity.getPreDutyId()) { -// ImsDutyRecEntity one = this.getOne(new LambdaQueryWrapper() {{ -// eq(ImsDutyRecEntity::getDutyId, entity.getId()); -// }}); -// ImsDutyMainEntity carryMainentity = imsDutyMainService.getOne(new LambdaQueryWrapper() {{ -// eq(ImsDutyMainEntity::getPreDutyId, entity.getPreDutyId()); -// }}); -// ImsDutyGroupEntity carryGroupEntity = imsDutyGroupService.getById(carryMainentity.getDutyGroupId()); -// if (ObjectUtil.isEmpty(one)) {//未发起交班流程 判断是否提醒交班 -// Long differMinute = DateUtils.getDifferMinute(calculateDate(entity, classEntity, OperationalConstants.DutyRecTypeEnum.HAND_REC.getVal())); -// if (differMinute == -OperationalConstants.MessageRecTypeEnum.HAND_REC_MESSAGE.getVal()) { // 提醒交班 -// remondingHead(req, OperationalConstants.RecTypeEnum.HAND_REMIND.getVal(), groupEntity.getManagerId(), groupEntity.getTenantId(), groupEntity.getCreateDept(), groupEntity.getCreateUser()); -// } else if (differMinute == OperationalConstants.MessageRecTypeEnum.DELAYED_HAND_REC_MESSAGE.getVal()) {//延时交班提醒 -// //提醒站长 接班人 交班人 -// User admin = userClient.userByAccount(entity.getTenantId(), "admin").getData(); -// remondingStation(req, admin, userName, classEntity);//提醒站长 -// remondingCarry(req, OperationalConstants.RecTypeEnum.HAND_DELAY.getVal(), carryGroupEntity.getManagerId(), userName, classEntity, null, carryGroupEntity.getTenantId(), carryGroupEntity.getCreateDept(), carryGroupEntity.getCreateUser());//提醒接班人 -// remondingHead(req, OperationalConstants.RecTypeEnum.HAND_DELAY.getVal(), groupEntity.getManagerId(), groupEntity.getTenantId(), groupEntity.getCreateDept(), groupEntity.getCreateUser());//提醒交班人 -// } -// } else {//已发起接班流程 判断是否提醒接班 -// ImsDutyClassEntity carryClassEntity = imsDutyClassService.getById(carryMainentity.getClassId()); -// Long differMinute = DateUtils.getDifferMinute(calculateDate(carryMainentity, carryClassEntity, OperationalConstants.DutyRecTypeEnum.CARRY_REC.getVal())); -// if (differMinute > 0 && one.getDelayStatus() == 0) { -// ImsDutyGroupEntity groupEntity1 = imsDutyGroupService.getById(carryMainentity.getDutyGroupId()); -// //提醒站长 接班人 交班人 -// User admin = userClient.userByAccount(entity.getTenantId(), "admin").getData(); -// remondingStation(req, admin, groupEntity1.getManagerId().toString(), classEntity);//提醒站长 -// remondingCarry(req, 2, carryGroupEntity.getManagerId(), groupEntity1.getManagerId().toString(), classEntity, null, groupEntity1.getTenantId(), groupEntity1.getCreateDept(), groupEntity1.getCreateUser());//提醒接班人 -// } -// } -// } -// } -// } -// } -// } /** * 消息提醒 @@ -770,7 +647,6 @@ public class ImsDutyRecServiceImpl extends ServiceImpl() {{ eq(ImsDutyRecEntity::getDutyId, entity.getId()); diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AreaMonthReportServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AreaMonthReportServiceImpl.java index 7f3e1cc..02da94f 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AreaMonthReportServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AreaMonthReportServiceImpl.java @@ -8,8 +8,6 @@ import com.hnac.hzims.equipment.entity.PlanGenerationEntity; import com.hnac.hzims.equipment.feign.IEmParamClient; import com.hnac.hzims.equipment.feign.IPlanGenertionClient; import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo; -import com.hnac.hzims.message.dto.MailPushDto; -import com.hnac.hzims.message.fegin.IPushMsgClient; import com.hnac.hzims.operational.defect.constants.TreatMethodConstant; import com.hnac.hzims.operational.defect.entity.OperPhenomenonEntity; import com.hnac.hzims.operational.defect.service.IOperPhenomenonService; @@ -52,6 +50,8 @@ import org.springblade.core.log.exception.ServiceException; import org.springblade.core.mp.base.BaseEntity; import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.*; +import org.springblade.message.dto.MailPushDto; +import org.springblade.message.fegin.IPushMsgClient; import org.springblade.system.entity.Dept; import org.springblade.system.feign.ISysClient; import org.springblade.system.user.entity.User; diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/scheduled/MaintenanceTaskCreateTask.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/scheduled/MaintenanceTaskCreateTask.java index 49415b1..39783f9 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/scheduled/MaintenanceTaskCreateTask.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/scheduled/MaintenanceTaskCreateTask.java @@ -4,9 +4,6 @@ import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.hnac.hzims.common.logs.utils.StringUtils; -import com.hnac.hzims.message.dto.PlanMsgRecordDto; -import com.hnac.hzims.message.entity.config.MessageTemplateEntity; -import com.hnac.hzims.message.fegin.IMessageClient; import com.hnac.hzims.operational.duty.entity.ImsDutyMainEntity; import com.hnac.hzims.operational.duty.service.IImsDutyMainService; import com.hnac.hzims.operational.maintenance.entity.OperMaintenancePlanEntity; @@ -28,6 +25,9 @@ import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.*; import org.springblade.flow.core.entity.BladeFlow; import org.springblade.flow.core.feign.IFlowClient; +import org.springblade.message.dto.PlanMsgRecordDto; +import org.springblade.message.entity.MessageTemplateEntity; +import org.springblade.message.fegin.IMessageClient; import org.springframework.beans.factory.annotation.Value; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.jdbc.datasource.DataSourceTransactionManager; @@ -253,26 +253,10 @@ public class MaintenanceTaskCreateTask { * @return void **/ private void pushTaskMessage(OperMaintenanceTaskEntity taskEntity) { - - - - XxlJobLogger.log("开始保存{}的日常维护消息推送记录",taskEntity.getDisposer()); R templateR = messageClient.getMsgTemplateById(taskEntity.getMessageTemplateId()); if(templateR.isSuccess() && ObjectUtil.isNotEmpty(templateR.getData())) { Func.toLongList(",",taskEntity.getDisposer()).forEach(userId -> { - // MessagePushRecordDto recordDto = BeanUtil.copy(templateR.getData(),MessagePushRecordDto.class); - // recordDto.setTypes(Arrays.asList(Func.split(recordDto.getType(),","))); - // recordDto.setDeptId(taskEntity.getCreateDept()); - // recordDto.setCreateUser(taskEntity.getCreateUser()); - // recordDto.setCreateDept(taskEntity.getCreateDept()); - // ZoneId zoneId = ZoneId.systemDefault(); - // recordDto.setPlanTime(LocalDateTime.ofInstant(taskEntity.getDisposeTime().toInstant(),zoneId)); - // recordDto.setPushType(MessageConstants.PLAN); - // recordDto.setPusher(userId.toString()); - // recordDto.setPusherName(UserCache.getUser(userId).getName()); - // recordDto.setAccount(recordDto.getPusher()); - // recordDto.setContent("距离任务执行时间已不满一小时,请及时处理"); //推送消息 ZoneId zoneId = ZoneId.systemDefault(); PlanMsgRecordDto planMsgRecordDto = new PlanMsgRecordDto(); diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/scheduled/MaintenanceTaskRemindHandler.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/scheduled/MaintenanceTaskRemindHandler.java index 534545f..ef5ad66 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/scheduled/MaintenanceTaskRemindHandler.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/scheduled/MaintenanceTaskRemindHandler.java @@ -2,9 +2,6 @@ package com.hnac.hzims.operational.maintenance.scheduled; import com.google.common.collect.Lists; import com.hnac.hzims.common.constant.CommonConstant; -import com.hnac.hzims.message.MessageConstants; -import com.hnac.hzims.message.dto.BusinessMessageDTO; -import com.hnac.hzims.message.fegin.IMessageClient; import com.hnac.hzims.operational.constants.RedisKeyConstants; import com.hnac.hzims.operational.constants.RoleAliasConstants; import com.hnac.hzims.operational.maintenance.entity.OperMaintenanceTaskEntity; @@ -15,7 +12,13 @@ import com.xxl.job.core.log.XxlJobLogger; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springblade.core.tool.api.R; -import org.springblade.core.tool.utils.*; +import org.springblade.core.tool.utils.CollectionUtil; +import org.springblade.core.tool.utils.DateUtil; +import org.springblade.core.tool.utils.ObjectUtil; +import org.springblade.core.tool.utils.StringUtil; +import org.springblade.message.MessageConstants; +import org.springblade.message.dto.BusinessMessageDTO; +import org.springblade.message.fegin.IMessageClient; import org.springblade.system.user.entity.User; import org.springblade.system.user.feign.IUserClient; import org.springframework.data.redis.core.RedisTemplate; diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/MaintenanceServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/MaintenanceServiceImpl.java index dcb009a..3a62461 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/MaintenanceServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/MaintenanceServiceImpl.java @@ -1,6 +1,5 @@ package com.hnac.hzims.operational.maintenance.service.impl; -import cn.hutool.core.stream.CollectorUtil; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.TypeReference; @@ -10,11 +9,6 @@ import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.hnac.hzims.common.logs.utils.StringUtils; import com.hnac.hzims.common.utils.DateUtil; -import com.hnac.hzims.message.MessageConstants; -import com.hnac.hzims.message.dto.BusinessMessageDTO; -import com.hnac.hzims.message.dto.PlanMsgRecordDto; -import com.hnac.hzims.message.entity.config.MessageTemplateEntity; -import com.hnac.hzims.message.fegin.IMessageClient; import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse; import com.hnac.hzims.operational.duty.entity.ImsDutyMainEntity; import com.hnac.hzims.operational.duty.service.IImsDutyMainService; @@ -29,18 +23,20 @@ import com.hnac.hzims.operational.maintenance.vo.OperMaintenanceTaskEntityVo; import com.hnac.hzims.operational.util.StringObjUtils; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; - import org.apache.commons.lang3.math.NumberUtils; import org.springblade.core.log.exception.ServiceException; -import org.springblade.core.mp.base.BaseEntity; import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.*; import org.springblade.flow.core.feign.IFlowClient; +import org.springblade.message.MessageConstants; +import org.springblade.message.dto.BusinessMessageDTO; +import org.springblade.message.dto.PlanMsgRecordDto; +import org.springblade.message.entity.MessageTemplateEntity; +import org.springblade.message.fegin.IMessageClient; import org.springblade.system.feign.ISysClient; import org.springblade.system.user.cache.UserCache; import org.springblade.system.user.entity.User; import org.springframework.beans.BeanUtils; -import org.springframework.jdbc.datasource.DataSourceTransactionManager; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.Assert; @@ -148,41 +144,6 @@ public class MaintenanceServiceImpl implements MaintenanceService { taskService.updateById(entity); //推送消息 if (response.getTaskId() != null) { - // MessagePushRecordDto message = new MessagePushRecordDto(); - // message.setBusinessClassify("business"); - // message.setBusinessKey(MessageConstants.BusinessClassifyEnum.OPERATIONTICKETMESSAGE.getKey()); - // message.setSubject(MessageConstants.BusinessClassifyEnum.OPERATIONTICKETMESSAGE.getDescription()); - // message.setTaskId(entity.getId()); - // message.setTenantId("200000"); - // message.setTypes(Arrays.asList(MessageConstants.APP_PUSH, MessageConstants.WS_PUSH)); - // message.setPushType(MessageConstants.IMMEDIATELY); - // //您有一张工作票待审批,工作内容:*****,审批环节:*****; - // String countent = - // "您有一条日常维护任务待审批,工作内容:".concat(entity.getTitle()) - // .concat(",审批环节:") - // .concat(response.getTaskName()); - // message.setContent(countent); - // message.setDeptId(entity.getCreateDept()); - // R deptName = sysClient.getDeptName(entity.getCreateDept()); - // if (deptName.isSuccess()) { - // message.setDeptName(deptName.getData()); - // } - // String userIds = response.getUserId(); - // if (com.hnac.hzims.common.logs.utils.StringUtils.isBlank(userIds)) { - // log.error("推送的消息不能为空哦,{}", userIds); - // return; - // } - // String[] split = userIds.split(","); - // for (String userId : split) { - // message.setPusher(userId); - // User user = UserCache.getUser(NumberUtils.toLong(userId)); - // if (ObjectUtils.isNotEmpty(user)) { - // message.setPusherName(user.getName()); - // } - // message.setAccount(userId); - // message.setCreateUser(NumberUtils.toLong(userId)); - // messageClient.sendMessage(message); - // } BusinessMessageDTO businessMessageDTO = new BusinessMessageDTO(); businessMessageDTO.setBusinessClassify("business"); businessMessageDTO.setBusinessKey(MessageConstants.BusinessClassifyEnum.ROUTINEMAINTENANCE.getKey()); diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/OperMaintenancePlanServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/OperMaintenancePlanServiceImpl.java index b8565c5..19bcbf7 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/OperMaintenancePlanServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/OperMaintenancePlanServiceImpl.java @@ -2,18 +2,13 @@ package com.hnac.hzims.operational.maintenance.service.impl; import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; -import com.hnac.hzims.common.utils.DateUtil; -import com.hnac.hzims.message.dto.PlanMsgRecordDto; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.hnac.hzims.operational.duty.entity.ImsDutyClassEntity; import com.hnac.hzims.operational.duty.service.IImsDutyClassService; import com.hnac.hzims.operational.maintenance.dto.OperMaintenancePlanDTO; import com.hnac.hzims.operational.maintenance.entity.OperMaintenancePlanEntity; -import com.hnac.hzims.operational.maintenance.entity.OperMaintenanceTaskEntity; import com.hnac.hzims.operational.maintenance.mapper.OperMaintenancePlanMapper; -import com.hnac.hzims.operational.maintenance.scheduled.MaintenancePlanCreateTask; -import com.hnac.hzims.operational.maintenance.scheduled.MaintenanceTaskCreateTask; import com.hnac.hzims.operational.maintenance.scheduled.MaintenanceTaskSchedule; import com.hnac.hzims.operational.maintenance.service.IOperMaintenancePlanService; import com.hnac.hzims.operational.maintenance.template.service.TemplateService; @@ -22,24 +17,18 @@ import com.hnac.hzims.operational.maintenance.wrapper.OperMaintenancePlanWrapper import com.hnac.hzims.safeproduct.feign.IDangerSourceClient; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Query; import org.springblade.core.tool.api.R; -import org.springblade.core.tool.utils.*; -import org.springframework.beans.factory.annotation.Autowired; +import org.springblade.core.tool.utils.CollectionUtil; +import org.springblade.core.tool.utils.Func; +import org.springblade.core.tool.utils.SpringUtil; import org.springframework.stereotype.Service; import java.time.LocalDate; import java.time.LocalDateTime; import java.time.LocalTime; -import java.time.YearMonth; -import java.util.Date; import java.util.List; -import java.util.concurrent.Executor; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; import java.util.stream.Collectors; diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/template/abstracts/TemplateAbstractService.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/template/abstracts/TemplateAbstractService.java index 4082e4f..59186ba 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/template/abstracts/TemplateAbstractService.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/template/abstracts/TemplateAbstractService.java @@ -1,11 +1,9 @@ package com.hnac.hzims.operational.maintenance.template.abstracts; -import com.hnac.hzims.message.dto.PlanMsgRecordDto; -import com.hnac.hzims.message.fegin.IMessageClient; import com.hnac.hzims.operational.maintenance.template.service.TemplateService; -import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; +import org.springblade.message.dto.PlanMsgRecordDto; +import org.springblade.message.fegin.IMessageClient; import javax.annotation.Resource; @@ -19,7 +17,7 @@ import javax.annotation.Resource; public abstract class TemplateAbstractService implements TemplateService { @Resource - private IMessageClient messageClient; + private IMessageClient messageClient; /** * 具体业务 diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/template/service/TemplateService.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/template/service/TemplateService.java index 07d6770..5bd62b2 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/template/service/TemplateService.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/template/service/TemplateService.java @@ -1,6 +1,6 @@ package com.hnac.hzims.operational.maintenance.template.service; -import com.hnac.hzims.message.dto.PlanMsgRecordDto; +import org.springblade.message.dto.PlanMsgRecordDto; /** * @Author WL diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/template/serviceimpl/MaintenanceTempleServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/template/serviceimpl/MaintenanceTempleServiceImpl.java index b49b931..87a658e 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/template/serviceimpl/MaintenanceTempleServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/template/serviceimpl/MaintenanceTempleServiceImpl.java @@ -1,9 +1,7 @@ package com.hnac.hzims.operational.maintenance.template.serviceimpl; -import com.hnac.hzims.message.dto.PlanMsgRecordDto; -import com.hnac.hzims.message.fegin.IMessageClient; import com.hnac.hzims.operational.maintenance.template.abstracts.TemplateAbstractService; -import com.hnac.hzims.operational.maintenance.template.service.TemplateService; +import org.springblade.message.dto.PlanMsgRecordDto; import org.springframework.stereotype.Service; import java.util.Objects; @@ -39,4 +37,5 @@ public class MaintenanceTempleServiceImpl extends TemplateAbstractService { public Boolean isTemplateStatus(int status) { return Objects.equals(status,1); } + } diff --git a/hzims-service/pom.xml b/hzims-service/pom.xml index 7702f2a..08f17ec 100644 --- a/hzims-service/pom.xml +++ b/hzims-service/pom.xml @@ -18,7 +18,6 @@ safeproduct operational inspect - message ticket weather hzims-middle diff --git a/hzims-service/safeproduct/pom.xml b/hzims-service/safeproduct/pom.xml index d31a804..7c216a1 100644 --- a/hzims-service/safeproduct/pom.xml +++ b/hzims-service/safeproduct/pom.xml @@ -45,10 +45,6 @@ com.hnac.hzims - message-api - - - com.hnac.hzims inspect-api diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/flow/service/impl/InnerDangerFlowServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/flow/service/impl/InnerDangerFlowServiceImpl.java index 99daa47..82022e5 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/flow/service/impl/InnerDangerFlowServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/flow/service/impl/InnerDangerFlowServiceImpl.java @@ -9,10 +9,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.hnac.hzims.common.logs.utils.StringUtils; -import com.hnac.hzims.message.MessageConstants; -import com.hnac.hzims.message.dto.BusinessMessageDTO; -import com.hnac.hzims.message.fegin.IMessageClient; import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse; import com.hnac.hzims.safeproduct.dto.InnerDangerDTO; import com.hnac.hzims.safeproduct.entity.InnerDangerEntity; @@ -21,7 +19,6 @@ import com.hnac.hzims.safeproduct.flow.service.IInnerDangerFlowService; import com.hnac.hzims.safeproduct.vo.*; import org.apache.commons.collections4.CollectionUtils; import org.springblade.core.log.exception.ServiceException; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Query; import org.springblade.core.secure.utils.AuthUtil; @@ -31,6 +28,9 @@ import org.springblade.core.tool.utils.DateUtil; import org.springblade.core.tool.utils.Func; import org.springblade.flow.core.entity.BladeFlow; import org.springblade.flow.core.feign.IFlowClient; +import org.springblade.message.MessageConstants; +import org.springblade.message.dto.BusinessMessageDTO; +import org.springblade.message.fegin.IMessageClient; import org.springblade.system.feign.ISysClient; import org.springblade.system.user.feign.IUserClient; import org.springframework.beans.factory.annotation.Autowired; @@ -344,8 +344,8 @@ public class InnerDangerFlowServiceImpl extends ServiceImpl> list = userClient.relationUserListByRoleAlias(AuthUtil.getTenantId(), Long.parseLong(stationId), "stationAgent"); if (list.isSuccess()) { List users = list.getData(); - if (users.size() > 0) { + if (!users.isEmpty()) { List userIds = users.stream().map(user -> String.valueOf(user.getId())).collect(Collectors.toList()); - //app推送 - AppPushDto appPushDto = new AppPushDto(); - appPushDto.setBusinessClassify(MessageConstants.BusinessClassifyEnum.SAFE_PRODUCT.getKey()); - appPushDto.setBusinessKey("quarter_check"); - appPushDto.setIsAll(true); - appPushDto.setContent(sb.toString()); - appPushDto.setSubject("季度大检查通知"); - appPushDto.setTitle("季度大检查通知"); - appPushDto.setAudienceType(PushAudienceType.TAG); - appPushDto.setTags(userIds); - appPushDto.setPushAlert(sb.toString()); - pushMsgClient.sendPush(appPushDto); - //web推送 - WsPushDto wsPushDto = new WsPushDto(); - wsPushDto.setBusinessClassify(MessageConstants.BusinessClassifyEnum.SAFE_PRODUCT.getKey()); - wsPushDto.setBusinessKey("quarter_check"); - wsPushDto.setContent(sb.toString()); - wsPushDto.setSubject("季度大检查通知"); - wsPushDto.setUserIdList(userIds); - wsPushDto.setText(sb.toString()); - pushMsgClient.sendWebsocket(wsPushDto); + // 推送app/web消息 + BusinessMessageDTO message = new BusinessMessageDTO(); + message.setBusinessClassify(MessageConstants.BusinessClassifyEnum.SAFE_PRODUCT.getKey()); + message.setBusinessKey("quarter_check"); + message.setSubject("季度大检查通知"); + message.setTaskId(req.getId()); + message.setTenantId(CommonConstant.TENANT_ID); + message.setContent(sb.toString()); + message.setDeptId(req.getCreateDept()); + message.setUserIds(String.join(",", userIds)); + message.setCreateUser(req.getCreateUser()); + messageClient.sendAppAndWsMsgByUsers(message); } } else { log.error("季度大检查通知获取站长失败"); diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/template/abstracts/TemplateAbstractService.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/template/abstracts/TemplateAbstractService.java index 32d4ea2..d2bdef9 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/template/abstracts/TemplateAbstractService.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/template/abstracts/TemplateAbstractService.java @@ -1,13 +1,11 @@ package com.hnac.hzims.safeproduct.template.abstracts; -import com.hnac.hzims.message.dto.PlanMsgRecordDto; -import com.hnac.hzims.message.fegin.IMessageClient; import com.hnac.hzims.safeproduct.template.service.TemplateService; -import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springblade.core.log.exception.ServiceException; import org.springblade.core.tool.api.R; -import org.springframework.beans.factory.annotation.Autowired; +import org.springblade.message.dto.PlanMsgRecordDto; +import org.springblade.message.fegin.IMessageClient; import javax.annotation.Resource; diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/template/service/TemplateService.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/template/service/TemplateService.java index 3af0449..6dfb96d 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/template/service/TemplateService.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/template/service/TemplateService.java @@ -1,6 +1,7 @@ package com.hnac.hzims.safeproduct.template.service; -import com.hnac.hzims.message.dto.PlanMsgRecordDto; + +import org.springblade.message.dto.PlanMsgRecordDto; /** * @Author WL diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/template/serviceimpl/MaintenanceTempleServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/template/serviceimpl/MaintenanceTempleServiceImpl.java index bf4192f..c6e90c2 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/template/serviceimpl/MaintenanceTempleServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/template/serviceimpl/MaintenanceTempleServiceImpl.java @@ -1,11 +1,12 @@ package com.hnac.hzims.safeproduct.template.serviceimpl; import com.alibaba.fastjson.JSON; -import com.hnac.hzims.message.dto.PlanMsgRecordDto; import com.hnac.hzims.safeproduct.template.abstracts.TemplateAbstractService; +import org.springblade.message.dto.PlanMsgRecordDto; import org.springblade.system.user.cache.UserCache; import org.springblade.system.user.entity.User; import org.springframework.stereotype.Service; + import java.time.format.DateTimeFormatter; import java.util.HashMap; import java.util.Map; diff --git a/hzims-service/ticket/pom.xml b/hzims-service/ticket/pom.xml index 56e0868..d1732f0 100644 --- a/hzims-service/ticket/pom.xml +++ b/hzims-service/ticket/pom.xml @@ -53,10 +53,6 @@ com.hnac.hzims - message-api - - - com.hnac.hzims equipment-api diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/repair/service/impl/WorkTaskServiceImpl.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/repair/service/impl/WorkTaskServiceImpl.java index 629a069..7209c4c 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/repair/service/impl/WorkTaskServiceImpl.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/repair/service/impl/WorkTaskServiceImpl.java @@ -1,17 +1,14 @@ package com.hnac.hzims.ticket.repair.service.impl; -import cn.afterturn.easypoi.excel.entity.TemplateExportParams; -import cn.afterturn.easypoi.word.WordExportUtil; import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.TypeReference; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.hnac.hzims.common.constant.CommonConstant; -import com.hnac.hzims.message.MessageConstants; -import com.hnac.hzims.message.dto.BusinessMessageDTO; -import com.hnac.hzims.message.fegin.IMessageClient; import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse; +import com.hnac.hzims.ticket.repair.constants.WorkTaskConstants; import com.hnac.hzims.ticket.repair.entity.WorkTaskEntity; import com.hnac.hzims.ticket.repair.mapper.WorkTaskMapper; import com.hnac.hzims.ticket.repair.service.IWorkTaskService; @@ -19,25 +16,26 @@ import com.hnac.hzims.ticket.repair.vo.WorkTaskContentVO; import com.hnac.hzims.ticket.repair.vo.WorkTaskPreviewVO; import com.hnac.hzims.ticket.repair.vo.WorkTaskVO; import com.hnac.hzims.ticket.utils.AsposeUtil; -import com.hnac.hzims.ticket.utils.ExcelUtil; import com.hnac.hzims.ticket.utils.PdfUtils; import com.hnac.hzims.ticket.utils.WordUtils; import com.hnac.hzims.ticket.workTicket.entity.WorkTicketInfoEntity; import com.hnac.hzims.ticket.workTicket.service.IWorkTicketInfoService; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import org.apache.poi.ss.usermodel.Workbook; -import org.apache.poi.xwpf.usermodel.XWPFDocument; import org.springblade.core.log.exception.ServiceException; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import org.springblade.core.mp.support.Condition; import org.springblade.core.secure.utils.AuthUtil; import org.springblade.core.tool.api.R; -import org.springblade.core.tool.utils.*; +import org.springblade.core.tool.utils.CollectionUtil; +import org.springblade.core.tool.utils.DateUtil; +import org.springblade.core.tool.utils.ObjectUtil; +import org.springblade.core.tool.utils.StringUtil; import org.springblade.flow.core.entity.BladeFlow; import org.springblade.flow.core.feign.IFlowClient; import org.springblade.flow.core.utils.FlowUtil; import org.springblade.flow.core.utils.TaskUtil; +import org.springblade.message.MessageConstants; +import org.springblade.message.dto.BusinessMessageDTO; +import org.springblade.message.fegin.IMessageClient; import org.springblade.system.entity.Dept; import org.springblade.system.feign.ISysClient; import org.springblade.system.user.entity.User; @@ -48,12 +46,7 @@ import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes; import javax.servlet.http.HttpServletResponse; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; import java.util.*; -import java.util.stream.Collectors; /** * @author ysj @@ -368,10 +361,10 @@ public class WorkTaskServiceImpl extends ServiceImpl result = sysClient.getDeptName(entity.getCreateDept()); if (result.isSuccess()) { diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/controller/OperationTicketController.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/controller/OperationTicketController.java index 56cc07f..2560bc4 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/controller/OperationTicketController.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/controller/OperationTicketController.java @@ -1,9 +1,6 @@ package com.hnac.hzims.ticket.standardTicket.controller; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; -import com.hnac.hzims.message.MessageConstants; -import com.hnac.hzims.message.dto.BusinessMessageDTO; -import com.hnac.hzims.message.fegin.IMessageClient; import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse; import com.hnac.hzims.ticket.standardTicket.service.OperationTicketService; import com.hnac.hzims.ticket.twoTicket.vo.operation.StandardTicketInfoVo; @@ -12,6 +9,9 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springblade.core.log.exception.ServiceException; import org.springblade.core.tool.api.R; +import org.springblade.message.MessageConstants; +import org.springblade.message.dto.BusinessMessageDTO; +import org.springblade.message.fegin.IMessageClient; import org.springblade.system.feign.ISysClient; import org.springframework.web.bind.annotation.*; diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/OperationTicketServiceImpl.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/OperationTicketServiceImpl.java index d0fbf33..4442a1e 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/OperationTicketServiceImpl.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/OperationTicketServiceImpl.java @@ -7,9 +7,6 @@ import com.alibaba.fastjson.TypeReference; import com.baomidou.mybatisplus.core.toolkit.IdWorker; import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.hnac.hzims.common.logs.utils.StringUtils; -import com.hnac.hzims.message.MessageConstants; -import com.hnac.hzims.message.dto.BusinessMessageDTO; -import com.hnac.hzims.message.fegin.IMessageClient; import com.hnac.hzims.middle.process.feign.ProcessDictFeignService; import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse; import com.hnac.hzims.operational.station.entity.StationEntity; @@ -41,6 +38,9 @@ import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.ObjectUtil; import org.springblade.flow.core.entity.BladeFlow; import org.springblade.flow.core.feign.IFlowClient; +import org.springblade.message.MessageConstants; +import org.springblade.message.dto.BusinessMessageDTO; +import org.springblade.message.fegin.IMessageClient; import org.springblade.system.feign.ISysClient; import org.springblade.system.user.cache.UserCache; import org.springblade.system.user.entity.User; @@ -52,7 +52,6 @@ import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletResponse; import java.time.Duration; import java.time.Instant; -import java.time.LocalDateTime; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -221,39 +220,6 @@ public class OperationTicketServiceImpl implements OperationTicketService { //推送消息 if (response.getTaskId() != null) { - // MessagePushRecordDto message = new MessagePushRecordDto(); - // message.setBusinessClassify("business"); - // message.setBusinessKey(MessageConstants.BusinessClassifyEnum.OPERATIONTICKETMESSAGE.getKey()); - // message.setSubject(MessageConstants.BusinessClassifyEnum.OPERATIONTICKETMESSAGE.getDescription()); - // message.setTaskId(standardTicketInfoEntity.getId()); - // message.setTenantId("200000"); - // message.setTypes(Arrays.asList(MessageConstants.APP_PUSH, MessageConstants.WS_PUSH)); - // message.setPushType(MessageConstants.IMMEDIATELY); - // //您有一张工作票待审批,工作内容:*****,审批环节:*****; - // String countent = "您有一张工作票待审批,工作内容:".concat(standardTicketInfoEntity.getTitle()).concat(",审批环节:").concat(response.getTaskName()); - // message.setContent(countent); - // message.setDeptId(standardTicketInfoEntity.getCreateDept()); - // R deptName = sysClient.getDeptName(standardTicketInfoEntity.getCreateDept()); - // if (deptName.isSuccess()) { - // message.setDeptName(deptName.getData()); - // } - // String userIds = response.getUserId(); - // if (StringUtils.isBlank(userIds)) { - // log.error("推送的消息不能为空哦,{}", userIds); - // return; - // } - // String[] split = userIds.split(","); - // for (String userId : split) { - // message.setPusher(userId); - // User user = UserCache.getUser(NumberUtils.toLong(userId)); - // if (ObjectUtils.isNotEmpty(user)) { - // message.setPusherName(user.getName()); - // } - // message.setAccount(userId); - // - // message.setCreateUser(NumberUtils.toLong(userId)); - // messageClient.sendMessage(message); - // } BusinessMessageDTO businessMessageDTO = new BusinessMessageDTO(); businessMessageDTO.setBusinessClassify("business"); businessMessageDTO.setBusinessKey(MessageConstants.BusinessClassifyEnum.OPERATIONTICKETMESSAGE.getKey()); diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/FirstWorkTicketServiceImpl.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/FirstWorkTicketServiceImpl.java index 0ecb0d8..f294113 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/FirstWorkTicketServiceImpl.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/FirstWorkTicketServiceImpl.java @@ -8,9 +8,8 @@ import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.google.common.collect.Lists; -import com.hnac.hzims.message.entity.config.PushConfigEntity; -import com.hnac.hzims.message.fegin.IMessageConfigClient; import com.hnac.hzims.operational.access.dto.OperAccessTaskDTO; import com.hnac.hzims.operational.access.entity.OperAccessTaskEntity; import com.hnac.hzims.operational.access.feign.IOperAccessTaskClient; @@ -38,36 +37,31 @@ import com.hnac.hzims.ticket.workTicket.wrapper.WorkTicketInfoWrapper; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.poi.ss.usermodel.Workbook; -import org.apache.poi.xwpf.usermodel.*; +import org.apache.poi.xwpf.usermodel.XWPFDocument; import org.springblade.core.log.exception.ServiceException; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.core.secure.utils.AuthUtil; import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.*; import org.springblade.flow.core.entity.BladeFlow; import org.springblade.flow.core.feign.IFlowClient; import org.springblade.flow.core.vo.ComleteTask; +import org.springblade.message.entity.config.PushConfigEntity; +import org.springblade.message.fegin.IMessageConfigClient; import org.springblade.system.user.cache.UserCache; import org.springblade.system.user.entity.User; import org.springblade.system.user.feign.IUserClient; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.util.Assert; -import org.springframework.util.ResourceUtils; import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes; import javax.servlet.http.HttpServletResponse; import java.io.File; -import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.math.BigDecimal; import java.math.RoundingMode; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; import java.text.SimpleDateFormat; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketProcessServiceImpl.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketProcessServiceImpl.java index ba3829a..35f3e1e 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketProcessServiceImpl.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketProcessServiceImpl.java @@ -1,17 +1,12 @@ package com.hnac.hzims.ticket.twoTicket.service.impl; - import cn.afterturn.easypoi.word.WordExportUtil; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import com.baomidou.mybatisplus.core.toolkit.IdWorker; import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.hnac.hzims.common.logs.utils.StringUtils; -import com.hnac.hzims.message.MessageConstants; -import com.hnac.hzims.message.dto.BusinessMessageDTO; -import com.hnac.hzims.message.fegin.IMessageClient; import com.hnac.hzims.middle.process.feign.ProcessDictFeignService; import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse; import com.hnac.hzims.operational.access.entity.OperAccessTaskEntity; @@ -47,12 +42,17 @@ import org.apache.commons.lang3.BooleanUtils; import org.apache.commons.lang3.math.NumberUtils; import org.apache.poi.xwpf.usermodel.XWPFDocument; import org.springblade.core.log.exception.ServiceException; - import org.springblade.core.secure.utils.AuthUtil; import org.springblade.core.tool.api.R; -import org.springblade.core.tool.utils.*; +import org.springblade.core.tool.utils.CollectionUtil; +import org.springblade.core.tool.utils.Func; +import org.springblade.core.tool.utils.ObjectUtil; +import org.springblade.core.tool.utils.StringUtil; import org.springblade.flow.core.entity.BladeFlow; import org.springblade.flow.core.feign.IFlowClient; +import org.springblade.message.MessageConstants; +import org.springblade.message.dto.BusinessMessageDTO; +import org.springblade.message.fegin.IMessageClient; import org.springblade.system.feign.ISysClient; import org.springblade.system.user.cache.UserCache; import org.springblade.system.user.entity.User; @@ -433,50 +433,6 @@ public class TicketProcessServiceImpl implements TicketProcessService { if (response.getTaskId() != null || response.getUserId() != null) { - //推送消息 - // try { - // MessagePushRecordDto message = new MessagePushRecordDto(); - // message.setBusinessClassify("business"); - // message.setBusinessKey(MessageConstants.BusinessClassifyEnum.TICKETMESSAGE.getKey()); - // message.setSubject(MessageConstants.BusinessClassifyEnum.TICKETMESSAGE.getDescription()); - // message.setTaskId(workTicketInfo.getId()); - // message.setTenantId("200000"); - // message.setTypes(Arrays.asList(MessageConstants.APP_PUSH, MessageConstants.WS_PUSH)); - // message.setPushType(MessageConstants.IMMEDIATELY); - // //您有一张工作票待审批,工作内容:*****,审批环节:*****; - // String countent = - // "您有一张工作票待审批,工作内容: ".concat(workTicketInfo.getWorkContent()) - // .concat(",审批环节: ") - // .concat(response.getTaskName()); - // message.setContent(countent); - // message.setDeptId(workTicketInfo.getCreateDept()); - // message.setCreateDept(workTicketInfo.getCreateDept()); - // R deptName = sysClient.getDeptName(workTicketInfo.getCreateDept()); - // if (deptName.isSuccess()) { - // message.setDeptName(deptName.getData()); - // } - // String userIds = response.getUserId(); - // if (StringUtils.isBlank(userIds)) { - // log.error("推送的消息不能为空哦,{}", userIds); - // return; - // } - // String[] split = userIds.split(","); - // for (String userId : split) { - // message.setPusher(userId); - // User user = UserCache.getUser(NumberUtils.toLong(userId)); - // if (ObjectUtils.isNotEmpty(user)) { - // message.setPusherName(user.getName()); - // } - // message.setAccount(userId); - // message.setCreateUser(NumberUtils.toLong(userId)); - // messageClient.sendMessage(message); - // log.info("推送消息成功,用户名称{},消息{}", user.getName(), message); - // } - // } catch (Exception e) { - // e.printStackTrace(); - // } - - BusinessMessageDTO businessMessageDTO = new BusinessMessageDTO(); businessMessageDTO.setBusinessClassify("business"); businessMessageDTO.setBusinessKey(MessageConstants.BusinessClassifyEnum.TICKETMESSAGE.getKey()); diff --git a/pom.xml b/pom.xml index 6d681ef..ef75dc5 100644 --- a/pom.xml +++ b/pom.xml @@ -102,11 +102,6 @@ com.hnac.hzims - message-api - ${hzims.project.version} - - - com.hnac.hzims middle-api ${hzims.project.version}