Kaynağa Gözat

初始化计划发送数据

车车 3 ay önce
ebeveyn
işleme
484e5961d3

+ 94 - 0
yudao-module-iscs/src/main/java/cn/iocoder/yudao/module/iscs/controller/admin/notifyconfig/NotifyMessagePlanController.java

@@ -0,0 +1,94 @@
+package cn.iocoder.yudao.module.iscs.controller.admin.notifyconfig;
+
+import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
+import cn.iocoder.yudao.framework.common.pojo.CommonResult;
+import cn.iocoder.yudao.framework.common.pojo.PageParam;
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
+import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
+import cn.iocoder.yudao.module.iscs.controller.admin.notifyconfig.vo.NotifyMessagePlanPageReqVO;
+import cn.iocoder.yudao.module.iscs.controller.admin.notifyconfig.vo.NotifyMessagePlanRespVO;
+import cn.iocoder.yudao.module.iscs.controller.admin.notifyconfig.vo.NotifyMessagePlanSaveReqVO;
+import cn.iocoder.yudao.module.iscs.dal.dataobject.notifyconfig.NotifyMessagePlanDO;
+import cn.iocoder.yudao.module.iscs.service.notifyconfig.NotifyMessagePlanService;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.annotation.Resource;
+import jakarta.servlet.http.HttpServletResponse;
+import jakarta.validation.Valid;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import java.io.IOException;
+import java.util.List;
+
+import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
+import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
+
+
+@Tag(name = "管理后台 - 计划发送的站内信消息")
+@RestController
+@RequestMapping("/iscs/notify-message-plan")
+@Validated
+public class NotifyMessagePlanController {
+
+    @Resource
+    private NotifyMessagePlanService notifyMessagePlanService;
+
+    @PostMapping("/insertNotifyMessagePlan")
+    @Operation(summary = "创建计划发送的站内信消息")
+    @PreAuthorize("@ss.hasPermission('iscs:notify-message-plan:create')")
+    public CommonResult<Long> insertNotifyMessagePlan(@Valid @RequestBody NotifyMessagePlanSaveReqVO createReqVO) {
+        return success(notifyMessagePlanService.createNotifyMessagePlan(createReqVO));
+    }
+
+    @PutMapping("/updateNotifyMessagePlan")
+    @Operation(summary = "更新计划发送的站内信消息")
+    @PreAuthorize("@ss.hasPermission('iscs:notify-message-plan:update')")
+    public CommonResult<Boolean> updateNotifyMessagePlan(@Valid @RequestBody NotifyMessagePlanSaveReqVO updateReqVO) {
+        notifyMessagePlanService.updateNotifyMessagePlan(updateReqVO);
+        return success(true);
+    }
+
+    @DeleteMapping("/deleteNotifyMessagePlanList")
+    @Parameter(name = "ids", description = "编号", required = true)
+    @Operation(summary = "批量删除计划发送的站内信消息")
+                @PreAuthorize("@ss.hasPermission('iscs:notify-message-plan:delete')")
+    public CommonResult<Boolean> deleteNotifyMessagePlanList(@RequestParam("ids") List<Long> ids) {
+        notifyMessagePlanService.deleteNotifyMessagePlanListByIds(ids);
+        return success(true);
+    }
+
+    @GetMapping("/selectNotifyMessagePlanById")
+    @Operation(summary = "获得计划发送的站内信消息")
+    @Parameter(name = "id", description = "编号", required = true, example = "1024")
+    @PreAuthorize("@ss.hasPermission('iscs:notify-message-plan:query')")
+    public CommonResult<NotifyMessagePlanRespVO> selectNotifyMessagePlanById(@RequestParam("id") Long id) {
+        NotifyMessagePlanDO notifyMessagePlan = notifyMessagePlanService.getNotifyMessagePlan(id);
+        return success(BeanUtils.toBean(notifyMessagePlan, NotifyMessagePlanRespVO.class));
+    }
+
+    @GetMapping("/getNotifyMessagePlanPage")
+    @Operation(summary = "获得计划发送的站内信消息分页")
+    @PreAuthorize("@ss.hasPermission('iscs:notify-message-plan:query')")
+    public CommonResult<PageResult<NotifyMessagePlanRespVO>> getNotifyMessagePlanPage(@Valid NotifyMessagePlanPageReqVO pageReqVO) {
+        PageResult<NotifyMessagePlanDO> pageResult = notifyMessagePlanService.getNotifyMessagePlanPage(pageReqVO);
+        return success(BeanUtils.toBean(pageResult, NotifyMessagePlanRespVO.class));
+    }
+
+    @GetMapping("/exportNotifyMessagePlanExcel")
+    @Operation(summary = "导出计划发送的站内信消息 Excel")
+    @PreAuthorize("@ss.hasPermission('iscs:notify-message-plan:export')")
+    @ApiAccessLog(operateType = EXPORT)
+    public void exportNotifyMessagePlanExcel(@Valid NotifyMessagePlanPageReqVO pageReqVO,
+              HttpServletResponse response) throws IOException {
+        pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
+        List<NotifyMessagePlanDO> list = notifyMessagePlanService.getNotifyMessagePlanPage(pageReqVO).getList();
+        // 导出 Excel
+        ExcelUtils.write(response, "计划发送的站内信消息.xls", "数据", NotifyMessagePlanRespVO.class,
+                        BeanUtils.toBean(list, NotifyMessagePlanRespVO.class));
+    }
+
+}

