Commit c3247272 by “zcwang”

fix bug:自动执行重复发邮件

parent 704d1e43
......@@ -821,6 +821,8 @@ public class ChangeFlowBiz {
// 更改变更结果确认时间
changeRecord.setChangeConfirmResultTime(changeConfirmResultTime);
changeRecord.setUpdateTime(DateUtils.getCurrentTime());
// 延期需要重新发邮件,改变执行邮件状态
changeRecord.setAutoSubmitEmail(false);
changeFlowService.updateRecord(changeRecord);
return null;
default:
......
......@@ -55,10 +55,11 @@ public interface ChangeFlowService {
* 根据状态及时间获取数据
*
* @param entityId
* @param sendEmail
* @param nodeId1
* @param nodeId2
* @param tomorrowSpecificTime
* @return
*/
List<ChangeRecord> getByStatusAndTime(Long entityId, String nodeId1, String nodeId2, long tomorrowSpecificTime);
List<ChangeRecord> getByStatusAndTime(Long entityId, Integer sendEmail, String nodeId1, String nodeId2, long tomorrowSpecificTime);
}
\ No newline at end of file
......@@ -56,7 +56,7 @@ public class ChangeFlowServiceImpl implements ChangeFlowService {
}
@Override
public List<ChangeRecord> getByStatusAndTime(Long entityId, String nodeId1, String nodeId2, long tomorrowSpecificTime) {
return changeRecordMapper.getByStatusAndTime(entityId, nodeId1, nodeId2, tomorrowSpecificTime);
public List<ChangeRecord> getByStatusAndTime(Long entityId, Integer sendEmail, String nodeId1, String nodeId2, long tomorrowSpecificTime) {
return changeRecordMapper.getByStatusAndTime(entityId, sendEmail, nodeId1, nodeId2, tomorrowSpecificTime);
}
}
\ No newline at end of file
......@@ -81,10 +81,10 @@ public class AutoSubmit extends IJobHandler {
Long tomorrowSpecificTime = DateUtils.getTomorrowSpecificTime("00:00:00");
List<Long> count = new ArrayList<>();
Long entityId = 0L;
// 查询今天时间之前的数据
// 查询今天时间之前的未发送邮件的数据
try {
while (true) {
List<ChangeRecord> records = changeFlowService.getByStatusAndTime(entityId,
List<ChangeRecord> records = changeFlowService.getByStatusAndTime(entityId, 0,
ChangeFlowEnum.CHANGE_FLOW_EXE.getNodeId(), ChangeFlowEnum.CHANGE_FLOW_CONFIRM.getNodeId(),
tomorrowSpecificTime);
if (CollectionUtils.isEmpty(records)) {
......
......@@ -168,6 +168,11 @@ public class ChangeRecord {
private Integer todoId;
/**
* 自动执行邮件发送
*/
private Boolean autoSubmitEmail;
/**
* 创建时间
*/
private Long createTime;
......
......@@ -29,7 +29,7 @@ public interface ChangeRecordMapper extends tk.mybatis.mapper.common.Mapper<Chan
List<ChangeRecord> selectByConditionAndLimit(ChangeFlowListQueryReq changeFlowListQueryReq);
@Select("select * from TB_YX_QC_CHANGE_RECORD where id > #{entityId} and `flow_node` in (#{nodeId1}, #{nodeId2}) and change_confirm_result_time <= #{currentTime} limit 200")
List<ChangeRecord> getByStatusAndTime(@Param("entityId") Long entityId, @Param("nodeId1") String nodeId1,
@Select("select * from TB_YX_QC_CHANGE_RECORD where id > #{entityId} and auto_submit_email = #{sendEmail} and `flow_node` in (#{nodeId1}, #{nodeId2}) and change_confirm_result_time <= #{currentTime} limit 200")
List<ChangeRecord> getByStatusAndTime(@Param("entityId") Long entityId, @Param("sendEmail") Integer sendEmail, @Param("nodeId1") String nodeId1,
@Param("nodeId2") String nodeId2, @Param("currentTime") long currentTime);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment