Jelajahi Sumber

新增邮件配置相关

车车 4 bulan lalu
induk
melakukan
eabce6d2f6

+ 114 - 95
yudao-module-iscs/src/main/java/cn/iocoder/yudao/module/iscs/controller/admin/mailnotifyconfig/MailNotifyConfigController.java

@@ -1,95 +1,114 @@
-package cn.iocoder.yudao.module.iscs.controller.admin.mailnotifyconfig;
-
-import org.springframework.web.bind.annotation.*;
-import jakarta.annotation.Resource;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.security.access.prepost.PreAuthorize;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import io.swagger.v3.oas.annotations.Parameter;
-import io.swagger.v3.oas.annotations.Operation;
-
-import jakarta.validation.constraints.*;
-import jakarta.validation.*;
-import jakarta.servlet.http.*;
-import java.util.*;
-import java.io.IOException;
-
-import cn.iocoder.yudao.framework.common.pojo.PageParam;
-import cn.iocoder.yudao.framework.common.pojo.PageResult;
-import cn.iocoder.yudao.framework.common.pojo.CommonResult;
-import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
-import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
-
-import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
-
-import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
-import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
-
-import cn.iocoder.yudao.module.iscs.controller.admin.mailnotifyconfig.vo.*;
-import cn.iocoder.yudao.module.iscs.dal.dataobject.mailnotifyconfig.MailNotifyConfigDO;
-import cn.iocoder.yudao.module.iscs.service.mailnotifyconfig.MailNotifyConfigService;
-
-@Tag(name = "管理后台 - 系统邮件提醒周期配置")
-@RestController
-@RequestMapping("/iscs/mail-notify-config")
-@Validated
-public class MailNotifyConfigController {
-
-    @Resource
-    private MailNotifyConfigService mailNotifyConfigService;
-
-    @PostMapping("/insertMailNotifyConfig")
-    @Operation(summary = "创建系统邮件提醒周期配置")
-    @PreAuthorize("@ss.hasPermission('iscs:mail-notify-config:create')")
-    public CommonResult<Long> insertMailNotifyConfig(@Valid @RequestBody MailNotifyConfigSaveReqVO createReqVO) {
-        return success(mailNotifyConfigService.createMailNotifyConfig(createReqVO));
-    }
-
-    @PutMapping("/updateMailNotifyConfig")
-    @Operation(summary = "更新系统邮件提醒周期配置")
-    @PreAuthorize("@ss.hasPermission('iscs:mail-notify-config:update')")
-    public CommonResult<Boolean> updateMailNotifyConfig(@Valid @RequestBody MailNotifyConfigSaveReqVO updateReqVO) {
-        mailNotifyConfigService.updateMailNotifyConfig(updateReqVO);
-        return success(true);
-    }
-
-    @DeleteMapping("/deleteMailNotifyConfigList")
-    @Parameter(name = "ids", description = "编号", required = true)
-    @Operation(summary = "批量删除系统邮件提醒周期配置")
-                @PreAuthorize("@ss.hasPermission('iscs:mail-notify-config:delete')")
-    public CommonResult<Boolean> deleteMailNotifyConfigList(@RequestParam("ids") List<Long> ids) {
-        mailNotifyConfigService.deleteMailNotifyConfigListByIds(ids);
-        return success(true);
-    }
-
-    @GetMapping("/selectMailNotifyConfigById")
-    @Operation(summary = "获得系统邮件提醒周期配置")
-    @Parameter(name = "id", description = "编号", required = true, example = "1024")
-    @PreAuthorize("@ss.hasPermission('iscs:mail-notify-config:query')")
-    public CommonResult<MailNotifyConfigRespVO> selectMailNotifyConfigById(@RequestParam("id") Long id) {
-        MailNotifyConfigDO mailNotifyConfig = mailNotifyConfigService.getMailNotifyConfig(id);
-        return success(BeanUtils.toBean(mailNotifyConfig, MailNotifyConfigRespVO.class));
-    }
-
-    @GetMapping("/getMailNotifyConfigPage")
-    @Operation(summary = "获得系统邮件提醒周期配置分页")
-    @PreAuthorize("@ss.hasPermission('iscs:mail-notify-config:query')")
-    public CommonResult<PageResult<MailNotifyConfigRespVO>> getMailNotifyConfigPage(@Valid MailNotifyConfigPageReqVO pageReqVO) {
-        PageResult<MailNotifyConfigDO> pageResult = mailNotifyConfigService.getMailNotifyConfigPage(pageReqVO);
-        return success(BeanUtils.toBean(pageResult, MailNotifyConfigRespVO.class));
-    }
-
-    @GetMapping("/exportMailNotifyConfigExcel")
-    @Operation(summary = "导出系统邮件提醒周期配置 Excel")
-    @PreAuthorize("@ss.hasPermission('iscs:mail-notify-config:export')")
-    @ApiAccessLog(operateType = EXPORT)
-    public void exportMailNotifyConfigExcel(@Valid MailNotifyConfigPageReqVO pageReqVO,
-              HttpServletResponse response) throws IOException {
-        pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
-        List<MailNotifyConfigDO> list = mailNotifyConfigService.getMailNotifyConfigPage(pageReqVO).getList();
-        // 导出 Excel
-        ExcelUtils.write(response, "系统邮件提醒周期配置.xls", "数据", MailNotifyConfigRespVO.class,
-                        BeanUtils.toBean(list, MailNotifyConfigRespVO.class));
-    }
-
-}
+package cn.iocoder.yudao.module.iscs.controller.admin.mailnotifyconfig;
+
+import cn.hutool.core.lang.Assert;
+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.mailnotifyconfig.vo.MailNotifyConfigPageReqVO;
+import cn.iocoder.yudao.module.iscs.controller.admin.mailnotifyconfig.vo.MailNotifyConfigRespVO;
+import cn.iocoder.yudao.module.iscs.controller.admin.mailnotifyconfig.vo.MailNotifyConfigSaveReqVO;
+import cn.iocoder.yudao.module.iscs.dal.dataobject.mailnotifyconfig.MailNotifyConfigDO;
+import cn.iocoder.yudao.module.iscs.service.mailnotifyconfig.MailNotifyConfigService;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+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/mail-notify-config")
+@Validated
+public class MailNotifyConfigController {
+
+    @Resource
+    private MailNotifyConfigService mailNotifyConfigService;
+
+    @PostMapping("/insertMailNotifyConfig")
+    @Operation(summary = "创建系统邮件提醒周期配置")
+    @PreAuthorize("@ss.hasPermission('iscs:mail-notify-config:create')")
+    public CommonResult<Long> insertMailNotifyConfig(@Valid @RequestBody MailNotifyConfigSaveReqVO createReqVO) {
+        return success(mailNotifyConfigService.createMailNotifyConfig(createReqVO));
+    }
+
+    @PutMapping("/updateMailNotifyConfig")
+    @Operation(summary = "更新系统邮件提醒周期配置")
+    @PreAuthorize("@ss.hasPermission('iscs:mail-notify-config:update')")
+    public CommonResult<Boolean> updateMailNotifyConfig(@Valid @RequestBody MailNotifyConfigSaveReqVO updateReqVO) {
+        mailNotifyConfigService.updateMailNotifyConfig(updateReqVO);
+        return success(true);
+    }
+
+    @DeleteMapping("/deleteMailNotifyConfigList")
+    @Parameter(name = "ids", description = "编号", required = true)
+    @Operation(summary = "批量删除系统邮件提醒周期配置")
+                @PreAuthorize("@ss.hasPermission('iscs:mail-notify-config:delete')")
+    public CommonResult<Boolean> deleteMailNotifyConfigList(@RequestParam("ids") List<Long> ids) {
+        mailNotifyConfigService.deleteMailNotifyConfigListByIds(ids);
+        return success(true);
+    }
+
+    @GetMapping("/selectMailNotifyConfigById")
+    @Operation(summary = "获得系统邮件提醒周期配置")
+    @Parameter(name = "id", description = "编号", required = true, example = "1024")
+    @PreAuthorize("@ss.hasPermission('iscs:mail-notify-config:query')")
+    public CommonResult<MailNotifyConfigRespVO> selectMailNotifyConfigById(@RequestParam("id") Long id) {
+        MailNotifyConfigDO mailNotifyConfig = mailNotifyConfigService.getMailNotifyConfig(id);
+        return success(BeanUtils.toBean(mailNotifyConfig, MailNotifyConfigRespVO.class));
+    }
+
+    @GetMapping("/getMailNotifyConfigPage")
+    @Operation(summary = "获得系统邮件提醒周期配置分页")
+    @PreAuthorize("@ss.hasPermission('iscs:mail-notify-config:query')")
+    public CommonResult<PageResult<MailNotifyConfigRespVO>> getMailNotifyConfigPage(@Valid MailNotifyConfigPageReqVO pageReqVO) {
+        PageResult<MailNotifyConfigDO> pageResult = mailNotifyConfigService.getMailNotifyConfigPage(pageReqVO);
+        return success(BeanUtils.toBean(pageResult, MailNotifyConfigRespVO.class));
+    }
+
+    @GetMapping("/exportMailNotifyConfigExcel")
+    @Operation(summary = "导出系统邮件提醒周期配置 Excel")
+    @PreAuthorize("@ss.hasPermission('iscs:mail-notify-config:export')")
+    @ApiAccessLog(operateType = EXPORT)
+    public void exportMailNotifyConfigExcel(@Valid MailNotifyConfigPageReqVO pageReqVO,
+              HttpServletResponse response) throws IOException {
+        pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
+        List<MailNotifyConfigDO> list = mailNotifyConfigService.getMailNotifyConfigPage(pageReqVO).getList();
+        // 导出 Excel
+        ExcelUtils.write(response, "系统邮件提醒周期配置.xls", "数据", MailNotifyConfigRespVO.class,
+                        BeanUtils.toBean(list, MailNotifyConfigRespVO.class));
+    }
+
+    @Operation(summary = "修改自动创建周期检查计划")
+    @PreAuthorize("@ss.hasPermission('iscs:notify:update')")
+    @PostMapping("/updateAutomaticConfig")
+    public CommonResult<Boolean> updateAutomaticConfig(@RequestBody @Parameter(name = "isMailNotifyConfig", description = "修改数据类,放到body") MailNotifyConfigSaveReqVO updateReqVO)
+    {
+        return CommonResult.success(mailNotifyConfigService.updateAutomaticConfig(updateReqVO));
+    }
+
+    @Operation(summary = "获取系统邮件提醒周期配置详细信息code")
+    @Parameter(name = "templateCode", description = "templateCode")
+    @PreAuthorize("@ss.hasPermission('iscs:notify:query')")
+    @GetMapping(value = "/selectMailNotifyConfigByCode")
+    public CommonResult<MailNotifyConfigDO> selectMailNotifyConfigByCode(String templateCode)
+    {
+        Assert.notBlank(templateCode, "templateCode不可为空!");
+        return CommonResult.success(mailNotifyConfigService.getOne(Wrappers.<MailNotifyConfigDO>lambdaQuery()
+                .eq(MailNotifyConfigDO::getTemplateCode, templateCode)));
+    }
+
+}