+ 51 - 0
yudao-module-iscs/src/main/java/cn/iocoder/yudao/module/iscs/controller/admin/notifyconfig/vo/NotifyMessagePlanPageReqVO.java

@@ -0,0 +1,51 @@
+package cn.iocoder.yudao.module.iscs.controller.admin.notifyconfig.vo;
+
+import lombok.*;
+import java.util.*;
+import io.swagger.v3.oas.annotations.media.Schema;
+import cn.iocoder.yudao.framework.common.pojo.PageParam;
+import org.springframework.format.annotation.DateTimeFormat;
+import java.time.LocalDateTime;
+
+import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
+
+@Schema(description = "管理后台 - 计划发送的站内信消息分页 Request VO")
+@Data
+public class NotifyMessagePlanPageReqVO extends PageParam {
+
+    @Schema(description = "用户id", example = "3684")
+    private Long userId;
+
+    @Schema(description = "用户类型", example = "1")
+    private Integer userType;
+
+    @Schema(description = "模版编号", example = "2590")
+    private Long templateId;
+
+    @Schema(description = "模板编码")
+    private String templateCode;
+
+    @Schema(description = "模版发送人名称", example = "赵六")
+    private String templateNickname;
+
+    @Schema(description = "模版内容")
+    private String templateContent;
+
+    @Schema(description = "模版类型", example = "1")
+    private Integer templateType;
+
+    @Schema(description = "模版参数")
+    private String templateParams;
+
+    @Schema(description = "计划发送时间")
+    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
+    private LocalDateTime[] planSendTime;
+
+    @Schema(description = "发送状态", example = "1")
+    private String sendStatus;
+
+    @Schema(description = "创建时间")
+    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
+    private LocalDateTime[] createTime;
+
+}

+ 63 - 0
yudao-module-iscs/src/main/java/cn/iocoder/yudao/module/iscs/controller/admin/notifyconfig/vo/NotifyMessagePlanRespVO.java

