//
|
// Source code recreated from a .class file by IntelliJ IDEA
|
// (powered by FernFlower decompiler)
|
//
|
|
package com.flow.quartz;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.flow.mapper.ManagerMapper;
|
import com.flow.pojo.Card;
|
import com.flow.pojo.Company;
|
import com.flow.pojo.Duanxinlog;
|
import com.flow.pojo.Manager;
|
import com.flow.service.CardService;
|
import com.flow.service.CompanyService;
|
import com.flow.service.DuanxinlogService;
|
import com.flow.util.DESUtil;
|
import com.tencentcloudapi.common.Credential;
|
import com.tencentcloudapi.common.exception.TencentCloudSDKException;
|
import com.tencentcloudapi.common.profile.ClientProfile;
|
import com.tencentcloudapi.common.profile.HttpProfile;
|
import com.tencentcloudapi.sms.v20210111.SmsClient;
|
import com.tencentcloudapi.sms.v20210111.models.SendSmsRequest;
|
import com.tencentcloudapi.sms.v20210111.models.SendSmsResponse;
|
import java.util.List;
|
import java.util.concurrent.TimeUnit;
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
public class MyJob3 {
|
private String SecretId = "AKIDrjZOI4e6KLZu9FAsSRN8eOwSt52lbMBz";
|
private String SecretKey = "xnRtHUL3YqdMyOLVSBjKkz1pQoxujS4d";
|
@Autowired
|
CardService cardService;
|
@Autowired
|
CompanyService companyService;
|
|
@Autowired
|
ManagerMapper managerMapper;
|
|
@Autowired
|
DuanxinlogService duanxinlogService;
|
|
public MyJob3() {
|
}
|
|
private void execute1() throws Exception {
|
List<Company> companies = this.companyService.findLength();
|
|
for(int i = 0; i < companies.size(); ++i) {
|
TimeUnit.SECONDS.sleep(10L);
|
String GsMc = ((Company)companies.get(i)).getCompanyname();
|
String GsPhone = DESUtil.decrypt(((Company)companies.get(i)).getPhone(), DESUtil.key);
|
System.out.println(GsPhone);
|
List<Card> cardList = this.cardService.findDaoQi1(GsMc);
|
String cardNum = "";
|
if (cardList.size() == 0) {
|
break;
|
}
|
|
for(int j = 0; j < cardList.size(); ++j) {
|
if (j == cardList.size() - 1) {
|
cardNum = cardNum + ((Card)cardList.get(j)).getCardnumber();
|
} else {
|
cardNum = cardNum + ((Card)cardList.get(j)).getCardnumber() + ";";
|
}
|
}
|
|
try {
|
Credential cred = new Credential(this.SecretId, this.SecretKey);
|
HttpProfile httpProfile = new HttpProfile();
|
httpProfile.setEndpoint("sms.tencentcloudapi.com");
|
ClientProfile clientProfile = new ClientProfile();
|
clientProfile.setHttpProfile(httpProfile);
|
SmsClient client = new SmsClient(cred, "ap-beijing", clientProfile);
|
SendSmsRequest req = new SendSmsRequest();
|
String[] phoneNumberSet1 = new String[]{GsPhone};
|
req.setPhoneNumberSet(phoneNumberSet1);
|
QueryWrapper sms = new QueryWrapper();
|
sms.eq("none", "0");
|
sms.eq("smsreception", "1");
|
List<Manager> managerList = (managerMapper).selectList(sms);
|
for (int s=0;s<managerList.size();s++){
|
// System.out.println(managerList.get(s).getPhone());
|
// phoneNumberSet1[s] = managerList.get(s).getPhone();
|
String[] phoneNumberSet12 = {managerList.get(s).getPhone()};
|
System.out.println(phoneNumberSet12);
|
req.setPhoneNumberSet(phoneNumberSet12);
|
|
req.setSmsSdkAppId("1400838975");
|
req.setSignName("北京华星北斗智控");
|
req.setTemplateId("1907853");
|
|
// String[] templateParamSet1 = {String.valueOf(+num11 / 24 / 60 / 60 / 1000)};
|
String[] templateParamSet1 = new String[]{cardNum};
|
req.setTemplateParamSet(templateParamSet1);
|
// 返回的resp是一个SendSmsResponse的实例,与请求对象对应
|
SendSmsResponse resp = client.SendSms(req);
|
}
|
req.setSmsSdkAppId("1400838975");
|
req.setSignName("北京华星北斗智控");
|
req.setTemplateId("1878633");
|
String[] templateParamSet1 = new String[]{cardNum};
|
req.setTemplateParamSet(templateParamSet1);
|
SendSmsResponse resp = client.SendSms(req);
|
System.out.println(SendSmsResponse.toJsonString(resp));
|
Duanxinlog duanxinlog = new Duanxinlog();
|
duanxinlog.setIdentification(cardList.get(i).getCardnumber());
|
duanxinlog.setReceiver(cardList.get(i).getCompany());
|
duanxinlog.setNumber(GsPhone);
|
// duanxinlog.setContent("尊敬的用户,您好!您有服务器将于"+cardList.get(i).getEnddate()+"到期,为避免影响您的正常使用请及时续费,您可登录华星智控公司物联网管理平台查询详情续费,如有疑问可咨询我公司客服人员,祝您生活愉快!");
|
this.duanxinlogService.addDuanxinlog(duanxinlog);
|
} catch (TencentCloudSDKException var15) {
|
System.out.println(var15.toString());
|
}
|
}
|
|
}
|
}
|