a5e42c50d10c2fd2775fab2e6382fefebbce4747.svn-base
3.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
package yxy.timer.webservice.interfaces.impl;
import java.util.List;
import java.util.Map;
import javax.ejb.Remote;
import javax.ejb.Stateless;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
import net.sf.json.JSONObject;
import yxy.timer.dao.YxySendMailMasterBaseDao;
import yxy.timer.pojo.YxySendMailMasterBase;
import yxy.timer.service.YxySysParamaterService;
import yxy.timer.tool.AnalysisYxyMail;
import yxy.timer.webservice.interfaces.GetMailInterfaces;
@WebService(serviceName="yxymailinfoWebservice",targetNamespace="http://GetMailInterfaces.interfaces.webservice.timer.yxy/")
@Stateless
@Remote(GetMailInterfaces.class)
public class GetMailInterfacesImpl implements GetMailInterfaces{
/**获取邮件详细信息*/
@WebResult(name="result")
@WebMethod
public String getMailInfo(@WebParam(name="mailid",targetNamespace="http://GetMailInterfaces.interfaces.webservice.timer.yxy/")String mailid) throws Exception {
//返回值
String result="";
try {
//ID查询邮件
String hql="from YxySendMailMasterBase where send_mail_id="+mailid;
List<YxySendMailMasterBase> maillist=yxysendmailmasterbasedao.findByHql(hql);
if(maillist.size()>0){
String loginid=maillist.get(0).getUser_loginid();
String domain=maillist.get(0).getUser_domain();
String emlfilepath="";
//查询控制参数(用户级)
Map<String,String> usergraph=yxysysparamaterservice.findParamaterByLevel(4,loginid,domain);
if(usergraph.size()>0){
emlfilepath=usergraph.get("yxy_user_data_save_path").toString();
if(emlfilepath==null||emlfilepath.equals("")){
//查询控制参数(企业级)
Map<String,String> domaingraph=yxysysparamaterservice.findParamaterByLevel(2, loginid,domain);
emlfilepath=domaingraph.get("yxy_domain_save_path").toString();
}
}else{
//查询控制参数(企业级)
Map<String,String> domaingraph=yxysysparamaterservice.findParamaterByLevel(2, loginid,domain);
emlfilepath=domaingraph.get("yxy_domain_save_path").toString();
}
//处理邮件路径
String emlpath=maillist.get(0).getEml_file_path().replace("#####",emlfilepath);
//解析eml文件(传送钥匙)
AnalysisYxyMail mehtod=new AnalysisYxyMail();
List<String> paxlist=mehtod.ParseEmlMethod(emlpath);
//赋值
maillist.get(0).setBody(paxlist.get(0));
maillist.get(0).setAttarchment_path(paxlist.get(1));
result=JSONObject.fromObject(maillist.get(0)).toString();
}else{
result="erro";
}
} catch (Exception e) {
e.printStackTrace();
result="erro";
}
return result;
}
private YxySendMailMasterBaseDao yxysendmailmasterbasedao;//邮件基本信息dao
private YxySysParamaterService yxysysparamaterservice;//控制参数service
public YxySendMailMasterBaseDao getYxysendmailmasterbasedao() {
return yxysendmailmasterbasedao;
}
public void setYxysendmailmasterbasedao(
YxySendMailMasterBaseDao yxysendmailmasterbasedao) {
this.yxysendmailmasterbasedao = yxysendmailmasterbasedao;
}
public YxySysParamaterService getYxysysparamaterservice() {
return yxysysparamaterservice;
}
public void setYxysysparamaterservice(
YxySysParamaterService yxysysparamaterservice) {
this.yxysysparamaterservice = yxysysparamaterservice;
}
}