Преглед изворни кода

项目发起核对与完成核对新增发送邮件

anderx пре 4 година
родитељ
комит
d12914f821

+ 80 - 4
src/main/java/com/goafanti/common/bo/EmailBo.java

@@ -14,11 +14,29 @@ public class EmailBo {
 	//通知类型
 	//内容
 	//结束语
+	/**
+	 * 收件地址
+	 */
 	private String subject;
+	/**
+	 * 收件人
+	 */
 	private String address;
+	/**
+	 * 部门
+	 */
 	private String addressee;
+	/**
+	 * 发起人
+	 */
 	private String deptname;
+	/**
+	 * 收件地址
+	 */
 	private String sender;
+	/**
+	 * 内容
+	 */
 	private String content;
 	private String end = "详情请登录科德业务管理系统查看,谢谢!";
 	
@@ -114,11 +132,69 @@ public class EmailBo {
 		
 	}
 
+	public EmailBo(String subject, String address, String content) {
+		this.subject = subject;
+		this.address = address;
+		this.addressee = "";
+		this.content=setNewGeneral(content);
+	}
 
-	
-
-
-	
+	private String setNewGeneral(String content) {
+		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" +
+				"                			"+this.subject +
+				"        					</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" +
+				"              </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\">"+content+"</span></td>\r\n" +
+				"              </tr>\r\n" +
+				"              <tr>\r\n" +
+				"                <td width=\"720\" height=\"24\" colspan=\"2\" style=\"padding-left:40px;\"><span>"+end+"</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>\r\n" +
+				"  </table>";
+		return str;
+	}
 
 
 	public String setDunFormat(String addressee,String sender,String deptname,String orderNo,String contractNo,String date ,String dunStatusName,String adminName,

+ 16 - 0
src/main/java/com/goafanti/common/utils/AsyncUtils.java

@@ -6,6 +6,10 @@ import java.util.List;
 
 import javax.mail.MessagingException;
 
+import com.goafanti.admin.bo.AdminListBo;
+import com.goafanti.common.dao.AdminMapper;
+import com.goafanti.common.enums.NoticeStatus;
+import com.goafanti.core.shiro.token.TokenManager;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Component;
@@ -20,6 +24,8 @@ import com.goafanti.common.model.Notice;
 public class AsyncUtils {
 	@Autowired
 	private NoticeMapper noticeMapper;
+	@Autowired
+	private AdminMapper adminMapper;
 	
 	
 
@@ -48,6 +54,14 @@ public class AsyncUtils {
 		n.setType(NoticeTypes.getType(n.getNoticeType()));
 		noticeMapper.insertSelective(n);
 	}
+
+	public void addNoticAndEmail(Notice n) {
+		n.setType(NoticeTypes.getType(n.getNoticeType()));
+		AdminListBo a = adminMapper.getDeptNameByAid(TokenManager.getAdminId());
+		EmailBo bo=new EmailBo(NoticeStatus.getStatus(n.getNoticeType()).getDesc(),a.getEmail(),n.getContent()) ;
+		noticeMapper.insertSelective(n);
+		send(bo);
+	}
 	
 	
 	public void addNoticeBatch(List<Notice> ln) {
@@ -75,4 +89,6 @@ public class AsyncUtils {
     public void batchUpdateUnreaded(List<String> dl) {
 		noticeMapper.batchUpdateUnreaded(dl);
     }
+
+
 }

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

@@ -272,7 +272,7 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 				n.setNoticeType(NoticeStatus.ITEM_CHECK_END.getCode());
 				n.setContent(str2);
 				n.setReaded(0);//未读
-				asyncUtils.addNotice(n);
+				asyncUtils.addNoticAndEmail(n);
 			}
 			projcetCheckLogMapper.insertSelective(log);
 		}

+ 3 - 1
src/main/java/com/goafanti/order/service/impl/OrderProjectServiceImpl.java

@@ -13,6 +13,7 @@ import java.util.UUID;
 
 import javax.mail.MessagingException;
 
+import com.goafanti.admin.bo.AdminListBo;
 import com.goafanti.common.dao.*;
 import com.goafanti.order.bo.*;
 import org.apache.commons.collections4.map.HashedMap;
@@ -989,7 +990,8 @@ public class OrderProjectServiceImpl extends BaseMybatisDao<TOrderTaskMapper> im
 			n.setNoticeType(NoticeStatus.ITEM_CHECK_START.getCode());
 			n.setContent(str);
 			n.setReaded(0);//未读
-			asyncUtils.addNotice(n);
+
+			asyncUtils.addNoticAndEmail(n);
 		}
 		projcetCheckLogMapper.insertSelective(log);
 		tOrderPaymentMapper.deleteByParam(tid,2);