| New file |
| | |
| | | package cn.gistack.sm.sms.feign; |
| | | |
| | | import cn.com.flaginfo.sdk.cmc.api.sms.send.SMSSendRequest; |
| | | import cn.gistack.sm.sjztmd.entity.AttStBase; |
| | | import cn.gistack.sm.sjztmd.service.*; |
| | | import cn.gistack.sm.sms.util.SmsUtils; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springblade.core.tenant.annotation.NonDS; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import springfox.documentation.annotations.ApiIgnore; |
| | | |
| | | /** |
| | | * @PROJECT_NAME: skjcmanager |
| | | * @DESCRIPTION: 数据异常告警feign实现 |
| | | * @USER: aix |
| | | * @DATE: 2023/12/5 15:39 |
| | | */ |
| | | @NonDS |
| | | @ApiIgnore |
| | | @RestController |
| | | @AllArgsConstructor |
| | | @Slf4j |
| | | public class DataAbnormalWarnClient implements IDataAbnormalWarnClient{ |
| | | |
| | | @Autowired |
| | | private IAttResBaseService resBaseService; |
| | | |
| | | @Autowired |
| | | private IAttStBaseService attStBaseService; |
| | | @Autowired |
| | | private IAttResStagCharService attResStagCharService; |
| | | |
| | | @Autowired |
| | | private IAttResRsbNorspiService attResRsbNorspiService; |
| | | |
| | | @Autowired |
| | | private IAttResFlseLimService attResFlseLimService; |
| | | |
| | | @Override |
| | | public void sendOperate(String tableName, String phones) { |
| | | //汇聚任务水库基本信息表 用于判断是否有数据 |
| | | long count = 1l; |
| | | if (tableName.equals("dim_res_info_a")) |
| | | count = resBaseService.getDimResInfoACount(); |
| | | else if (tableName.equals("att_res_base")) |
| | | count = resBaseService.count(); |
| | | else if (tableName.equals("att_st_base")) { |
| | | // 构造 QueryWrapper 对象 |
| | | QueryWrapper<AttStBase> wrapper = new QueryWrapper<>(); |
| | | wrapper.isNotNull("\"share_st_code\"").ne("\"share_st_code\"", ""); |
| | | count = attStBaseService.count(wrapper); |
| | | } else if (tableName.equals("att_res_stag_char")) { |
| | | count = attResStagCharService.count(); |
| | | } else if (tableName.equals("att_res_rsb_norspi")) { |
| | | count = attResRsbNorspiService.count(); |
| | | } else if (tableName.equals("att_res_flse_lim")) { |
| | | count = attResFlseLimService.count(); |
| | | } |
| | | |
| | | log.info("预警数量count:" + count); |
| | | |
| | | if (count == 0) { |
| | | sendMsg(tableName, phones); |
| | | } |
| | | |
| | | } |
| | | |
| | | private void sendMsg(String tableName, String phones) { |
| | | SMSSendRequest request = new SMSSendRequest(); |
| | | String [] phoness = phones.split(","); |
| | | for (String n: phoness) { |
| | | request.setUserNumber(n); |
| | | request.setTemplateId("2431012268292"); |
| | | request.setMessageContent("紧急通知:数据表异常,请立即检查数据源并填充缺失的数据!"+tableName+",数据为空"); |
| | | SmsUtils.sendMsg(request); |
| | | } |
| | | } |
| | | |
| | | } |