Ver código fonte

全民护河上报问题上报问题 发送短信

tags/V1.7.0
wanghaoran 1 ano atrás
pai
commit
9fd7136085
1 arquivos alterados com 32 adições e 9 exclusões
  1. +32
    -9
      tuoheng-api/src/main/java/com/tuoheng/api/service/impl/FeedbackServiceImpl.java

+ 32
- 9
tuoheng-api/src/main/java/com/tuoheng/api/service/impl/FeedbackServiceImpl.java Ver arquivo

@@ -3,17 +3,14 @@ package com.tuoheng.api.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.tuoheng.api.entity.domain.Feedback;
import com.tuoheng.api.entity.domain.Stream;
import com.tuoheng.api.entity.domain.Tenant;
import com.tuoheng.api.entity.domain.User;
import com.tuoheng.api.constants.DictConstants;
import com.tuoheng.api.entity.domain.*;
import com.tuoheng.api.entity.request.FeedbackQuery;
import com.tuoheng.api.mapper.FeedbackMapper;
import com.tuoheng.api.mapper.StreamMapper;
import com.tuoheng.api.mapper.TenantMapper;
import com.tuoheng.api.mapper.UserMapper;
import com.tuoheng.api.mapper.*;
import com.tuoheng.api.service.IFeedbackService;
import com.tuoheng.api.utils.SmsUtil;
import com.tuoheng.common.common.BaseServiceImpl;
import com.tuoheng.common.config.CommonConfig;
import com.tuoheng.common.exception.ServiceException;
@@ -24,6 +21,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/**
@@ -43,9 +42,16 @@ public class FeedbackServiceImpl extends BaseServiceImpl<FeedbackMapper, Feedbac

@Autowired
private UserMapper userMapper;

@Autowired
private TenantMapper tenantMapper;

@Autowired
private ThDictMapper thDictMapper;

@Autowired
private ThDictDataMapper thDictDataMapper;


@Override
public JsonResult submit(Feedback feedback) {
@@ -64,7 +70,24 @@ public class FeedbackServiceImpl extends BaseServiceImpl<FeedbackMapper, Feedbac
return JsonResult.error("河流信息不存在");
}
super.add(feedback);
//TODO 发送短信
//发送短信
ThDict thDict = thDictMapper.selectOne(new LambdaQueryWrapper<ThDict>()
.eq(ThDict::getTenantId, stream.getTenantId())
.eq(ThDict::getCode, DictConstants.MSG_RULE_CODE)
.eq(ThDict::getMark, 1));
if(ObjectUtils.isNotNull(thDict)){
ThDictData thDictData = thDictDataMapper.selectOne(new LambdaQueryWrapper<ThDictData>()
.eq(ThDictData::getDictId, thDict.getId())
.eq(ThDictData::getName, DictConstants.MSG_RULE_PHONE));
if(ObjectUtils.isNotNull(thDictData)){
if(StringUtils.isNotEmpty(thDictData.getValue())){
List<String> phoneList = Arrays.asList(thDictData.getValue().split(","));
for (String phone : phoneList) {
SmsUtil.sendSyncSms(phone,DictConstants.SMS_276426880,DictConstants.SMS_SMART_LAKE,null);
}
}
}
}
return JsonResult.success();
}


Carregando…
Cancelar
Salvar