|
@@ -7,12 +7,13 @@ import com.example.demo.demos.web.constant.Constants;
|
|
|
import com.example.demo.demos.web.mapper.EcsInfoMapper;
|
|
import com.example.demo.demos.web.mapper.EcsInfoMapper;
|
|
|
import com.example.demo.demos.web.service.EcsInfoService;
|
|
import com.example.demo.demos.web.service.EcsInfoService;
|
|
|
import com.example.demo.demos.web.domain.EcsInfo;
|
|
import com.example.demo.demos.web.domain.EcsInfo;
|
|
|
|
|
+import com.example.demo.demos.web.util.CertUtil;
|
|
|
import com.example.demo.demos.web.util.DateUtil;
|
|
import com.example.demo.demos.web.util.DateUtil;
|
|
|
import com.example.demo.demos.web.util.SMSUtil;
|
|
import com.example.demo.demos.web.util.SMSUtil;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.scheduling.annotation.Scheduled;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
+import java.security.cert.X509Certificate;
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
|
@@ -45,7 +46,7 @@ public class EcsInfoServiceImpl extends ServiceImpl<EcsInfoMapper, EcsInfo> impl
|
|
|
if (!list.isEmpty()) {
|
|
if (!list.isEmpty()) {
|
|
|
for (String number : Constants.SEND_MSG_NUMBER) {
|
|
for (String number : Constants.SEND_MSG_NUMBER) {
|
|
|
list.forEach(i -> {
|
|
list.forEach(i -> {
|
|
|
- String str = "{\"name\": \""+i.getSerialNumber()+"\"}";
|
|
|
|
|
|
|
+ String str = "{\"name\": \""+i.getUrl()+"\"}";
|
|
|
try {
|
|
try {
|
|
|
SMSUtil.sendMsg(number,"天目智能科技","SMS_475345133",str);
|
|
SMSUtil.sendMsg(number,"天目智能科技","SMS_475345133",str);
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
@@ -56,4 +57,36 @@ public class EcsInfoServiceImpl extends ServiceImpl<EcsInfoMapper, EcsInfo> impl
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public List<String> crtList() {
|
|
|
|
|
+ LambdaQueryWrapper<EcsInfo> wrapper = Wrappers.lambdaQuery();
|
|
|
|
|
+ List<EcsInfo> ecsInfos = mapper.selectList(wrapper);
|
|
|
|
|
+ List<EcsInfo> updateInfo = new ArrayList<>();
|
|
|
|
|
+
|
|
|
|
|
+ List<String> list = new ArrayList<>();
|
|
|
|
|
+ ecsInfos.forEach(i -> {
|
|
|
|
|
+ X509Certificate certificate = CertUtil.getCertificate(i.getUrl());
|
|
|
|
|
+ String s = null;
|
|
|
|
|
+ if (certificate != null) {
|
|
|
|
|
+ s = DateUtil.parseDateToStr(DateUtil.YYYY_MM_DD, certificate.getNotAfter());
|
|
|
|
|
+ }
|
|
|
|
|
+ if (i.getNotAfter() == null) {
|
|
|
|
|
+ EcsInfo ecsInfo = new EcsInfo();
|
|
|
|
|
+ ecsInfo.setId(i.getId());
|
|
|
|
|
+ if (certificate != null) {
|
|
|
|
|
+ ecsInfo.setNotAfter(certificate.getNotAfter());
|
|
|
|
|
+ updateInfo.add(ecsInfo);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ list.add("域名:"+i.getUrl()+",有效期:"+s);
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ if (!updateInfo.isEmpty()){
|
|
|
|
|
+ updateInfo.forEach(this::updateById);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return list;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|