Parcourir la source

调整专利提醒逻辑

anderx il y a 4 ans
Parent
commit
e934ef46b8

+ 1 - 1
src/main/java/com/goafanti/common/task/OrderDunTask.java

@@ -155,7 +155,7 @@ public class OrderDunTask {
 					now2.setTime(o.getCustomizeTime());
 					CalendarTimeCleared(now);
 				}
-				if (now.getTimeInMillis() > now2.getTimeInMillis()) {
+				if (now.getTimeInMillis() >= now2.getTimeInMillis()) {
 					updateOrderDun(o);
 					Thread.sleep(2000);
 				}

+ 26 - 25
src/main/java/com/goafanti/common/task/PatentTask.java

@@ -43,29 +43,29 @@ public class PatentTask {
 	private AdminService adminService;
 	@Autowired
 	private AsyncUtils	asyncUtils;
-	
-	
-	
-	
-	
+
+
+
+
+
 
 	int pointsDataLimit=50;
-    
+
     private static final String regEx_script = "<script[^>]*?>[\\s\\S]*?<\\/script>"; // 定义script的正则表达式
     private static final String regEx_style = "<style[^>]*?>[\\s\\S]*?<\\/style>"; // 定义style的正则表达式
     private static final String regEx_html = "<[^>]+>"; // 定义HTML标签的正则表达式
     private static final String regEx_space = "\\s*|\t|\r|\n";//定义空格回车换行符
-	
 
-	
-	
+
+
+
 	/**
 	 * 专利提醒定时任务
 	 * 每天0点触发任务
 	 * 1、先计算出申请时间与当前时间相隔天数 2、然后用相隔天使除以365取余计算年份差 3、在用申请时间加上年限获取最后日期
 	 * 4、在相隔30天、20天、10天、3天、2天、1天分别一次提醒。原是在距离90天提醒。
 	 */
-	@Scheduled(cron = "0 0 0  * * ?") 
+	@Scheduled(cron = "0 0 0  * * ?")
 	@RequestMapping(value = "/open/patentRemind", method = RequestMethod.GET)
 	public void patentRemind() {
 		LoggerUtils.debug(getClass(), "====================开始检查专利提醒==================");
@@ -117,15 +117,14 @@ public class PatentTask {
 					n.setNoticeType(NoticeStatus.TASK_PATENT_ERROR.getCode());
 					Admin a = adminService.selectByPrimaryKey(p.getAid());
 					StringBuffer str2 = new StringBuffer();
-					str2.append("专利编号[").append(p.getPatentNo()).append("],名称[").append(p.getName()).append("],email[")
-							.append(p.getEmail().trim()).append("]");
+
 					if (a == null) {
 						str2.append(",aid=").append(p.getAid()).append(",找不到管理员。");
 						n.setAid("1");
 						n.setContent(str2.toString());
 						nlist.add(n);
 						continue;
-					} else if (!SendEmailUtil.isEmail(p.getEmail().trim())) {
+					} else if (!SendEmailUtil.isEmail(p.getEmail())) {
 						str2.append(",管理员=").append(a.getName()).append(",邮箱不正确。");
 						n.setAid("1");
 						n.setContent(str2.toString());
@@ -161,6 +160,8 @@ public class PatentTask {
 							nlist.add(n);
 						}
 						PatentNewLog pl = new PatentNewLog();
+						str2.append("专利编号[").append(p.getPatentNo()).append("],名称[").append(p.getName()).append("],email[")
+								.append(p.getEmail().trim()).append("]");
 						String str = StrToString(str2,p.getEndDate(),status);
 						pl.setContent(str);
 						pl.setCreateTime(new Date());
@@ -182,7 +183,7 @@ public class PatentTask {
 			updatePatentNew(s4,4);
 			updatePatentNew(s5,5);
 			patentNewService.pushResetPatentNew(s6);
-			
+
 		} catch (Exception e) {
 			LoggerUtils.debug(getClass(), "=====================专利提醒失败======================");
 			Notice n = new Notice(UUID.randomUUID().toString(), new Date(), 0, "1",
@@ -226,12 +227,12 @@ public class PatentTask {
 
 		}
 	}
-	
+
 
 	/**
 	 * 修改专利状态
 	 * @param status
-	 * @throws InterruptedException 
+	 * @throws InterruptedException
 	 */
 	private void updatePatentNew(List<String> list, Integer status) throws InterruptedException {
 		if (!list.isEmpty()) {
@@ -262,11 +263,11 @@ public class PatentTask {
 		str.append(",截止时间[").append(DateUtils.formatDate(date, AFTConstants.YYYYMMDD)).append("]请在截止时间前通知客户!");
 		return str.toString();
 	}
-	
 
-	
-	
-	
+
+
+
+
 	/**
          * @param htmlStr
          * @return
@@ -276,24 +277,24 @@ public class PatentTask {
             Pattern p_script = Pattern.compile(regEx_script, Pattern.CASE_INSENSITIVE);
             Matcher m_script = p_script.matcher(htmlStr);
             htmlStr = m_script.replaceAll(""); // 过滤script标签
-       
+
             Pattern p_style = Pattern.compile(regEx_style, Pattern.CASE_INSENSITIVE);
             Matcher m_style = p_style.matcher(htmlStr);
             htmlStr = m_style.replaceAll(""); // 过滤style标签
-       
+
             Pattern p_html = Pattern.compile(regEx_html, Pattern.CASE_INSENSITIVE);
             Matcher m_html = p_html.matcher(htmlStr);
             htmlStr = m_html.replaceAll(""); // 过滤html标签
-       
+
             Pattern p_space = Pattern.compile(regEx_space, Pattern.CASE_INSENSITIVE);
             Matcher m_space = p_space.matcher(htmlStr);
             htmlStr = m_space.replaceAll(""); // 过滤空格回车标签
             return htmlStr.trim(); // 返回文本字符串
         }
-           
+
         public static String getTextFromHtml(String htmlStr){
             htmlStr = delHTMLTag(htmlStr);
             htmlStr = htmlStr.replaceAll("&nbsp;", "");
             return htmlStr;
         }
-}
+}