Commit f864fb81 authored by fangxinjiang's avatar fangxinjiang

消息提醒

parent 7a7cb06e
......@@ -32,9 +32,14 @@ import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
*
*
......@@ -114,18 +119,37 @@ public class MsgInfoServiceImpl extends ServiceImpl<MsgInfoMapper, MsgInfo> impl
* @Param
* @return
**/
@Transactional
@Override
public void updateOverTimeMsg() {
// 1. 删除未读的超时,如果有继续生成
baseMapper.delete(Wrappers.<MsgInfo>query().lambda()
.eq(MsgInfo::getRead,CommonConstants.ZERO_STRING)
.eq(MsgInfo::getAlertType,CommonConstants.ONE_STRING));
List<MsgInfo> temps = baseMapper.selectList(Wrappers.<MsgInfo>query().lambda()
.eq(MsgInfo::getAlertType,CommonConstants.ONE_STRING)
.eq(MsgInfo::getRead,CommonConstants.ONE_STRING));
Map<String,MsgInfo> tempMap = new HashMap<>();
if (Common.isNotNull(temps)){
for (MsgInfo msg:temps){
tempMap.put(msg.getOrderNo(),msg);
}
}
List<MsgInfo> msgInfos = baseMapper.getMsgByTask();
List<MsgInfo> saves = new ArrayList<>();
if (Common.isNotNull(msgInfos)){
//1.先删除
baseMapper.delete(Wrappers.<MsgInfo>query().lambda().eq(MsgInfo::getAlertType,CommonConstants.ONE_STRING));
//2. 重新生成
MsgInfo temp;
for (MsgInfo ms:msgInfos){
temp = tempMap.get(ms.getOrderNo());
if (Common.isNotNull(temp)){
continue;
}
ms.setCreateTime(LocalDateTime.now());
ms.setUrl(MesConstants.orderUrl+ms.getOrderId());
saves.add(ms);
}
this.saveBatch(msgInfos);
this.saveBatch(saves);
}
}
}
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