|
@@ -0,0 +1,63 @@
|
|
|
+package com.fire.admin.service.impl;
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import com.fire.admin.mapper.BlacklistPhoneMapper;
|
|
|
+import com.fire.admin.service.BlacklistPhoneService;
|
|
|
+import com.fire.dto.BlacklistPhone;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.rocketmq.spring.core.RocketMQTemplate;
|
|
|
+import org.springframework.messaging.support.MessageBuilder;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+import static com.fire.common.constants.RocketTopic.UPDATE_TOPIC;
|
|
|
+import static com.fire.common.constants.RocketTags.BLACKLIST_TAG;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @author: admin
|
|
|
+ * @Description:
|
|
|
+ * @date: 2021-05-19 14:01
|
|
|
+ * @Modified By:
|
|
|
+ */
|
|
|
+@Service
|
|
|
+@Slf4j
|
|
|
+public class BlacklistPhoneServiceImpl extends ServiceImpl<BlacklistPhoneMapper, BlacklistPhone> implements BlacklistPhoneService {
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private RocketMQTemplate rocketMQTemplate;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public IPage<BlacklistPhone> getBlacklistPhone(Page page, String phoneNo) {
|
|
|
+
|
|
|
+ return baseMapper.getBlacklistPhone(page,phoneNo);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public String saveBlacklistPhone(List<BlacklistPhone> blacklist) {
|
|
|
+ for (BlacklistPhone no : blacklist) {
|
|
|
+ BlacklistPhone blacklistPhone = new BlacklistPhone();
|
|
|
+ blacklistPhone.setPhoneNo(no.getPhoneNo());
|
|
|
+ blacklistPhone.setNote(no.getNote());
|
|
|
+ baseMapper.insert(blacklistPhone);
|
|
|
+ }
|
|
|
+ //向MQ推送消息
|
|
|
+ rocketMQTemplate.send(UPDATE_TOPIC + ":" + BLACKLIST_TAG, MessageBuilder.withPayload(BLACKLIST_TAG).build());
|
|
|
+ return "sucess";
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public String deleteBlacklistPhone(List<String> phoneNos) {
|
|
|
+ int res = baseMapper.delPhones(phoneNos);
|
|
|
+ log.info("删除情况:" + res);
|
|
|
+ //向MQ推送消息
|
|
|
+ rocketMQTemplate.send(UPDATE_TOPIC + ":" + BLACKLIST_TAG, MessageBuilder.withPayload(BLACKLIST_TAG).build());
|
|
|
+ return "sucess";
|
|
|
+ }
|
|
|
+}
|