+ 66 - 63
yudao-module-iscs/src/main/java/cn/iocoder/yudao/module/iscs/service/mailnotifyconfig/MailNotifyConfigService.java

@@ -1,63 +1,66 @@
-package cn.iocoder.yudao.module.iscs.service.mailnotifyconfig;
-
-import java.util.*;
-import jakarta.validation.*;
-import cn.iocoder.yudao.module.iscs.controller.admin.mailnotifyconfig.vo.*;
-import cn.iocoder.yudao.module.iscs.dal.dataobject.mailnotifyconfig.MailNotifyConfigDO;
-import cn.iocoder.yudao.framework.common.pojo.PageResult;
-import cn.iocoder.yudao.framework.common.pojo.PageParam;
-import com.baomidou.mybatisplus.extension.service.IService;
-
-/**
- * 系统邮件提醒周期配置 Service 接口
- *
- * @author 芋道源码
- */
-public interface MailNotifyConfigService extends IService<MailNotifyConfigDO> {
-
-    /**
-     * 创建系统邮件提醒周期配置
-     *
-     * @param createReqVO 创建信息
-     * @return 编号
-     */
-    Long createMailNotifyConfig(@Valid MailNotifyConfigSaveReqVO createReqVO);
-
-    /**
-     * 更新系统邮件提醒周期配置
-     *
-     * @param updateReqVO 更新信息
-     */
-    void updateMailNotifyConfig(@Valid MailNotifyConfigSaveReqVO updateReqVO);
-
-    /**
-     * 删除系统邮件提醒周期配置
-     *
-     * @param id 编号
-     */
-    void deleteMailNotifyConfig(Long id);
-
-    /**
-    * 批量删除系统邮件提醒周期配置
-    *
-    * @param ids 编号
-    */
-    void deleteMailNotifyConfigListByIds(List<Long> ids);
-
-    /**
-     * 获得系统邮件提醒周期配置
-     *
-     * @param id 编号
-     * @return 系统邮件提醒周期配置
-     */
-    MailNotifyConfigDO getMailNotifyConfig(Long id);
-
-    /**
-     * 获得系统邮件提醒周期配置分页
-     *
-     * @param pageReqVO 分页查询
-     * @return 系统邮件提醒周期配置分页
-     */
-    PageResult<MailNotifyConfigDO> getMailNotifyConfigPage(MailNotifyConfigPageReqVO pageReqVO);
-
-}
+package cn.iocoder.yudao.module.iscs.service.mailnotifyconfig;
+
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.module.iscs.controller.admin.mailnotifyconfig.vo.MailNotifyConfigPageReqVO;
+import cn.iocoder.yudao.module.iscs.controller.admin.mailnotifyconfig.vo.MailNotifyConfigSaveReqVO;
+import cn.iocoder.yudao.module.iscs.dal.dataobject.mailnotifyconfig.MailNotifyConfigDO;
+import com.baomidou.mybatisplus.extension.service.IService;
+import jakarta.validation.Valid;
+
+import java.util.List;
+
+/**
+ * 系统邮件提醒周期配置 Service 接口
+ *
+ * @author 芋道源码
+ */
+public interface MailNotifyConfigService extends IService<MailNotifyConfigDO> {
+
+    /**
+     * 创建系统邮件提醒周期配置
+     *
+     * @param createReqVO 创建信息
+     * @return 编号
+     */
+    Long createMailNotifyConfig(@Valid MailNotifyConfigSaveReqVO createReqVO);
+
+    /**
+     * 更新系统邮件提醒周期配置
+     *
+     * @param updateReqVO 更新信息
+     */
+    void updateMailNotifyConfig(@Valid MailNotifyConfigSaveReqVO updateReqVO);
+
+    /**
+     * 删除系统邮件提醒周期配置
+     *
+     * @param id 编号
+     */
+    void deleteMailNotifyConfig(Long id);
+
+    /**
+    * 批量删除系统邮件提醒周期配置
+    *
+    * @param ids 编号
+    */
+    void deleteMailNotifyConfigListByIds(List<Long> ids);
+
+    /**
+     * 获得系统邮件提醒周期配置
+     *
+     * @param id 编号
+     * @return 系统邮件提醒周期配置
+     */
+    MailNotifyConfigDO getMailNotifyConfig(Long id);
+
+    /**
+     * 获得系统邮件提醒周期配置分页
+     *
+     * @param pageReqVO 分页查询
+     * @return 系统邮件提醒周期配置分页
+     */
+    PageResult<MailNotifyConfigDO> getMailNotifyConfigPage(MailNotifyConfigPageReqVO pageReqVO);
+
+    Boolean updateAutomaticConfig(MailNotifyConfigSaveReqVO updateReqVO);
+
+}

