Commit 826a564abd022c973190391d5729b1766100579f
1 parent
f7752298
站内信开发
Showing
27 changed files
with
1028 additions
and
76 deletions
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/notify/NotifyLogController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.controller.admin.notify; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.pojo.CommonResult; | ||
| 4 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 5 | +import cn.iocoder.yudao.module.system.controller.admin.notify.vo.log.NotifyLogBaseVO; | ||
| 6 | +import cn.iocoder.yudao.module.system.controller.admin.notify.vo.log.NotifyLogPageReqVO; | ||
| 7 | +import cn.iocoder.yudao.module.system.convert.notify.NotifyLogConvert; | ||
| 8 | +import cn.iocoder.yudao.module.system.dal.dataobject.notify.NotifyMessageDO; | ||
| 9 | +import cn.iocoder.yudao.module.system.service.notify.NotifyLogService; | ||
| 10 | +import cn.iocoder.yudao.module.system.service.user.AdminUserService; | ||
| 11 | +import io.swagger.annotations.Api; | ||
| 12 | +import io.swagger.annotations.ApiOperation; | ||
| 13 | +import org.springframework.validation.annotation.Validated; | ||
| 14 | +import org.springframework.web.bind.annotation.GetMapping; | ||
| 15 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 16 | +import org.springframework.web.bind.annotation.RestController; | ||
| 17 | + | ||
| 18 | +import javax.annotation.Resource; | ||
| 19 | +import javax.validation.Valid; | ||
| 20 | + | ||
| 21 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | ||
| 22 | + | ||
| 23 | +/** | ||
| 24 | + * <p> | ||
| 25 | + * | ||
| 26 | + * </p> | ||
| 27 | + * | ||
| 28 | + * @author LuoWenFeng | ||
| 29 | + */ | ||
| 30 | +@Api(tags = "管理后台 - 站内信发送日志") | ||
| 31 | +@RestController | ||
| 32 | +@RequestMapping("/system/notify-log") | ||
| 33 | +@Validated | ||
| 34 | +public class NotifyLogController { | ||
| 35 | + | ||
| 36 | + @Resource | ||
| 37 | + private NotifyLogService notifyLogService; | ||
| 38 | + | ||
| 39 | + @Resource | ||
| 40 | + private AdminUserService userService; | ||
| 41 | + | ||
| 42 | + @GetMapping("/page") | ||
| 43 | + @ApiOperation("获得发送站内信日志分页") | ||
| 44 | + public CommonResult<PageResult<NotifyLogBaseVO>> getNotifyLogPage(@Valid NotifyLogPageReqVO pageVO) { | ||
| 45 | + PageResult<NotifyMessageDO> pageResult = notifyLogService.getNotifyMessageSendPage(pageVO); | ||
| 46 | + PageResult<NotifyLogBaseVO> result = NotifyLogConvert.INSTANCE.convertPage(pageResult); | ||
| 47 | + result.getList().forEach(v -> { | ||
| 48 | + v.setReceiveUserName(userService.getUser(v.getUserId()).getNickname()); | ||
| 49 | + }); | ||
| 50 | + return success(result); | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + | ||
| 54 | +} |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/notify/NotifyMessageController.java
| @@ -18,15 +18,13 @@ import org.springframework.web.bind.annotation.*; | @@ -18,15 +18,13 @@ import org.springframework.web.bind.annotation.*; | ||
| 18 | 18 | ||
| 19 | import javax.annotation.Resource; | 19 | import javax.annotation.Resource; |
| 20 | import javax.validation.Valid; | 20 | import javax.validation.Valid; |
| 21 | - | ||
| 22 | -import java.util.Collection; | ||
| 23 | import java.util.Collections; | 21 | import java.util.Collections; |
| 24 | import java.util.List; | 22 | import java.util.List; |
| 25 | 23 | ||
| 26 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | 24 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 27 | import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; | 25 | import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; |
| 28 | 26 | ||
| 29 | -@Api(tags = "管理后台 - 站内信") | 27 | +@Api(tags = "管理后台 - 我的站内信") |
| 30 | @RestController | 28 | @RestController |
| 31 | @RequestMapping("/system/notify-message") | 29 | @RequestMapping("/system/notify-message") |
| 32 | @Validated | 30 | @Validated |
| @@ -48,8 +46,6 @@ public class NotifyMessageController { | @@ -48,8 +46,6 @@ public class NotifyMessageController { | ||
| 48 | @ApiOperation("获得站内信分页") | 46 | @ApiOperation("获得站内信分页") |
| 49 | @PreAuthorize("@ss.hasPermission('system:notify-message:query')") | 47 | @PreAuthorize("@ss.hasPermission('system:notify-message:query')") |
| 50 | public CommonResult<PageResult<NotifyMessageRespVO>> getNotifyMessagePage(@Valid NotifyMessagePageReqVO pageVO) { | 48 | public CommonResult<PageResult<NotifyMessageRespVO>> getNotifyMessagePage(@Valid NotifyMessagePageReqVO pageVO) { |
| 51 | - pageVO.setUserId(getLoginUserId()); | ||
| 52 | - pageVO.setUserType(UserTypeEnum.ADMIN.getValue()); | ||
| 53 | PageResult<NotifyMessageDO> pageResult = notifyMessageService.getNotifyMessagePage(pageVO); | 49 | PageResult<NotifyMessageDO> pageResult = notifyMessageService.getNotifyMessagePage(pageVO); |
| 54 | return success(NotifyMessageConvert.INSTANCE.convertPage(pageResult)); | 50 | return success(NotifyMessageConvert.INSTANCE.convertPage(pageResult)); |
| 55 | } | 51 | } |
| @@ -59,9 +55,6 @@ public class NotifyMessageController { | @@ -59,9 +55,6 @@ public class NotifyMessageController { | ||
| 59 | @ApiImplicitParam(name = "size", value = "10", defaultValue = "10", dataTypeClass = Integer.class) | 55 | @ApiImplicitParam(name = "size", value = "10", defaultValue = "10", dataTypeClass = Integer.class) |
| 60 | public CommonResult<List<NotifyMessageRespVO>> getRecentList(@RequestParam(name = "size", defaultValue = "10") Integer size) { | 56 | public CommonResult<List<NotifyMessageRespVO>> getRecentList(@RequestParam(name = "size", defaultValue = "10") Integer size) { |
| 61 | NotifyMessagePageReqVO reqVO = new NotifyMessagePageReqVO(); | 57 | NotifyMessagePageReqVO reqVO = new NotifyMessagePageReqVO(); |
| 62 | - reqVO.setUserId(getLoginUserId()); | ||
| 63 | - reqVO.setUserType(UserTypeEnum.ADMIN.getValue()); | ||
| 64 | - | ||
| 65 | List<NotifyMessageDO> pageResult = notifyMessageService.getNotifyMessageList(reqVO, size); | 58 | List<NotifyMessageDO> pageResult = notifyMessageService.getNotifyMessageList(reqVO, size); |
| 66 | if (CollUtil.isNotEmpty(pageResult)) { | 59 | if (CollUtil.isNotEmpty(pageResult)) { |
| 67 | return success(NotifyMessageConvert.INSTANCE.convertList(pageResult)); | 60 | return success(NotifyMessageConvert.INSTANCE.convertList(pageResult)); |
| @@ -75,19 +68,20 @@ public class NotifyMessageController { | @@ -75,19 +68,20 @@ public class NotifyMessageController { | ||
| 75 | return success(notifyMessageService.getUnreadNotifyMessageCount(getLoginUserId(), UserTypeEnum.ADMIN.getValue())); | 68 | return success(notifyMessageService.getUnreadNotifyMessageCount(getLoginUserId(), UserTypeEnum.ADMIN.getValue())); |
| 76 | } | 69 | } |
| 77 | 70 | ||
| 78 | - @GetMapping("/update-list-read") | 71 | + @PutMapping("/update-list-read") |
| 79 | @ApiOperation("批量标记已读") | 72 | @ApiOperation("批量标记已读") |
| 80 | @ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class) | 73 | @ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class) |
| 81 | - public CommonResult<Boolean> batchUpdateNotifyMessageReadStatus(@RequestParam("ids") Collection<Long> ids) { | 74 | + public CommonResult<Boolean> batchUpdateNotifyMessageReadStatus(@RequestBody List<Long> ids) { |
| 82 | notifyMessageService.batchUpdateNotifyMessageReadStatus(ids, getLoginUserId()); | 75 | notifyMessageService.batchUpdateNotifyMessageReadStatus(ids, getLoginUserId()); |
| 83 | return success(Boolean.TRUE); | 76 | return success(Boolean.TRUE); |
| 84 | } | 77 | } |
| 85 | 78 | ||
| 86 | - @GetMapping("/update-all-read") | 79 | + @PutMapping("/update-all-read") |
| 87 | @ApiOperation("所有未读消息标记已读") | 80 | @ApiOperation("所有未读消息标记已读") |
| 88 | public CommonResult<Boolean> batchUpdateAllNotifyMessageReadStatus() { | 81 | public CommonResult<Boolean> batchUpdateAllNotifyMessageReadStatus() { |
| 89 | notifyMessageService.batchUpdateAllNotifyMessageReadStatus(getLoginUserId(), UserTypeEnum.ADMIN.getValue()); | 82 | notifyMessageService.batchUpdateAllNotifyMessageReadStatus(getLoginUserId(), UserTypeEnum.ADMIN.getValue()); |
| 90 | return success(Boolean.TRUE); | 83 | return success(Boolean.TRUE); |
| 91 | } | 84 | } |
| 92 | 85 | ||
| 86 | + | ||
| 93 | } | 87 | } |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/notify/NotifyTemplateController.java
| @@ -95,6 +95,6 @@ public class NotifyTemplateController { | @@ -95,6 +95,6 @@ public class NotifyTemplateController { | ||
| 95 | @ApiOperation("发送站内信") | 95 | @ApiOperation("发送站内信") |
| 96 | public CommonResult<Long> sendNotify(@Valid @RequestBody NotifyTemplateSendReqVO sendReqVO) { | 96 | public CommonResult<Long> sendNotify(@Valid @RequestBody NotifyTemplateSendReqVO sendReqVO) { |
| 97 | return success(notifySendService.sendSingleNotifyToAdmin(sendReqVO.getUserId(), | 97 | return success(notifySendService.sendSingleNotifyToAdmin(sendReqVO.getUserId(), |
| 98 | - sendReqVO.getTemplateId(), sendReqVO.getTemplateParams())); | 98 | + sendReqVO.getTemplateCode(), sendReqVO.getTemplateParams())); |
| 99 | } | 99 | } |
| 100 | } | 100 | } |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/notify/vo/log/NotifyLogBaseVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.controller.admin.notify.vo.log; | ||
| 2 | + | ||
| 3 | +import io.swagger.annotations.ApiModelProperty; | ||
| 4 | +import lombok.Data; | ||
| 5 | +import org.springframework.format.annotation.DateTimeFormat; | ||
| 6 | + | ||
| 7 | +import java.util.Date; | ||
| 8 | + | ||
| 9 | +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | ||
| 10 | + | ||
| 11 | +/** | ||
| 12 | + * 站内信 Base VO,提供给添加、修改、详细的子 VO 使用 | ||
| 13 | + * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 | ||
| 14 | + */ | ||
| 15 | +@Data | ||
| 16 | +public class NotifyLogBaseVO { | ||
| 17 | + | ||
| 18 | + @ApiModelProperty(value = "模版编码") | ||
| 19 | + private String templateCode; | ||
| 20 | + | ||
| 21 | + @ApiModelProperty(value = "标题") | ||
| 22 | + private String title; | ||
| 23 | + | ||
| 24 | + @ApiModelProperty(value = "内容", required = true) | ||
| 25 | + private String content; | ||
| 26 | + | ||
| 27 | + @ApiModelProperty(value = "发送时间", required = true) | ||
| 28 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | ||
| 29 | + private Date sendTime; | ||
| 30 | + | ||
| 31 | + @ApiModelProperty(value = "芋艿", required = true) | ||
| 32 | + private String receiveUserName; | ||
| 33 | + | ||
| 34 | + @ApiModelProperty(value = "1", required = true) | ||
| 35 | + private Long userId; | ||
| 36 | + | ||
| 37 | + @ApiModelProperty(value = "是否已读 false-未读 true-已读") | ||
| 38 | + private Boolean readStatus; | ||
| 39 | + | ||
| 40 | + @ApiModelProperty(value = "阅读时间") | ||
| 41 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | ||
| 42 | + private Date readTime; | ||
| 43 | + | ||
| 44 | +} |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/notify/vo/log/NotifyLogPageReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.controller.admin.notify.vo.log; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageParam; | ||
| 4 | +import io.swagger.annotations.ApiModel; | ||
| 5 | +import io.swagger.annotations.ApiModelProperty; | ||
| 6 | +import lombok.Data; | ||
| 7 | +import lombok.EqualsAndHashCode; | ||
| 8 | +import lombok.ToString; | ||
| 9 | +import org.springframework.format.annotation.DateTimeFormat; | ||
| 10 | + | ||
| 11 | +import java.util.Date; | ||
| 12 | + | ||
| 13 | +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | ||
| 14 | + | ||
| 15 | +@ApiModel("管理后台 - 站内信日志分页 Request VO") | ||
| 16 | +@Data | ||
| 17 | +@EqualsAndHashCode(callSuper = true) | ||
| 18 | +@ToString(callSuper = true) | ||
| 19 | +public class NotifyLogPageReqVO extends PageParam { | ||
| 20 | + | ||
| 21 | + @ApiModelProperty(value = "模版编码") | ||
| 22 | + private String templateCode; | ||
| 23 | + | ||
| 24 | + @ApiModelProperty(value = "标题") | ||
| 25 | + private String title; | ||
| 26 | + | ||
| 27 | + @ApiModelProperty(value = "创建时间") | ||
| 28 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | ||
| 29 | + private Date[] sendTime; | ||
| 30 | +} |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/notify/vo/message/NotifyMessageBaseVO.java
| 1 | package cn.iocoder.yudao.module.system.controller.admin.notify.vo.message; | 1 | package cn.iocoder.yudao.module.system.controller.admin.notify.vo.message; |
| 2 | 2 | ||
| 3 | -import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; | ||
| 4 | -import cn.iocoder.yudao.framework.common.validation.InEnum; | ||
| 5 | import io.swagger.annotations.ApiModelProperty; | 3 | import io.swagger.annotations.ApiModelProperty; |
| 6 | import lombok.Data; | 4 | import lombok.Data; |
| 7 | import org.springframework.format.annotation.DateTimeFormat; | 5 | import org.springframework.format.annotation.DateTimeFormat; |
| 8 | 6 | ||
| 9 | -import javax.validation.constraints.NotNull; | ||
| 10 | import java.util.Date; | 7 | import java.util.Date; |
| 11 | 8 | ||
| 12 | import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | 9 | import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; |
| 13 | 10 | ||
| 14 | /** | 11 | /** |
| 15 | -* 站内信 Base VO,提供给添加、修改、详细的子 VO 使用 | ||
| 16 | -* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 | ||
| 17 | -*/ | 12 | + * 站内信 Base VO,提供给添加、修改、详细的子 VO 使用 |
| 13 | + * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 | ||
| 14 | + */ | ||
| 18 | @Data | 15 | @Data |
| 19 | public class NotifyMessageBaseVO { | 16 | public class NotifyMessageBaseVO { |
| 20 | 17 | ||
| 21 | - @ApiModelProperty(value = "用户编号", required = true) | ||
| 22 | - @NotNull(message = "用户编号不能为空") | ||
| 23 | - private Long userId; | ||
| 24 | - | ||
| 25 | - @ApiModelProperty(value = "用户类型", required = true) | ||
| 26 | - @NotNull(message = "用户类型不能为空") | ||
| 27 | - @InEnum(value = UserTypeEnum.class, message = "用户类型必须是 {value}") | ||
| 28 | - private Integer userType; | ||
| 29 | - | ||
| 30 | @ApiModelProperty(value = "标题") | 18 | @ApiModelProperty(value = "标题") |
| 31 | private String title; | 19 | private String title; |
| 32 | 20 | ||
| 33 | - @ApiModelProperty(value = "内容", required = true) | ||
| 34 | - @NotNull(message = "内容不能为空") | 21 | + @ApiModelProperty(value = "内容") |
| 35 | private String content; | 22 | private String content; |
| 36 | 23 | ||
| 24 | + @ApiModelProperty(value = "发送时间") | ||
| 25 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | ||
| 26 | + private Date sendTime; | ||
| 27 | + | ||
| 28 | + @ApiModelProperty(value = "芋艿") | ||
| 29 | + private String sendUserName; | ||
| 30 | + | ||
| 37 | @ApiModelProperty(value = "是否已读 false-未读 true-已读") | 31 | @ApiModelProperty(value = "是否已读 false-未读 true-已读") |
| 38 | private Boolean readStatus; | 32 | private Boolean readStatus; |
| 39 | 33 |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/notify/vo/message/NotifyMessagePageReqVO.java
| @@ -28,11 +28,4 @@ public class NotifyMessagePageReqVO extends PageParam { | @@ -28,11 +28,4 @@ public class NotifyMessagePageReqVO extends PageParam { | ||
| 28 | @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | 28 | @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) |
| 29 | private Date[] createTime; | 29 | private Date[] createTime; |
| 30 | 30 | ||
| 31 | - // TODO 芋艿:去掉 userId 和 userType,不要在 VO 里 | ||
| 32 | - | ||
| 33 | - @ApiModelProperty(value = "用户编号", hidden = true) | ||
| 34 | - private Long userId; | ||
| 35 | - | ||
| 36 | - @ApiModelProperty(value = "用户类型", hidden = true) | ||
| 37 | - private Integer userType; | ||
| 38 | } | 31 | } |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/notify/vo/message/NotifyMessageRespVO.java
| @@ -13,7 +13,4 @@ public class NotifyMessageRespVO extends NotifyMessageBaseVO { | @@ -13,7 +13,4 @@ public class NotifyMessageRespVO extends NotifyMessageBaseVO { | ||
| 13 | @ApiModelProperty(value = "ID", required = true) | 13 | @ApiModelProperty(value = "ID", required = true) |
| 14 | private Long id; | 14 | private Long id; |
| 15 | 15 | ||
| 16 | - @ApiModelProperty(value = "创建时间", required = true) | ||
| 17 | - private Date createTime; | ||
| 18 | - | ||
| 19 | } | 16 | } |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/notify/vo/template/NotifyTemplateSendReqVO.java
| @@ -15,9 +15,9 @@ public class NotifyTemplateSendReqVO { | @@ -15,9 +15,9 @@ public class NotifyTemplateSendReqVO { | ||
| 15 | @NotNull(message = "用户id不能为空") | 15 | @NotNull(message = "用户id不能为空") |
| 16 | private Long userId; | 16 | private Long userId; |
| 17 | 17 | ||
| 18 | - @ApiModelProperty(value = "模板Id", required = true, example = "01") | ||
| 19 | - @NotNull(message = "模板Id不能为空") | ||
| 20 | - private Long templateId; | 18 | + @ApiModelProperty(value = "模板编码", required = true, example = "01") |
| 19 | + @NotNull(message = "模板编码不能为空") | ||
| 20 | + private String templateCode; | ||
| 21 | 21 | ||
| 22 | @ApiModelProperty(value = "模板参数") | 22 | @ApiModelProperty(value = "模板参数") |
| 23 | private Map<String, Object> templateParams; | 23 | private Map<String, Object> templateParams; |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/convert/notify/NotifyLogConvert.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.convert.notify; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 4 | +import cn.iocoder.yudao.module.system.controller.admin.notify.vo.log.NotifyLogBaseVO; | ||
| 5 | +import cn.iocoder.yudao.module.system.dal.dataobject.notify.NotifyMessageDO; | ||
| 6 | +import org.mapstruct.Mapper; | ||
| 7 | +import org.mapstruct.factory.Mappers; | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * <p> | ||
| 11 | + * | ||
| 12 | + * </p> | ||
| 13 | + * | ||
| 14 | + * @author LuoWenFeng | ||
| 15 | + */ | ||
| 16 | +@Mapper | ||
| 17 | +public interface NotifyLogConvert { | ||
| 18 | + | ||
| 19 | + NotifyLogConvert INSTANCE = Mappers.getMapper(NotifyLogConvert.class); | ||
| 20 | + | ||
| 21 | + PageResult<NotifyLogBaseVO> convertPage(PageResult<NotifyMessageDO> page); | ||
| 22 | + | ||
| 23 | +} |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/convert/notify/NotifyMessageConvert.java
| 1 | package cn.iocoder.yudao.module.system.convert.notify; | 1 | package cn.iocoder.yudao.module.system.convert.notify; |
| 2 | 2 | ||
| 3 | -import java.util.*; | ||
| 4 | - | ||
| 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 6 | - | ||
| 7 | import cn.iocoder.yudao.module.system.controller.admin.notify.vo.message.NotifyMessageRespVO; | 4 | import cn.iocoder.yudao.module.system.controller.admin.notify.vo.message.NotifyMessageRespVO; |
| 5 | +import cn.iocoder.yudao.module.system.dal.dataobject.notify.NotifyMessageDO; | ||
| 8 | import org.mapstruct.Mapper; | 6 | import org.mapstruct.Mapper; |
| 9 | import org.mapstruct.factory.Mappers; | 7 | import org.mapstruct.factory.Mappers; |
| 10 | -import cn.iocoder.yudao.module.system.dal.dataobject.notify.NotifyMessageDO; | 8 | + |
| 9 | +import java.util.List; | ||
| 11 | 10 | ||
| 12 | /** | 11 | /** |
| 13 | * 站内信 Convert | 12 | * 站内信 Convert |
| @@ -25,4 +24,5 @@ public interface NotifyMessageConvert { | @@ -25,4 +24,5 @@ public interface NotifyMessageConvert { | ||
| 25 | 24 | ||
| 26 | PageResult<NotifyMessageRespVO> convertPage(PageResult<NotifyMessageDO> page); | 25 | PageResult<NotifyMessageRespVO> convertPage(PageResult<NotifyMessageDO> page); |
| 27 | 26 | ||
| 27 | + | ||
| 28 | } | 28 | } |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/notify/NotifyMessageDO.java
| @@ -36,6 +36,12 @@ public class NotifyMessageDO extends BaseDO { | @@ -36,6 +36,12 @@ public class NotifyMessageDO extends BaseDO { | ||
| 36 | */ | 36 | */ |
| 37 | private Long templateId; | 37 | private Long templateId; |
| 38 | /** | 38 | /** |
| 39 | + * 站内信模版编码 | ||
| 40 | + * | ||
| 41 | + * 关联 {@link NotifyTemplateDO#getCode()} | ||
| 42 | + */ | ||
| 43 | + private String templateCode; | ||
| 44 | + /** | ||
| 39 | * 用户编号 | 45 | * 用户编号 |
| 40 | * | 46 | * |
| 41 | * 关联 MemberUserDO 的 id 字段、或者 AdminUserDO 的 id 字段 | 47 | * 关联 MemberUserDO 的 id 字段、或者 AdminUserDO 的 id 字段 |
| @@ -56,6 +62,18 @@ public class NotifyMessageDO extends BaseDO { | @@ -56,6 +62,18 @@ public class NotifyMessageDO extends BaseDO { | ||
| 56 | */ | 62 | */ |
| 57 | private String content; | 63 | private String content; |
| 58 | /** | 64 | /** |
| 65 | + * 发送时间 | ||
| 66 | + */ | ||
| 67 | + private Date sendTime; | ||
| 68 | + /** | ||
| 69 | + * 发送用户id | ||
| 70 | + */ | ||
| 71 | + private Long sendUserId; | ||
| 72 | + /** | ||
| 73 | + * 发送用户名 | ||
| 74 | + */ | ||
| 75 | + private String sendUserName; | ||
| 76 | + /** | ||
| 59 | * 是否已读 | 77 | * 是否已读 |
| 60 | */ | 78 | */ |
| 61 | private Boolean readStatus; | 79 | private Boolean readStatus; |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/notify/NotifyMessageMapper.java
| @@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.system.dal.mysql.notify; | @@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.system.dal.mysql.notify; | ||
| 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | 4 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| 5 | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | 5 | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| 6 | +import cn.iocoder.yudao.module.system.controller.admin.notify.vo.log.NotifyLogPageReqVO; | ||
| 6 | import cn.iocoder.yudao.module.system.controller.admin.notify.vo.message.NotifyMessagePageReqVO; | 7 | import cn.iocoder.yudao.module.system.controller.admin.notify.vo.message.NotifyMessagePageReqVO; |
| 7 | import cn.iocoder.yudao.module.system.dal.dataobject.notify.NotifyMessageDO; | 8 | import cn.iocoder.yudao.module.system.dal.dataobject.notify.NotifyMessageDO; |
| 8 | import org.apache.ibatis.annotations.Mapper; | 9 | import org.apache.ibatis.annotations.Mapper; |
| @@ -17,23 +18,31 @@ import java.util.List; | @@ -17,23 +18,31 @@ import java.util.List; | ||
| 17 | @Mapper | 18 | @Mapper |
| 18 | public interface NotifyMessageMapper extends BaseMapperX<NotifyMessageDO> { | 19 | public interface NotifyMessageMapper extends BaseMapperX<NotifyMessageDO> { |
| 19 | 20 | ||
| 20 | - default PageResult<NotifyMessageDO> selectPage(NotifyMessagePageReqVO reqVO) { | 21 | + default PageResult<NotifyMessageDO> selectPage(NotifyMessagePageReqVO reqVO, Long userId, Integer userType) { |
| 21 | return selectPage(reqVO, new LambdaQueryWrapperX<NotifyMessageDO>() | 22 | return selectPage(reqVO, new LambdaQueryWrapperX<NotifyMessageDO>() |
| 22 | .likeIfPresent(NotifyMessageDO::getTitle, reqVO.getTitle()) | 23 | .likeIfPresent(NotifyMessageDO::getTitle, reqVO.getTitle()) |
| 23 | .eqIfPresent(NotifyMessageDO::getReadStatus, reqVO.getReadStatus()) | 24 | .eqIfPresent(NotifyMessageDO::getReadStatus, reqVO.getReadStatus()) |
| 24 | .betweenIfPresent(NotifyMessageDO::getCreateTime, reqVO.getCreateTime()) | 25 | .betweenIfPresent(NotifyMessageDO::getCreateTime, reqVO.getCreateTime()) |
| 25 | - .eqIfPresent(NotifyMessageDO::getUserId, reqVO.getUserId()) | ||
| 26 | - .eqIfPresent(NotifyMessageDO::getUserType, reqVO.getUserType()) | 26 | + .eq(NotifyMessageDO::getUserId, userId) |
| 27 | + .eq(NotifyMessageDO::getUserType, userType) | ||
| 27 | .orderByDesc(NotifyMessageDO::getId)); | 28 | .orderByDesc(NotifyMessageDO::getId)); |
| 28 | } | 29 | } |
| 29 | 30 | ||
| 30 | - default List<NotifyMessageDO> selectList(NotifyMessagePageReqVO reqVO, Integer size) { | 31 | + default PageResult<NotifyMessageDO> selectSendPage(NotifyLogPageReqVO reqVO, Long userId) { |
| 32 | + return selectPage(reqVO, new LambdaQueryWrapperX<NotifyMessageDO>() | ||
| 33 | + .likeIfPresent(NotifyMessageDO::getTitle, reqVO.getTitle()) | ||
| 34 | + .betweenIfPresent(NotifyMessageDO::getSendTime, reqVO.getSendTime()) | ||
| 35 | + .eq(NotifyMessageDO::getSendUserId, userId) | ||
| 36 | + .orderByDesc(NotifyMessageDO::getId)); | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + default List<NotifyMessageDO> selectList(NotifyMessagePageReqVO reqVO, Integer size, Long userId, Integer userType) { | ||
| 31 | return selectList(new LambdaQueryWrapperX<NotifyMessageDO>() | 40 | return selectList(new LambdaQueryWrapperX<NotifyMessageDO>() |
| 32 | .likeIfPresent(NotifyMessageDO::getTitle, reqVO.getTitle()) | 41 | .likeIfPresent(NotifyMessageDO::getTitle, reqVO.getTitle()) |
| 33 | .eqIfPresent(NotifyMessageDO::getReadStatus, reqVO.getReadStatus()) | 42 | .eqIfPresent(NotifyMessageDO::getReadStatus, reqVO.getReadStatus()) |
| 34 | .betweenIfPresent(NotifyMessageDO::getCreateTime, reqVO.getCreateTime()) | 43 | .betweenIfPresent(NotifyMessageDO::getCreateTime, reqVO.getCreateTime()) |
| 35 | - .eqIfPresent(NotifyMessageDO::getUserId, reqVO.getUserId()) | ||
| 36 | - .eqIfPresent(NotifyMessageDO::getUserType, reqVO.getUserType()) | 44 | + .eqIfPresent(NotifyMessageDO::getUserId, userId) |
| 45 | + .eqIfPresent(NotifyMessageDO::getUserType, userType) | ||
| 37 | .orderByDesc(NotifyMessageDO::getId) | 46 | .orderByDesc(NotifyMessageDO::getId) |
| 38 | .last("limit " + size)); | 47 | .last("limit " + size)); |
| 39 | } | 48 | } |
| @@ -51,4 +60,5 @@ public interface NotifyMessageMapper extends BaseMapperX<NotifyMessageDO> { | @@ -51,4 +60,5 @@ public interface NotifyMessageMapper extends BaseMapperX<NotifyMessageDO> { | ||
| 51 | .eq(NotifyMessageDO::getUserId, userId) | 60 | .eq(NotifyMessageDO::getUserId, userId) |
| 52 | .eq(NotifyMessageDO::getUserType, userType)); | 61 | .eq(NotifyMessageDO::getUserType, userType)); |
| 53 | } | 62 | } |
| 63 | + | ||
| 54 | } | 64 | } |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/notify/NotifyLogService.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.service.notify; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 4 | +import cn.iocoder.yudao.module.system.controller.admin.notify.vo.log.NotifyLogPageReqVO; | ||
| 5 | +import cn.iocoder.yudao.module.system.dal.dataobject.notify.NotifyMessageDO; | ||
| 6 | + | ||
| 7 | +/** | ||
| 8 | + * <p> | ||
| 9 | + * 站内信日志 Service 接口 | ||
| 10 | + * </p> | ||
| 11 | + * | ||
| 12 | + * @author LuoWenFeng | ||
| 13 | + */ | ||
| 14 | +public interface NotifyLogService { | ||
| 15 | + | ||
| 16 | + | ||
| 17 | + /** | ||
| 18 | + * 获得站内信发送分页 | ||
| 19 | + * | ||
| 20 | + * @param pageReqVO 分页查询 | ||
| 21 | + * @return 站内信分页 | ||
| 22 | + */ | ||
| 23 | + PageResult<NotifyMessageDO> getNotifyMessageSendPage(NotifyLogPageReqVO pageReqVO); | ||
| 24 | +} |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/notify/NotifyLogServiceImpl.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.service.notify; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 4 | +import cn.iocoder.yudao.module.system.controller.admin.notify.vo.log.NotifyLogPageReqVO; | ||
| 5 | +import cn.iocoder.yudao.module.system.dal.dataobject.notify.NotifyMessageDO; | ||
| 6 | +import cn.iocoder.yudao.module.system.dal.mysql.notify.NotifyMessageMapper; | ||
| 7 | +import org.springframework.stereotype.Service; | ||
| 8 | +import org.springframework.validation.annotation.Validated; | ||
| 9 | + | ||
| 10 | +import javax.annotation.Resource; | ||
| 11 | + | ||
| 12 | +import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; | ||
| 13 | + | ||
| 14 | +/** | ||
| 15 | + * <p> | ||
| 16 | + * 站内信日志 Service 实现类 | ||
| 17 | + * | ||
| 18 | + * </p> | ||
| 19 | + * | ||
| 20 | + * @author LuoWenFeng | ||
| 21 | + */ | ||
| 22 | +@Service | ||
| 23 | +@Validated | ||
| 24 | +public class NotifyLogServiceImpl implements NotifyLogService { | ||
| 25 | + | ||
| 26 | + @Resource | ||
| 27 | + private NotifyMessageMapper notifyMessageMapper; | ||
| 28 | + | ||
| 29 | + @Override | ||
| 30 | + public PageResult<NotifyMessageDO> getNotifyMessageSendPage(NotifyLogPageReqVO pageReqVO) { | ||
| 31 | + return notifyMessageMapper.selectSendPage(pageReqVO, getLoginUserId()); | ||
| 32 | + } | ||
| 33 | + | ||
| 34 | + | ||
| 35 | +} |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/notify/NotifyMessageService.java
| @@ -49,7 +49,7 @@ public interface NotifyMessageService { | @@ -49,7 +49,7 @@ public interface NotifyMessageService { | ||
| 49 | /** | 49 | /** |
| 50 | * 统计用户未读站内信条数 | 50 | * 统计用户未读站内信条数 |
| 51 | * | 51 | * |
| 52 | - * @param userId 用户ID | 52 | + * @param userId 用户ID |
| 53 | * @param userType 用户类型 | 53 | * @param userType 用户类型 |
| 54 | * @return 返回未读站内信条数 | 54 | * @return 返回未读站内信条数 |
| 55 | */ | 55 | */ |
| @@ -58,7 +58,7 @@ public interface NotifyMessageService { | @@ -58,7 +58,7 @@ public interface NotifyMessageService { | ||
| 58 | /** | 58 | /** |
| 59 | * 修改站内信阅读状态 | 59 | * 修改站内信阅读状态 |
| 60 | * | 60 | * |
| 61 | - * @param id 站内信编号 | 61 | + * @param id 站内信编号 |
| 62 | * @param status 状态 | 62 | * @param status 状态 |
| 63 | */ | 63 | */ |
| 64 | void updateNotifyMessageReadStatus(Long id, Boolean status); | 64 | void updateNotifyMessageReadStatus(Long id, Boolean status); |
| @@ -66,7 +66,7 @@ public interface NotifyMessageService { | @@ -66,7 +66,7 @@ public interface NotifyMessageService { | ||
| 66 | /** | 66 | /** |
| 67 | * 批量修改站内信阅读状态 | 67 | * 批量修改站内信阅读状态 |
| 68 | * | 68 | * |
| 69 | - * @param ids 站内信编号集合 | 69 | + * @param ids 站内信编号集合 |
| 70 | * @param userId 用户ID | 70 | * @param userId 用户ID |
| 71 | */ | 71 | */ |
| 72 | void batchUpdateNotifyMessageReadStatus(Collection<Long> ids, Long userId); | 72 | void batchUpdateNotifyMessageReadStatus(Collection<Long> ids, Long userId); |
| @@ -74,8 +74,9 @@ public interface NotifyMessageService { | @@ -74,8 +74,9 @@ public interface NotifyMessageService { | ||
| 74 | /** | 74 | /** |
| 75 | * 批量修改用户所有未读消息标记已读 | 75 | * 批量修改用户所有未读消息标记已读 |
| 76 | * | 76 | * |
| 77 | - * @param userId 用户ID | 77 | + * @param userId 用户ID |
| 78 | * @param userType 用户类型 | 78 | * @param userType 用户类型 |
| 79 | */ | 79 | */ |
| 80 | void batchUpdateAllNotifyMessageReadStatus(Long userId, Integer userType); | 80 | void batchUpdateAllNotifyMessageReadStatus(Long userId, Integer userType); |
| 81 | + | ||
| 81 | } | 82 | } |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/notify/NotifyMessageServiceImpl.java
| @@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.system.service.notify; | @@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.system.service.notify; | ||
| 3 | import cn.hutool.core.collection.CollUtil; | 3 | import cn.hutool.core.collection.CollUtil; |
| 4 | import cn.hutool.core.util.NumberUtil; | 4 | import cn.hutool.core.util.NumberUtil; |
| 5 | import cn.iocoder.yudao.framework.common.core.KeyValue; | 5 | import cn.iocoder.yudao.framework.common.core.KeyValue; |
| 6 | +import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; | ||
| 6 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 7 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 7 | import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; | 8 | import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; |
| 8 | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | 9 | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| @@ -16,11 +17,13 @@ import org.springframework.validation.annotation.Validated; | @@ -16,11 +17,13 @@ import org.springframework.validation.annotation.Validated; | ||
| 16 | 17 | ||
| 17 | import javax.annotation.Resource; | 18 | import javax.annotation.Resource; |
| 18 | import java.util.Collection; | 19 | import java.util.Collection; |
| 20 | +import java.util.Date; | ||
| 19 | import java.util.List; | 21 | import java.util.List; |
| 20 | import java.util.Map; | 22 | import java.util.Map; |
| 21 | import java.util.stream.Collectors; | 23 | import java.util.stream.Collectors; |
| 22 | 24 | ||
| 23 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | 25 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| 26 | +import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; | ||
| 24 | import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*; | 27 | import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*; |
| 25 | 28 | ||
| 26 | /** | 29 | /** |
| @@ -86,12 +89,12 @@ public class NotifyMessageServiceImpl implements NotifyMessageService { | @@ -86,12 +89,12 @@ public class NotifyMessageServiceImpl implements NotifyMessageService { | ||
| 86 | 89 | ||
| 87 | @Override | 90 | @Override |
| 88 | public List<NotifyMessageDO> getNotifyMessageList(NotifyMessagePageReqVO pageReqVO, Integer size) { | 91 | public List<NotifyMessageDO> getNotifyMessageList(NotifyMessagePageReqVO pageReqVO, Integer size) { |
| 89 | - return notifyMessageMapper.selectList(pageReqVO, size); | 92 | + return notifyMessageMapper.selectList(pageReqVO, size, getLoginUserId(), UserTypeEnum.ADMIN.getValue()); |
| 90 | } | 93 | } |
| 91 | 94 | ||
| 92 | @Override | 95 | @Override |
| 93 | public PageResult<NotifyMessageDO> getNotifyMessagePage(NotifyMessagePageReqVO pageReqVO) { | 96 | public PageResult<NotifyMessageDO> getNotifyMessagePage(NotifyMessagePageReqVO pageReqVO) { |
| 94 | - return notifyMessageMapper.selectPage(pageReqVO); | 97 | + return notifyMessageMapper.selectPage(pageReqVO, getLoginUserId(), UserTypeEnum.ADMIN.getValue()); |
| 95 | } | 98 | } |
| 96 | 99 | ||
| 97 | /** | 100 | /** |
| @@ -160,9 +163,15 @@ public class NotifyMessageServiceImpl implements NotifyMessageService { | @@ -160,9 +163,15 @@ public class NotifyMessageServiceImpl implements NotifyMessageService { | ||
| 160 | } | 163 | } |
| 161 | } | 164 | } |
| 162 | 165 | ||
| 166 | + | ||
| 167 | + /** | ||
| 168 | + * 批量修改阅读状态为已读 | ||
| 169 | + * @param ids | ||
| 170 | + */ | ||
| 163 | private void batchUpdateReadStatus(Collection<Long> ids) { | 171 | private void batchUpdateReadStatus(Collection<Long> ids) { |
| 164 | NotifyMessageDO updateObj = new NotifyMessageDO(); | 172 | NotifyMessageDO updateObj = new NotifyMessageDO(); |
| 165 | - updateObj.setReadStatus(false); | 173 | + updateObj.setReadStatus(true); |
| 174 | + updateObj.setReadTime(new Date()); | ||
| 166 | notifyMessageMapper.update(updateObj, new LambdaQueryWrapperX<NotifyMessageDO>().in(NotifyMessageDO::getId, ids)); | 175 | notifyMessageMapper.update(updateObj, new LambdaQueryWrapperX<NotifyMessageDO>().in(NotifyMessageDO::getId, ids)); |
| 167 | } | 176 | } |
| 168 | } | 177 | } |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/notify/NotifySendService.java
| @@ -12,36 +12,36 @@ public interface NotifySendService { | @@ -12,36 +12,36 @@ public interface NotifySendService { | ||
| 12 | * 在 mobile 为空时,使用 userId 加载对应管理员的手机号 | 12 | * 在 mobile 为空时,使用 userId 加载对应管理员的手机号 |
| 13 | * | 13 | * |
| 14 | * @param userId 用户编号 | 14 | * @param userId 用户编号 |
| 15 | - * @param templateId 短信模板编号 | 15 | + * @param templateCode 短信模板编号 |
| 16 | * @param templateParams 短信模板参数 | 16 | * @param templateParams 短信模板参数 |
| 17 | * @return 发送日志编号 | 17 | * @return 发送日志编号 |
| 18 | */ | 18 | */ |
| 19 | Long sendSingleNotifyToAdmin(Long userId, | 19 | Long sendSingleNotifyToAdmin(Long userId, |
| 20 | - Long templateId, Map<String, Object> templateParams); | 20 | + String templateCode, Map<String, Object> templateParams); |
| 21 | /** | 21 | /** |
| 22 | * 发送单条站内信给用户 APP 的用户 | 22 | * 发送单条站内信给用户 APP 的用户 |
| 23 | * | 23 | * |
| 24 | * 在 mobile 为空时,使用 userId 加载对应会员的手机号 | 24 | * 在 mobile 为空时,使用 userId 加载对应会员的手机号 |
| 25 | * | 25 | * |
| 26 | * @param userId 用户编号 | 26 | * @param userId 用户编号 |
| 27 | - * @param templateId 站内信模板编号 | 27 | + * @param templateCode 站内信模板编号 |
| 28 | * @param templateParams 站内信模板参数 | 28 | * @param templateParams 站内信模板参数 |
| 29 | * @return 发送日志编号 | 29 | * @return 发送日志编号 |
| 30 | */ | 30 | */ |
| 31 | Long sendSingleNotifyToMember(Long userId, | 31 | Long sendSingleNotifyToMember(Long userId, |
| 32 | - Long templateId, Map<String, Object> templateParams); | 32 | + String templateCode, Map<String, Object> templateParams); |
| 33 | 33 | ||
| 34 | /** | 34 | /** |
| 35 | * 发送单条站内信给用户 | 35 | * 发送单条站内信给用户 |
| 36 | * | 36 | * |
| 37 | * @param userId 用户编号 | 37 | * @param userId 用户编号 |
| 38 | * @param userType 用户类型 | 38 | * @param userType 用户类型 |
| 39 | - * @param templateId 站内信模板编号 | 39 | + * @param templateCode 站内信模板编号 |
| 40 | * @param templateParams 站内信模板参数 | 40 | * @param templateParams 站内信模板参数 |
| 41 | * @return 发送日志编号 | 41 | * @return 发送日志编号 |
| 42 | */ | 42 | */ |
| 43 | Long sendSingleNotify( Long userId, Integer userType, | 43 | Long sendSingleNotify( Long userId, Integer userType, |
| 44 | - Long templateId, Map<String, Object> templateParams); | 44 | + String templateCode, Map<String, Object> templateParams); |
| 45 | 45 | ||
| 46 | default void sendBatchNotify(List<String> mobiles, List<Long> userIds, Integer userType, | 46 | default void sendBatchNotify(List<String> mobiles, List<Long> userIds, Integer userType, |
| 47 | String templateCode, Map<String, Object> templateParams) { | 47 | String templateCode, Map<String, Object> templateParams) { |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/notify/NotifySendServiceImpl.java
| @@ -3,7 +3,9 @@ package cn.iocoder.yudao.module.system.service.notify; | @@ -3,7 +3,9 @@ package cn.iocoder.yudao.module.system.service.notify; | ||
| 3 | import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; | 3 | import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; |
| 4 | import cn.iocoder.yudao.module.system.dal.dataobject.notify.NotifyMessageDO; | 4 | import cn.iocoder.yudao.module.system.dal.dataobject.notify.NotifyMessageDO; |
| 5 | import cn.iocoder.yudao.module.system.dal.dataobject.notify.NotifyTemplateDO; | 5 | import cn.iocoder.yudao.module.system.dal.dataobject.notify.NotifyTemplateDO; |
| 6 | +import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO; | ||
| 6 | import cn.iocoder.yudao.module.system.dal.mysql.notify.NotifyMessageMapper; | 7 | import cn.iocoder.yudao.module.system.dal.mysql.notify.NotifyMessageMapper; |
| 8 | +import cn.iocoder.yudao.module.system.service.user.AdminUserService; | ||
| 7 | import com.google.common.annotations.VisibleForTesting; | 9 | import com.google.common.annotations.VisibleForTesting; |
| 8 | import lombok.extern.slf4j.Slf4j; | 10 | import lombok.extern.slf4j.Slf4j; |
| 9 | import org.springframework.stereotype.Service; | 11 | import org.springframework.stereotype.Service; |
| @@ -14,6 +16,7 @@ import java.util.Date; | @@ -14,6 +16,7 @@ import java.util.Date; | ||
| 14 | import java.util.Map; | 16 | import java.util.Map; |
| 15 | 17 | ||
| 16 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | 18 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| 19 | +import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; | ||
| 17 | import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.NOTICE_NOT_FOUND; | 20 | import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.NOTICE_NOT_FOUND; |
| 18 | 21 | ||
| 19 | /** | 22 | /** |
| @@ -32,41 +35,48 @@ public class NotifySendServiceImpl implements NotifySendService { | @@ -32,41 +35,48 @@ public class NotifySendServiceImpl implements NotifySendService { | ||
| 32 | @Resource | 35 | @Resource |
| 33 | private NotifyMessageMapper notifyMessageMapper; | 36 | private NotifyMessageMapper notifyMessageMapper; |
| 34 | 37 | ||
| 38 | + @Resource | ||
| 39 | + private AdminUserService userService; | ||
| 40 | + | ||
| 35 | @Override | 41 | @Override |
| 36 | - public Long sendSingleNotifyToAdmin(Long userId, Long templateId, Map<String, Object> templateParams) { | 42 | + public Long sendSingleNotifyToAdmin(Long userId, String templateCode, Map<String, Object> templateParams) { |
| 37 | 43 | ||
| 38 | - return sendSingleNotify(userId, UserTypeEnum.ADMIN.getValue(), templateId, templateParams); | 44 | + return sendSingleNotify(userId, UserTypeEnum.ADMIN.getValue(), templateCode, templateParams); |
| 39 | } | 45 | } |
| 40 | 46 | ||
| 41 | @Override | 47 | @Override |
| 42 | - public Long sendSingleNotifyToMember(Long userId, Long templateId, Map<String, Object> templateParams) { | ||
| 43 | - return sendSingleNotify(userId, UserTypeEnum.MEMBER.getValue(), templateId, templateParams); | 48 | + public Long sendSingleNotifyToMember(Long userId, String templateCode, Map<String, Object> templateParams) { |
| 49 | + return sendSingleNotify(userId, UserTypeEnum.MEMBER.getValue(), templateCode, templateParams); | ||
| 44 | } | 50 | } |
| 45 | 51 | ||
| 46 | @Override | 52 | @Override |
| 47 | - public Long sendSingleNotify(Long userId, Integer userType, Long templateId, Map<String, Object> templateParams) { | 53 | + public Long sendSingleNotify(Long userId, Integer userType, String templateCode, Map<String, Object> templateParams) { |
| 48 | // 校验短信模板是否合法 | 54 | // 校验短信模板是否合法 |
| 49 | - NotifyTemplateDO template = this.checkNotifyTemplateValid(templateId); | 55 | + NotifyTemplateDO template = this.checkNotifyTemplateValid(templateCode); |
| 50 | String content = notifyTemplateService.formatNotifyTemplateContent(template.getContent(), templateParams); | 56 | String content = notifyTemplateService.formatNotifyTemplateContent(template.getContent(), templateParams); |
| 57 | + AdminUserDO sendUser = userService.getUser(getLoginUserId()); | ||
| 51 | 58 | ||
| 52 | // todo 模板状态未开启时的业务 | 59 | // todo 模板状态未开启时的业务 |
| 53 | NotifyMessageDO notifyMessageDO = new NotifyMessageDO(); | 60 | NotifyMessageDO notifyMessageDO = new NotifyMessageDO(); |
| 54 | notifyMessageDO.setContent(content); | 61 | notifyMessageDO.setContent(content); |
| 55 | notifyMessageDO.setTitle(template.getTitle()); | 62 | notifyMessageDO.setTitle(template.getTitle()); |
| 56 | notifyMessageDO.setReadStatus(false); | 63 | notifyMessageDO.setReadStatus(false); |
| 57 | - notifyMessageDO.setReadTime(new Date()); | ||
| 58 | - notifyMessageDO.setTemplateId(templateId); | 64 | + notifyMessageDO.setTemplateId(template.getId()); |
| 65 | + notifyMessageDO.setTemplateCode(templateCode); | ||
| 59 | notifyMessageDO.setUserId(userId); | 66 | notifyMessageDO.setUserId(userId); |
| 60 | notifyMessageDO.setUserType(userType); | 67 | notifyMessageDO.setUserType(userType); |
| 68 | + notifyMessageDO.setSendTime(new Date()); | ||
| 69 | + notifyMessageDO.setSendUserId(sendUser.getId()); | ||
| 70 | + notifyMessageDO.setSendUserName(sendUser.getUsername()); | ||
| 61 | notifyMessageMapper.insert(notifyMessageDO); | 71 | notifyMessageMapper.insert(notifyMessageDO); |
| 62 | return notifyMessageDO.getId(); | 72 | return notifyMessageDO.getId(); |
| 63 | } | 73 | } |
| 64 | 74 | ||
| 65 | // 此注解的含义 | 75 | // 此注解的含义 |
| 66 | @VisibleForTesting | 76 | @VisibleForTesting |
| 67 | - public NotifyTemplateDO checkNotifyTemplateValid(Long templateId) { | 77 | + public NotifyTemplateDO checkNotifyTemplateValid(String templateCode) { |
| 68 | // 获得短信模板。考虑到效率,从缓存中获取 | 78 | // 获得短信模板。考虑到效率,从缓存中获取 |
| 69 | - NotifyTemplateDO template = notifyTemplateService.getNotifyTemplate(templateId); | 79 | + NotifyTemplateDO template = notifyTemplateService.getNotifyTemplateByCodeFromCache(templateCode); |
| 70 | // 短信模板不存在 | 80 | // 短信模板不存在 |
| 71 | if (template == null) { | 81 | if (template == null) { |
| 72 | throw exception(NOTICE_NOT_FOUND); | 82 | throw exception(NOTICE_NOT_FOUND); |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/notify/NotifyTemplateServiceImpl.java
| @@ -109,7 +109,7 @@ public class NotifyTemplateServiceImpl implements NotifyTemplateService { | @@ -109,7 +109,7 @@ public class NotifyTemplateServiceImpl implements NotifyTemplateService { | ||
| 109 | return notifyTemplateMapper.selectList(); | 109 | return notifyTemplateMapper.selectList(); |
| 110 | } | 110 | } |
| 111 | 111 | ||
| 112 | - @Scheduled(fixedDelay = SCHEDULER_PERIOD, initialDelay = SCHEDULER_PERIOD) | 112 | + @Scheduled(fixedDelay = SCHEDULER_PERIOD) |
| 113 | public void schedulePeriodicRefresh() { | 113 | public void schedulePeriodicRefresh() { |
| 114 | initLocalCache(); | 114 | initLocalCache(); |
| 115 | } | 115 | } |
yudao-ui-admin/src/api/system/notify/myNotify.js
0 → 100644
| 1 | +import request from '@/utils/request' | ||
| 2 | + | ||
| 3 | + | ||
| 4 | +// 获得我的站内信分页 | ||
| 5 | +export function getNotifyMessagePage(query) { | ||
| 6 | + return request({ | ||
| 7 | + url: '/system/notify-message/page', | ||
| 8 | + method: 'get', | ||
| 9 | + params: query | ||
| 10 | + }) | ||
| 11 | +} | ||
| 12 | + | ||
| 13 | +// 获得单条我的站内信 | ||
| 14 | +export function getNotifyMessage(query) { | ||
| 15 | + return request({ | ||
| 16 | + url: '/system/notify-message/get', | ||
| 17 | + method: 'get', | ||
| 18 | + params: query | ||
| 19 | + }) | ||
| 20 | +} | ||
| 21 | + | ||
| 22 | +// 批量标记已读 | ||
| 23 | +export function updateNotifyMessageListRead(data) { | ||
| 24 | + return request({ | ||
| 25 | + url: '/system/notify-message/update-list-read', | ||
| 26 | + method: 'put', | ||
| 27 | + data: data | ||
| 28 | + }) | ||
| 29 | +} | ||
| 30 | + | ||
| 31 | +// 所有未读消息标记已读 | ||
| 32 | +export function updateNotifyMessageAllRead(data) { | ||
| 33 | + return request({ | ||
| 34 | + url: '/system/notify-message/update-all-read', | ||
| 35 | + method: 'put', | ||
| 36 | + data: data | ||
| 37 | + }) | ||
| 38 | +} |
yudao-ui-admin/src/api/system/notify/notifyLog.js
0 → 100644
yudao-ui-admin/src/api/system/notify/notifyTemplate.js
0 → 100644
| 1 | +import request from '@/utils/request' | ||
| 2 | + | ||
| 3 | +// 创建站内信模板 | ||
| 4 | +export function createNotifyTemplate(data) { | ||
| 5 | + return request({ | ||
| 6 | + url: '/system/notify-template/create', | ||
| 7 | + method: 'post', | ||
| 8 | + data: data | ||
| 9 | + }) | ||
| 10 | +} | ||
| 11 | + | ||
| 12 | +// 更新站内信模板 | ||
| 13 | +export function updateNotifyTemplate(data) { | ||
| 14 | + return request({ | ||
| 15 | + url: '/system/notify-template/update', | ||
| 16 | + method: 'put', | ||
| 17 | + data: data | ||
| 18 | + }) | ||
| 19 | +} | ||
| 20 | + | ||
| 21 | +// 删除站内信模板 | ||
| 22 | +export function deleteNotifyTemplate(id) { | ||
| 23 | + return request({ | ||
| 24 | + url: '/system/notify-template/delete?id=' + id, | ||
| 25 | + method: 'delete' | ||
| 26 | + }) | ||
| 27 | +} | ||
| 28 | + | ||
| 29 | +// 获得站内信模板 | ||
| 30 | +export function getNotifyTemplate(id) { | ||
| 31 | + return request({ | ||
| 32 | + url: '/system/notify-template/get?id=' + id, | ||
| 33 | + method: 'get' | ||
| 34 | + }) | ||
| 35 | +} | ||
| 36 | + | ||
| 37 | +// 获得站内信模板分页 | ||
| 38 | +export function getNotifyTemplatePage(query) { | ||
| 39 | + return request({ | ||
| 40 | + url: '/system/notify-template/page', | ||
| 41 | + method: 'get', | ||
| 42 | + params: query | ||
| 43 | + }) | ||
| 44 | +} | ||
| 45 | + | ||
| 46 | +// 创建站内信模板 | ||
| 47 | +export function sendNotify(data) { | ||
| 48 | + return request({ | ||
| 49 | + url: '/system/notify-template/send-notify', | ||
| 50 | + method: 'post', | ||
| 51 | + data: data | ||
| 52 | + }) | ||
| 53 | +} | ||
| 54 | + | ||
| 55 | +// 导出站内信模板 Excel | ||
| 56 | +export function exportNotifyTemplateExcel(query) { | ||
| 57 | + return request({ | ||
| 58 | + url: '/system/notify-template/export-excel', | ||
| 59 | + method: 'get', | ||
| 60 | + params: query, | ||
| 61 | + responseType: 'blob' | ||
| 62 | + }) | ||
| 63 | +} | ||
| 64 | + |
yudao-ui-admin/src/utils/dict.js
| @@ -24,6 +24,7 @@ export const DICT_TYPE = { | @@ -24,6 +24,7 @@ export const DICT_TYPE = { | ||
| 24 | SYSTEM_SMS_RECEIVE_STATUS: 'system_sms_receive_status', | 24 | SYSTEM_SMS_RECEIVE_STATUS: 'system_sms_receive_status', |
| 25 | SYSTEM_ERROR_CODE_TYPE: 'system_error_code_type', | 25 | SYSTEM_ERROR_CODE_TYPE: 'system_error_code_type', |
| 26 | SYSTEM_OAUTH2_GRANT_TYPE: 'system_oauth2_grant_type', | 26 | SYSTEM_OAUTH2_GRANT_TYPE: 'system_oauth2_grant_type', |
| 27 | + SYSTEM_NOTIFY_READ_STATUS: "system_notify_read_status", | ||
| 27 | 28 | ||
| 28 | // ========== INFRA 模块 ========== | 29 | // ========== INFRA 模块 ========== |
| 29 | INFRA_BOOLEAN_STRING: 'infra_boolean_string', | 30 | INFRA_BOOLEAN_STRING: 'infra_boolean_string', |
yudao-ui-admin/src/views/system/notify/myNotify.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <div class="app-container"> | ||
| 3 | + <!-- 搜索工作栏 --> | ||
| 4 | + <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="150px"> | ||
| 5 | + <el-form-item label="模板标题" prop="title"> | ||
| 6 | + <el-input v-model="queryParams.title" placeholder="请输入模板标题" clearable @keyup.enter.native="handleQuery"/> | ||
| 7 | + </el-form-item> | ||
| 8 | + <el-form-item label="读取状态" prop="readStatus"> | ||
| 9 | + <el-select v-model="queryParams.readStatus" placeholder="请选择状态" clearable> | ||
| 10 | + <el-option v-for="dict in this.getDictDatas(DICT_TYPE.SYSTEM_NOTIFY_READ_STATUS)" | ||
| 11 | + :key="dict.value" :label="dict.label" :value="dict.value"/> | ||
| 12 | + </el-select> | ||
| 13 | + </el-form-item> | ||
| 14 | + <el-form-item label="创建时间" prop="createTime"> | ||
| 15 | + <el-date-picker v-model="queryParams.createTime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" type="daterange" | ||
| 16 | + range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']" /> | ||
| 17 | + </el-form-item> | ||
| 18 | + <el-form-item> | ||
| 19 | + <el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button> | ||
| 20 | + <el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button> | ||
| 21 | + </el-form-item> | ||
| 22 | + </el-form> | ||
| 23 | + | ||
| 24 | + <!-- 操作工具栏 --> | ||
| 25 | + <el-row :gutter="10" class="mb8"> | ||
| 26 | + <el-col :span="1.5"> | ||
| 27 | + <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleUpdateList">标记已读</el-button> | ||
| 28 | + </el-col> | ||
| 29 | + <el-col :span="1.5"> | ||
| 30 | + <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleUpdateAll">全部已读</el-button> | ||
| 31 | + </el-col> | ||
| 32 | + <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> | ||
| 33 | + </el-row> | ||
| 34 | + | ||
| 35 | + <!-- 列表 --> | ||
| 36 | + <el-table v-loading="loading" ref="tables" :data="list"> | ||
| 37 | + <el-table-column type="selection" width="55" /> | ||
| 38 | + <el-table-column label="模板标题" align="center" prop="title" /> | ||
| 39 | + <el-table-column label="模板内容" align="center" prop="content" width="300" /> | ||
| 40 | + <el-table-column label="发送人" align="center" prop="sendUserName" /> | ||
| 41 | + <el-table-column label="发送时间" align="center" prop="sendTime" width="180"> | ||
| 42 | + <template slot-scope="scope"> | ||
| 43 | + <span>{{ parseTime(scope.row.sendTime) }}</span> | ||
| 44 | + </template> | ||
| 45 | + </el-table-column> | ||
| 46 | + <el-table-column label="读取状态" align="center" prop="readStatus"> | ||
| 47 | + <template slot-scope="scope"> | ||
| 48 | + <dict-tag :type="DICT_TYPE.SYSTEM_NOTIFY_READ_STATUS" :value="scope.row.readStatus"/> | ||
| 49 | + </template> | ||
| 50 | + </el-table-column> | ||
| 51 | + <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="150"> | ||
| 52 | + <template slot-scope="scope"> | ||
| 53 | + <el-button v-show="!scope.row.readStatus" size="mini" type="text" icon="el-icon-check" @click="handleUpdateSingle(scope.row)">已读</el-button> | ||
| 54 | + </template> | ||
| 55 | + </el-table-column> | ||
| 56 | + </el-table> | ||
| 57 | + <!-- 分页组件 --> | ||
| 58 | + <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize" | ||
| 59 | + @pagination="getList"/> | ||
| 60 | + | ||
| 61 | + </div> | ||
| 62 | +</template> | ||
| 63 | + | ||
| 64 | +<script> | ||
| 65 | +import { getNotifyMessagePage, updateNotifyMessageListRead, updateNotifyMessageAllRead} from "@/api/system/notify/myNotify"; | ||
| 66 | + | ||
| 67 | +export default { | ||
| 68 | + name: "myNotify", | ||
| 69 | + data() { | ||
| 70 | + return { | ||
| 71 | + // 遮罩层 | ||
| 72 | + loading: true, | ||
| 73 | + // 导出遮罩层 | ||
| 74 | + exportLoading: false, | ||
| 75 | + // 显示搜索条件 | ||
| 76 | + showSearch: true, | ||
| 77 | + // 总条数 | ||
| 78 | + total: 0, | ||
| 79 | + // 我的站内信列表 | ||
| 80 | + list: [], | ||
| 81 | + // 弹出层标题 | ||
| 82 | + title: "", | ||
| 83 | + // 是否显示弹出层 | ||
| 84 | + open: false, | ||
| 85 | + // 查询参数 | ||
| 86 | + queryParams: { | ||
| 87 | + pageNo: 1, | ||
| 88 | + pageSize: 10, | ||
| 89 | + readStatus: null, | ||
| 90 | + code: null, | ||
| 91 | + title: null, | ||
| 92 | + createTime: [] | ||
| 93 | + }, | ||
| 94 | + }; | ||
| 95 | + }, | ||
| 96 | + created() { | ||
| 97 | + this.getList(); | ||
| 98 | + }, | ||
| 99 | + methods: { | ||
| 100 | + /** 查询列表 */ | ||
| 101 | + getList() { | ||
| 102 | + this.loading = true; | ||
| 103 | + // 执行查询 | ||
| 104 | + getNotifyMessagePage(this.queryParams).then(response => { | ||
| 105 | + this.list = response.data.list; | ||
| 106 | + this.total = response.data.total; | ||
| 107 | + this.loading = false; | ||
| 108 | + }); | ||
| 109 | + }, | ||
| 110 | + /** 搜索按钮操作 */ | ||
| 111 | + handleQuery() { | ||
| 112 | + this.queryParams.pageNo = 1; | ||
| 113 | + this.getList(); | ||
| 114 | + }, | ||
| 115 | + /** 重置按钮操作 */ | ||
| 116 | + resetQuery() { | ||
| 117 | + this.resetForm("queryForm"); | ||
| 118 | + this.handleQuery(); | ||
| 119 | + }, | ||
| 120 | + handleUpdateList(){ | ||
| 121 | + let list = this.$refs["tables"].selection; | ||
| 122 | + if(list.length != 0){ | ||
| 123 | + this.handleUpdate(list.map(v=>v.id)) | ||
| 124 | + } | ||
| 125 | + }, | ||
| 126 | + handleUpdateSingle(row){ | ||
| 127 | + this.handleUpdate([row.id]) | ||
| 128 | + }, | ||
| 129 | + handleUpdate(ids){ | ||
| 130 | + updateNotifyMessageListRead(ids).then(response => { | ||
| 131 | + this.$modal.msgSuccess("修改成功"); | ||
| 132 | + this.getList(); | ||
| 133 | + }); | ||
| 134 | + }, | ||
| 135 | + handleUpdateAll(){ | ||
| 136 | + updateNotifyMessageAllRead().then(response => { | ||
| 137 | + this.$modal.msgSuccess("修改成功"); | ||
| 138 | + this.getList(); | ||
| 139 | + }); | ||
| 140 | + } | ||
| 141 | + } | ||
| 142 | +} | ||
| 143 | +</script> |
yudao-ui-admin/src/views/system/notify/notifyLog.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <div class="app-container"> | ||
| 3 | + <!-- 搜索工作栏 --> | ||
| 4 | + <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="150px"> | ||
| 5 | + <el-form-item label="模板编码" prop="templateCode"> | ||
| 6 | + <el-input v-model="queryParams.templateCode" placeholder="请输入模板编码" clearable @keyup.enter.native="handleQuery"/> | ||
| 7 | + </el-form-item> | ||
| 8 | + <el-form-item label="模板标题" prop="title"> | ||
| 9 | + <el-input v-model="queryParams.title" placeholder="请输入模板标题" clearable @keyup.enter.native="handleQuery"/> | ||
| 10 | + </el-form-item> | ||
| 11 | + <el-form-item label="发送时间" prop="sendTime"> | ||
| 12 | + <el-date-picker v-model="queryParams.sendTime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" type="daterange" | ||
| 13 | + range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']" /> | ||
| 14 | + </el-form-item> | ||
| 15 | + <el-form-item> | ||
| 16 | + <el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button> | ||
| 17 | + <el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button> | ||
| 18 | + </el-form-item> | ||
| 19 | + </el-form> | ||
| 20 | + | ||
| 21 | + <!-- 操作工具栏 --> | ||
| 22 | + <!-- <el-row :gutter="10" class="mb8"> | ||
| 23 | + <el-col :span="1.5"> | ||
| 24 | + <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading" | ||
| 25 | + v-hasPermi="['system:notify-log:export']">导出</el-button> | ||
| 26 | + </el-col> | ||
| 27 | + <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> | ||
| 28 | + </el-row> --> | ||
| 29 | + | ||
| 30 | + <!-- 列表 --> | ||
| 31 | + <el-table v-loading="loading" :data="list"> | ||
| 32 | + <el-table-column label="模板编码" align="center" prop="templateCode" /> | ||
| 33 | + <el-table-column label="模板标题" align="center" prop="title" /> | ||
| 34 | + <el-table-column label="模板内容" align="center" prop="content" width="300" /> | ||
| 35 | + <el-table-column label="阅读状态" align="center" prop="readStatus"> | ||
| 36 | + <template slot-scope="scope"> | ||
| 37 | + <dict-tag :type="DICT_TYPE.SYSTEM_NOTIFY_READ_STATUS" :value="scope.row.readStatus"/> | ||
| 38 | + </template> | ||
| 39 | + </el-table-column> | ||
| 40 | + <el-table-column label="接收人" align="center" prop="receiveUserName" /> | ||
| 41 | + <el-table-column label="发送时间" align="center" prop="sendTime" width="180"> | ||
| 42 | + <template slot-scope="scope"> | ||
| 43 | + <span>{{ parseTime(scope.row.sendTime) }}</span> | ||
| 44 | + </template> | ||
| 45 | + </el-table-column> | ||
| 46 | + <el-table-column label="阅读时间" align="center" prop="createTime" width="180"> | ||
| 47 | + <template slot-scope="scope"> | ||
| 48 | + <span>{{ parseTime(scope.row.readTime) }}</span> | ||
| 49 | + </template> | ||
| 50 | + </el-table-column> | ||
| 51 | + </el-table> | ||
| 52 | + <!-- 分页组件 --> | ||
| 53 | + <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize" | ||
| 54 | + @pagination="getList"/> | ||
| 55 | + | ||
| 56 | + </div> | ||
| 57 | +</template> | ||
| 58 | + | ||
| 59 | +<script> | ||
| 60 | +import { getNotifyLogPage} from "@/api/system/notify/notifyLog"; | ||
| 61 | + | ||
| 62 | +export default { | ||
| 63 | + name: "notifyLog", | ||
| 64 | + data() { | ||
| 65 | + return { | ||
| 66 | + // 遮罩层 | ||
| 67 | + loading: true, | ||
| 68 | + // 导出遮罩层 | ||
| 69 | + exportLoading: false, | ||
| 70 | + // 显示搜索条件 | ||
| 71 | + showSearch: true, | ||
| 72 | + // 总条数 | ||
| 73 | + total: 0, | ||
| 74 | + // 我的站内信列表 | ||
| 75 | + list: [], | ||
| 76 | + // 弹出层标题 | ||
| 77 | + title: "", | ||
| 78 | + // 是否显示弹出层 | ||
| 79 | + open: false, | ||
| 80 | + // 查询参数 | ||
| 81 | + queryParams: { | ||
| 82 | + pageNo: 1, | ||
| 83 | + pageSize: 10, | ||
| 84 | + templateCode: null, | ||
| 85 | + title: null, | ||
| 86 | + sendTime: [] | ||
| 87 | + }, | ||
| 88 | + }; | ||
| 89 | + }, | ||
| 90 | + created() { | ||
| 91 | + this.getList(); | ||
| 92 | + }, | ||
| 93 | + methods: { | ||
| 94 | + /** 查询列表 */ | ||
| 95 | + getList() { | ||
| 96 | + this.loading = true; | ||
| 97 | + // 执行查询 | ||
| 98 | + getNotifyLogPage(this.queryParams).then(response => { | ||
| 99 | + this.list = response.data.list; | ||
| 100 | + this.total = response.data.total; | ||
| 101 | + this.loading = false; | ||
| 102 | + }); | ||
| 103 | + }, | ||
| 104 | + /** 搜索按钮操作 */ | ||
| 105 | + handleQuery() { | ||
| 106 | + this.queryParams.pageNo = 1; | ||
| 107 | + this.getList(); | ||
| 108 | + }, | ||
| 109 | + /** 重置按钮操作 */ | ||
| 110 | + resetQuery() { | ||
| 111 | + this.resetForm("queryForm"); | ||
| 112 | + this.handleQuery(); | ||
| 113 | + }, | ||
| 114 | + } | ||
| 115 | +} | ||
| 116 | +</script> | ||
| 117 | + | ||
| 118 | +<style> | ||
| 119 | + | ||
| 120 | +</style> |
yudao-ui-admin/src/views/system/notify/notifyTemplate.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <div class="app-container"> | ||
| 3 | + <!-- 搜索工作栏 --> | ||
| 4 | + <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="150px"> | ||
| 5 | + <el-form-item label="模板编码" prop="code"> | ||
| 6 | + <el-input v-model="queryParams.code" placeholder="请输入模板编码" clearable @keyup.enter.native="handleQuery"/> | ||
| 7 | + </el-form-item> | ||
| 8 | + <el-form-item label="模板标题" prop="title"> | ||
| 9 | + <el-input v-model="queryParams.title" placeholder="请输入模板标题" clearable @keyup.enter.native="handleQuery"/> | ||
| 10 | + </el-form-item> | ||
| 11 | + <el-form-item label="开启状态" prop="status"> | ||
| 12 | + <el-select v-model="queryParams.status" placeholder="请选择开启状态" clearable> | ||
| 13 | + <el-option v-for="dict in this.getDictDatas(DICT_TYPE.COMMON_STATUS)" | ||
| 14 | + :key="dict.value" :label="dict.label" :value="dict.value"/> | ||
| 15 | + </el-select> | ||
| 16 | + </el-form-item> | ||
| 17 | + <el-form-item label="创建时间" prop="createTime"> | ||
| 18 | + <el-date-picker v-model="queryParams.createTime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" type="daterange" | ||
| 19 | + range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']" /> | ||
| 20 | + </el-form-item> | ||
| 21 | + <el-form-item> | ||
| 22 | + <el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button> | ||
| 23 | + <el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button> | ||
| 24 | + </el-form-item> | ||
| 25 | + </el-form> | ||
| 26 | + | ||
| 27 | + <!-- 操作工具栏 --> | ||
| 28 | + <el-row :gutter="10" class="mb8"> | ||
| 29 | + <el-col :span="1.5"> | ||
| 30 | + <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" | ||
| 31 | + v-hasPermi="['system:notify-template:create']">新增</el-button> | ||
| 32 | + </el-col> | ||
| 33 | + <el-col :span="1.5"> | ||
| 34 | + <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading" | ||
| 35 | + v-hasPermi="['system:notify-template:export']">导出</el-button> | ||
| 36 | + </el-col> | ||
| 37 | + <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> | ||
| 38 | + </el-row> | ||
| 39 | + | ||
| 40 | + <!-- 列表 --> | ||
| 41 | + <el-table v-loading="loading" :data="list"> | ||
| 42 | + <el-table-column label="模板编码" align="center" prop="code" /> | ||
| 43 | + <el-table-column label="模板标题" align="center" prop="title" /> | ||
| 44 | + <el-table-column label="模板内容" align="center" prop="content" width="300" /> | ||
| 45 | + <el-table-column label="开启状态" align="center" prop="status"> | ||
| 46 | + <template slot-scope="scope"> | ||
| 47 | + <dict-tag :type="DICT_TYPE.COMMON_STATUS" :value="scope.row.status"/> | ||
| 48 | + </template> | ||
| 49 | + </el-table-column> | ||
| 50 | + <el-table-column label="备注" align="center" prop="remark" /> | ||
| 51 | + <el-table-column label="创建时间" align="center" prop="createTime" width="180"> | ||
| 52 | + <template slot-scope="scope"> | ||
| 53 | + <span>{{ parseTime(scope.row.createTime) }}</span> | ||
| 54 | + </template> | ||
| 55 | + </el-table-column> | ||
| 56 | + <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="150"> | ||
| 57 | + <template slot-scope="scope"> | ||
| 58 | + <el-button size="mini" type="text" icon="el-icon-share" @click="handleSendNotify(scope.row)" | ||
| 59 | + v-hasPermi="['system:notify-template:send-notify']">发送</el-button> | ||
| 60 | + <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" | ||
| 61 | + v-hasPermi="['system:notify-template:update']">修改</el-button> | ||
| 62 | + <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" | ||
| 63 | + v-hasPermi="['system:notify-template:delete']">删除</el-button> | ||
| 64 | + </template> | ||
| 65 | + </el-table-column> | ||
| 66 | + </el-table> | ||
| 67 | + <!-- 分页组件 --> | ||
| 68 | + <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize" | ||
| 69 | + @pagination="getList"/> | ||
| 70 | + | ||
| 71 | + <!-- 对话框(添加 / 修改) --> | ||
| 72 | + <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> | ||
| 73 | + <el-form ref="form" :model="form" :rules="rules" label-width="140px"> | ||
| 74 | + <el-form-item label="模板编号" prop="code"> | ||
| 75 | + <el-input v-model="form.code" placeholder="请输入模板编号" /> | ||
| 76 | + </el-form-item> | ||
| 77 | + <el-form-item label="模板标题" prop="title"> | ||
| 78 | + <el-input v-model="form.title" placeholder="请输入标题名称" /> | ||
| 79 | + </el-form-item> | ||
| 80 | + <el-form-item label="模板内容" prop="content"> | ||
| 81 | + <el-input type="textarea" v-model="form.content" placeholder="请输入模板内容" /> | ||
| 82 | + </el-form-item> | ||
| 83 | + <el-form-item label="开启状态" prop="status"> | ||
| 84 | + <el-radio-group v-model="form.status"> | ||
| 85 | + <el-radio v-for="dict in this.getDictDatas(DICT_TYPE.COMMON_STATUS)" | ||
| 86 | + :key="dict.value" :label="parseInt(dict.value)">{{dict.label}}</el-radio> | ||
| 87 | + </el-radio-group> | ||
| 88 | + </el-form-item> | ||
| 89 | + <el-form-item label="备注" prop="remark"> | ||
| 90 | + <el-input v-model="form.remark" placeholder="请输入备注" /> | ||
| 91 | + </el-form-item> | ||
| 92 | + </el-form> | ||
| 93 | + <div slot="footer" class="dialog-footer"> | ||
| 94 | + <el-button type="primary" @click="submitForm">确 定</el-button> | ||
| 95 | + <el-button @click="cancel">取 消</el-button> | ||
| 96 | + </div> | ||
| 97 | + </el-dialog> | ||
| 98 | + | ||
| 99 | + <!-- 对话框(发送站内信) --> | ||
| 100 | + <el-dialog title="发送站内信" :visible.sync="sendNotifyOpen" width="500px" append-to-body> | ||
| 101 | + <el-form ref="sendNotifyForm" :model="sendNotifyForm" :rules="sendNotifyRules" label-width="140px"> | ||
| 102 | + <el-form-item label="模板内容" prop="content"> | ||
| 103 | + <el-input v-model="sendNotifyForm.content" type="textarea" placeholder="请输入模板内容" readonly /> | ||
| 104 | + </el-form-item> | ||
| 105 | + <el-form-item label="接收人" prop="userId"> | ||
| 106 | + <el-select v-model="sendNotifyForm.userId" placeholder="请输入接收人" clearable style="width: 100%"> | ||
| 107 | + <el-option v-for="item in users" :key="parseInt(item.id)" :label="item.nickname" :value="parseInt(item.id)" /> | ||
| 108 | + </el-select> | ||
| 109 | + </el-form-item> | ||
| 110 | + <el-form-item v-for="param in sendNotifyForm.params" :key="param" :label="'参数 {' + param + '}'" :prop="'templateParams.' + param"> | ||
| 111 | + <el-input v-model="sendNotifyForm.templateParams[param]" :placeholder="'请输入 ' + param + ' 参数'" /> | ||
| 112 | + </el-form-item> | ||
| 113 | + </el-form> | ||
| 114 | + <div slot="footer" class="dialog-footer"> | ||
| 115 | + <el-button type="primary" @click="submitSendNotifyForm">确 定</el-button> | ||
| 116 | + <el-button @click="cancelSendNotify">取 消</el-button> | ||
| 117 | + </div> | ||
| 118 | + </el-dialog> | ||
| 119 | + | ||
| 120 | + </div> | ||
| 121 | +</template> | ||
| 122 | + | ||
| 123 | +<script> | ||
| 124 | +import { createNotifyTemplate, updateNotifyTemplate, deleteNotifyTemplate, getNotifyTemplate, getNotifyTemplatePage, | ||
| 125 | + exportNotifyTemplateExcel, sendNotify } from "@/api/system/notify/notifyTemplate"; | ||
| 126 | +import {listSimpleUsers} from "@/api/system/user"; | ||
| 127 | + | ||
| 128 | +export default { | ||
| 129 | + name: "NotifyTemplate", | ||
| 130 | + data() { | ||
| 131 | + return { | ||
| 132 | + // 遮罩层 | ||
| 133 | + loading: true, | ||
| 134 | + // 导出遮罩层 | ||
| 135 | + exportLoading: false, | ||
| 136 | + // 显示搜索条件 | ||
| 137 | + showSearch: true, | ||
| 138 | + // 总条数 | ||
| 139 | + total: 0, | ||
| 140 | + // 短信模板列表 | ||
| 141 | + list: [], | ||
| 142 | + // 弹出层标题 | ||
| 143 | + title: "", | ||
| 144 | + // 是否显示弹出层 | ||
| 145 | + open: false, | ||
| 146 | + // 查询参数 | ||
| 147 | + queryParams: { | ||
| 148 | + pageNo: 1, | ||
| 149 | + pageSize: 10, | ||
| 150 | + status: null, | ||
| 151 | + code: null, | ||
| 152 | + title: null, | ||
| 153 | + createTime: [] | ||
| 154 | + }, | ||
| 155 | + // 表单参数 | ||
| 156 | + form: {}, | ||
| 157 | + // 表单校验 | ||
| 158 | + rules: { | ||
| 159 | + status: [{ required: true, message: "开启状态不能为空", trigger: "blur" }], | ||
| 160 | + code: [{ required: true, message: "模板编码不能为空", trigger: "blur" }], | ||
| 161 | + title: [{ required: true, message: "模板标题不能为空", trigger: "blur" }], | ||
| 162 | + content: [{ required: true, message: "模板内容不能为空", trigger: "blur" }], | ||
| 163 | + userId: [{ required: true, message: "接收人不能为空", trigger: "blur" }] | ||
| 164 | + }, | ||
| 165 | + // 用户列表 | ||
| 166 | + users: [], | ||
| 167 | + // 发送短信 | ||
| 168 | + sendNotifyOpen: false, | ||
| 169 | + sendNotifyForm: { | ||
| 170 | + params: [], // 模板的参数列表 | ||
| 171 | + }, | ||
| 172 | + sendNotifyRules: { | ||
| 173 | + mobile: [{ required: true, message: "手机不能为空", trigger: "blur" }], | ||
| 174 | + templateCode: [{ required: true, message: "手机不能为空", trigger: "blur" }], | ||
| 175 | + templateParams: { } | ||
| 176 | + } | ||
| 177 | + }; | ||
| 178 | + }, | ||
| 179 | + created() { | ||
| 180 | + this.getList(); | ||
| 181 | + // 获得用户列表 | ||
| 182 | + listSimpleUsers().then(response => { | ||
| 183 | + this.users = response.data; | ||
| 184 | + }) | ||
| 185 | + }, | ||
| 186 | + methods: { | ||
| 187 | + /** 查询列表 */ | ||
| 188 | + getList() { | ||
| 189 | + this.loading = true; | ||
| 190 | + // 执行查询 | ||
| 191 | + getNotifyTemplatePage(this.queryParams).then(response => { | ||
| 192 | + this.list = response.data.list; | ||
| 193 | + this.total = response.data.total; | ||
| 194 | + this.loading = false; | ||
| 195 | + }); | ||
| 196 | + }, | ||
| 197 | + /** 取消按钮 */ | ||
| 198 | + cancel() { | ||
| 199 | + this.open = false; | ||
| 200 | + this.reset(); | ||
| 201 | + }, | ||
| 202 | + /** 表单重置 */ | ||
| 203 | + reset() { | ||
| 204 | + this.form = { | ||
| 205 | + id: undefined, | ||
| 206 | + status: undefined, | ||
| 207 | + code: undefined, | ||
| 208 | + title: undefined, | ||
| 209 | + content: undefined, | ||
| 210 | + remark: undefined, | ||
| 211 | + }; | ||
| 212 | + this.resetForm("form"); | ||
| 213 | + }, | ||
| 214 | + /** 搜索按钮操作 */ | ||
| 215 | + handleQuery() { | ||
| 216 | + this.queryParams.pageNo = 1; | ||
| 217 | + this.getList(); | ||
| 218 | + }, | ||
| 219 | + /** 重置按钮操作 */ | ||
| 220 | + resetQuery() { | ||
| 221 | + this.resetForm("queryForm"); | ||
| 222 | + this.handleQuery(); | ||
| 223 | + }, | ||
| 224 | + /** 新增按钮操作 */ | ||
| 225 | + handleAdd() { | ||
| 226 | + this.reset(); | ||
| 227 | + this.open = true; | ||
| 228 | + this.title = "添加站内信模板"; | ||
| 229 | + }, | ||
| 230 | + /** 修改按钮操作 */ | ||
| 231 | + handleUpdate(row) { | ||
| 232 | + this.reset(); | ||
| 233 | + const id = row.id; | ||
| 234 | + getNotifyTemplate(id).then(response => { | ||
| 235 | + this.form = response.data; | ||
| 236 | + this.open = true; | ||
| 237 | + this.title = "修改站内信模板"; | ||
| 238 | + }); | ||
| 239 | + }, | ||
| 240 | + /** 提交按钮 */ | ||
| 241 | + submitForm() { | ||
| 242 | + this.$refs["form"].validate(valid => { | ||
| 243 | + if (!valid) { | ||
| 244 | + return; | ||
| 245 | + } | ||
| 246 | + // 修改的提交 | ||
| 247 | + if (this.form.id != null) { | ||
| 248 | + updateNotifyTemplate(this.form).then(response => { | ||
| 249 | + this.$modal.msgSuccess("修改成功"); | ||
| 250 | + this.open = false; | ||
| 251 | + this.getList(); | ||
| 252 | + }); | ||
| 253 | + return; | ||
| 254 | + } | ||
| 255 | + // 添加的提交 | ||
| 256 | + createNotifyTemplate(this.form).then(response => { | ||
| 257 | + this.$modal.msgSuccess("新增成功"); | ||
| 258 | + this.open = false; | ||
| 259 | + this.getList(); | ||
| 260 | + }); | ||
| 261 | + }); | ||
| 262 | + }, | ||
| 263 | + /** 删除按钮操作 */ | ||
| 264 | + handleDelete(row) { | ||
| 265 | + const id = row.id; | ||
| 266 | + this.$modal.confirm('是否确认删除站内信模板编号为"' + id + '"的数据项?').then(function() { | ||
| 267 | + return deleteNotifyTemplate(id); | ||
| 268 | + }).then(() => { | ||
| 269 | + this.getList(); | ||
| 270 | + this.$modal.msgSuccess("删除成功"); | ||
| 271 | + }).catch(() => {}); | ||
| 272 | + }, | ||
| 273 | + /** 导出按钮操作 */ | ||
| 274 | + handleExport() { | ||
| 275 | + // 处理查询参数 | ||
| 276 | + let params = {...this.queryParams}; | ||
| 277 | + params.pageNo = undefined; | ||
| 278 | + params.pageSize = undefined; | ||
| 279 | + // 执行导出 | ||
| 280 | + this.$modal.confirm('是否确认导出所有站内信模板数据项?', "警告").then(() => { | ||
| 281 | + this.exportLoading = true; | ||
| 282 | + return exportNotifyTemplateExcel(params); | ||
| 283 | + }).then(response => { | ||
| 284 | + this.$download.excel(response, '短信模板.xls'); | ||
| 285 | + this.exportLoading = false; | ||
| 286 | + }).catch(() => {}); | ||
| 287 | + }, | ||
| 288 | + /** 发送站内信按钮 */ | ||
| 289 | + handleSendNotify(row) { | ||
| 290 | + this.resetSendNotify(row); | ||
| 291 | + // 设置参数 | ||
| 292 | + this.sendNotifyForm.content = row.content; | ||
| 293 | + this.sendNotifyForm.params = row.params; | ||
| 294 | + this.sendNotifyForm.templateCode = row.code; | ||
| 295 | + this.sendNotifyForm.templateParams = row.params.reduce(function(obj, item) { | ||
| 296 | + obj[item] = undefined; | ||
| 297 | + return obj; | ||
| 298 | + }, {}); | ||
| 299 | + // 根据 row 重置 rules | ||
| 300 | + this.sendNotifyRules.templateParams = row.params.reduce(function(obj, item) { | ||
| 301 | + obj[item] = { required: true, message: '参数 ' + item + " 不能为空", trigger: "change" }; | ||
| 302 | + return obj; | ||
| 303 | + }, {}); | ||
| 304 | + // 设置打开 | ||
| 305 | + this.sendNotifyOpen = true; | ||
| 306 | + }, | ||
| 307 | + /** 重置发送站内信的表单 */ | ||
| 308 | + resetSendNotify() { | ||
| 309 | + // 根据 row 重置表单 | ||
| 310 | + this.sendNotifyForm = { | ||
| 311 | + content: undefined, | ||
| 312 | + params: undefined, | ||
| 313 | + userId: undefined, | ||
| 314 | + templateCode: undefined, | ||
| 315 | + templateParams: {} | ||
| 316 | + }; | ||
| 317 | + this.resetForm("sendNotifyForm"); | ||
| 318 | + }, | ||
| 319 | + /** 取消发送站内信 */ | ||
| 320 | + cancelSendNotify() { | ||
| 321 | + this.sendNotifyOpen = false; | ||
| 322 | + this.resetSendNotify(); | ||
| 323 | + }, | ||
| 324 | + /** 提交按钮 */ | ||
| 325 | + submitSendNotifyForm() { | ||
| 326 | + this.$refs["sendNotifyForm"].validate(valid => { | ||
| 327 | + if (!valid) { | ||
| 328 | + return; | ||
| 329 | + } | ||
| 330 | + // 添加的提交 | ||
| 331 | + sendNotify(this.sendNotifyForm).then(response => { | ||
| 332 | + this.$modal.msgSuccess("提交发送成功!发送结果,见发送日志编号:" + response.data); | ||
| 333 | + this.sendNotifyOpen = false; | ||
| 334 | + }); | ||
| 335 | + }); | ||
| 336 | + }, | ||
| 337 | + } | ||
| 338 | +}; | ||
| 339 | +</script> |