admin
2025-02-25 30d8e227e8d823b6c38c3b9c90ac2df03b63befe
fanli/src/main/java/com/yeshi/fanli/service/impl/mq/MQUnSendInfoServiceImpl.java
@@ -1,53 +1,53 @@
package com.yeshi.fanli.service.impl.mq;
import java.util.Date;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.yeshi.fanli.dao.mybatis.mq.MQUnSendInfoMapper;
import com.yeshi.fanli.entity.mq.MQUnSendInfo;
import com.yeshi.fanli.exception.mq.MQUnSendInfoException;
import com.yeshi.fanli.service.inter.mq.MQUnSendInfoService;
import com.yeshi.fanli.util.StringUtil;
@Service
public class MQUnSendInfoServiceImpl implements MQUnSendInfoService {
   @Resource
   private MQUnSendInfoMapper mqUnSendInfoMapper;
   @Override
   public void addMQUnSendInfo(MQUnSendInfo info) throws MQUnSendInfoException {
      if (StringUtil.isNullOrEmpty(info.getTag()) || StringUtil.isNullOrEmpty(info.getTopic())
            || StringUtil.isNullOrEmpty(info.getBody()) || StringUtil.isNullOrEmpty(info.getKey())) {
         throw new MQUnSendInfoException(1, "信息不完整");
      }
      MQUnSendInfo oldInfo = mqUnSendInfoMapper.selectByTopicTagAndKey(info.getTopic(), info.getTag(), info.getKey());
      if (oldInfo != null)
         return;
      if (info.getLastSendTime() == null)
         info.setLastSendTime(new Date());
      mqUnSendInfoMapper.insertSelective(info);
   }
   @Override
   public List<MQUnSendInfo> listByMaxSendTime(Date maxSendTime, int page, int pageSize) {
      return mqUnSendInfoMapper.listByMaxSendTime(maxSendTime, (page - 1) * pageSize, pageSize);
   }
   @Override
   public void deleteByPrimaryKey(Long id) {
      mqUnSendInfoMapper.deleteByPrimaryKey(id);
   }
   @Override
   public void updateSendTime(Long id, Date sendTime) {
      MQUnSendInfo info = new MQUnSendInfo();
      info.setId(id);
      info.setLastSendTime(sendTime);
      mqUnSendInfoMapper.updateByPrimaryKeySelective(info);
   }
}
package com.yeshi.fanli.service.impl.mq;
import java.util.Date;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.yeshi.fanli.dao.mybatis.mq.MQUnSendInfoMapper;
import com.yeshi.fanli.entity.mq.MQUnSendInfo;
import com.yeshi.fanli.exception.mq.MQUnSendInfoException;
import com.yeshi.fanli.service.inter.mq.MQUnSendInfoService;
import com.yeshi.fanli.util.StringUtil;
@Service
public class MQUnSendInfoServiceImpl implements MQUnSendInfoService {
   @Resource
   private MQUnSendInfoMapper mqUnSendInfoMapper;
   @Override
   public void addMQUnSendInfo(MQUnSendInfo info) throws MQUnSendInfoException {
      if (StringUtil.isNullOrEmpty(info.getTag()) || StringUtil.isNullOrEmpty(info.getTopic())
            || StringUtil.isNullOrEmpty(info.getBody()) || StringUtil.isNullOrEmpty(info.getKey())) {
         throw new MQUnSendInfoException(1, "信息不完整");
      }
      MQUnSendInfo oldInfo = mqUnSendInfoMapper.selectByTopicTagAndKey(info.getTopic(), info.getTag(), info.getKey());
      if (oldInfo != null)
         return;
      if (info.getLastSendTime() == null)
         info.setLastSendTime(new Date());
      mqUnSendInfoMapper.insertSelective(info);
   }
   @Override
   public List<MQUnSendInfo> listByMaxSendTime(Date maxSendTime, int page, int pageSize) {
      return mqUnSendInfoMapper.listByMaxSendTime(maxSendTime, (page - 1) * pageSize, pageSize);
   }
   @Override
   public void deleteByPrimaryKey(Long id) {
      mqUnSendInfoMapper.deleteByPrimaryKey(id);
   }
   @Override
   public void updateSendTime(Long id, Date sendTime) {
      MQUnSendInfo info = new MQUnSendInfo();
      info.setId(id);
      info.setLastSendTime(sendTime);
      mqUnSendInfoMapper.updateByPrimaryKeySelective(info);
   }
}