|
@@ -1,12 +1,42 @@
|
|
|
package com.example.demo.demos.web.service.impl;
|
|
package com.example.demo.demos.web.service.impl;
|
|
|
|
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
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.DateUtil;
|
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
|
|
+import java.util.List;
|
|
|
|
|
+
|
|
|
@Service
|
|
@Service
|
|
|
public class EcsInfoServiceImpl extends ServiceImpl<EcsInfoMapper, EcsInfo> implements EcsInfoService {
|
|
public class EcsInfoServiceImpl extends ServiceImpl<EcsInfoMapper, EcsInfo> implements EcsInfoService {
|
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private EcsInfoMapper mapper;
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public List<EcsInfo> getInfos() {
|
|
|
|
|
+ LambdaQueryWrapper<EcsInfo> wrapper = Wrappers.lambdaQuery();
|
|
|
|
|
+ List<EcsInfo> ecsInfos = mapper.selectList(wrapper);
|
|
|
|
|
+
|
|
|
|
|
+ List<EcsInfo> list = new ArrayList<>();
|
|
|
|
|
+ ecsInfos.forEach(ecsInfo -> {
|
|
|
|
|
+ String endOfExpiration = DateUtil.parseDateToStr(DateUtil.YYYY_MM_DD, ecsInfo.getNotAfter());
|
|
|
|
|
+ String nowDateStr = DateUtil.parseDateToStr(DateUtil.YYYY_MM_DD, DateUtil.getNowDate());
|
|
|
|
|
+
|
|
|
|
|
+ Long[] longs = DateUtil.computeDate(nowDateStr, endOfExpiration);
|
|
|
|
|
+ Long month = longs[0];
|
|
|
|
|
+ Long day = longs[1];
|
|
|
|
|
+ if (month == 0 && day < 20) {
|
|
|
|
|
+ list.add(ecsInfo);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ return list;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|