Browse Source

消息提醒与邮件开发

anderx 6 years ago
parent
commit
a1a15d0be8

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

@@ -171,6 +171,7 @@ public interface OrderNewService {
 	List<TOrderLogBo> selectOrderLog(String orderNo);
 
 	void generalSendNoticeAndEmail(List<String> alist, Integer type,String OrderNo,String adminId);
+	void sendMailByAsynchronousMode(List<String> alist, Integer type, String orderNo, String id);
 	
 	
 }

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

@@ -308,6 +308,7 @@ public class OrderChangeServiceImpl extends BaseMybatisDao<NewOrderChangeMapper>
 		}
 		//发送站内信息与邮件
 		orderNewService.generalSendNoticeAndEmail(alist, type, o.getOrderNo(), a.getId());
+		
 	}
 	
 	private void changgeAdopt(NewOrderChangeBo nb) {
@@ -417,7 +418,8 @@ public class OrderChangeServiceImpl extends BaseMybatisDao<NewOrderChangeMapper>
 		}
 		t.setProcessState(1);//流程置为营销管理员
 		sendNotice(0, t);
-		return newOrderChangeMapper.updateByPrimaryKeySelective(noc);
+		if(changeType!=1)newOrderChangeMapper.updateByPrimaryKeySelective(noc);
+		return 1; 
 	}
 	@Override
 	public int addOrderRefundInvoice(OrderRefundInvoice o) {

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

@@ -22,6 +22,8 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
+import org.springframework.core.task.TaskExecutor;
+import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
 
 import com.alibaba.fastjson.JSON;
@@ -925,7 +927,22 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 		return tOrderLogMapper.selectOrderByNo(orderNo);
 	}
 
-
+	
+	/**
+     * 异步发送邮件
+     * 
+     * @param email
+     */
+	@Async
+    public void sendMailByAsynchronousMode(List<String> alist, Integer type,String OrderNo,String adminId){  
+			try {      
+	        	generalSendNoticeAndEmail(alist,  type, OrderNo, adminId);
+	             } catch (Exception e) {    
+         }    
+        
+    }
+
+    @Async
 	public  void generalSendNoticeAndEmail(List<String> alist, Integer type,String OrderNo,String adminId) {
 		AdminListBo a = adminMapper.getDeptNameByAid(TokenManager.getAdminId());
 		String str=NoticeStatus.getValueByCode(type)+": 订单编号 -"+OrderNo+", 操作人:"+a.getDepartmentName()+"-"+a.getName()+"。";