新增邮件发送记录编辑接口,邮件记录重新发送接口
This commit is contained in:
+107
@@ -0,0 +1,107 @@
|
||||
package com.ruoyi.system.domain.entity.shortmessage;
|
||||
|
||||
import java.util.Date;
|
||||
import javax.persistence.*;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@Table(name = "ms_send_mail_history_record")
|
||||
public class MsSendMailHistoryRecord {
|
||||
@Id
|
||||
@GeneratedValue(generator = "JDBC")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 邮件名称
|
||||
*/
|
||||
@Column(name = "mail_name")
|
||||
private String mailName;
|
||||
|
||||
/**
|
||||
* 邮件接收地址
|
||||
*/
|
||||
@Column(name = "mail_address")
|
||||
private String mailAddress;
|
||||
|
||||
/**
|
||||
* 发送时间
|
||||
*/
|
||||
@Column(name = "send_time")
|
||||
private Date sendTime;
|
||||
|
||||
/**
|
||||
* 案件编号
|
||||
*/
|
||||
@Column(name = "case_num")
|
||||
private String caseNum;
|
||||
|
||||
/**
|
||||
* 发送状态
|
||||
*/
|
||||
@Column(name = "send_status")
|
||||
private Long sendStatus;
|
||||
|
||||
/**
|
||||
* 立案申请id
|
||||
*/
|
||||
@Column(name = "case_id")
|
||||
private Long caseId;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Column(name = "create_time")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 创建者
|
||||
*/
|
||||
@Column(name = "create_by")
|
||||
private String createBy;
|
||||
|
||||
/**
|
||||
* 更新者
|
||||
*/
|
||||
@Column(name = "update_by")
|
||||
private String updateBy;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@Column(name = "update_time")
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 附件id用英文逗号隔开
|
||||
*/
|
||||
@Column(name = "file_ids")
|
||||
private String fileIds;
|
||||
|
||||
/**
|
||||
* 邮件主题
|
||||
*/
|
||||
@Column(name = "mail_subject")
|
||||
private String mailSubject;
|
||||
|
||||
/**
|
||||
* 邮件发送地址
|
||||
*/
|
||||
@Column(name = "mail_from_address")
|
||||
private String mailFromAddress;
|
||||
|
||||
/**
|
||||
* 邮件父类id
|
||||
*/
|
||||
@Column(name = "parent_id")
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 邮件内容
|
||||
*/
|
||||
@Column(name = "mail_content")
|
||||
private String mailContent;
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
package com.ruoyi.system.mapper.shortmessage;
|
||||
|
||||
import com.ruoyi.system.domain.entity.shortmessage.MsSendMailHistoryRecord;
|
||||
import tk.mybatis.mapper.common.Mapper;
|
||||
|
||||
public interface MsSendMailHistoryRecordMapper extends Mapper<MsSendMailHistoryRecord> {
|
||||
}
|
||||
+11
-1
@@ -3,9 +3,10 @@ package com.ruoyi.wisdomarbitrate.domain.dto.sendrecord;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class SendMailRecord extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -40,6 +41,15 @@ public class SendMailRecord extends BaseEntity {
|
||||
private Integer sendStatus;
|
||||
|
||||
|
||||
/** 附件id */
|
||||
private String fileIds;
|
||||
|
||||
/** 邮件主题 */
|
||||
private String mailSubject;
|
||||
|
||||
/** 邮件发件人地址 */
|
||||
private String mailFromAddress;
|
||||
|
||||
|
||||
public Integer getSendStatus() {
|
||||
return sendStatus;
|
||||
|
||||
+25
-3
@@ -5,10 +5,32 @@ import com.ruoyi.wisdomarbitrate.domain.dto.sendrecord.SendMailRecord;
|
||||
import java.util.List;
|
||||
|
||||
public interface SendMailRecordMapper {
|
||||
/**
|
||||
* 新增发送邮件记录
|
||||
*
|
||||
* @param sendMailRecord 发送邮件记录
|
||||
* @return 结果
|
||||
*/
|
||||
|
||||
int saveSendMailRecord(SendMailRecord sendMailRecord);
|
||||
|
||||
/**
|
||||
* 查询发送邮件记录
|
||||
*
|
||||
* @param sendMailRecord 发送邮件记录
|
||||
* @return 结果
|
||||
*/
|
||||
List<SendMailRecord> selectSendMailRecord(SendMailRecord sendMailRecord);
|
||||
/**
|
||||
* 修改发送邮件记录
|
||||
*
|
||||
* @param sendMailRecord 发送邮件记录
|
||||
* @return 结果
|
||||
*/
|
||||
int updateSendMailRecord(SendMailRecord sendMailRecord);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 根据id查询发送邮件记录
|
||||
* @param id
|
||||
*/
|
||||
SendMailRecord querySendMailRecordById(Long id);
|
||||
}
|
||||
|
||||
+20
-3
@@ -1,15 +1,32 @@
|
||||
package com.ruoyi.wisdomarbitrate.service.sendrecord;
|
||||
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.wisdomarbitrate.domain.dto.sendrecord.SendMailRecord;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ISendMailRecordService {
|
||||
|
||||
/**
|
||||
* 查询邮件发送记录
|
||||
*
|
||||
* @param sendMailRecord
|
||||
* @return
|
||||
*/
|
||||
|
||||
List<SendMailRecord> selectSendMailRecordList(SendMailRecord sendMailRecord);
|
||||
|
||||
/**
|
||||
* 编辑邮件记录
|
||||
*
|
||||
* @param sendMailRecord
|
||||
*/
|
||||
AjaxResult updateSendMailRecord(SendMailRecord sendMailRecord);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 重新发送邮件
|
||||
*
|
||||
* @param sendMailRecord
|
||||
* @return
|
||||
*/
|
||||
Boolean reSendMailRecord(SendMailRecord sendMailRecord);
|
||||
}
|
||||
|
||||
+79
@@ -1,11 +1,19 @@
|
||||
package com.ruoyi.wisdomarbitrate.service.sendrecord.impl;
|
||||
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.utils.EmailOutUtil;
|
||||
import com.ruoyi.system.domain.entity.shortmessage.MsSendMailHistoryRecord;
|
||||
import com.ruoyi.system.mapper.shortmessage.MsSendMailHistoryRecordMapper;
|
||||
import com.ruoyi.wisdomarbitrate.domain.dto.sendrecord.SendMailRecord;
|
||||
import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAttach;
|
||||
import com.ruoyi.wisdomarbitrate.mapper.mscase.MsCaseAttachMapper;
|
||||
import com.ruoyi.wisdomarbitrate.mapper.sendrecord.SendMailRecordMapper;
|
||||
import com.ruoyi.wisdomarbitrate.service.sendrecord.ISendMailRecordService;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
@@ -20,6 +28,77 @@ public class SendMailRecordServiceImpl implements ISendMailRecordService {
|
||||
return records;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
MsSendMailHistoryRecordMapper msSendMailHistoryRecordMapper;
|
||||
|
||||
/**
|
||||
* 编辑邮件记录
|
||||
*
|
||||
* @param sendMailRecord
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult updateSendMailRecord(SendMailRecord sendMailRecord) {
|
||||
try {
|
||||
if (sendMailRecord != null && sendMailRecord.getId() != null) {
|
||||
SendMailRecord old = sendMailRecordMapper.querySendMailRecordById(sendMailRecord.getId());
|
||||
MsSendMailHistoryRecord msSendMailHistoryRecord = new MsSendMailHistoryRecord();
|
||||
BeanUtils.copyProperties(old, msSendMailHistoryRecord);
|
||||
msSendMailHistoryRecord.setParentId(old.getId());
|
||||
msSendMailHistoryRecord.setId(null);
|
||||
msSendMailHistoryRecordMapper.insertSelective(msSendMailHistoryRecord);
|
||||
sendMailRecordMapper.updateSendMailRecord(sendMailRecord);
|
||||
return AjaxResult.success("编辑成功");
|
||||
} else {
|
||||
return AjaxResult.error("编辑失败");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return AjaxResult.error("编辑失败");
|
||||
}
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private EmailOutUtil emailOutUtil;
|
||||
@Autowired
|
||||
MsCaseAttachMapper msCaseAttachMapper;
|
||||
|
||||
/**
|
||||
* 重新发送邮件
|
||||
*
|
||||
* @param sendMailRecord
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Boolean reSendMailRecord(SendMailRecord sendMailRecord) {
|
||||
List<File> fileList = null;
|
||||
if (sendMailRecord.getFileIds() != null && sendMailRecord.getFileIds() != "") {
|
||||
String[] fileIds = sendMailRecord.getFileIds().split(",");
|
||||
for (int i = 0; i < fileIds.length; i++) {
|
||||
String fileId = fileIds[i];
|
||||
try {
|
||||
Long id = Long.parseLong(fileId);
|
||||
MsCaseAttach msCaseAttach = msCaseAttachMapper.queryAnnexById(id);
|
||||
String annexPath = msCaseAttach.getAnnexPath();
|
||||
if (annexPath != null && annexPath != "") {
|
||||
String prefix = "/profile";
|
||||
int startIndex = prefix.length();
|
||||
String path = "/home/ruoyi/uploadPath/" + annexPath.substring(startIndex + 1);
|
||||
File file = new File(path);
|
||||
fileList.add(file);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
Boolean flag = emailOutUtil.sendEmil(sendMailRecord.getMailAddress(), sendMailRecord.getMailContent(), sendMailRecord.getMailSubject(), fileList, null);
|
||||
//发送成功后更细邮件记录的发送时间和发送状态
|
||||
if (flag) {
|
||||
sendMailRecord.setSendStatus(1);
|
||||
sendMailRecord.setSendTime(new java.util.Date());
|
||||
sendMailRecord.setUpdateTime(new java.util.Date());
|
||||
sendMailRecordMapper.updateSendMailRecord(sendMailRecord);
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
}
|
||||
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
<?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="com.ruoyi.system.mapper.shortmessage.MsSendMailHistoryRecordMapper">
|
||||
<resultMap id="BaseResultMap" type="com.ruoyi.system.domain.entity.shortmessage.MsSendMailHistoryRecord">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
-->
|
||||
<id column="id" jdbcType="BIGINT" property="id" />
|
||||
<result column="mail_name" jdbcType="VARCHAR" property="mailName" />
|
||||
<result column="mail_address" jdbcType="VARCHAR" property="mailAddress" />
|
||||
<result column="send_time" jdbcType="TIMESTAMP" property="sendTime" />
|
||||
<result column="case_num" jdbcType="VARCHAR" property="caseNum" />
|
||||
<result column="send_status" jdbcType="BIGINT" property="sendStatus" />
|
||||
<result column="case_id" jdbcType="BIGINT" property="caseId" />
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||
<result column="create_by" jdbcType="VARCHAR" property="createBy" />
|
||||
<result column="update_by" jdbcType="VARCHAR" property="updateBy" />
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||
<result column="file_ids" jdbcType="VARCHAR" property="fileIds" />
|
||||
<result column="mail_subject" jdbcType="VARCHAR" property="mailSubject" />
|
||||
<result column="mail_from_address" jdbcType="VARCHAR" property="mailFromAddress" />
|
||||
<result column="parent_id" jdbcType="BIGINT" property="parentId" />
|
||||
<result column="mail_content" jdbcType="LONGVARCHAR" property="mailContent" />
|
||||
</resultMap>
|
||||
</mapper>
|
||||
+34
-19
@@ -5,22 +5,26 @@
|
||||
<mapper namespace="com.ruoyi.wisdomarbitrate.mapper.sendrecord.SendMailRecordMapper">
|
||||
|
||||
<resultMap type="com.ruoyi.wisdomarbitrate.domain.dto.sendrecord.SendMailRecord" id="SendMailRecordResult">
|
||||
<id property="id" column="id" />
|
||||
<result property="mailName" column="mail_name" />
|
||||
<result property="mailContent" column="mail_content" />
|
||||
<result property="mailAddress" column="mail_address" />
|
||||
<result property="sendTime" column="send_time" />
|
||||
<result property="caseId" column="case_id" />
|
||||
<result property="caseNum" column="case_num" />
|
||||
<result property="sendStatus" column="send_status" />
|
||||
<id property="id" column="id"/>
|
||||
<result property="mailName" column="mail_name"/>
|
||||
<result property="mailContent" column="mail_content"/>
|
||||
<result property="mailAddress" column="mail_address"/>
|
||||
<result property="sendTime" column="send_time"/>
|
||||
<result property="caseId" column="case_id"/>
|
||||
<result property="caseNum" column="case_num"/>
|
||||
<result property="sendStatus" column="send_status"/>
|
||||
<result property="fileIds" column="file_ids"/>
|
||||
<result property="mailSubject" column="mail_subject"/>
|
||||
<result property="mailFromAddress" column="mail_from_address"/>
|
||||
|
||||
</resultMap>
|
||||
|
||||
<select id="selectSendMailRecord" parameterType="com.ruoyi.wisdomarbitrate.domain.dto.sendrecord.SendMailRecord" resultMap="SendMailRecordResult">
|
||||
<select id="selectSendMailRecord" parameterType="com.ruoyi.wisdomarbitrate.domain.dto.sendrecord.SendMailRecord"
|
||||
resultMap="SendMailRecordResult">
|
||||
SELECT s.id ,s.mail_name ,s.mail_content ,s.mail_address ,s.send_time ,s.case_id ,s.create_time ,s.create_by ,
|
||||
s.update_by ,s.update_time , s.send_status ,c.case_num
|
||||
s.update_by ,s.update_time , s.send_status ,s.file_ids ,s.mail_subject ,s.mail_from_address ,c.case_num
|
||||
from ms_send_mail_record s left join ms_case_application c
|
||||
on s.case_id = c.id
|
||||
on s.case_id = c.id
|
||||
<where>
|
||||
<if test="caseNum != null and caseNum != ''">
|
||||
AND c.case_num = #{caseNum}
|
||||
@@ -38,6 +42,9 @@
|
||||
<if test="caseId != null ">case_id,</if>
|
||||
<if test="sendStatus != null ">send_status,</if>
|
||||
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||
<if test="fileIds != null and fileIds != ''">file_ids,</if>
|
||||
<if test="mailSubject != null and mailSubject != ''">mail_subject,</if>
|
||||
<if test="mailFromAddress != null and mailFromAddress != ''">mail_from_address,</if>
|
||||
create_time
|
||||
)values(
|
||||
<if test="mailName != null and mailName != ''">#{mailName},</if>
|
||||
@@ -47,15 +54,23 @@
|
||||
<if test="caseId != null ">#{caseId},</if>
|
||||
<if test="sendStatus != null ">#{sendStatus},</if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
<if test="fileIds != null and fileIds != ''">#{fileIds},</if>
|
||||
<if test="mailSubject != null and mailSubject != ''">#{mailSubject},</if>
|
||||
<if test="mailFromAddress != null and mailFromAddress != ''">#{mailFromAddress},</if>
|
||||
sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<update id="updateSendMailRecord">
|
||||
update ms_send_mail_record
|
||||
set mail_content= #{mailContent},
|
||||
update_time=#{updateTime},
|
||||
send_time=#{sendTime},
|
||||
send_status=#{sendStatus}
|
||||
where id = #{id}
|
||||
</update>
|
||||
<select id="querySendMailRecordById" resultMap="SendMailRecordResult">
|
||||
select *
|
||||
from ms_send_mail_record
|
||||
where id = #{id}
|
||||
</select>
|
||||
</mapper>
|
||||
+45
-35
@@ -5,20 +5,21 @@
|
||||
|
||||
<mapper namespace="com.ruoyi.wisdomarbitrate.mapper.sendrecord.SmsRecordMapper">
|
||||
<resultMap type="com.ruoyi.wisdomarbitrate.domain.dto.sendrecord.SmsSendRecord" id="SmsSendRecordResult">
|
||||
<id property="id" column="id" />
|
||||
<result property="caseId" column="case_appli_id" />
|
||||
<result property="caseNum" column="case_num" />
|
||||
<result property="phone" column="phone" />
|
||||
<result property="sendTime" column="send_time" />
|
||||
<result property="sendContent" column="send_content" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="sendStatus" column="send_status" />
|
||||
<result property="sid" column="sid" />
|
||||
<id property="id" column="id"/>
|
||||
<result property="caseId" column="case_appli_id"/>
|
||||
<result property="caseNum" column="case_num"/>
|
||||
<result property="phone" column="phone"/>
|
||||
<result property="sendTime" column="send_time"/>
|
||||
<result property="sendContent" column="send_content"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="sendStatus" column="send_status"/>
|
||||
<result property="sid" column="sid"/>
|
||||
</resultMap>
|
||||
<insert id="saveSmsSendRecord" parameterType="com.ruoyi.wisdomarbitrate.domain.dto.sendrecord.SmsSendRecord" useGeneratedKeys="true" keyProperty="id">
|
||||
<insert id="saveSmsSendRecord" parameterType="com.ruoyi.wisdomarbitrate.domain.dto.sendrecord.SmsSendRecord"
|
||||
useGeneratedKeys="true" keyProperty="id">
|
||||
|
||||
insert into ms_sms_send_record(
|
||||
<if test="caseId != null ">case_appli_id,</if>
|
||||
@@ -47,31 +48,32 @@
|
||||
<insert id="batchSaveSmsSendRecord">
|
||||
|
||||
insert into ms_sms_send_record(
|
||||
case_appli_id,
|
||||
case_num,
|
||||
phone,
|
||||
send_time,
|
||||
send_content,
|
||||
create_by,
|
||||
send_status,
|
||||
case_appli_id,
|
||||
case_num,
|
||||
phone,
|
||||
send_time,
|
||||
send_content,
|
||||
create_by,
|
||||
send_status,
|
||||
create_time,
|
||||
sid,reason
|
||||
)values
|
||||
<foreach item="item" index="index" collection="list" separator=",">
|
||||
(
|
||||
#{item.caseId},
|
||||
#{item.caseNum},
|
||||
#{item.phone},
|
||||
#{item.sendTime},
|
||||
#{item.sendContent},
|
||||
#{item.createBy},
|
||||
#{item.sendStatus},
|
||||
sysdate(),#{sid},#{reason}
|
||||
)
|
||||
(
|
||||
#{item.caseId},
|
||||
#{item.caseNum},
|
||||
#{item.phone},
|
||||
#{item.sendTime},
|
||||
#{item.sendContent},
|
||||
#{item.createBy},
|
||||
#{item.sendStatus},
|
||||
sysdate(),#{sid},#{reason}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<select id="getSmsSendRecord" parameterType="com.ruoyi.wisdomarbitrate.domain.dto.sendrecord.SmsSendRecord" resultMap="SmsSendRecordResult">
|
||||
<select id="getSmsSendRecord" parameterType="com.ruoyi.wisdomarbitrate.domain.dto.sendrecord.SmsSendRecord"
|
||||
resultMap="SmsSendRecordResult">
|
||||
|
||||
select *
|
||||
from ms_sms_send_record
|
||||
@@ -84,20 +86,28 @@
|
||||
</select>
|
||||
|
||||
<select id="selectBySId" resultMap="SmsSendRecordResult">
|
||||
select * from ms_sms_send_record where sid=#{sid}
|
||||
select *
|
||||
from ms_sms_send_record
|
||||
where sid = #{sid}
|
||||
</select>
|
||||
|
||||
<update id="updateStatus">
|
||||
update ms_sms_send_record
|
||||
set send_status= #{sendStatus} ,reason=#{reason} where sid=#{sid}
|
||||
set send_status= #{sendStatus},
|
||||
reason=#{reason}
|
||||
where sid = #{sid}
|
||||
</update>
|
||||
<update id="updateSendContent">
|
||||
update ms_sms_send_record
|
||||
set send_content= #{sendContent} ,update_time=#{updateTime} where id=#{id}
|
||||
set send_content= #{sendContent},
|
||||
update_time=#{updateTime}
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<select id="selectById" resultMap="SmsSendRecordResult">
|
||||
select * from ms_sms_send_record where id=#{id}
|
||||
select *
|
||||
from ms_sms_send_record
|
||||
where id = #{id}
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user