|
@@ -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)));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+}
|