提交 8d54d87c 作者: 张开石

1、添加编辑、查询邮件模板接口

父级 f93ab8a0
...@@ -9,7 +9,7 @@ import org.springframework.scheduling.annotation.EnableScheduling; ...@@ -9,7 +9,7 @@ import org.springframework.scheduling.annotation.EnableScheduling;
@SpringBootApplication @SpringBootApplication
@MapperScan("com.@cmeeting.mapper.primary") @MapperScan("com.cmeeting.mapper.primary")
@EnableScheduling @EnableScheduling
public class TencentMeetingCallbackApplication { public class TencentMeetingCallbackApplication {
public static void main(String[] args) { public static void main(String[] args) {
......
package com.cmeeting.controller; package com.cmeeting.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.cmeeting.pojo.MeetEmailTemplate;
import com.cmeeting.service.MeetEmailTemplateService;
import com.cmeeting.util.R; import com.cmeeting.util.R;
import com.cmeeting.util.RedisUtils; import com.cmeeting.util.RedisUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -12,23 +19,29 @@ import java.util.Map; ...@@ -12,23 +19,29 @@ import java.util.Map;
@RequestMapping("/email") @RequestMapping("/email")
public class EmailController { public class EmailController {
@Resource @Autowired
private RedisUtils redisUtils; private MeetEmailTemplateService meetEmailTemplateService;
@PostMapping("/saveContentTemplate") @PostMapping("/edit")
public R saveContentTemplate(@RequestBody Map<String,Object> map){ public R edit(@RequestBody MeetEmailTemplate param){
if(!map.containsKey("template")){ String content = param.getContent();
return R.error("保存失败");
} Date now = new Date();
redisUtils.set("EMAIL_CONTENT_TEMPLATE",map.get("template")); MeetEmailTemplate meetEmailTemplate = new MeetEmailTemplate();
return R.ok("保存成功"); meetEmailTemplate.setContent(content);
meetEmailTemplate.setCreateTime(now);
meetEmailTemplate.setUpdateTime(now);
meetEmailTemplateService.save(meetEmailTemplate);
return R.ok();
} }
@GetMapping("/getContentTemplate") @GetMapping("/get")
public R getTemplate(){ public R getTemplate(){
if(!redisUtils.hasKey("EMAIL_CONTENT_TEMPLATE")){
return R.error("邮件通知内容未设置"); MeetEmailTemplate template = meetEmailTemplateService.getOne(new LambdaQueryWrapper<MeetEmailTemplate>().orderByDesc(MeetEmailTemplate::getId).last("LIMIT 1"));
}
return R.ok(redisUtils.get("EMAIL_CONTENT_TEMPLATE"));
return R.ok(template);
} }
} }
...@@ -3,8 +3,12 @@ package com.cmeeting.pojo; ...@@ -3,8 +3,12 @@ package com.cmeeting.pojo;
import com.baomidou.mybatisplus.annotation.*; import com.baomidou.mybatisplus.annotation.*;
import java.util.Date; import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.NotEmpty;
/** /**
* 会议纪要邮件模板 * 会议纪要邮件模板
* @TableName meet_email_template * @TableName meet_email_template
...@@ -21,17 +25,20 @@ public class MeetEmailTemplate { ...@@ -21,17 +25,20 @@ public class MeetEmailTemplate {
/** /**
* 模板名称 * 模板名称
*/ */
@NotEmpty(message = "content不能为空")
private String content; private String content;
/** /**
* *
*/ */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@TableField(fill = FieldFill.INSERT) @TableField(fill = FieldFill.INSERT)
private Date createTime; private Date createTime;
/** /**
* *
*/ */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@TableField(fill = FieldFill.INSERT_UPDATE) @TableField(fill = FieldFill.INSERT_UPDATE)
private Date updateTime; private Date updateTime;
} }
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论