@@ -0,0 +1,63 @@
+package cn.iocoder.yudao.module.iscs.controller.admin.notifyconfig.vo;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.*;
+import java.util.*;
+import org.springframework.format.annotation.DateTimeFormat;
+import java.time.LocalDateTime;
+import com.alibaba.excel.annotation.*;
+
+@Schema(description = "管理后台 - 计划发送的站内信消息 Response VO")
+@Data
+@ExcelIgnoreUnannotated
+public class NotifyMessagePlanRespVO {
+
+    @Schema(description = "用户ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "22749")
+    @ExcelProperty("用户ID")
+    private Long id;
+
+    @Schema(description = "用户id", requiredMode = Schema.RequiredMode.REQUIRED, example = "3684")
+    @ExcelProperty("用户id")
+    private Long userId;
+
+    @Schema(description = "用户类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
+    @ExcelProperty("用户类型")
+    private Integer userType;
+
+    @Schema(description = "模版编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "2590")
+    @ExcelProperty("模版编号")
+    private Long templateId;
+
+    @Schema(description = "模板编码", requiredMode = Schema.RequiredMode.REQUIRED)
+    @ExcelProperty("模板编码")
+    private String templateCode;
+
+    @Schema(description = "模版发送人名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六")
+    @ExcelProperty("模版发送人名称")
+    private String templateNickname;
+
+    @Schema(description = "模版内容", requiredMode = Schema.RequiredMode.REQUIRED)
+    @ExcelProperty("模版内容")
+    private String templateContent;
+
+    @Schema(description = "模版类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
+    @ExcelProperty("模版类型")
+    private Integer templateType;
+
+    @Schema(description = "模版参数", requiredMode = Schema.RequiredMode.REQUIRED)
+    @ExcelProperty("模版参数")
+    private String templateParams;
+
+    @Schema(description = "计划发送时间", requiredMode = Schema.RequiredMode.REQUIRED)
+    @ExcelProperty("计划发送时间")
+    private LocalDateTime planSendTime;
+
+    @Schema(description = "发送状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
+    @ExcelProperty("发送状态")
+    private String sendStatus;
+
+    @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
+    @ExcelProperty("创建时间")
+    private LocalDateTime createTime;
+
+}

+ 57 - 0
yudao-module-iscs/src/main/java/cn/iocoder/yudao/module/iscs/controller/admin/notifyconfig/vo/NotifyMessagePlanSaveReqVO.java

@@ -0,0 +1,57 @@
+package cn.iocoder.yudao.module.iscs.controller.admin.notifyconfig.vo;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.*;
+import java.util.*;
+import jakarta.validation.constraints.*;
+import org.springframework.format.annotation.DateTimeFormat;
+import java.time.LocalDateTime;
+
+@Schema(description = "管理后台 - 计划发送的站内信消息新增/修改 Request VO")
+@Data
+public class NotifyMessagePlanSaveReqVO {
+
+    @Schema(description = "用户ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "22749")
+    private Long id;
+
+    @Schema(description = "用户id", requiredMode = Schema.RequiredMode.REQUIRED, example = "3684")
+    @NotNull(message = "用户id不能为空")
+    private Long userId;
+
+    @Schema(description = "用户类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
+    @NotNull(message = "用户类型不能为空")
+    private Integer userType;
+
+    @Schema(description = "模版编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "2590")
+    @NotNull(message = "模版编号不能为空")
+    private Long templateId;
+
+    @Schema(description = "模板编码", requiredMode = Schema.RequiredMode.REQUIRED)
+    @NotEmpty(message = "模板编码不能为空")
+    private String templateCode;
+
+    @Schema(description = "模版发送人名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六")
+    @NotEmpty(message = "模版发送人名称不能为空")
+    private String templateNickname;
+
+    @Schema(description = "模版内容", requiredMode = Schema.RequiredMode.REQUIRED)
+    @NotEmpty(message = "模版内容不能为空")
+    private String templateContent;
+
+    @Schema(description = "模版类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
+    @NotNull(message = "模版类型不能为空")
+    private Integer templateType;
+
+    @Schema(description = "模版参数", requiredMode = Schema.RequiredMode.REQUIRED)
+    @NotEmpty(message = "模版参数不能为空")
+    private String templateParams;
+
+    @Schema(description = "计划发送时间", requiredMode = Schema.RequiredMode.REQUIRED)
+    @NotNull(message = "计划发送时间不能为空")
+    private LocalDateTime planSendTime;
+
+    @Schema(description = "发送状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
+    @NotEmpty(message = "发送状态不能为空")
+    private String sendStatus;
+
+}

+ 73 - 0
yudao-module-iscs/src/main/java/cn/iocoder/yudao/module/iscs/dal/dataobject/notifyconfig/NotifyMessagePlanDO.java

@@ -0,0 +1,73 @@
+package cn.iocoder.yudao.module.iscs.dal.dataobject.notifyconfig;
+
+import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
+import com.baomidou.mybatisplus.annotation.KeySequence;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.*;
+
+import java.time.LocalDateTime;
+
+/**
+ * 计划发送的站内信消息 DO
+ *
+ * @author 博士安全
+ */
+@TableName("isc_notify_message_plan")
+@KeySequence("isc_notify_message_plan_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ToString(callSuper = true)
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+public class NotifyMessagePlanDO extends BaseDO {
+
+    /**
+     * 用户ID
+     */
+    @TableId
+    private Long id;
+    /**
+     * 用户id
+     */
+    private Long userId;
+    /**
+     * 用户类型
+     */
+    private Integer userType;
+    /**
+     * 模版编号
+     */
+    private Long templateId;
+    /**
+     * 模板编码
+     */
+    private String templateCode;
+    /**
+     * 模版发送人名称
+     */
+    private String templateNickname;
+    /**
+     * 模版内容
+     */
+    private String templateContent;
+    /**
+     * 模版类型
+     */
+    private Integer templateType;
+    /**
+     * 模版参数
+     */
+    private String templateParams;
+    /**
+     * 计划发送时间
+     */
+    private LocalDateTime planSendTime;
+    /**
+     * 发送状态
+     */
+    private String sendStatus;
+
+
+}

+ 34 - 0
yudao-module-iscs/src/main/java/cn/iocoder/yudao/module/iscs/dal/mysql/notifyconfig/NotifyMessagePlanMapper.java

@@ -0,0 +1,34 @@
+package cn.iocoder.yudao.module.iscs.dal.mysql.notifyconfig;
+
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
+import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
+import cn.iocoder.yudao.module.iscs.controller.admin.notifyconfig.vo.NotifyMessagePlanPageReqVO;
+import cn.iocoder.yudao.module.iscs.dal.dataobject.notifyconfig.NotifyMessagePlanDO;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * 计划发送的站内信消息 Mapper
+ *
+ * @author 博士安全
+ */
+@Mapper
+public interface NotifyMessagePlanMapper extends BaseMapperX<NotifyMessagePlanDO> {
+
+    default PageResult<NotifyMessagePlanDO> selectPage(NotifyMessagePlanPageReqVO reqVO) {
+        return selectPage(reqVO, new LambdaQueryWrapperX<NotifyMessagePlanDO>()
+                .eqIfPresent(NotifyMessagePlanDO::getUserId, reqVO.getUserId())
+                .eqIfPresent(NotifyMessagePlanDO::getUserType, reqVO.getUserType())
+                .eqIfPresent(NotifyMessagePlanDO::getTemplateId, reqVO.getTemplateId())
+                .eqIfPresent(NotifyMessagePlanDO::getTemplateCode, reqVO.getTemplateCode())
+                .likeIfPresent(NotifyMessagePlanDO::getTemplateNickname, reqVO.getTemplateNickname())
+                .eqIfPresent(NotifyMessagePlanDO::getTemplateContent, reqVO.getTemplateContent())
+                .eqIfPresent(NotifyMessagePlanDO::getTemplateType, reqVO.getTemplateType())
+                .eqIfPresent(NotifyMessagePlanDO::getTemplateParams, reqVO.getTemplateParams())
+                .betweenIfPresent(NotifyMessagePlanDO::getPlanSendTime, reqVO.getPlanSendTime())
+                .eqIfPresent(NotifyMessagePlanDO::getSendStatus, reqVO.getSendStatus())
+                .betweenIfPresent(NotifyMessagePlanDO::getCreateTime, reqVO.getCreateTime())
+                .orderByDesc(NotifyMessagePlanDO::getId));
+    }
+
+}

+ 57 - 0
yudao-module-iscs/src/main/java/cn/iocoder/yudao/module/iscs/service/notifyconfig/NotifyMessagePlanService.java

@@ -0,0 +1,57 @@
+package cn.iocoder.yudao.module.iscs.service.notifyconfig;
+
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.module.iscs.controller.admin.notifyconfig.vo.NotifyMessagePlanPageReqVO;
+import cn.iocoder.yudao.module.iscs.controller.admin.notifyconfig.vo.NotifyMessagePlanSaveReqVO;
+import cn.iocoder.yudao.module.iscs.dal.dataobject.notifyconfig.NotifyMessagePlanDO;
+import com.baomidou.mybatisplus.extension.service.IService;
+import jakarta.validation.Valid;
+
+import java.util.List;
+
+/**
+ * 计划发送的站内信消息 Service 接口
+ *
+ * @author 博士安全
+ */
+public interface NotifyMessagePlanService extends IService<NotifyMessagePlanDO> {
+
+    /**
+     * 创建计划发送的站内信消息
+     *
+     * @param createReqVO 创建信息
+     * @return 编号
+     */
+    Long createNotifyMessagePlan(@Valid NotifyMessagePlanSaveReqVO createReqVO);
+
+    /**
+     * 更新计划发送的站内信消息
+     *
+     * @param updateReqVO 更新信息
+     */
+    void updateNotifyMessagePlan(@Valid NotifyMessagePlanSaveReqVO updateReqVO);
+
+    /**
+    * 批量删除计划发送的站内信消息
+    *
+    * @param ids 编号
+    */
+    void deleteNotifyMessagePlanListByIds(List<Long> ids);
+
+    /**
+     * 获得计划发送的站内信消息
+     *
+     * @param id 编号
+     * @return 计划发送的站内信消息
+     */
+    NotifyMessagePlanDO getNotifyMessagePlan(Long id);
+
+    /**
+     * 获得计划发送的站内信消息分页
+     *
+     * @param pageReqVO 分页查询
+     * @return 计划发送的站内信消息分页
+     */
+    PageResult<NotifyMessagePlanDO> getNotifyMessagePlanPage(NotifyMessagePlanPageReqVO pageReqVO);
+
+}

+ 62 - 0
yudao-module-iscs/src/main/java/cn/iocoder/yudao/module/iscs/service/notifyconfig/NotifyMessagePlanServiceImpl.java

@@ -0,0 +1,62 @@
+package cn.iocoder.yudao.module.iscs.service.notifyconfig;
+
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
+import cn.iocoder.yudao.module.iscs.controller.admin.notifyconfig.vo.NotifyMessagePlanPageReqVO;
+import cn.iocoder.yudao.module.iscs.controller.admin.notifyconfig.vo.NotifyMessagePlanSaveReqVO;
+import cn.iocoder.yudao.module.iscs.dal.dataobject.notifyconfig.NotifyMessagePlanDO;
+import cn.iocoder.yudao.module.iscs.dal.mysql.notifyconfig.NotifyMessagePlanMapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import jakarta.annotation.Resource;
+import org.springframework.stereotype.Service;
+import org.springframework.validation.annotation.Validated;
+
+import java.util.List;
+
+/**
+ * 计划发送的站内信消息 Service 实现类
+ *
+ * @author 博士安全
+ */
+@Service
+@Validated
+public class NotifyMessagePlanServiceImpl extends ServiceImpl<NotifyMessagePlanMapper, NotifyMessagePlanDO> implements NotifyMessagePlanService {
+
+    @Resource
+    private NotifyMessagePlanMapper notifyMessagePlanMapper;
+
+    @Override
+    public Long createNotifyMessagePlan(NotifyMessagePlanSaveReqVO createReqVO) {
+        // 插入
+        NotifyMessagePlanDO notifyMessagePlan = BeanUtils.toBean(createReqVO, NotifyMessagePlanDO.class);
+        notifyMessagePlanMapper.insert(notifyMessagePlan);
+
+        // 返回
+        return notifyMessagePlan.getId();
+    }
+
+    @Override
+    public void updateNotifyMessagePlan(NotifyMessagePlanSaveReqVO updateReqVO) {
+        // 更新
+        NotifyMessagePlanDO updateObj = BeanUtils.toBean(updateReqVO, NotifyMessagePlanDO.class);
+        notifyMessagePlanMapper.updateById(updateObj);
+    }
+
+    @Override
+    public void deleteNotifyMessagePlanListByIds(List<Long> ids) {
+        // 删除
+        notifyMessagePlanMapper.deleteByIds(ids);
+    }
+
+
+    @Override
+    public NotifyMessagePlanDO getNotifyMessagePlan(Long id) {
+        return notifyMessagePlanMapper.selectById(id);
+    }
+
+    @Override
+    public PageResult<NotifyMessagePlanDO> getNotifyMessagePlanPage(NotifyMessagePlanPageReqVO pageReqVO) {
+        return notifyMessagePlanMapper.selectPage(pageReqVO);
+    }
+
+}

+ 12 - 0
yudao-module-iscs/src/main/resources/mapper/NotifyMessagePlanMapper.xml

@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="cn.iocoder.yudao.module.iscs.dal.mysql.notifyconfig.NotifyMessagePlanMapper">
+
+    <!--
+        一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
+        无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
+        代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
+        文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
+     -->
+
+</mapper>