Procházet zdrojové kódy

发送邮件修改

anderx před 4 roky
rodič
revize
f7a6ba0d52

+ 11 - 8
src/main/java/com/goafanti/common/bo/EmailBo.java

@@ -1,5 +1,10 @@
 package com.goafanti.common.bo;
 
+import java.util.Calendar;
+import java.util.Date;
+
+import com.goafanti.common.constant.AFTConstants;
+import com.goafanti.common.utils.DateUtils;
 
 public class EmailBo {
 	
@@ -41,19 +46,17 @@ public class EmailBo {
 	 */
 	
 	public  EmailBo(String subject, String address, String addressee,
-			String deptname, String sender,String patentName,String patentNo,String amount,String date,Integer status) {
+			String deptname, String sender,String patentName,String patentNo,String amount,Date date) {
 		this.subject = subject;
 		this.address = address;
 		this.addressee = addressee;
 		this.deptname = deptname;
 		this.sender = sender;
-		Integer days=0;
-		if (status==1) days=90;
-		else if (status==2) days=60;
-		else if (status==3) days=30;
-		else if (status==4) days=15;
-		else if (status==5) days=7;
-		this.content=setPatentFormat( addressee, sender, patentName, patentNo, amount, date,days);
+		long now = new Date().getTime(); 
+		long end = date.getTime(); 
+		String endStr=DateUtils.formatDate(date, AFTConstants.YYYYMMDD);
+		Integer days = (int)((end - now) / (1000 * 60 * 60 *24)); 
+		this.content=setPatentFormat( addressee, sender, patentName, patentNo, amount, endStr,days);
 	}
 	
 	/**

+ 1 - 1
src/main/java/com/goafanti/patent/service/impl/PatentNewServiceImpl.java

@@ -419,7 +419,7 @@ public class PatentNewServiceImpl  extends BaseMybatisDao<PatentNewMapper> imple
 				BigDecimal amout= patentNew.getPatentAmount().multiply(new BigDecimal(10000));
 				EmailBo emailBo = new EmailBo("专利提醒", patentNew.getEmail().trim(), userName, "科德集团", a.getName(),
 						patentNew.getName(), patentNew.getPatentNo(),amout.stripTrailingZeros().toPlainString(),
-						DateFormatUtils.format(patentNew.getEndDate(), "yyyy-MM-dd"), patentNew.getStatus());
+						patentNew.getEndDate());
 				list.add(emailBo);
 			}
 			asyncUtils.sendList(list);