邮件接口

This commit is contained in:
zhouyahui 2018-12-05 17:33:28 +08:00
parent 1e24e85567
commit 3705d65e0a
3 changed files with 116 additions and 0 deletions

View File

@ -0,0 +1,41 @@
<%@ page contentType="text/html; charset=GBK"%>
<%@ include file="/Frame/resources/include/include_begin_info.jspf"%><%
/*
Author: undefined 2018-06-08
Content: 示例详情页面
History Log:
*/
String sPrevUrl = CurPage.getParameter("PrevUrl");
if(sPrevUrl == null) sPrevUrl = "/Tenwa/Lease/App/Interface/Email/EmailSendList.jsp";
String sTempletNo = "EmailSendInfo";//--模板号--
ASObjectModel doTemp = new ASObjectModel(sTempletNo);
ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request);
dwTemp.Style = "2";//freeform
//dwTemp.ReadOnly = "-2";//只读模式
dwTemp.genHTMLObjectWindow(CurPage.getParameter("ID"));
String sButtons[][] = {
{"true","All","Button","保存","保存所有修改","as_save(0,'sendEmail()')","","","",""},
{String.valueOf(!com.amarsoft.are.lang.StringX.isSpace(sPrevUrl)),"All","Button","返回","返回列表","returnList()","","","",""}
};
sButtonPosition = "south";
%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%>
<script type="text/javascript">
function returnList(){
parent.AsDialog.ClosePage();
}
function sendEmail(){
var sendStatus = getItemValue(0,getRow(0),"SEND_STATUS");
if(sendStatus!="IMMEDIATELY"){
var id = getItemValue(0,getRow(0),"ID");
var resultValue =AsControl.RunJavaMethodTrans("com.tenwa.sendemail.SendEmail","send","id="+id);
alert(resultValue);
parent.AsDialog.ClosePage();
}else{
alert("邮件保存成功!");
}
}
</script>
<%@ include file="/Frame/resources/include/include_end.jspf"%>

View File

@ -0,0 +1,41 @@
<%@ page contentType="text/html; charset=GBK"%>
<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><%
/*
Author: undefined 2018-06-08
Content:
History Log:
*/
ASObjectModel doTemp = new ASObjectModel("EmailSendList");
ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request);
dwTemp.Style="1"; //--设置为Grid风格--
dwTemp.ReadOnly = "1"; //只读模式
dwTemp.setPageSize(10);
dwTemp.genHTMLObjectWindow("");
//0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标CSS层叠样式 10、风格
String sButtons[][] = {
{"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""},
{"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""},
{"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0)","","","","btn_icon_delete",""},
};
%><%@include file="/Frame/resources/include/ui/include_list.jspf"%>
<script type="text/javascript">
function newRecord(){
var sUrl = "/Tenwa/Lease/App/Interface/Email/EmailSendInfo.jsp";
AsDialog.PopView(sUrl,'','dialogWidth=700px;dialogHeight=300px;status:no;center:yes;help:no;minimize:no;maximize:no;border:thin;statusbar:no',function(){
reloadSelf();
},'发送邮件');
}
function viewAndEdit(){
var sUrl = "/Tenwa/Lease/App/Interface/Email/EmailSendInfo.jsp";
var ID = getItemValue(0,getRow(0),'ID');
if(typeof(ID)=="undefined" || ID.length==0 ){
alert("参数不能为空!");
return ;
}
AsDialog.PopView(sUrl,'ID='+ID ,'dialogWidth=700px;dialogHeight=300px;status:no;center:yes;help:no;minimize:no;maximize:no;border:thin;statusbar:no',function(){
reloadSelf();
},'编辑邮件');
}
</script>
<%@ include file="/Frame/resources/include/include_end.jspf"%>

View File

@ -0,0 +1,34 @@
package com.tenwa.sendemail;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import com.amarsoft.are.jbo.BizObject;
import com.amarsoft.are.jbo.JBOFactory;
import com.amarsoft.are.jbo.JBOTransaction;
import com.amarsoft.are.lang.DataElement;
import com.tenwa.util.SendEmailUtil;
import jbo.app.tenwa.customer.BT_EMAIL_SEND;
public class SendEmail {
private String id;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String send(JBOTransaction tx)throws Exception {
BizObject bo= JBOFactory.getBizObjectManager(BT_EMAIL_SEND.CLASS_NAME,tx).createQuery("ID=:ID").setParameter("ID",id).getSingleResult(false);
String toUser =bo.getAttribute("TOEMAIL").toString();
String title = bo.getAttribute("EMAIL_HEADLINE").toString();
String content =bo.getAttribute("EMAIL_CONTENT").toString();
SendEmailUtil.sendMessage(tx,toUser,title,content,true,null);
return "Óʼþ·¢Ëͳɹ¦£¡";
}
}