+ 14 - 0
yudao-module-iscs/src/main/java/cn/iocoder/yudao/module/iscs/service/mailnotifyconfig/MailNotifyConfigServiceImpl.java

@@ -1,12 +1,14 @@
 package cn.iocoder.yudao.module.iscs.service.mailnotifyconfig;
 
 import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.lang.Assert;
 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.mailnotifyconfig.vo.MailNotifyConfigPageReqVO;
 import cn.iocoder.yudao.module.iscs.controller.admin.mailnotifyconfig.vo.MailNotifyConfigSaveReqVO;
 import cn.iocoder.yudao.module.iscs.dal.dataobject.mailnotifyconfig.MailNotifyConfigDO;
 import cn.iocoder.yudao.module.iscs.dal.mysql.mailnotifyconfig.MailNotifyConfigMapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import jakarta.annotation.Resource;
 import org.springframework.stereotype.Service;
@@ -84,4 +86,16 @@ public class MailNotifyConfigServiceImpl extends ServiceImpl<MailNotifyConfigMap
         return mailNotifyConfigMapper.selectPage(pageReqVO);
     }
 
+    @Override
+    public Boolean updateAutomaticConfig(MailNotifyConfigSaveReqVO updateReqVO) {
+        Assert.notBlank(updateReqVO.getTemplateCode(), "模板code不能为空!");
+        update(Wrappers.<MailNotifyConfigDO>lambdaUpdate()
+                .eq(MailNotifyConfigDO::getTemplateCode, updateReqVO.getTemplateCode())
+                .set(MailNotifyConfigDO::getPlanFrequency, updateReqVO.getPlanFrequency())
+                .set(MailNotifyConfigDO::getPlanDate, updateReqVO.getPlanDate())
+                .set(MailNotifyConfigDO::getStartStatus, updateReqVO.getStartStatus())
+                .set(MailNotifyConfigDO::getCheckUserId, updateReqVO.getCheckUserId()));
+        return true;
+    }
+
 }

+ 3 - 3
yudao-module-iscs/src/main/resources/mapper/BlacklistMapper.xml

@@ -29,9 +29,9 @@
     <select id="getWhiteUserPage"
             resultType="cn.iocoder.yudao.module.iscs.controller.admin.blacklist.vo.WhiteUserVO">
         SELECT
-        u.user_id,
-        u.user_name,
-        u.nick_name
+        u.id as user_id,
+        u.username as user_name,
+        u.nickname as nick_name
         FROM
         system_users u
         <where>