|
|
@@ -14,18 +14,10 @@ import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
-import com.aliyuncs.DefaultAcsClient;
|
|
|
-import com.aliyuncs.IAcsClient;
|
|
|
-import com.aliyuncs.exceptions.ClientException;
|
|
|
-import com.aliyuncs.exceptions.ServerException;
|
|
|
-import com.aliyuncs.profile.DefaultProfile;
|
|
|
-import com.aliyuncs.profile.IClientProfile;
|
|
|
-import com.aliyuncs.sms.model.v20160927.SingleSendSmsRequest;
|
|
|
-import com.aliyuncs.sms.model.v20160927.SingleSendSmsResponse;
|
|
|
import com.goafanti.common.constant.AFTConstants;
|
|
|
import com.goafanti.common.utils.DateUtils;
|
|
|
import com.goafanti.common.utils.LoggerUtils;
|
|
|
-import com.goafanti.patent.bo.PatentExpireBO;
|
|
|
+import com.goafanti.patent.bo.PatentExpireBo;
|
|
|
import com.goafanti.patent.service.PatentInfoService;
|
|
|
|
|
|
@Component
|
|
|
@@ -47,56 +39,43 @@ public class PatentTask {
|
|
|
* "0 0 6 * * ?" 每天上午6点触发一次
|
|
|
*/
|
|
|
|
|
|
- @Scheduled(cron = "0 0 6 * * ?")
|
|
|
+ @Scheduled(cron = "0 0 0 * * ?")
|
|
|
public void exprireRun() {
|
|
|
LoggerUtils.debug(getClass(), "开始检查专利到期");
|
|
|
- List<PatentExpireBO> peb = patentInfoService.selectExpireRecord();
|
|
|
+ List<PatentExpireBo> peb = patentInfoService.selectExpireRecord();
|
|
|
if (null != peb && peb.size() > 0) {
|
|
|
- for (PatentExpireBO p : peb) {
|
|
|
+ //List<PatentCost> list = new ArrayList<PatentCost>();
|
|
|
+ for (PatentExpireBo p : peb) {
|
|
|
String mobile = p.getMobile();
|
|
|
+ Date patentApplicationDate = p.getPatentApplicationDate();
|
|
|
if (StringUtils.isNotBlank(mobile) && StringUtils.isNumeric(mobile)
|
|
|
- && null != p.getPatentApplicationDate()) {
|
|
|
+ && null != patentApplicationDate) {
|
|
|
+ Calendar now = Calendar.getInstance();
|
|
|
try {
|
|
|
- if (disposeExprire(p)) {
|
|
|
- sendMessage(p);
|
|
|
+ if (disposeExprire(p, now)) {
|
|
|
+ //sendMessage(p);
|
|
|
+ return;
|
|
|
}
|
|
|
+
|
|
|
} catch (ParseException e) {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
+ }
|
|
|
+ /*List<PatentAnnualFeeTaskBo> af = patentInfoService.findAnnualFeeTaskBo();
|
|
|
+ PatentCost cost = null;*/
|
|
|
+ /*if (disposeExprireDate(patentApplicationDate, now.getTime())){
|
|
|
+ cost = new PatentCost();
|
|
|
+ cost.setId(p.getCostId());
|
|
|
+ cost.setAnnualFeeState(PatentAnnualFeeStatus.);
|
|
|
+ }*/
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * "0 0 0 * * ?" 每天0点触发一次
|
|
|
- */
|
|
|
- @Scheduled(cron = "0 0 0 * * ?")
|
|
|
- public void annualFeeRun() {
|
|
|
- LoggerUtils.debug(getClass(), "开始检查专利年费续缴");
|
|
|
- List<PatentExpireBO> peb = patentInfoService.selectExpireRecord();
|
|
|
- if (null != peb && peb.size() > 0) {
|
|
|
- for (PatentExpireBO p : peb) {
|
|
|
- String mobile = p.getMobile();
|
|
|
- if (StringUtils.isNotBlank(mobile) && StringUtils.isNumeric(mobile)
|
|
|
- && null != p.getPatentApplicationDate()) {
|
|
|
- try {
|
|
|
- if (disposeExprire(p)) {
|
|
|
- sendMessage(p);
|
|
|
- }
|
|
|
- } catch (ParseException e) {
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
- }
|
|
|
-
|
|
|
- private Boolean disposeExprire(PatentExpireBO peb) throws ParseException {
|
|
|
+ private Boolean disposeExprire(PatentExpireBo peb, Calendar now) throws ParseException {
|
|
|
Date addYear = disposeAddYear(peb.getPatentApplicationDate());// 申请日5年后
|
|
|
- Calendar now = Calendar.getInstance();
|
|
|
-
|
|
|
if (addYear.getTime() - now.getTime().getTime() >= 0) {
|
|
|
- now.add(Calendar.MONTH, -3);//提前三个月
|
|
|
+ now.add(Calendar.MONTH, +3);//提前三个月
|
|
|
return disposeExprireDate(peb.getPatentApplicationDate(), now.getTime());
|
|
|
}
|
|
|
return Boolean.FALSE;
|
|
|
@@ -129,7 +108,7 @@ public class PatentTask {
|
|
|
+ DateFormatUtils.format(s, AFTConstants.MMDD), AFTConstants.YYYYMMDD);
|
|
|
}
|
|
|
|
|
|
- private void sendMessage(PatentExpireBO p) {
|
|
|
+ /*private void sendMessage(PatentExpireBo p) {
|
|
|
IClientProfile profile = DefaultProfile.getProfile("cn-hangzhou", accessKey, accessSecret);
|
|
|
try {
|
|
|
DefaultProfile.addEndpoint("cn-hangzhou", "cn-hangzhou", "Sms", "sms.aliyuncs.com");
|
|
|
@@ -149,6 +128,6 @@ public class PatentTask {
|
|
|
} catch (ClientException e) {
|
|
|
LoggerUtils.fmtError(getClass(), e, "客户端手机短信异常:%s", e.getMessage());
|
|
|
}
|
|
|
- }
|
|
|
+ }*/
|
|
|
|
|
|
}
|