ソースを参照

专利提醒修改

anderx 6 年 前
コミット
5421a8b938

+ 121 - 0
src/main/java/com/goafanti/common/bo/EmailBo.java

@@ -17,6 +17,9 @@ public class EmailBo {
 	private String content;
 	private String end = "详情请登录科德业务管理系统查看,谢谢!";
 	
+	
+	
+	
 	public EmailBo() {
 	}
 	
@@ -30,6 +33,30 @@ public class EmailBo {
 		this.sender = sender;
 		this.content = content;
 	}
+	
+	/**
+	 * 
+	 * @param subject
+	 * @param address
+	 * @param addressee
+	 * @param deptname
+	 * @param sender
+	 * @param userName
+	 * @param adminName
+	 * @param patentName
+	 * @param patentNo
+	 * @param amount
+	 * @param date
+	 */
+	public  EmailBo(String subject, String address, String addressee,
+			String deptname, String sender,String patentName,String patentNo,String amount,String date ) {
+		this.subject = subject;
+		this.address = address;
+		this.addressee = addressee;
+		this.deptname = deptname;
+		this.sender = sender;
+		this.content=setPatentFormat( addressee, sender, patentName, patentNo, amount, date);
+	}
 
 
 
@@ -78,6 +105,100 @@ public class EmailBo {
         		+ "<div>" + this.content + "</div>"
         		+ "<div>" + this.end + "</div>";
     }
+	
+	
+	
+	public String setPatentFormat(String userName,String adminName,String patentName,String patentNo,String amount,String date ){
+		String str="<table width=\"800\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\" bgcolor=\"#ffffff\" style=\"font-family:'Microsoft YaHei';\">\r\n" + 
+				"    		<tbody><tr>\r\n" + 
+				"		        <td>\r\n" + 
+				"		             <table width=\"800\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\" height=\"40\"></table>\r\n" + 
+				"		        </td>\r\n" + 
+				"		    </tr>\r\n" + 
+				"			\r\n" + 
+				"    		<tr>\r\n" + 
+				"        		<td>\r\n" + 
+				"            		\r\n" + 
+				"            		<table width=\"800\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\" bgcolor=\"#1C5299\" height=\"48\" style=\"font-family:'Microsoft YaHei';\">\r\n" + 
+				"              			<tbody><tr>\r\n" + 
+				"                			<td height=\"48\" border=\"0\" align=\"center\" valign=\"middle\" style=\"padding-left:20px; color: white; font-size: 20px;\">\r\n" + 
+				"                				专利提醒\r\n" + 
+				"        					</td>\r\n" + 
+				"              			</tr>\r\n" + 
+				"		            </tbody></table>\r\n" + 
+				"		            \r\n" + 
+				"        		</td>\r\n" + 
+				"		    </tr>\r\n" + 
+				"		    \r\n" + 
+				"   			<tr>\r\n" + 
+				"        		<td>\r\n" + 
+				"		            \r\n" + 
+				"		        <table width=\"800\" border=\"0\" align=\"left\" cellpadding=\"0\" cellspacing=\"0\" style=\" border:1px solid #edecec; border-top:none; padding:0 20px;font-size:14px;color:#333333;\">\r\n" + 
+				"	               		<tbody><tr>\r\n" + 
+				"                <td width=\"760\" height=\"56\" border=\"0\" align=\"left\" colspan=\"2\" style=\" font-size:16px;vertical-align:bottom;\">尊敬的" + userName + ":</td>\r\n" + 
+				"              </tr>\r\n" + 
+				"               <tr>\r\n" + 
+				"                <td width=\"760\" height=\"30\" border=\"0\" align=\"left\" colspan=\"2\" style=\"text-indent: 2em\">您好!</td>\r\n" + 
+				"              </tr>\r\n" + 
+				"                      <tr>\r\n" + 
+				"                <td width=\"40\" height=\"32\" border=\"0\" align=\"left\" valign=\"middle\" style=\" width:40px; text-align:left;vertical-align:middle; line-height:32px; float:left;\">&nbsp;</td>\r\n" + 
+				"                <td width=\"720\" height=\"32\" border=\"0\" align=\"left\" style=\" width:720px; text-align:left;vertical-align:middle;line-height:32px;\"><span style=\"font-weight: 900\">科德集团</span>【" + adminName + "】向您发起了专利缴费提醒!<span style=\"color: red\">如已缴费,请您忽略此短信!</span></td>\r\n" + 
+				"              </tr>\r\n" + 
+				"              <tr>\r\n" + 
+				"                <td width=\"720\" height=\"24\" colspan=\"2\" style=\"padding-left:40px;\"><span style=\"font-weight: 900\">专利信息</span></td>\r\n" + 
+				"              </tr>\r\n" + 
+				"              \r\n" + 
+				"              <tr>\r\n" + 
+				"                <td width=\"720\" height=\"24\" colspan=\"2\" style=\"padding-left:40px;\">专利名称:" + patentName + "</td>\r\n" + 
+				"              </tr>\r\n" + 
+				"              <tr>\r\n" + 
+				"                <td width=\"720\" height=\"24\" colspan=\"2\" style=\"padding-left:40px;\">客户名称:" + userName + "</td>\r\n" + 
+				"              </tr>\r\n" + 
+				"               <tr>\r\n" + 
+				"                <td width=\"720\" height=\"24\" colspan=\"2\" style=\"padding-left:40px;\">专利编号:" + patentNo + "</td>\r\n" + 
+				"              </tr>\r\n" + 
+				"               <tr>\r\n" + 
+				"                <td width=\"720\" height=\"24\" colspan=\"2\" style=\"padding-left:40px;\">金额:" + amount + " <span style=\"color: red\">(本缴费金额仅供参考,实际缴费金额,请登录国知局官方网址<a href=\"http://cpquery.sipo.gov.cn/\">cpquery.sipo.gov.cn</a>查询)</span></td>\r\n" + 
+				"              </tr>\r\n" + 
+				"               <tr>\r\n" + 
+				"                <td width=\"720\" height=\"24\" colspan=\"2\" style=\"padding-left:40px;\">到期时间:" + date + "</td>\r\n" + 
+				"              </tr>\r\n" + 
+				"               <tr>\r\n" + 
+				"                <td width=\"720\" height=\"24\" colspan=\"2\" style=\"padding-left:40px;\">&nbsp;</td>\r\n" + 
+				"              </tr>\r\n" + 
+				"              <tr>\r\n" + 
+				"                <td width=\"720\" height=\"24\" colspan=\"2\" style=\"padding-left:40px;\"><span style=\"font-weight: 900\">温馨提示</span></td>\r\n" + 
+				"              </tr>\r\n" + 
+				"              <tr>\r\n" + 
+				"                <td width=\"720\" height=\"24\" colspan=\"2\" style=\"padding-left:40px;\"><span style=\"color: red;\">依据【专利管理办法】规定:如未及时续费,您的专利将会失效!</span></td>\r\n" + 
+				"              </tr>\r\n" + 
+				"              <tr>\r\n" + 
+				"                <td width=\"720\" height=\"24\" colspan=\"2\" style=\"padding-left:40px;\"><span style=\"color: black; font-weight: 900;\">请您尽快核实专利到期时间及缴费信息!</span></td>\r\n" + 
+				"              </tr>\r\n" + 
+				"              <tr>\r\n" + 
+				"                <td width=\"720\" height=\"24\" colspan=\"2\" style=\"padding-left:40px;\"></td>\r\n" + 
+				"              </tr>\r\n" + 
+				"              <tr>\r\n" + 
+				"                <td width=\"720\" height=\"24\" colspan=\"2\" style=\"padding-left:40px;\"><span>如果您对此有更多疑问,请联系<span style=\"font-weight: 900\">科德集团</span>【" + adminName + "】,以获得方便快捷的服务</span></td>\r\n" + 
+				"              </tr>\r\n" + 
+				"              <tr>\r\n" + 
+				"                <td width=\"720\" height=\"24\" colspan=\"2\" style=\"padding-left:40px;\"></td>\r\n" + 
+				"              </tr>\r\n" + 
+				"              \r\n" + 
+				"		               	<tr>\r\n" + 
+				"		                	<td width=\"720\" height=\"14\" colspan=\"2\" style=\"padding-bottom:16px; border-bottom:1px dashed #e5e5e5;font-family:'Microsoft YaHei';\"><a href=\"http://www.kedexinxi.com/\">湖南科德信息咨询有限公司</a></td>\r\n" + 
+				"		              	</tr>\r\n" + 
+				"		               	<tr>\r\n" + 
+				"		                	<td width=\"720\" height=\"14\" colspan=\"2\" style=\"padding:8px 0 28px;color:#999999; font-size:12px;font-family:'Microsoft YaHei';\">此为系统邮件请勿回复</td>\r\n" + 
+				"		              	</tr>\r\n" + 
+				"		            </tbody></table>\r\n" + 
+				"		            \r\n" + 
+				"        		</td>\r\n" + 
+				"		    </tr>\r\n" + 
+				"		</tbody></table>";
+//		"<div>" + this.content + "</div>"
+        return  str;
+    }
 
 	public void SetEnd(String end) {
 		this.end = end;

+ 1 - 1
src/main/java/com/goafanti/common/mapper/TOrderNewMapper.xml

@@ -1411,7 +1411,7 @@ where super_id is null ) e on e.order_no=a.order_no
     a.order_no as orderNo, a.order_type as orderType, a.creater, a.create_time as createTime,a.update_time as updateTime, a.buyer_id as buyerId,
     a.first_amount as firstAmount,a.total_amount as totalAmount, a.settlement_amount as settlementAmount, order_status as orderStatus,
     a.liquidation_status as liquidationStatus, a.process_status as processStatus, a.project_status as projectStatus, a.approval,
-    a.order_remarks as orderRemarks, a.delete_sign as deleteSign, a.salesman_id as salesmanId, finance_id as financeId, technician_id as technicianId, 
+    a.order_remarks as orderRemarks, a.delete_sign as deleteSign, a.salesman_id as salesmanId, a.finance_id as financeId, technician_id as technicianId, 
     a.sign_time as signTime, a.settlement_time as settlementTime, a.contract_no as contractNo, a.contract_type as contractType, a.contacts,
     a.contact_mobile as contactMobile, a.legal_person as legalPerson, a.legal_person_tel as legalPersonTel, a.proof_count as proofCount,
     a.proof_aid as proofAid,contract_picture_url as contractPictureUrl, c.name as salesmanName,dep.name as depName,d.name as financeName,

+ 8 - 17
src/main/java/com/goafanti/common/task/PatentTask.java

@@ -2,9 +2,6 @@ package com.goafanti.common.task;
 
 import java.io.UnsupportedEncodingException;
 import java.math.BigDecimal;
-import java.text.DateFormat;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
 import java.util.Calendar;
 import java.util.Date;
 import java.util.List;
@@ -15,9 +12,6 @@ import javax.annotation.Resource;
 import javax.mail.MessagingException;
 
 import org.apache.commons.lang3.time.DateFormatUtils;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.scheduling.annotation.Scheduled;
-import org.springframework.stereotype.Component;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
@@ -36,8 +30,8 @@ import com.goafanti.patent.service.PatentNewService;
 
 
 
-@Component
-//@Controller
+//@Component
+@Controller
 public class PatentTask {
 	@Resource
 	private PatentNewService patentNewService;
@@ -59,11 +53,10 @@ public class PatentTask {
 	
 	
 	
-	@Scheduled(cron = "0 0 0  * * ?") 
-//	@RequestMapping(value = "/open/patentRemind", method = RequestMethod.GET)
+	//@Scheduled(cron = "0 0 0  * * ?") 
+	@RequestMapping(value = "/open/patentRemind", method = RequestMethod.GET)
 	public void patentRemind() {
 		LoggerUtils.debug(getClass(), "开始检查专利提醒");
-		DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
 		List<PatentNew> l=patentNewService.AllselectStartPatentNew();
 		for (PatentNew p : l) {
 			 Calendar cst =Calendar.getInstance();
@@ -83,15 +76,13 @@ public class PatentTask {
 				  String content = null;
 					 Admin a=adminService.selectByPrimaryKey(p.getAid());
 					 //计算出年费金额,然后存入数据库
-					 BigDecimal Money=countMoney(y,p.getType());
+					 BigDecimal money=countMoney(y,p.getType());
 
 					 if(StringUtils.isNotBlank(p.getEmail())){
 						 ted.setTime(cst.getTime());
 						 ted.add(Calendar.YEAR, y);
-						  content = "<div>专利名称: "+ p.getName() +"</div><div>客户名称: " + p.getApplicant() + "</div>"
-								  + "<div>专利编号: "+ p.getPatentNo() + "<div>金额: "+ Money +"</div><div>你的专利将在 "+DateFormatUtils.format(ted, "yyyy-MM-dd")+" 到期</div>";
-							EmailBo emailBo = new EmailBo("专利提醒", p.getEmail(), "客户", "科德集团", a.getName(), content);
-							emailBo.SetEnd("详情请联系相关办理人员,谢谢!");
+						  
+							EmailBo emailBo = new EmailBo("专利提醒",p.getEmail(), p.getApplicant(), "科德集团", a.getName(),p.getName(), p.getPatentNo(), money.toString(), DateFormatUtils.format(ted, "yyyy-MM-dd"));
 							try {
 								SendEmailUtil.getInstance().send(emailBo);
 							} catch (UnsupportedEncodingException e) {
@@ -102,7 +93,7 @@ public class PatentTask {
 								e.printStackTrace();
 							}
 						}
-					 p.setPatentAmount(Money);
+					 p.setPatentAmount(money);
 					 p.setStatus(1);//提醒中
 					 p.setYears(y);
 					 patentNewService.updatePatenNew(p);

+ 40 - 10
src/main/java/com/goafanti/common/utils/SendEmailUtil.java

@@ -19,6 +19,8 @@ import javax.mail.internet.MimeMessage;
 import javax.mail.internet.MimeMultipart;
 import javax.mail.internet.MimeUtility;
 
+import org.apache.commons.lang3.time.DateFormatUtils;
+
 import com.goafanti.common.bo.EmailBo;
 import com.goafanti.order.enums.OrderNewState;
 import com.sun.mail.util.MailSSLSocketFactory;
@@ -94,7 +96,6 @@ public class SendEmailUtil {
 
 		// Set message attributes
 		msg.setFrom(new InternetAddress(MimeUtility.encodeText(AUTH_USER_NICKNAME) +"<" +  FROM + ">"));
-
 //		msg.setFrom(new InternetAddress(FROM));
 		String[] adds =  emailBo.getAddress().split(",");
 		String[] ees =  emailBo.getAddressee().split(",");
@@ -108,6 +109,35 @@ public class SendEmailUtil {
 			Transport.send(msg);
 		}
 	}
+	
+	/**
+	 * 如果要给多个人发,请EmailBo 的 address , addressee用逗号隔开 注意要一一对应且个数相等
+	 * @param emailBo
+	 * @throws MessagingException
+	 * @throws UnsupportedEncodingException
+	 */
+	public void patentSend(EmailBo emailBo)
+			throws MessagingException, UnsupportedEncodingException {
+		// Session session = getSession();
+		// Instantiate a message
+		Message msg = new MimeMessage(session);
+
+		// Set message attributes
+		msg.setFrom(new InternetAddress(MimeUtility.encodeText(AUTH_USER_NICKNAME) +"<" +  FROM + ">"));
+		emailBo.SetEnd("");
+//		msg.setFrom(new InternetAddress(FROM));
+		String[] adds =  emailBo.getAddress().split(",");
+		String[] ees =  emailBo.getAddressee().split(",");
+		for (int i = 0; i < adds.length; i++) {
+			InternetAddress internetAddress = new InternetAddress(adds[i]);
+			msg.setRecipient(Message.RecipientType.TO, internetAddress);
+			msg.setSubject(emailBo.getSubject());
+			msg.setSentDate(new Date());
+			msg.setContent(emailBo.getContent(), "text/html;charset=utf-8");
+			// Send the message
+			Transport.send(msg);
+		}
+	}
 
 	public static void main(String[] args) throws MessagingException, UnsupportedEncodingException {
 //		System.out.println(OrderNewState.getStatus(0));
@@ -125,15 +155,15 @@ public class SendEmailUtil {
 //		EmailBo bo =new EmailBo("催收通知","3298921364@qq.com,","管理员,","平台超管中心","管理员","<div>客户名称: 国防湖南</div><div>订单编号: 273822676366036992</div><div>催收时间: 273822676366036992</div><div>催收科目: 273822676366036992</div><div>催收情况: 273822676366036992</div>");
 //		send(bo);
 		EmailBo bo = new EmailBo("奖金信息", "3298921364@qq.com,", "limim,", "财务部", "财务专员彭晓丽", content);*/
-		
-		
-		
 		SendEmailUtil emailUtil = SendEmailUtil.getInstance();
-		String content ="<body>"+ 
-				"<div style='background-color:red'>专利缴费提醒: "+ "专利1号" +"</div><div>客户名称: " + "湖南明和" + "</div>" +"<div>专利编号: "+ "zl0001" +"</div>"+
-				"</body>";
-			EmailBo emailBo = new EmailBo("专利提醒","2304089483@qq.com", "客户", "科德集团", "技术员", content);
-			emailBo.SetEnd("详情请联系相关办理人员,谢谢!");
-			emailUtil.send(emailBo);
+//		String content ="<body>"+ 
+//				"<div style='background-color:red'>专利缴费提醒: "+ "专利1号" +"</div><div>客户名称: " + "湖南明和" + "</div>" +"<div>专利编号: "+ "zl0001" +"</div>"+
+//				"</body>";
+//			EmailBo emailBo = new EmailBo("专利提醒","2304089483@qq.com", "客户", "科德集团", "技术员", content);
+//			emailBo.SetEnd("详情请联系相关办理人员,谢谢!");
+//			emailUtil.send(emailBo);
+		
+			EmailBo emailBo = new EmailBo("专利提醒","287486941@qq.com", "客户", "科德集团", "技术员","专利001", "zx001", "600", "2019-06-06");
+			emailUtil.patentSend(emailBo);
 	}
 }

+ 0 - 1
src/main/java/com/goafanti/order/service/impl/OrderNewServiceImpl.java

@@ -462,7 +462,6 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 			
 		}else if (outsource==1) {//外包
 			o.setRefundStatus(0);
-			
 			if(o.getId()==null) {
 				o.setCreateTime(new Date());
 				tOrderOutsourceMapper.insertSelective(o);

+ 1 - 1
src/main/resources/props/config_local.properties

@@ -60,7 +60,7 @@ template.cacheable=false
 portal.host=//sf.jishutao.com/portal/2.0.6
 avatar.upload.host=//sb.jishutao.com/upload
 #连接开发
-static.host=//sb.jishutao.com/1.1.19
+static.host=//sb.jishutao.com/1.1.20
 avatar.host=//sb.jishutao.com
 
 #连测试