diff --git b/.classpath a/.classpath new file mode 100644 index 0000000..1308147 --- /dev/null +++ a/.classpath @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="src" path="src"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> + <classpathentry kind="con" path="melibrary.com.genuitec.eclipse.j2eedt.core.MYECLIPSE_JAVAEE_5_CONTAINER"/> + <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/JoSQL-2.1.jar"/> + <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/antlr-2.7.6.jar"/> + <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/asm-3.3.1.jar"/> + <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/aspectjweaver.jar"/> + <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/c3p0-0.9.1.2.jar"/> + <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/cglib-2.2.jar"/> + <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/commons-collections-3.1.jar"/> + <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/commons-dbcp.jar"/> + <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/commons-logging-1.1.1.jar"/> + <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/commons-pool.jar"/> + <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/dom4j-1.6.1.jar"/> + <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/gentlyWEB-utils-1.1.jar"/> + <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/hibernate-jpa-2.0-api-1.0.1.Final.jar"/> + <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/hibernate3.jar"/> + <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/javassist-3.12.0.GA.jar"/> + <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/jta-1.1.jar"/> + <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/log4j.jar"/> + <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/mail.jar"/> + <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/mysql-connector-java-5.1.6-bin.jar"/> + <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/quartz.jar"/> + <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/slf4j-api-1.6.1.jar"/> + <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/spring-beans.jar"/> + <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/spring-context.jar"/> + <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/spring-core-3.2.0.M1-javadoc.jar"/> + <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/spring-web.jar"/> + <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/spring.jar"/> + <classpathentry kind="output" path="WebRoot/WEB-INF/classes"/> +</classpath> diff --git b/.mymetadata a/.mymetadata new file mode 100644 index 0000000..cd897bd --- /dev/null +++ a/.mymetadata @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project-module + type="WEB" + name="espeedSendYingXiaoYouBase" + id="myeclipse.1432285515350" + context-root="/espeedSendYingXiaoYouBase" + j2ee-spec="5.0" + archive="espeedSendYingXiaoYouBase.war"> + <attributes> + <attribute name="webrootdir" value="WebRoot" /> + </attributes> +</project-module> + diff --git b/.project a/.project new file mode 100644 index 0000000..7c9bf3c --- /dev/null +++ a/.project @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>espeedSendYingXiaoYouBase</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.wst.jsdt.core.javascriptValidator</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>com.genuitec.eclipse.j2eedt.core.WebClasspathBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>com.genuitec.eclipse.j2eedt.core.J2EEProjectValidator</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>com.genuitec.eclipse.j2eedt.core.DeploymentDescriptorValidator</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.wst.validation.validationbuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>com.genuitec.eclipse.ast.deploy.core.DeploymentBuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>com.genuitec.eclipse.ast.deploy.core.deploymentnature</nature> + <nature>com.genuitec.eclipse.j2eedt.core.webnature</nature> + <nature>org.eclipse.jdt.core.javanature</nature> + <nature>org.eclipse.wst.jsdt.core.jsNature</nature> + </natures> +</projectDescription> diff --git b/.settings/.jsdtscope a/.settings/.jsdtscope new file mode 100644 index 0000000..69b5585 --- /dev/null +++ a/.settings/.jsdtscope @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/> + <classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.WebProject"> + <attributes> + <attribute name="hide" value="true"/> + </attributes> + </classpathentry> + <classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/> + <classpathentry kind="src" path="WebRoot"/> + <classpathentry kind="output" path=""/> +</classpath> diff --git b/.settings/org.eclipse.core.resources.prefs a/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..a64058d --- /dev/null +++ a/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,3 @@ +#Fri May 22 17:05:27 CST 2015 +eclipse.preferences.version=1 +encoding/<project>=UTF-8 diff --git b/.settings/org.eclipse.jdt.core.prefs a/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..d9729d6 --- /dev/null +++ a/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,12 @@ +#Fri May 22 17:05:27 CST 2015 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 diff --git b/.settings/org.eclipse.wst.jsdt.ui.superType.container a/.settings/org.eclipse.wst.jsdt.ui.superType.container new file mode 100644 index 0000000..3bd5d0a --- /dev/null +++ a/.settings/org.eclipse.wst.jsdt.ui.superType.container @@ -0,0 +1 @@ +org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git b/.settings/org.eclipse.wst.jsdt.ui.superType.name a/.settings/org.eclipse.wst.jsdt.ui.superType.name new file mode 100644 index 0000000..05bd71b --- /dev/null +++ a/.settings/org.eclipse.wst.jsdt.ui.superType.name @@ -0,0 +1 @@ +Window \ No newline at end of file diff --git b/.svn/entries a/.svn/entries new file mode 100644 index 0000000..48082f7 --- /dev/null +++ a/.svn/entries @@ -0,0 +1 @@ +12 diff --git b/.svn/format a/.svn/format new file mode 100644 index 0000000..48082f7 --- /dev/null +++ a/.svn/format @@ -0,0 +1 @@ +12 diff --git b/.svn/pristine/06/06e2a4d30569877911a927822805192e595d970f.svn-base a/.svn/pristine/06/06e2a4d30569877911a927822805192e595d970f.svn-base new file mode 100644 index 0000000..9f59bc0 Binary files /dev/null and a/.svn/pristine/06/06e2a4d30569877911a927822805192e595d970f.svn-base differ diff --git b/.svn/pristine/08/083ffd434b56568f4398bb8013a8e3b3a93f4591.svn-base a/.svn/pristine/08/083ffd434b56568f4398bb8013a8e3b3a93f4591.svn-base new file mode 100644 index 0000000..50cd9fd --- /dev/null +++ a/.svn/pristine/08/083ffd434b56568f4398bb8013a8e3b3a93f4591.svn-base @@ -0,0 +1,46 @@ +package com.espeed.yxy.dao.impl; + +import java.util.List; + +import com.espeed.yxy.dao.YxySendMailMasterBaseDao; +import com.espeed.yxy.pojo.YxySendMailMasterBase; +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 邮件基本信息DAO(营销游) + * 开始时间: 2013.12.09 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +public class YxySendMailMasterBaseDaoImpl extends HibernateBaseDAOImpl<YxySendMailMasterBase, Long> implements YxySendMailMasterBaseDao{ + + /**实体插入*/ + public int addPojo(YxySendMailMasterBase o)throws Exception{ + return super.add(o); + } + /**实体编辑*/ + public void updatePojo(YxySendMailMasterBase o)throws Exception{ + super.update(o); + } + /**HQL查询*/ + public List<YxySendMailMasterBase> findByHql(String hql)throws Exception{ + return super.getAll(hql); + } + /**指定条记录*/ + public List<YxySendMailMasterBase> findByHqlSet(String hql,int num)throws Exception{ + return super.findBySet(hql, num); + } + /**SQL查询*/ + public List<Object> findBySqlQuery(String sql)throws Exception{ + return super.findBySql(sql); + } + /**HQL更新*/ + public void updateByHql(String hql)throws Exception{ + super.updateorDelByHql(hql); + } + +} diff --git b/.svn/pristine/0e/0eb23726c6a71845221391f98547bc04d3acc39f.svn-base a/.svn/pristine/0e/0eb23726c6a71845221391f98547bc04d3acc39f.svn-base new file mode 100644 index 0000000..e8de327 Binary files /dev/null and a/.svn/pristine/0e/0eb23726c6a71845221391f98547bc04d3acc39f.svn-base differ diff --git b/.svn/pristine/0f/0f16328e9eb295371885e10ac98088729d379302.svn-base a/.svn/pristine/0f/0f16328e9eb295371885e10ac98088729d379302.svn-base new file mode 100644 index 0000000..989504d --- /dev/null +++ a/.svn/pristine/0f/0f16328e9eb295371885e10ac98088729d379302.svn-base @@ -0,0 +1,46 @@ +package com.espeed.yxy.tool; + +import java.util.ArrayList; +import java.util.List; +import java.util.Random; +/*** + * + * @author xieyong + * 获取随机码 + */ +public class GetRondom { + + //生成随机码 + public static List<String> getRandom(List<String> value){ + + List<String> newSmtpList=new ArrayList(); + int n = value.size(); + Random rand = new Random(); + boolean[] bool = new boolean[n]; + + int num =0; + + for (int i = 0; i<n; i++){ + do{ + //如果产生的数相同继续循环 + num = rand.nextInt(n); + }while(bool[num]); + bool[num] =true; + newSmtpList.add(value.get(num)); + } + return newSmtpList; + + } + + public static void main(String[] args) { + List<String> oldStr=new ArrayList<String>(); + for(int i=0;i<3;i++){ + oldStr.add("name"+i); + } + + List<String> newStr=getRandom(oldStr); + for(int j=0;j<newStr.size();j++){ + System.out.println(newStr.get(j)); + } + } +} diff --git b/.svn/pristine/12/129d23d29de183eafe787b9566c2d0bbb8eab47a.svn-base a/.svn/pristine/12/129d23d29de183eafe787b9566c2d0bbb8eab47a.svn-base new file mode 100644 index 0000000..383efde Binary files /dev/null and a/.svn/pristine/12/129d23d29de183eafe787b9566c2d0bbb8eab47a.svn-base differ diff --git b/.svn/pristine/14/145f5d7d2aa3d3116f48fa6bc7b280efd38266b1.svn-base a/.svn/pristine/14/145f5d7d2aa3d3116f48fa6bc7b280efd38266b1.svn-base new file mode 100644 index 0000000..a478e53 --- /dev/null +++ a/.svn/pristine/14/145f5d7d2aa3d3116f48fa6bc7b280efd38266b1.svn-base @@ -0,0 +1,186 @@ +package com.espeed.yxy.tool; + +import java.io.File; +import java.io.FileOutputStream; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.activation.DataHandler; +import javax.activation.FileDataSource; +import javax.mail.internet.InternetAddress; +import javax.mail.internet.MimeBodyPart; +import javax.mail.internet.MimeMessage; +import javax.mail.internet.MimeMultipart; +import javax.mail.internet.MimeUtility; + +import com.espeed.yxy.pojo.YxySendMailMaster; +/* + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 生成本地邮件(营销邮) + * 开始时间: 2013.12.13 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +public class GreateEmlFile { + + private static MimeMessage mimeMsg = null; // MIME邮件对象 + private static javax.mail.Session mailSession = null; + + /**生成eml文件*/ + public static List<Object> GreateMail(YxySendMailMaster yxysendmailmaster,String loginid,String domain,String uploadattrName,String usersetpath)throws Exception{ + List<Object> RemlPath=new ArrayList<Object>(); + RemlPath.add("0"); + RemlPath.add(""); + RemlPath.add(""); + RemlPath.add("0"); + RemlPath.add(""); + + //营销web路径(文件路径) + String pathew=ConfigPath.getYxyServicePath(); + //内容 + String context=yxysendmailmaster.getBody(); + + //获取上传的附件名 + String newUpload=uploadattrName.replaceAll("\"", ""); + String [] newstr=newUpload.split(",");//分割多个附件 + + int isAttr=0;//附件个数 + //1.获取附件 + String fileNames[]=new String[0];//定义附件名 + if(newstr==null||newstr[0].equals("")){//判断是否存在附件 + fileNames=new String[0]; + }else{ + String sysPath=pathew+"/mailtempfile/"+domain+"/"+loginid+"/attachment"; + fileNames=new String[newstr.length]; + for (int i = 0; i < newstr.length; i++) { + fileNames[i]=sysPath+"\\"+newstr[i]; + } + } + isAttr=fileNames.length;//附件个数 + + //变量定义 + String mailName=yxysendmailmaster.getSender();//发件人 + String sendMail=yxysendmailmaster.getSend_email();//发件人邮箱 + String replyEmail=yxysendmailmaster.getReply_email();//回复邮箱 + String title=yxysendmailmaster.getSubject();//主题 + + + //------- 设置from、to等信息---------- + mimeMsg = new javax.mail.internet.MimeMessage(mailSession); + + InternetAddress sentFrom; + //发件人 + sentFrom = new InternetAddress(sendMail ,mailName,"UTF-8"); + mimeMsg.setFrom(sentFrom); + //主题 + mimeMsg.setSubject(title,"UTF-8"); + + // ---设置回复人地址--------------- + InternetAddress addressis; + addressis = new InternetAddress(replyEmail); + InternetAddress[] addrs = new InternetAddress[1]; + addrs[0] = addressis; + mimeMsg.setReplyTo(addrs); + + // ------------------------------------- + MimeBodyPart messageBodyPart1 = new MimeBodyPart(); + messageBodyPart1.setHeader("Content-Transfer-Encoding", "base64"); + + + //--------附件-------------------- + MimeMultipart multipart = new MimeMultipart();// 附件传输格式 + multipart.setSubType("related");//这句很重要 + multipart.addBodyPart(messageBodyPart1); + + for (int j = 0; j < fileNames.length; j++) { + MimeBodyPart messageBodyPart2 = new MimeBodyPart(); + messageBodyPart2.setHeader("Content-Transfer-Encoding", "base64"); + //messageBodyPart2.setContentLanguage("UTF-8"); + // 选择出每一个附件名 + String filename = fileNames[j].split("#####")[0]; + String displayname = fileNames[j].split("#####")[1]; + // 得到数据源 + FileDataSource fds = new FileDataSource(filename); + // 得到附件本身并至入BodyPart + messageBodyPart2.setDataHandler(new DataHandler(fds));// 得到文件名同样至入BodyPart + messageBodyPart2.setHeader("Content-Type", "application/octet-stream;name="+displayname); + messageBodyPart2.setFileName(MimeUtility.encodeText(displayname,"UTF-8","B")); + multipart.addBodyPart(messageBodyPart2); + } + String resultpicpath="";//图片路径 + //11.判断是否有图片 + String[] picpath=context.split("<img"); + for(int i=0;i<picpath.length;i++){ + if(picpath[i].contains("src")){ + int index=picpath[i].indexOf("mailtempfile/"); + if(index==-1){ + continue; + } + //处理字符 + String[] picAarry=picpath[i].split("src=\""); + int end=picAarry[1].indexOf("\""); + String result=picAarry[1].substring(0,end); + + //获取图片路径 + int pathbegin=result.indexOf("mailtempfile"); + String path=result.substring(pathbegin,result.length()); + String picpaths=pathew+"\\"+path;//图片真实路径 + + //获取图片保存名字 + //String[] filenamestr=result.split("/"); + //String picname=filenamestr[filenamestr.length-1]; + resultpicpath+=path+"#####"; + + //替换图片 + context=context.replaceFirst(result,"cid:IMG"+i); + + //加入图片源码 + File pf=new File(picpaths); + if(pf.exists()){ + MimeBodyPart gifBodyPart=new MimeBodyPart(); + FileDataSource fds=new FileDataSource(pf);//图片所在的目录的绝对路径 + gifBodyPart.setDataHandler(new DataHandler(fds)); + gifBodyPart.setHeader("Content-Type", "image/jpeg"); + gifBodyPart.setFileName(MimeUtility.encodeText("espeedpic.jpg","UTF-8","B")); + gifBodyPart.setContentID("<IMG"+i+">"); //cid的值 + multipart.addBodyPart(gifBodyPart); + } + } + } + + messageBodyPart1.setContent(context,"text/html" + ";charset=" + "UTF-8"); + + mimeMsg.setContent(multipart); + + //------------- 设置信件头的发送日期--------------- + mimeMsg.setSentDate(new Date()); + + //文件存放路径 + //以当前用户名+当前日期为文件名 + SimpleDateFormat df=new SimpleDateFormat("yyyyMMddHHssmm"); + String nowDate=df.format(new Date()); + String emlfileName=""; + emlfileName=loginid+nowDate + ".eml"; + //保存邮件 + File dir = new File(usersetpath); + dir.mkdirs();// 创建所有目录,包括子目录 + mimeMsg.writeTo(new FileOutputStream(dir+"\\" + emlfileName)); + File files=new File(dir+"\\" + emlfileName); + //返回值 + RemlPath.set(0,files.length());//文件大小 + RemlPath.set(1,usersetpath + "\\" + emlfileName);//返回eml存放路径 + //RemlPath.set(2,"");//文件key + RemlPath.set(3,isAttr);//是否有附件 + RemlPath.set(4,resultpicpath);//图片路径 + + return RemlPath; + } + +} diff --git b/.svn/pristine/14/14a52f217a6b2507ea5c84e09ce36c9e560b1b91.svn-base a/.svn/pristine/14/14a52f217a6b2507ea5c84e09ce36c9e560b1b91.svn-base new file mode 100644 index 0000000..60de058 --- /dev/null +++ a/.svn/pristine/14/14a52f217a6b2507ea5c84e09ce36c9e560b1b91.svn-base @@ -0,0 +1,142 @@ +package com.espeed.yxy.pojo; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +import javax.persistence.CascadeType; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToMany; +import javax.persistence.Table; + +@Entity +@Table(name="yxy_marketing_plan") +public class YxyMarketingPlan implements Serializable{ + private static final long serialVersionUID = 1L; + private int plan_id; + private String plan_title;//计划说明或主题 + private int plan_type;//计划类型 + private int plan_cycle;//计划周期 + private String plan_createtime;//建立时间 + private String plan_executetime;//执行时间 + private String plan_begintime;//开始时间 + private String plan_endtime;//结束时间 + private int plan_groupid;//计划地址分组 + private String loginid;//账号 + private String domain;//域名 + private int plan_status;//计划状态(0:未执行,1:已执行,-1:正在执行) + /**0:本地库, + * 1:客户分类未超标,2:客户分类已超标 + * 3:客户状态未超标,4:客户状态已超标 + * 5:客户来源未超标,6:客户来源已超标 + * 7:意向产品未超标,8:意向产品已超标 + * 9:采购偏好未超标,10:采购偏好已超标 + * 11:个性营销未超标,12:个性营销已超标 + */ + private Integer plan_differen; + private String other_name;//针对于采购偏好或个性营销邮的名称 + + private List<YxyMarketingWeek> weeklist=new ArrayList<YxyMarketingWeek>(); + @Id + @GeneratedValue(strategy=GenerationType.AUTO) + public int getPlan_id() { + return plan_id; + } + public void setPlan_id(int planId) { + plan_id = planId; + } + public int getPlan_type() { + return plan_type; + } + public void setPlan_type(int planType) { + plan_type = planType; + } + public int getPlan_cycle() { + return plan_cycle; + } + public void setPlan_cycle(int planCycle) { + plan_cycle = planCycle; + } + + public String getPlan_createtime() { + return plan_createtime; + } + public void setPlan_createtime(String planCreatetime) { + plan_createtime = planCreatetime; + } + public String getPlan_executetime() { + return plan_executetime; + } + public void setPlan_executetime(String planExecutetime) { + plan_executetime = planExecutetime; + } + public String getPlan_begintime() { + return plan_begintime; + } + public void setPlan_begintime(String planBegintime) { + plan_begintime = planBegintime; + } + public String getPlan_endtime() { + return plan_endtime; + } + public void setPlan_endtime(String planEndtime) { + plan_endtime = planEndtime; + } + public int getPlan_groupid() { + return plan_groupid; + } + public void setPlan_groupid(int planGroupid) { + plan_groupid = planGroupid; + } + public String getLoginid() { + return loginid; + } + public void setLoginid(String loginid) { + this.loginid = loginid; + } + public String getDomain() { + return domain; + } + public void setDomain(String domain) { + this.domain = domain; + } + public String getPlan_title() { + return plan_title; + } + public void setPlan_title(String planTitle) { + plan_title = planTitle; + } + public int getPlan_status() { + return plan_status; + } + public void setPlan_status(int planStatus) { + plan_status = planStatus; + } + + @OneToMany(cascade = CascadeType.REFRESH, fetch = FetchType.EAGER) + @JoinColumn(name="plan_id",updatable = false,insertable=false) + public List<YxyMarketingWeek> getWeeklist() { + return weeklist; + } + public void setWeeklist(List<YxyMarketingWeek> weeklist) { + this.weeklist = weeklist; + } + + public Integer getPlan_differen() { + return plan_differen; + } + public void setPlan_differen(Integer plan_differen) { + this.plan_differen = plan_differen; + } + public String getOther_name() { + return other_name; + } + public void setOther_name(String other_name) { + this.other_name = other_name; + } +} diff --git b/.svn/pristine/14/14f6e5aedc400d47fda71c2fdc8ac3c1ac37ec0b.svn-base a/.svn/pristine/14/14f6e5aedc400d47fda71c2fdc8ac3c1ac37ec0b.svn-base new file mode 100644 index 0000000..254272e --- /dev/null +++ a/.svn/pristine/14/14f6e5aedc400d47fda71c2fdc8ac3c1ac37ec0b.svn-base @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Class-Path: + diff --git b/.svn/pristine/15/15f214f2ce9b4f753732b9bde4b749abb98ebf5c.svn-base a/.svn/pristine/15/15f214f2ce9b4f753732b9bde4b749abb98ebf5c.svn-base new file mode 100644 index 0000000..a757fc9 --- /dev/null +++ a/.svn/pristine/15/15f214f2ce9b4f753732b9bde4b749abb98ebf5c.svn-base @@ -0,0 +1,40 @@ +package com.espeed.yxy.dao.impl; + +import java.util.List; + +import com.espeed.centre.pojo.CentreYxyedmNewcustomer; +import com.espeed.yxy.dao.CentreYxyedmNewcustomerDao; +/** + * 项目名称: 统一验证中心系统 + * 版权所有: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 技术支持: info@21gmail.com + * 单元名称: 营销邮开发客户配置Dao实现类 + * 开始时间: 2018.04.08 + * 开发人员: 陈南巧 + */ +public class CentreYxyedmNewcustomerDaoImpl extends CentreHibernateBaseDAOImpl<CentreYxyedmNewcustomer, Long> implements CentreYxyedmNewcustomerDao { + /**实体插入*/ + public int addPojo(CentreYxyedmNewcustomer o)throws Exception{ + return super.add(o); + } + /**实体编辑*/ + public void updatePojo(CentreYxyedmNewcustomer o)throws Exception{ + super.update(o); + } + /**HQL查询*/ + public List<CentreYxyedmNewcustomer> findByHql(String hql)throws Exception{ + return super.getAll(hql); + } + /**HQL查询数量*/ + public int findByHqlCount(String hql)throws Exception{ + return super.count(hql); + } + /**SQL查询*/ + public List<Object> findBySqlFind(String sql)throws Exception{ + return super.findBySql(sql); + } + /**HQL更新*/ + public void updateByHql(String hql)throws Exception{ + super.updateorDelBySql(hql); + } +} diff --git b/.svn/pristine/17/17db20e2e1d0340cd61fe4a3933733bd2274ee62.svn-base a/.svn/pristine/17/17db20e2e1d0340cd61fe4a3933733bd2274ee62.svn-base new file mode 100644 index 0000000..47f5ad6 --- /dev/null +++ a/.svn/pristine/17/17db20e2e1d0340cd61fe4a3933733bd2274ee62.svn-base @@ -0,0 +1,95 @@ +package com.espeed.plan; + +import java.io.Serializable; +import java.util.List; +import java.util.concurrent.ArrayBlockingQueue; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; +import com.espeed.yxy.pojo.YxyMarketingPlan; +import com.espeed.yxy.pojo.YxySendSmtpInfo; +import com.espeed.yxy.service.YxyMarketingPlanService; +import com.espeed.yxy.service.YxySendMailService; +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 手动收邮件后台线程池 + * 开始时间: 2013.09.02 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +public class PlanThreadPoolTask implements Runnable,Serializable{ + + private static final long serialVersionUID = 0; + private static ThreadPoolExecutor threadPool=null; + private static PlanThreadPoolTask threadpooltask=null; + + private YxyMarketingPlanService planservice;//计划service + private YxySendMailService mailservice;//邮件service + private YxySendSmtpInfo smtpinfo;//smtp集合 + private YxyMarketingPlan planinfo;//计划集合 + //无参构造方法 + PlanThreadPoolTask(){ + } + //传递参数 + PlanThreadPoolTask(YxyMarketingPlanService planservice,YxySendMailService mailservice,YxySendSmtpInfo smtpinfo,YxyMarketingPlan planinfo){ + this.planservice=planservice; + this.smtpinfo=smtpinfo; + this.smtpinfo=smtpinfo; + this.mailservice=mailservice; + } + + //单例方法 + public static PlanThreadPoolTask getMethodInstance(){ + if(threadpooltask==null){ + //System.out.println("创建新对像了"); + threadpooltask=new PlanThreadPoolTask(); + } + return threadpooltask; + } + + //线程池 + public static ThreadPoolExecutor getInstance(int bigThread){ + if(threadPool==null){ + threadPool=new ThreadPoolExecutor(bigThread,bigThread+2,100, + TimeUnit.SECONDS,new ArrayBlockingQueue<Runnable>(4000), + new ThreadPoolExecutor.DiscardOldestPolicy()); + } + return threadPool; + } + //线程池运行方法 + public synchronized void getResult(YxyMarketingPlanService planservice,YxySendMailService mailservice,List<YxySendSmtpInfo> smtplist,List<YxyMarketingPlan> planlist) { + threadPool=getInstance(10); + //计划加入线程池 + for(int j=0;j<planlist.size();j++){ + try { + threadPool.execute(new PlanThreadPoolTask(planservice,mailservice,smtplist.get(j),planlist.get(j))); + } catch (Exception e) { + e.printStackTrace(); + } + } + } + //获取线程量 + public int getThreadNum(){ + if(threadPool==null){ + return -1; + }else{ + return threadPool.getActiveCount(); + } + } + + //执行计划 + public void run(){ + try { + + + + } catch (Exception e) { + e.printStackTrace(); + } + } + +} diff --git b/.svn/pristine/19/19a0895351d2877325532e7ea619b50b60bf44fd.svn-base a/.svn/pristine/19/19a0895351d2877325532e7ea619b50b60bf44fd.svn-base new file mode 100644 index 0000000..73df7b1 Binary files /dev/null and a/.svn/pristine/19/19a0895351d2877325532e7ea619b50b60bf44fd.svn-base differ diff --git b/.svn/pristine/1d/1d5f20b4ea675e6fab6ab79f1cd60ec268ddc015.svn-base a/.svn/pristine/1d/1d5f20b4ea675e6fab6ab79f1cd60ec268ddc015.svn-base new file mode 100644 index 0000000..f50f03f Binary files /dev/null and a/.svn/pristine/1d/1d5f20b4ea675e6fab6ab79f1cd60ec268ddc015.svn-base differ diff --git b/.svn/pristine/22/22259bec6a476a15f2f95921b91600a8897645ae.svn-base a/.svn/pristine/22/22259bec6a476a15f2f95921b91600a8897645ae.svn-base new file mode 100644 index 0000000..cd897bd --- /dev/null +++ a/.svn/pristine/22/22259bec6a476a15f2f95921b91600a8897645ae.svn-base @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project-module + type="WEB" + name="espeedSendYingXiaoYouBase" + id="myeclipse.1432285515350" + context-root="/espeedSendYingXiaoYouBase" + j2ee-spec="5.0" + archive="espeedSendYingXiaoYouBase.war"> + <attributes> + <attribute name="webrootdir" value="WebRoot" /> + </attributes> +</project-module> + diff --git b/.svn/pristine/23/2317f852f326c254df22a4a483ad354d554516f6.svn-base a/.svn/pristine/23/2317f852f326c254df22a4a483ad354d554516f6.svn-base new file mode 100644 index 0000000..87e79f7 --- /dev/null +++ a/.svn/pristine/23/2317f852f326c254df22a4a483ad354d554516f6.svn-base @@ -0,0 +1,459 @@ +package com.espeed.yxy.service.impl; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + + +import com.espeed.centre.pojo.CentreYxyedmOldcustomer; +import com.espeed.webmail.pojo.YxyCustomerEmail; +import com.espeed.yxy.dao.CentreUserDao; +import com.espeed.yxy.dao.CentreYxyedmOldcustomerDao; +import com.espeed.yxy.dao.CrmCustomerInfoDao; +import com.espeed.yxy.dao.YxyCustomerEmailDao; +import com.espeed.yxy.dao.YxyMailStencilDao; +import com.espeed.yxy.dao.YxyMarketingPlanDao; +import com.espeed.yxy.dao.YxyMarketingWeekDao; +import com.espeed.yxy.dao.YxyParamaterDao; +import com.espeed.yxy.dao.YxySendCountDao; +import com.espeed.yxy.dao.YxySenderSetDao; +import com.espeed.yxy.dao.YxySysParamatersValueDao; +import com.espeed.yxy.dao.YxyUserAddressDao; +import com.espeed.yxy.pojo.YxyMailStencil; +import com.espeed.yxy.pojo.YxyMarketingPlan; +import com.espeed.yxy.pojo.YxySendCount; +import com.espeed.yxy.pojo.YxySenderSet; +import com.espeed.yxy.pojo.YxySysParamaters; +import com.espeed.yxy.pojo.YxySysParamatersValue; +import com.espeed.yxy.pojo.YxyUserAddress; +import com.espeed.yxy.service.YxyMarketingPlanService; +import com.espeed.yxy.tool.DateFormat; + +public class YxyMarketingPlanServiceImpl implements YxyMarketingPlanService{ + + /**是否有可执行的营销计划*/ + public List<YxyMarketingPlan> findHavePlan() throws Exception { + SimpleDateFormat df=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String nowdate=df.format(new Date()); + String nowday=nowdate.split(" ")[0]; + String nowtime=nowdate.split(" ")[1]; + + //hql查询 + String hql="from YxyMarketingPlan where (plan_status=0 or plan_status=-1) and plan_type=1 and plan_executetime<='"+nowtime+"' and plan_begintime<='"+nowday+"' and plan_endtime>='"+nowday+"'"; + return marketingplandao.findByHql(hql); + } + + /**根据地址分组查询地址*/ + public List<YxyUserAddress> findAddressByGroupid(int typeid,int plan_differen,String loginid,String domain,String other_name) throws Exception { + //判断是否是本地库发送还是CRM库 + if(plan_differen == 0)//本地库发送 + { + String hql="from YxyUserAddress where user_addr_type_id="+typeid; + return addressdao.findByHql(hql); + } + else//客户管理发送 + { + int company_id = 0; + int user_id = 0; + List<YxyCustomerEmail> customerEmails = new ArrayList<YxyCustomerEmail>(); + if(plan_differen == 1 || plan_differen == 2){//客户分类 + String sql = "select company_id from centre_company where domain = '"+domain+"'"; + List<Object> objects = centreuserdao.findBySqlFind(sql); + if(objects.size() > 0 && objects.get(0) != null){ + company_id = Integer.parseInt(objects.get(0).toString()); + sql = "select user_id from centre_user where company_id = "+company_id+" and login_id = '"+loginid+"'"; + objects = centreuserdao.findBySqlFind(sql); + if(objects.size() > 0 && objects.get(0) != null){ + user_id = Integer.parseInt(objects.get(0).toString()); + String hql = "from YxyCustomerEmail where user_id = "+user_id+" and current_status != 1 " + + "and delete_flag = 0 and classify_id = "+typeid; + customerEmails = yxycustomeremaildao.findByHql(hql); + } + } + }else if(plan_differen == 3 || plan_differen == 4){//客户状态 + String sql = "select company_id from centre_company where domain = '"+domain+"'"; + List<Object> objects = centreuserdao.findBySqlFind(sql); + if(objects.size() > 0 && objects.get(0) != null){ + company_id = Integer.parseInt(objects.get(0).toString()); + sql = "select user_id from centre_user where company_id = "+company_id+" and login_id = '"+loginid+"'"; + objects = centreuserdao.findBySqlFind(sql); + if(objects.size() > 0 && objects.get(0) != null){ + user_id = Integer.parseInt(objects.get(0).toString()); + String hql = "from YxyCustomerEmail where user_id = "+user_id+" and current_status != 1 " + + "and delete_flag = 0 and customer_status = "+typeid; + customerEmails = yxycustomeremaildao.findByHql(hql); + } + } + }else if(plan_differen == 5 || plan_differen == 6){//客户来源 + String sql = "select company_id from centre_company where domain = '"+domain+"'"; + List<Object> objects = centreuserdao.findBySqlFind(sql); + if(objects.size() > 0 && objects.get(0) != null){ + company_id = Integer.parseInt(objects.get(0).toString()); + sql = "select user_id from centre_user where company_id = "+company_id+" and login_id = '"+loginid+"'"; + objects = centreuserdao.findBySqlFind(sql); + if(objects.size() > 0 && objects.get(0) != null){ + user_id = Integer.parseInt(objects.get(0).toString()); + String hql = "from YxyCustomerEmail where user_id = "+user_id+" and current_status != 1 " + + "and delete_flag = 0 and source_from_id = "+typeid; + customerEmails = yxycustomeremaildao.findByHql(hql); + } + } + }else if(plan_differen == 7 || plan_differen == 8){//意向产品 + String sql = "select company_id from centre_company where domain = '"+domain+"'"; + List<Object> objects = centreuserdao.findBySqlFind(sql); + if(objects.size() > 0 && objects.get(0) != null){ + company_id = Integer.parseInt(objects.get(0).toString()); + sql = "select user_id from centre_user where company_id = "+company_id+" and login_id = '"+loginid+"'"; + objects = centreuserdao.findBySqlFind(sql); + if(objects.size() > 0 && objects.get(0) != null){ + user_id = Integer.parseInt(objects.get(0).toString()); + String hql = "from YxyCustomerEmail where user_id = "+user_id+" and current_status != 1 " + + "and delete_flag = 0 and find_in_set("+typeid+",prductid) > 0"; + customerEmails = yxycustomeremaildao.findByHql(hql); + } + } + }else if(plan_differen == 9 || plan_differen == 10){//采购偏好 + if(other_name != null && !"".equals(other_name)){ + String sql = "select company_id from centre_company where domain = '"+domain+"'"; + List<Object> objects = centreuserdao.findBySqlFind(sql); + if(objects.size() > 0 && objects.get(0) != null){ + company_id = Integer.parseInt(objects.get(0).toString()); + sql = "select user_id from centre_user where company_id = "+company_id+" and login_id = '"+loginid+"'"; + objects = centreuserdao.findBySqlFind(sql); + if(objects.size() > 0 && objects.get(0) != null){ + user_id = Integer.parseInt(objects.get(0).toString()); + String customerids = ""; + sql = "select customer_id from crm_customer_info where most_sourcing_industries like '%" + other_name + "%' and user_id = " + user_id; + objects = crmcustomerinfodao.findBySqlFind(sql); + for (int i = 0;i < objects.size();i++) { + customerids += objects.get(i).toString() + ","; + } + if(!customerids.equals("")){ + customerids = customerids.substring(0,customerids.length()-1); + String hql = "from YxyCustomerEmail where delete_flag = 0 and current_status != 1 " + + "and user_id = "+user_id+" and customer_id in("+customerids+")"; + customerEmails = yxycustomeremaildao.findByHql(hql); + } + } + } + } + }else if(plan_differen == 11 || plan_differen == 12){//个性营销 + if(other_name != null && !"".equals(other_name)){ + String sql = "select company_id from centre_company where domain = '"+domain+"'"; + List<Object> objects = centreuserdao.findBySqlFind(sql); + if(objects.size() > 0 && objects.get(0) != null){ + company_id = Integer.parseInt(objects.get(0).toString()); + sql = "select user_id from centre_user where company_id = "+company_id+" and login_id = '"+loginid+"'"; + objects = centreuserdao.findBySqlFind(sql); + if(objects.size() > 0 && objects.get(0) != null){ + user_id = Integer.parseInt(objects.get(0).toString()); + String[] conditionArr = other_name.split("@espeed@"); + if(conditionArr.length == 10){ + String classfiyStr = conditionArr[0];//客户分类信息 + String statusStr = conditionArr[1];//客户状态信息 + String fromStr = conditionArr[2];//客户来源信息 + String starStr = conditionArr[3];//客户星级信息 + String productStr = conditionArr[4];//意向产品信息 + String caigouStr = conditionArr[5];//采购偏好信息 + String entrolStr = conditionArr[6];//入库时间信息 + String contactStr = conditionArr[7];//联系时间信息 + String followStr = conditionArr[8];//未跟进时间信息 + String typeStr = conditionArr[9];//客户类型信息,0私海,1公海 + String hql = "from YxyCustomerEmail where user_id = "+user_id+" and delete_flag = 0 and current_status != 1 and"; + if(typeStr.equals("1")){//公海客户 + hql = "from YxyCustomerEmail where company_id = "+company_id+" and delete_flag = 0 and current_status = 1 and"; + } + if(!classfiyStr.equals("no")){ + hql += " classify_id in("+classfiyStr+") and"; + } + if(!statusStr.equals("no")){ + hql += " customer_status in("+statusStr+") and"; + } + if(!fromStr.equals("no")){ + hql += " source_from_id in("+fromStr+") and"; + } + if(!starStr.equals("no")){ + hql += " important_star in("+starStr+") and"; + } + if(!productStr.equals("no")){ + String[] productArr = productStr.split("@G@"); + String subHql = " ("; + for(String s : productArr){ + subHql += "find_in_set("+s+",prductid) > 0 or "; + } + subHql = subHql.substring(0,subHql.lastIndexOf("or ")-1); + hql += subHql + ") and"; + } + if(!caigouStr.equals("no")){ + String[] caigouArr = caigouStr.split("@G@"); + int jingzhun = Integer.parseInt(caigouArr[0]);//0:不精准,1:精准 + String customerids = ""; + for(int k = 1;k < caigouArr.length; k++){ + sql = ""; + if(jingzhun == 1){ + sql = "select customer_id from crm_customer_info where find_in_set('"+caigouArr[k]+"',most_sourcing_industries) > 0 and user_id = " + user_id; + }else{ + sql = "select customer_id from crm_customer_info where most_sourcing_industries like '%" + caigouArr[k] + "%' and user_id = " + user_id; + } + objects = crmcustomerinfodao.findBySqlFind(sql); + for (int i = 0;i < objects.size();i++) { + customerids += objects.get(i).toString() + ","; + } + } + if(!customerids.equals("")){ + customerids = customerids.substring(0,customerids.length()-1); + hql += " customer_id in("+customerids+") and"; + } + } + if(!entrolStr.equals("no")){ + String[] entrolArr = entrolStr.split("@G@"); + if(entrolArr.length == 1){ + hql += " enrol_time >= '"+entrolArr[0]+" 00:00:00' and"; + }else if(entrolArr.length == 2){ + hql += " enrol_time >= '"+entrolArr[0]+" 00:00:00' and enrol_time <= '"+entrolArr[1]+" 23:59:59' and"; + } + } + if(!contactStr.equals("no")){ + String[] contactArr = contactStr.split("@G@"); + if(contactArr.length == 1){ + hql += " last_contact_date >= '"+contactArr[0]+" 00:00:00' and"; + }else if(contactArr.length == 2){ + hql += " last_contact_date >= '"+contactArr[0]+" 00:00:00' and last_contact_date <= '"+contactArr[1]+" 23:59:59' and"; + } + } + if(!followStr.equals("no")){ + String[] followArr = followStr.split("@G@"); + int day = Integer.parseInt(followArr[0]); + if(day != -1){ + String start_time = DateFormat.lastDays(-day); + hql += " last_contact_date < '"+start_time+" 00:00:00' and"; + }else if(followArr.length == 2){ + String[] timeArr = followArr[1].split(","); + if(timeArr.length == 1){ + hql += " last_contact_date >= '"+timeArr[0]+" 00:00:00' and"; + }else if(timeArr.length == 2){ + hql += " last_contact_date >= '"+timeArr[0]+" 00:00:00' and last_contact_date <= '"+timeArr[1]+" 23:59:59' and"; + } + } + } + if(!hql.equals("from YxyCustomerEmail where user_id = "+user_id+" and delete_flag = 0 and current_status != 1 and") + && !hql.equals("from YxyCustomerEmail where company_id = "+company_id+" and delete_flag = 0 and current_status = 1 and")){//说明以上的条件都不适合 + hql = hql.substring(0,hql.length()-3); + customerEmails = yxycustomeremaildao.findByHql(hql); + } + } + } + } + } + } + SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd"); + SimpleDateFormat df2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String nowtime = df2.format(new Date()); + String nowdate = df.format(new Date()); + List<YxyUserAddress> address_list = new ArrayList<YxyUserAddress>(); + for(YxyCustomerEmail customer : customerEmails){ + //只查询主联系人的信息 + String sql = "select full_name,email from crm_linkman where is_main_linkman = 1 and customer_id = "+customer.getCustomer_id(); + List<Object> objects = yxycustomeremaildao.findBySqlQuery(sql); + if(objects.size() > 0){ + Object[] obj_arr = (Object[])objects.get(0); + YxyUserAddress address = new YxyUserAddress(); + address.setUser_addr_id(customer.getCustomer_id());//客户id赋值给主键id + address.setCompany_variable(customer.getCustomer_name());//客户名称 + address.setUser_addr_email(obj_arr[1].toString());//地址 + address.setUser_addr_name(obj_arr[0].toString());//联系人 + address_list.add(address);//添加到集合 + try{ + String hql = "from YxySendCount where user_id = "+user_id+" and customer_id = "+customer.getCustomer_id()+" and send_date = '"+nowdate+"'"; + List<YxySendCount> counts = yxysendcountdao.findByHql(hql); + if(counts.size() > 0){ + YxySendCount count = counts.get(0); + count.setSend_counts(count.getSend_counts()+1); + count.setSend_time(nowtime); + yxysendcountdao.updatePojo(count); + }else{ + YxySendCount count = new YxySendCount(); + count.setUser_id(user_id); + count.setCompany_id(company_id); + count.setSend_counts(1); + count.setSend_date(nowdate); + count.setSend_time(nowtime); + count.setCustomer_id(customer.getCustomer_id()); + yxysendcountdao.addPojo(count); + } + }catch (Exception e) { + // TODO: handle exception + } + } + } + return address_list; + } + } + + /**查询模版*/ + public YxyMailStencil findStencilInfo(int stencilid) throws Exception { + String hql="from YxyMailStencil where stencil_id="+stencilid; + List<YxyMailStencil> stencillist=stencildao.findByHql(hql); + if(stencillist.size()>0){ + return stencillist.get(0); + }else{ + return null; + } + } + + /**查询发件人*/ + public YxySenderSet findSender(String loginid,String domain)throws Exception{ + String hql="from YxySenderSet where user_login='"+loginid+"' and user_domain='"+domain+"' and isdefault=1"; + List<YxySenderSet> senderlist=senderdao.findByHql(hql); + if(senderlist.size()>0){ + return senderlist.get(0); + }else{ + return null; + } + } + + /**修改计划周期状态*/ + public void updateWeekStatus(int weekid,int status)throws Exception{ + String hql="update YxyMarketingWeek set isexecution="+status+" where week_id="+weekid; + marketingweekdao.updateByHql(hql); + } + + /**修改计划状态*/ + public void updatePlanStatus(int planid,int status)throws Exception{ + String hql="update YxyMarketingPlan set plan_status="+status+" where plan_id="+planid; + marketingplandao.updateByHql(hql); + } + + /**code查询控制参数(有用户级返回用户级,否则返回默认参数)*/ + public String findCompanyParamByCode(String code,String loginid,String domain)throws Exception{ + //查询此code的paramid + String hql="from YxySysParamaters where para_code='"+code+"'"; + List<YxySysParamaters> paraslist=yxysysparamaterdao.findByHql(hql); + if(paraslist.size()>0){ + int paramid=paraslist.get(0).getPara_id(); + int level=paraslist.get(0).getOwner_type();//所属等级 + String defaultvalue=paraslist.get(0).getDefault_value();//默认值 + if(level==4){//用户级 + //查询参数值 + String hql1="from YxySysParamatersValue where para_id="+paramid+" and owner_loginid='"+loginid+"' and company_domain='"+domain+"'"; + List<YxySysParamatersValue> paraValue=yxysysparamatersvaluedao.findByHql(hql1); + if(paraValue.size()>0){ + return paraValue.get(0).getPara_value(); + }else{ + return defaultvalue; + } + }else{//系统级 + //查询参数值 + String hql1="from YxySysParamatersValue where para_id="+paramid+" and company_domain='"+domain+"'"; + List<YxySysParamatersValue> paraValue=yxysysparamatersvaluedao.findByHql(hql1); + if(paraValue.size()>0){ + return paraValue.get(0).getPara_value(); + }else{ + return defaultvalue; + } + } + + }else{ + return "-1"; + } + } + + /**获取EDM配置-盘活客户配置信息*/ + public CentreYxyedmOldcustomer getOldCusSet(String domain)throws Exception{ + String hql= "from CentreYxyedmOldcustomer where company_domain = '"+domain+"'"; + List<CentreYxyedmOldcustomer> list = centreyxyedmoldcustomerdao.findByHql(hql); + if(list.size()>0){ + return list.get(0); + }else{ + return null; + } + } + + private YxyMarketingPlanDao marketingplandao;//营销计划dao + private YxyMarketingWeekDao marketingweekdao;//营销计划周期dao + private YxyUserAddressDao addressdao;//用户地址dao + private YxyMailStencilDao stencildao;//模版dao + private YxySenderSetDao senderdao;//发件人dao + private YxyParamaterDao yxysysparamaterdao;//控制参数dao + private YxySysParamatersValueDao yxysysparamatersvaluedao;//控制参数值dao + private YxyCustomerEmailDao yxycustomeremaildao;//客户邮件dao + private CentreYxyedmOldcustomerDao centreyxyedmoldcustomerdao;//盘活客户配置dao + private CentreUserDao centreuserdao;//用户dao + private CrmCustomerInfoDao crmcustomerinfodao;//阿里巴巴客户dao + private YxySendCountDao yxysendcountdao;//客户发送邮件的统计dao + public YxyCustomerEmailDao getYxycustomeremaildao() { + return yxycustomeremaildao; + } + public void setYxycustomeremaildao(YxyCustomerEmailDao yxycustomeremaildao) { + this.yxycustomeremaildao = yxycustomeremaildao; + } + public YxyUserAddressDao getAddressdao() { + return addressdao; + } + public void setAddressdao(YxyUserAddressDao addressdao) { + this.addressdao = addressdao; + } + public YxyMarketingPlanDao getMarketingplandao() { + return marketingplandao; + } + public void setMarketingplandao(YxyMarketingPlanDao marketingplandao) { + this.marketingplandao = marketingplandao; + } + public YxyMarketingWeekDao getMarketingweekdao() { + return marketingweekdao; + } + public void setMarketingweekdao(YxyMarketingWeekDao marketingweekdao) { + this.marketingweekdao = marketingweekdao; + } + public YxyMailStencilDao getStencildao() { + return stencildao; + } + public void setStencildao(YxyMailStencilDao stencildao) { + this.stencildao = stencildao; + } + public YxySenderSetDao getSenderdao() { + return senderdao; + } + public void setSenderdao(YxySenderSetDao senderdao) { + this.senderdao = senderdao; + } + public YxyParamaterDao getYxysysparamaterdao() { + return yxysysparamaterdao; + } + public void setYxysysparamaterdao(YxyParamaterDao yxysysparamaterdao) { + this.yxysysparamaterdao = yxysysparamaterdao; + } + public YxySysParamatersValueDao getYxysysparamatersvaluedao() { + return yxysysparamatersvaluedao; + } + public void setYxysysparamatersvaluedao( + YxySysParamatersValueDao yxysysparamatersvaluedao) { + this.yxysysparamatersvaluedao = yxysysparamatersvaluedao; + } + public CentreYxyedmOldcustomerDao getCentreyxyedmoldcustomerdao() { + return centreyxyedmoldcustomerdao; + } + public void setCentreyxyedmoldcustomerdao( + CentreYxyedmOldcustomerDao centreyxyedmoldcustomerdao) { + this.centreyxyedmoldcustomerdao = centreyxyedmoldcustomerdao; + } + public CentreUserDao getCentreuserdao() { + return centreuserdao; + } + public void setCentreuserdao(CentreUserDao centreuserdao) { + this.centreuserdao = centreuserdao; + } + public CrmCustomerInfoDao getCrmcustomerinfodao() { + return crmcustomerinfodao; + } + public void setCrmcustomerinfodao(CrmCustomerInfoDao crmcustomerinfodao) { + this.crmcustomerinfodao = crmcustomerinfodao; + } + public YxySendCountDao getYxysendcountdao() { + return yxysendcountdao; + } + public void setYxysendcountdao(YxySendCountDao yxysendcountdao) { + this.yxysendcountdao = yxysendcountdao; + } +} diff --git b/.svn/pristine/25/2509c4c60151438d0d8ddaf5a943afcd1118bac8.svn-base a/.svn/pristine/25/2509c4c60151438d0d8ddaf5a943afcd1118bac8.svn-base new file mode 100644 index 0000000..4b5ddec --- /dev/null +++ a/.svn/pristine/25/2509c4c60151438d0d8ddaf5a943afcd1118bac8.svn-base @@ -0,0 +1,61 @@ +package com.espeed.yxy.dao.impl; + +import java.util.List; + +import com.espeed.webmail.pojo.CrmCustomerInfo; +import com.espeed.yxy.dao.CrmCustomerInfoDao; + + +/** +* +* @项目名称: 科飞管理后台系统 +* @版权所有: 深圳市科飞时速网络技术有限公司(0755-88843776) +* @技术支持: info@21gmail.com +* @单元名称: 实体类CrmCustomerInfo的DAO接口 +* @开始时间: 2018-09-27 +* @开发人员: 杨志钊 +*/ + +public class CrmCustomerInfoDaoImpl extends WebmailHibernateBaseDAOImpl<CrmCustomerInfo, Long> implements CrmCustomerInfoDao { + + /**实体插入*/ + public int addPojo(CrmCustomerInfo entity) throws Exception { + return super.add(entity); + } + + /**实体编辑*/ + public void updatePojo(CrmCustomerInfo entity) throws Exception { + super.update(entity); + } + + /**HQL查询*/ + public List<CrmCustomerInfo> findByHql(String hql) throws Exception { + return super.getAll(hql); + } + + /**HQL指定条查询*/ + public List<CrmCustomerInfo> findByHqlSet(String hql,int num) throws Exception { + return super.findBySet(hql, num); + } + + /**SQL查询*/ + public List<Object> findBySqlFind(String sql) throws Exception { + return super.findBySql(sql); + } + + /**HQL更新*/ + public void updateByHql(String hql) throws Exception { + super.updateorDelBySql(hql); + } + + /**sql更新*/ + public void updateBySql(String sql) throws Exception { + super.updateorDelSql(sql); + } + + /**HQL查询数量*/ + public int findByHqlCount(String hql) throws Exception { + return super.count(hql); + } + +} diff --git b/.svn/pristine/26/26afa12057979d21b7bca53eac3628b083dad225.svn-base a/.svn/pristine/26/26afa12057979d21b7bca53eac3628b083dad225.svn-base new file mode 100644 index 0000000..839a3fb --- /dev/null +++ a/.svn/pristine/26/26afa12057979d21b7bca53eac3628b083dad225.svn-base @@ -0,0 +1,587 @@ +package com.espeed.yxy.mail; + +import java.io.PrintWriter; +import java.io.StringWriter; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Properties; +import javax.mail.Transport; +import com.espeed.yxy.pojo.YxySendMailDetail; +import com.espeed.yxy.pojo.YxySendMailMaster; +import com.espeed.yxy.pojo.YxySendSmtpInfo; +import com.espeed.yxy.pojo.YxySmtpSendSelfOverset; +import com.espeed.yxy.pojo.YxySmtpSendSelfSet; +import com.espeed.yxy.pojo.YxySmtpSendSet; +import com.espeed.yxy.pojo.YxySmtpSuffixSet; +import com.espeed.yxy.service.YxySendMailService; +import com.espeed.yxy.timer.SendMailTimer; +import com.espeed.yxy.tool.DES_Encrypt; +import com.espeed.yxy.tool.DateFormat; +import com.espeed.yxy.tool.LogsTool; +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 发送邮件之前的判断(营销游) + * 开始时间: 2013.12.09 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +public class YxysendMethod { + //private static Properties props =null; + //private static Transport transport =null; + /**参数说明(1:service层接口,2:smtp服务器,3:邮件信息,4:smtp后缀信息,5:smtp后缀发送量信息)*/ + public static void sendMethodImpl(YxySendMailService YxySendMailService,YxySendSmtpInfo SmtpInfo,YxySendMailMaster mailinfo){ + //public static void sendMethodImpl(YxySendMailService YxySendMailService,YxySendSmtpInfo SmtpInfo,YxySendMailMaster mailinfo,List<YxySmtpSuffixSet> smtpsuffixsetList){ + try{ + //获取当前时间 + SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String nowDate=sdf1.format(new Date()); + //邮件ID + int mailid=mailinfo.getSend_mail_id(); + //SMTPID + int smtpid=SmtpInfo.getSmtp_service_id(); + //int isyxy=SmtpInfo.getSmtp_service_isyxy();//是自配还是运营 + //判断是自配smtp还是运营smtp +// if(isyxy==0){//自配 +// //更新smtp状态 +// YxySendMailService.updateSmtpUseStatus(1,smtpid,""); +// +// //更新待发邮件为已使用中 +// YxySendMailService.updateMailUseStatus(mailid,1,nowDate); +// +// //自配smtp发送方法 +// selfSmtpMethod(YxySendMailService,SmtpInfo,mailinfo); +// +// //发送完后将smtp状态改回可用,且使用时间修改为当前时间 +// YxySendMailService.updateSmtpUseStatus(0,smtpid,nowDate); +// +// //发送完后将待发邮件状态改回未使用 +// YxySendMailService.updateMailUseStatus(mailid,0,nowDate); +// }else{//运营 + try { + synchronized (SendMailTimer.nowtimer) { + //更新smtp状态 + YxySendMailService.updateSmtpUseStatus(1,smtpid,""); + //更新待发邮件为已使用中 + YxySendMailService.updateMailUseStatus(mailid,1,nowDate); + } + //调用方法 + yxySmtpMethod(YxySendMailService,SmtpInfo,mailinfo); + //yxySmtpMethod(YxySendMailService,SmtpInfo,mailinfo,smtpsuffixsetList); + synchronized (SendMailTimer.nowtimer) { + //发送完后将smtp状态改回可用,且使用时间修改为当前时间 + YxySendMailService.updateSmtpUseStatus(0,smtpid,nowDate); + //发送完后将待发邮件状态改回未使用 + YxySendMailService.updateMailUseStatus(mailid,0,nowDate); + } + } catch (Exception e) { + e.printStackTrace(); + //写入日志 + StringWriter sw = new StringWriter(); + e.printStackTrace(new PrintWriter(sw, true)); + String str = sw.toString(); + LogsTool.erroLogs(str); + //更新此邮件异常量 + YxySendMailService.updateMailExpStatus(mailid,mailinfo.getExptionnum()+1); + } + //} + }catch (Exception e) { + e.printStackTrace(); + System.out.println("sendMethodImpl方法加载异常!"); + //写入日志 + StringWriter sw = new StringWriter(); + e.printStackTrace(new PrintWriter(sw, true)); + String str = sw.toString(); + LogsTool.erroLogs(str); + } + } + + + /**自配运行方法*/ + public static void selfSmtpMethod(YxySendMailService YxySendMailService,YxySendSmtpInfo SmtpInfo,YxySendMailMaster mailinfo){ + try { + //邮件ID + int mailid=mailinfo.getSend_mail_id(); + //邮件UID + String mailuid=mailinfo.getMail_uid(); + //验证SMTP + List<Object> isTong=connectionService(SmtpInfo.getSmtp_service_number(),SmtpInfo.getSmtp_service_account(),SmtpInfo.getSmtp_service_password(),SmtpInfo.getSmtp_is_ssl(),SmtpInfo.getSmtp_service_port()); + + //判断是否验证通过 + if(isTong.get(0).toString().equals("1")){ + Properties props =(Properties) isTong.get(1); + Transport transport =(Transport) isTong.get(2); + //通过获取的待发邮件ID来获取该封邮件的待发地址 + int MastermailId=mailinfo.getSend_mail_id();//该封邮件主ID + List<YxySendMailDetail> addressList=YxySendMailService.findAddressByMailID(MastermailId);//待发邮件对应的地址 + + if(addressList.size()<=0){ + System.out.println("没有待发地址了..结束后续工作"); + //将该邮件状态改为已发送 + YxySendMailService.updateMailStatus(1,mailid,mailuid); + }else{ + //-------定义变量------------------ + //获取当前时间 + SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String currDate=sdf1.format(new Date()); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + String nowDay=sdf.format(new Date()); + + String smtpaccount=SmtpInfo.getSmtp_service_account();//smtp账号 + String smtphost=SmtpInfo.getSmtp_service_number();//SMTP服务器 + int selftenNum=0;//十分钟最大发信量 + int selfhourNum=0;//60分钟最大发信量 + int selfdayNum=0;//一天最大发信量 + + int selftenNumOver=0;//十分钟已发信量 + int selfhourNumOver=0;//60分钟已发信量 + int selfdayNumOver=0;//一天已发信量 + + boolean tenisok=false;//10分钟是否通过 + boolean hourisok=false;//60分钟是否通过 + boolean dayisok=false;//一天是否通过 + + int selftenNumSurplus=0;//十分钟剩余发信量 + int selfhourNumSurplus=0;//60分钟剩余发信量 + int selfdayNumSurplus=0;//一天剩余发信量 + //1.获取自配smtp发送量限制 + List<YxySmtpSendSelfSet> smtpselfsendsetList=YxySendMailService.findSendSelfSetByService(smtphost); + + if(smtpselfsendsetList.size()>=2){//说明有控制量限制(包含默认的和自己配的) + if(!smtpselfsendsetList.get(0).getSmtp_send_self_set_account().equals("domain")){//自配量 + selftenNum=smtpselfsendsetList.get(0).getSmtp_send_self_set_tennum();//十分钟最大发信量 + selfhourNum=smtpselfsendsetList.get(0).getSmtp_send_self_set_hournum();//60分钟最大发信量 + selfdayNum=smtpselfsendsetList.get(0).getSmtp_send_self_set_daynum();//一小时最大发信量 + }else{//domain默认设置信息 + selftenNum=smtpselfsendsetList.get(1).getSmtp_send_self_set_tennum();//十分钟最大发信量 + selfhourNum=smtpselfsendsetList.get(1).getSmtp_send_self_set_hournum();//60分钟最大发信量 + selfdayNum=smtpselfsendsetList.get(1).getSmtp_send_self_set_daynum();//一小时最大发信量 + } + }else{//默认的 + selftenNum=smtpselfsendsetList.get(0).getSmtp_send_self_set_tennum();//十分钟最大发信量 + selfhourNum=smtpselfsendsetList.get(0).getSmtp_send_self_set_hournum();//60分钟最大发信量 + selfdayNum=smtpselfsendsetList.get(0).getSmtp_send_self_set_daynum();//一小时最大发信量 + } + //2.获取自配smtp已发送量 + List<YxySmtpSendSelfOverset> smtpsendsetoverList=YxySendMailService.findBySmtpAccount(smtpaccount); + if(smtpsendsetoverList.size()>0){//说明已存在发送量记录 + //判断是不是当天的记录 + String nowsend=smtpsendsetoverList.get(0).getSmtp_send_self_over_daydate(); + if(nowDay.equals(nowsend)){//说明是当天的记录 + //已发量 + selftenNumOver=smtpsendsetoverList.get(0).getSmtp_send_self_over_tennum(); + selfhourNumOver=smtpsendsetoverList.get(0).getSmtp_send_self_over_hournum(); + selfdayNumOver=smtpsendsetoverList.get(0).getSmtp_send_self_over_daynum(); + + //判断是否在某段时间内发送量是否满足 + //1.10分钟内判断*/ + if(DateFormat.minute1s(smtpsendsetoverList.get(0).getSmtp_send_self_over_tendate(),currDate)<10){//在此时间段内 + if(selftenNumOver>=selftenNum){//已发量大于限定量则不能发 + tenisok=false; + }else{ + tenisok=true; + } + }else{//不在此时间段内 + selftenNumOver=0; + tenisok=true; + //更新此smtp十分钟为0 + smtpsendsetoverList.get(0).setSmtp_send_self_over_tennum(0); + } + + //60分钟内判断 + if(DateFormat.minute1s(smtpsendsetoverList.get(0).getSmtp_send_self_over_hourdate(),currDate)<60){//在此时间段内 + if(selfhourNumOver>=selfhourNum){//已发量大于限定量则不能发 + hourisok=false; + }else{ + hourisok=true; + } + }else{//不在此时间段内 + selfhourNumOver=0; + hourisok=true; + //更新此smtp60分钟为0 + smtpsendsetoverList.get(0).setSmtp_send_self_over_hournum(0); + } + + //一天内判断 + if(smtpsendsetoverList.get(0).getSmtp_send_self_over_daydate().equals(nowDay)){//是否在当天 + if(selfdayNumOver>=selfdayNum){//已发量大于限定量则不能发 + dayisok=false; + }else{ + dayisok=true; + } + }else{//不在此时间段内 + selfdayNumOver=0; + dayisok=true; + //更新此smtp一天数为0 + smtpsendsetoverList.get(0).setSmtp_send_self_over_daynum(0); + } + //YxySendMailService.updateSendSelfSet(smtpsendsetoverList.get(0)); + } + }else{//不存在发送记录则添加一条 + YxySmtpSendSelfOverset o=new YxySmtpSendSelfOverset(); + o.setSmtp_send_self_over_account(smtpaccount);//smtp账号 + o.setSmtp_send_self_over_tendate(currDate); + o.setSmtp_send_self_over_hourdate(currDate); + o.setSmtp_send_self_over_daydate(nowDay); + //添加自配设置信息 + YxySendMailService.addSendSelfSet(o); + tenisok=true; + hourisok=true; + dayisok=true; + } + if(tenisok&&hourisok&&dayisok){//如果发送量都已通过检测则调用发送程序 + //获取剩余量 + selftenNumSurplus=selftenNum-selftenNumOver;//十分钟剩余发信量 + selfhourNumSurplus=selfhourNum-selfhourNumOver;//60分钟剩余发信量 + selfdayNumSurplus=selfdayNum-selfdayNumOver;//一天剩余发信量 + int minNum=0;//最小值 + //三个时间内取最小值(此账号最多能发的量) + if(selftenNumSurplus<selfhourNumSurplus&&selftenNumSurplus<selfdayNumSurplus){ + minNum=selftenNumSurplus; + }else if(selfhourNumSurplus<selftenNumSurplus&&selfhourNumSurplus<selfdayNumSurplus){ + minNum=selfhourNumSurplus; + }else if(selfdayNumSurplus<selftenNumSurplus&&selfdayNumSurplus<selfhourNumSurplus){ + minNum=selfdayNumSurplus; + } + //调用发送方法 + YxySendMail send=new YxySendMail(); + //取固定量的地址 + int sendSuccessNum=0; + if(minNum>addressList.size()){ + //调用发邮件方法 + send.sendMailMethod(addressList,YxySendMailService,SmtpInfo,mailinfo,props,transport); + }else{ + List<YxySendMailDetail> minaddressList=new ArrayList<YxySendMailDetail>(); + for(int j=0;j<minNum;j++){ + minaddressList.add(addressList.get(j)); + } + //调用发邮件方法,返回成功量 + send.sendMailMethod(minaddressList,YxySendMailService,SmtpInfo,mailinfo,props,transport); + } + if(sendSuccessNum>0){ + //更新自配smtp发送量 + smtpsendsetoverList.get(0).setSmtp_send_self_over_daydate(nowDay); + smtpsendsetoverList.get(0).setSmtp_send_self_over_daynum(selfdayNumOver+sendSuccessNum); + smtpsendsetoverList.get(0).setSmtp_send_self_over_hourdate(currDate); + smtpsendsetoverList.get(0).setSmtp_send_self_over_hournum(selfhourNumOver+sendSuccessNum); + smtpsendsetoverList.get(0).setSmtp_send_self_over_tendate(currDate); + smtpsendsetoverList.get(0).setSmtp_send_self_over_tennum(selftenNumOver+sendSuccessNum); + //更新已发量 + YxySendMailService.updateSendSelfSet(smtpsendsetoverList.get(0)); + } + + + }else{//未通过检测 + System.out.println("发送量超标了"); + } + } + } + } catch (Exception e) { + e.printStackTrace(); + //写入日志 + StringWriter sw = new StringWriter(); + e.printStackTrace(new PrintWriter(sw, true)); + String str = sw.toString(); + LogsTool.erroLogs(str); + } + + + + } + /**运营运行方法*/ + //public static void yxySmtpMethod(YxySendMailService YxySendMailService,YxySendSmtpInfo SmtpInfo,YxySendMailMaster mailinfo,List<YxySmtpSuffixSet> smtpsuffixsetList){ + public static void yxySmtpMethod(YxySendMailService YxySendMailService,YxySendSmtpInfo SmtpInfo,YxySendMailMaster mailinfo){ + try { + ///定义变量------------------ + //1.此为没有设置的后缀地址集合 +// List<YxySendMailDetail> nohouzhui=new ArrayList<YxySendMailDetail>(); +// //2.保存有设置的后缀 +// List<YxySendMailDetail> havehouzhui=new ArrayList<YxySendMailDetail>(); +// //3.保存能发的后缀地址集合 +// List<YxySendMailDetail> sendAddress=new ArrayList<YxySendMailDetail>(); + //5.获取当前时间 +// SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); +// String currDate=sdf1.format(new Date()); +// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); +// String nowDay=sdf.format(new Date()); + //邮件ID + int mailid=mailinfo.getSend_mail_id(); + //邮件唯一码 + String mailuid=mailinfo.getMail_uid(); + //smtp相关信息 + String smtpService=SmtpInfo.getSmtp_service_number();//smtp服务器 + //通过获取的待发邮件ID来获取该封邮件的待发地址(未包含异常邮件) + int MastermailId=mailinfo.getSend_mail_id();//该封邮件主ID + List<YxySendMailDetail> addressList=YxySendMailService.findAddressByMailID(MastermailId);//待发邮件对应的地址 + if(addressList.size()<=0){ + //将该邮件状态改为已发送 + YxySendMailService.updateMailStatus(1,mailid,mailuid); + System.out.println("邮件:"+MastermailId+"整理后没有待发地址!!!"); + }else{ + //是否SSL加密 + int isssl=SmtpInfo.getSmtp_is_ssl(); + //端口号 + String port=SmtpInfo.getSmtp_service_port(); + //验证SMTP是否通过 + List<Object> isTong=connectionService(smtpService,SmtpInfo.getSmtp_service_account(),SmtpInfo.getSmtp_service_password(),isssl,port); + if(isTong.get(0).toString().equals("1")){ + Properties props =(Properties) isTong.get(1); + Transport transport =(Transport) isTong.get(2); + //调用发邮件方法 + YxySendMail send=new YxySendMail(); + send.sendMailMethod(addressList,YxySendMailService,SmtpInfo,mailinfo,props,transport); +// //获取后缀已发送量信息 +// List<YxySmtpSendSet> smtpsendsetList=YxySendMailService.findAllSmtpSendSet(smtpService,nowDay); +// //如果没有数据则说明是新的一天了(删除以前的信息) +// if(smtpsendsetList.size()==0){ +// YxySendMailService.delmSmtpSet(smtpService); +// } +// //循环判断该地址的后缀属于哪个smtp统计出来 +// for(int i=0;i<addressList.size();i++){ +// int gs=0; +// our:for(int j=0;j<smtpsuffixsetList.size();j++){ +// //每个地址判断是否属于后缀类别中的一个 +// if(addressList.get(i).getEmail_suffix().equals(smtpsuffixsetList.get(j).getSmtp_suffix_name())){ +// havehouzhui.add(addressList.get(i)); +// gs++; +// break our; +// } +// } +// if(gs==0){ +// nohouzhui.add(addressList.get(i)); +// } +// } +// +// int tensendNum=0;//10分钟最大发送数 +// int hoursendNum=0;//60分钟最大发送数 +// int daysendNum=0;//1天最大发送数 +// +// int tensendNumOver=0;//10分钟已发送数 +// int hoursendNumOver=0;//60分钟已发送数 +// int daysendNumOver=0;//1天已发送数 +// +// String addrSuffix="";//地址后缀 +// String smtpsetSuffix="";//smtp设置后缀 +// +// boolean tenisok=false;//10分钟是否通过 +// boolean hourisok=false;//60分钟是否通过 +// boolean dayisok=false;//一天是否通过 +// +// //调用发送方法 +// YxySendMail send=new YxySendMail(); +// for(int i=0;i<2;i++){ +// //当i=0时表示该地址没有在设置值中直接发送 +// if(i==0){ +// if(nohouzhui.size()==0){ +// System.out.println("未后缀设置的没有地址"); +// continue; +// }else{ +// //没后缀的地址使用默认后缀控制参数(domain) +// send.sendMailMethod(nohouzhui,YxySendMailService,SmtpInfo,mailinfo,props,transport);/**调用发邮件方法*/ +// } +// } +// //否则表示有设置值的后缀 +// if(i==1){ +// //判断是否还存在地址 +// if(havehouzhui.size()==0){ +// System.out.println("后缀集合中没有待发地址了!!!"); +// }else{ +// //循环判断该地址后缀是否还能发送 +// address:for(int m=0;m<havehouzhui.size();m++){ +// //1.获取该地址后缀发送最大量 +// suffix:for(int f=0;f<smtpsuffixsetList.size();f++){ +// addrSuffix=smtpsuffixsetList.get(f).getSmtp_suffix_name();//系统设定的后缀名 +// //for(int j=0;j<havehouzhui.size();j++){ +// if(havehouzhui.get(m).getEmail_suffix().equals(addrSuffix)){ +// tensendNum=smtpsuffixsetList.get(f).getSmtp_suffix_ten();//10分钟最大发送量 +// hoursendNum=smtpsuffixsetList.get(f).getSmtp_suffix_hour();//60分钟最大发送量 +// daysendNum=smtpsuffixsetList.get(f).getSmtp_suffix_day();//一天最大发送量 +// break suffix; +// } +// } +// boolean isexist=false; +// addrSuffix=havehouzhui.get(m).getEmail_suffix();//地址后缀赋值 +// //循环后缀发送量 +// smtpset:for(int s=0;s<smtpsendsetList.size();s++){ +// //判断该地址后缀是否在设置中存在 +// smtpsetSuffix=smtpsendsetList.get(s).getSmtp_send_set_suffix();//smtp设置后缀 +// if(addrSuffix.equals(smtpsetSuffix)){//存在 +// //如果存在则查出各个时间段的已发送量 +// tensendNumOver=smtpsendsetList.get(s).getSmtp_send_set_tennum();//10分钟已发送数 +// hoursendNumOver=smtpsendsetList.get(s).getSmtp_send_set_hournum();//60分钟已发送数 +// daysendNumOver=smtpsendsetList.get(s).getSmtp_send_set_daynum();//1天已发送数 +// isexist=true; +// +// //判断该地址的已发量与设定量是否通过 +// //1.当前时间与最后一次发送时间判断是否是在10分钟内 +// if(DateFormat.minute1s(smtpsendsetList.get(s).getSmtp_send_set_tendate(),currDate)<10){ +// //在此10分钟内,判断是否能发 +// if(tensendNumOver>=tensendNum){ +// System.out.println("十分钟之内无法发送了"); +// //此地址无法发送 +// tenisok=false; +// continue address; +// }else{ +// tenisok=true; +// } +// }else{ +// tenisok=true; +// //更新此smtp10分钟为0 +// smtpsendsetList.get(s).setSmtp_send_set_tennum(0); +// smtpsendsetList.get(s).setSmtp_send_set_tendate(currDate); +// } +// //2.当前时间与最后一次发送时间判断是否是在60分钟内 +// if(DateFormat.minute1s(smtpsendsetList.get(s).getSmtp_send_set_hourdate(),currDate)<60){ +// if(hoursendNumOver>hoursendNum){ +// System.out.println("60分钟之内无法发送了"); +// hourisok=false; +// //此地址无法发送 +// continue address; +// }else{ +// hourisok=true; +// } +// }else{ +// hourisok=true; +// //更新此smtp60分钟为0 +// smtpsendsetList.get(s).setSmtp_send_set_hournum(0); +// smtpsendsetList.get(s).setSmtp_send_set_hourdate(currDate); +// } +// //3.当前时间与最后一次发送时间判断是否是在一天内 +// if(DateFormat.minute1s(smtpsendsetList.get(s).getSmtp_send_set_daydate()+" 00:00:00",currDate)<1440){ +// if(daysendNumOver>daysendNum){ +// System.out.println("一天之内无法发送了"); +// dayisok=false; +// //此地址无法发送 +// continue address; +// }else{ +// dayisok=true; +// } +// }else{ +// //更新此一天为0 +// dayisok=true; +// smtpsendsetList.get(s).setSmtp_send_set_daynum(0); +// smtpsendsetList.get(s).setSmtp_send_set_daydate(currDate); +// } +// //是否都符合 +// if(tenisok&&hourisok&&dayisok){ +// sendAddress.add(havehouzhui.get(m));/**都符合将待发地址加入到可发地址集合中*/ +// /**在该后缀信息上累加1*/ +// smtpsendsetList.get(s).setSmtp_send_set_tennum(smtpsendsetList.get(s).getSmtp_send_set_tennum()+1); +// smtpsendsetList.get(s).setSmtp_send_set_hournum(smtpsendsetList.get(s).getSmtp_send_set_hournum()+1); +// smtpsendsetList.get(s).setSmtp_send_set_daynum(smtpsendsetList.get(s).getSmtp_send_set_daynum()+1); +// +// /**更新后缀已发量记录*/ +// smtpsendsetList.set(s,smtpsendsetList.get(s)); +// +// continue address; +// }else{ +// break smtpset; +// } +// } +// } +// /**循环完后未存在的则新建一条*/ +// if(!isexist){ +// /**添加该后缀的配置信息*/ +// YxySmtpSendSet o=new YxySmtpSendSet(); +// o.setSmtp_send_set_service(smtpService); +// o.setSmtp_send_set_suffix(addrSuffix); +// o.setSmtp_send_set_tendate(currDate); +// o.setSmtp_send_set_hourdate(currDate); +// o.setSmtp_send_set_daydate(nowDay); +// o.setSmtp_send_set_daynum(1); +// o.setSmtp_send_set_hournum(1); +// o.setSmtp_send_set_tennum(1); +// /**将新的后缀量加入集合中*/ +// smtpsendsetList.add(o); +// +// +// sendAddress.add(havehouzhui.get(m)); +// +// } +// } +// //更新各个后缀信息的发送量 +// synchronized (SendMailTimer.nowtimer) { +// YxySendMailService.updateSmtpSet(smtpsendsetList); +// } +// if(sendAddress.size()>0){ +// //调用发邮件方法 +// send.sendMailMethod(sendAddress,YxySendMailService,SmtpInfo,mailinfo,props,transport); +// } +// } +// +// } +// } + }else{ + System.out.println("服务器:"+SmtpInfo.getSmtp_service_id()+"验证不通过"); + } + } + + } catch (Exception e) { + e.printStackTrace(); + //写入日志 + StringWriter sw = new StringWriter(); + e.printStackTrace(new PrintWriter(sw, true)); + String str = sw.toString(); + LogsTool.erroLogs(str); + } + } + + + /** 连接邮件服务器,验证用户名,密码*/ + public static List<Object> connectionService(String host,String servername,String serverpaswd,int isssl,String port) { + List<Object> result=new ArrayList<Object>(); + result.add(0); + result.add(0); + result.add(0); + + Properties props =new Properties(); + Transport transport =null; + + props.put("mail.smtp.host", host); + props.put("mail.smtp.auth", "true");/** 设定发送邮件时需要进行身份验证*/ + javax.mail.Session mailSession = javax.mail.Session.getInstance(props); + mailSession.setDebug(false); + //判断是否需要ssl验证 + String ishost=host.split("\\.")[1]; + if(isssl==1){ + if("gmail".equals(ishost)){ + props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory"); + props.put("mail.smtp.socketFactory.fallback", "false"); + props.put("mail.smtp.port", port); + props.put("mail.smtp.socketFactory.port", port); + }else{ + props.put("mail.smtp.starttls.enable","true"); + props.put("mail.smtp.port", port); + } + } + try { + //解密密码 + DES_Encrypt desEncrypt = new DES_Encrypt(); + desEncrypt.setKey("06"); + desEncrypt.setDesString(serverpaswd); + serverpaswd=desEncrypt.getStrM();//smtp密码需要解密 + + transport = mailSession.getTransport("smtp"); + transport.connect(host, servername, serverpaswd); + + result.set(0, 1); + result.set(1, props); + result.set(2, transport); + } catch (Exception e) { + //写入日志 + StringWriter sw = new StringWriter(); + e.printStackTrace(new PrintWriter(sw, true)); + String str = sw.toString(); + LogsTool.erroLogs("服务器:"+host+","+servername+","+str); + //e.printStackTrace(); + System.out.println("验证失败"); + } + return result; + } +} diff --git b/.svn/pristine/27/2726aceefde5b61ee145c97f3a0ba04de4368bbc.svn-base a/.svn/pristine/27/2726aceefde5b61ee145c97f3a0ba04de4368bbc.svn-base new file mode 100644 index 0000000..2d5bd8e --- /dev/null +++ a/.svn/pristine/27/2726aceefde5b61ee145c97f3a0ba04de4368bbc.svn-base @@ -0,0 +1,40 @@ +package com.espeed.yxy.dao.impl; + +import java.util.List; +import com.espeed.yxy.dao.YxySendCountDao; +import com.espeed.yxy.pojo.YxySendCount; +/** + * 客户发送邮件的统计Dao实现类 + * @author 陈南巧 + */ +public class YxySendCountDaoImpl extends HibernateBaseDAOImpl<YxySendCount, Long> implements YxySendCountDao{ + /**实体插入*/ + public int addPojo(YxySendCount o)throws Exception{ + return super.add(o); + } + /**实体编辑*/ + public void updatePojo(YxySendCount o)throws Exception{ + super.update(o); + } + /**HQL查询*/ + public List<YxySendCount> findByHql(String hql)throws Exception{ + return super.getAll(hql); + } + /**指定条记录*/ + public List<YxySendCount> findByHqlSet(String hql,int num)throws Exception{ + return super.findBySet(hql, num); + } + /**SQL查询*/ + public List<Object> findBySqlQuery(String sql)throws Exception{ + return super.findBySql(sql); + } + /**HQL更新*/ + public void updateByHql(String hql)throws Exception{ + super.updateorDelByHql(hql); + } + + /**HQL数量查询*/ + public int findByHqlCount(String hql)throws Exception{ + return super.count(hql); + } +} diff --git b/.svn/pristine/29/29753edf6700f471ea6458c307b056ee0d597bf6.svn-base a/.svn/pristine/29/29753edf6700f471ea6458c307b056ee0d597bf6.svn-base new file mode 100644 index 0000000..b232a5e --- /dev/null +++ a/.svn/pristine/29/29753edf6700f471ea6458c307b056ee0d597bf6.svn-base @@ -0,0 +1,75 @@ +package com.espeed.yxy.dao.impl; + +import java.util.List; + +import com.espeed.yxy.dao.YxySendMailMasterDao; +import com.espeed.yxy.pojo.YxySendMailMaster; +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 待发邮件DAO实现类 + * 开始时间: 2013.11.27 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +public class YxySendMailMasterDaoImpl extends HibernateBaseDAOImpl<YxySendMailMaster, Long> implements YxySendMailMasterDao{ + + /**批量插入*/ + public void addPiPojo(List<YxySendMailMaster> o)throws Exception{ + super.addPi(o); + } + + /**实体添加*/ + public int addPojo(YxySendMailMaster o)throws Exception{ + return super.add(o); + } + + /**HQL查询*/ + public List<YxySendMailMaster> findByHql(String hql)throws Exception{ + return super.getAll(hql); + } + + /**SQL查询*/ + public List<Object> findbysql(String sql)throws Exception{ + return super.findBySql(sql); + } + + /**SQL更新*/ + public void updateBySql(String sql)throws Exception{ + super.updateorDelBySql(sql); + } + + /**HQL更新*/ + public void updateByHql(String hql)throws Exception{ + super.updateorDelByHql(hql); + } + +// /**查询所有可用待发邮件*/ +// public List<YxySendMailMaster> findByMailNum() throws Exception { +// String hql="from YxySendMailMaster where (status=0 or status=2) and exptionnum<=3 and isuse=0 order by result_remark"; +// return super.getAll(hql); +// } +// /**添加修改邮件状态*/ +// public void updateMaster(YxySendMailMaster o) throws Exception { +// super.update(o); +// } +// /**更新base表为已发送状态*/ +// public void updateMasterBase(String sql) throws Exception { +// super.updateorDelBysql(sql); +// } +// /**HQL查询*/ +// public List findByHql(String hql) throws Exception { +// return super.getAll(hql); +// } +// +// /**HQL修改*/ +// public int updateByHql(String hql) throws Exception { +// return super.updateorDelBySql(hql); +// } + + +} diff --git b/.svn/pristine/2b/2b6bea72139737d41f0dddc5ecb8fd18bc02dc05.svn-base a/.svn/pristine/2b/2b6bea72139737d41f0dddc5ecb8fd18bc02dc05.svn-base new file mode 100644 index 0000000..119e0cb --- /dev/null +++ a/.svn/pristine/2b/2b6bea72139737d41f0dddc5ecb8fd18bc02dc05.svn-base @@ -0,0 +1,23 @@ +package com.espeed.yxy.tool; + +import java.util.Random; + +/*** + * + * @author xieyong + * 获取随即码 + */ +public class GetRandom { + + //生成随机码 + public static String getRandomString(int length) throws Exception{ //length表示生成字符串的长度 + String base = "abcdefghijklmnopqrstuvwxyz0123456789"; //生成字符串从此序列中取 + Random random = new Random(); + StringBuffer sb = new StringBuffer(); + for (int i = 0; i < length; i++) { + int number = random.nextInt(base.length()); + sb.append(base.charAt(number)); + } + return sb.toString(); + } +} diff --git b/.svn/pristine/2d/2d859791fbf7d880591864bd4004d8442a8a3b81.svn-base a/.svn/pristine/2d/2d859791fbf7d880591864bd4004d8442a8a3b81.svn-base new file mode 100644 index 0000000..8758a96 Binary files /dev/null and a/.svn/pristine/2d/2d859791fbf7d880591864bd4004d8442a8a3b81.svn-base differ diff --git b/.svn/pristine/2e/2e25efd05a4aad5471161617b272456f38ece1c9.svn-base a/.svn/pristine/2e/2e25efd05a4aad5471161617b272456f38ece1c9.svn-base new file mode 100644 index 0000000..38a8859 --- /dev/null +++ a/.svn/pristine/2e/2e25efd05a4aad5471161617b272456f38ece1c9.svn-base @@ -0,0 +1,109 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- + 共有方法,负责所有共有配置文件 +--> +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:aop="http://www.springframework.org/schema/aop" + xmlns:tx="http://www.springframework.org/schema/tx" + xsi:schemaLocation=" + http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd + http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd + http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd"> +<!-- hibernate注入 --> + <!-- 1、配置C3P0,数据源 --> + <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"> + <property name="driverClassName"> + <value>com.mysql.jdbc.Driver</value> + </property> + <property name="url"> + <value>jdbc:mysql://localhost:3306/yxybase?useUnicode=true&characterEncoding=utf8&autoReconnect=true</value> + </property> + <property name="username"> + <value>root</value> + </property> + <property name="password"> + <value>sz1234567890</value> + </property> + + <property name="maxActive" value="300"/> + + <property name="maxIdle" value="50"/> + + <property name="initialSize" value="100"/> + + <property name="maxWait" value="1000"/> + + <property name="defaultAutoCommit" value="true"/> + + <property name="removeAbandoned" value="true"/> + + <property name="removeAbandonedTimeout" value="60"/> + + <property name="logAbandoned" value="true"/> + + <property name="minEvictableIdleTimeMillis" value="10000"/> + <property name="validationQuery" value="SELECT NOW() FROM DUAL"/> + + </bean> + + <!-- 2、配置sessionFactory --> + <bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"> + <!-- 数据源注入 --> + <property name="dataSource" ref="dataSource" /> + <property name="packagesToScan"> + <list> + <value>com.espeed.yxy.pojo</value> + </list> + </property> + <property name="hibernateProperties"> + <props> + <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop> + <prop key="hibernate.show_sql">false</prop> + + <!-- 如果开启, Hibernate将收集有助于性能调节的统计数据. 取值 true | false --> + <prop key="hibernate.generate_statistics">true</prop> + <!-- 指定Hibernate在何时释放JDBC连接. --> + <prop key="hibernate.connetion.release_mode">auto</prop> + </props> + </property> + </bean> + + + + <!--3、配置spring事务(AOP) --> + <!-- 事务管理器 --> + <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> + <property name="sessionFactory" ref="sessionFactory" /> + </bean> + + <!-- 事务的传播特性(propagation) --> + <tx:advice id="txAdvice" transaction-manager="transactionManager"> + <tx:attributes> + <tx:method name="del*"/> + <tx:method name="save*" /> + <tx:method name="update*" /> + <tx:method name="add*" /> + <tx:method name="get*" propagation="SUPPORTS" read-only="true"/> + <tx:method name="load*" propagation="SUPPORTS" read-only="true"/> + <tx:method name="list*" propagation="SUPPORTS" read-only="true"/> + <tx:method name="*" propagation="SUPPORTS" read-only="true"/> + </tx:attributes> + </tx:advice> + <!-- 配置哪些类哪些方法具有事务 ,采用AOP--> + <aop:config> + <aop:pointcut expression="execution(* com.espeed.service.*.*(..))" id="allMethod"/> + <aop:advisor pointcut-ref="allMethod" advice-ref="txAdvice"/> + </aop:config> + <!-- 注入SpringFactory类 --> + <bean id="springfactory" class="com.espeed.yxy.tool.SpringFactory"> + </bean> + <!-- POJO配置 --> + <!--待发邮件实体--> + <bean id="yxysendmailmaster" class="com.espeed.yxy.pojo.YxySendMailMaster"></bean> + <!--待发邮件地址实体--> + <bean id="yxysendmaildetail" class="com.espeed.yxy.pojo.YxySendMailDetail"></bean> + <!--smtp实体--> + <bean id="yxysendsmtpinfo" class="com.espeed.yxy.pojo.YxySendSmtpInfo"></bean> +</beans> diff --git b/.svn/pristine/2e/2e2ea7d297144988c859aff24fdd881cf78384ba.svn-base a/.svn/pristine/2e/2e2ea7d297144988c859aff24fdd881cf78384ba.svn-base new file mode 100644 index 0000000..5b43ed8 --- /dev/null +++ a/.svn/pristine/2e/2e2ea7d297144988c859aff24fdd881cf78384ba.svn-base @@ -0,0 +1,226 @@ +package com.espeed.yxy.dao.impl; + +import java.io.Serializable; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.util.List; +import org.hibernate.Query; +import org.hibernate.Session; +import org.springframework.orm.hibernate3.support.HibernateDaoSupport; + +import com.espeed.yxy.dao.HibernateBaseDAO; +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: hbernate常用方法(营销邮) + * 开始时间: 2013.11.27 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +public abstract class HibernateBaseDAOImpl<T extends Serializable ,Pk extends Serializable> extends HibernateDaoSupport implements HibernateBaseDAO<T, Pk> { + private Connection conn; + private PreparedStatement pst; + private ResultSet rs; + + /**增加记录 (返回新增加记录的主键)*/ + public int add(T o) throws Exception { + return (Integer) super.getHibernateTemplate().save(o); + + } + + + /**修改记录*/ + public void update(T o) throws Exception { + super.getHibernateTemplate().update(o); + } + /**删除记录*/ + public void del(T o) throws Exception { + super.getHibernateTemplate().delete(o); + } + + /**添加或更新*/ + public void saveOrUpdate(T o) throws Exception { + super.getHibernateTemplate().saveOrUpdate(o); + } + /**根据ID获取一条数据*/ + @SuppressWarnings("unchecked") + public T get(Class<T> t,Pk pk) throws Exception { + return (T) super.getHibernateTemplate().get(t, pk); + } + /**根据ID获取一条数据*/ + @SuppressWarnings("unchecked") + public T load(Class<T> t,Pk pk) throws Exception { + return (T) super.getHibernateTemplate().load(t, pk); + } + /**根据hql进行条件查询*/ + @SuppressWarnings("unchecked") + public List<T> getAll(String hql) throws Exception { + return super.getHibernateTemplate().find(hql); + } + /**条件查询*/ + @SuppressWarnings("unchecked") + public List<T> getAll(String whereHql, Object... params) throws Exception { + return super.getHibernateTemplate().find(whereHql,params); + } + /* + * -------------------------------查询总记录数----------------------------------------- + */ + /**根据条件查询总记录*/ + public int count(String hql) throws Exception { + return Integer.valueOf(super.getHibernateTemplate().find(hql).get(0).toString()); + } + /**根据条件和参数查询总记录*/ + public int count(String hql, Object... params) throws Exception { + return Integer.valueOf(super.getHibernateTemplate().find(hql,params).get(0).toString()); + } + + /**hql语句修改删除记录*/ + public int updateorDelByHql(String hql){ + Session session = super.getHibernateTemplate().getSessionFactory().openSession(); + try { + Query query = session.createQuery(hql); + return query.executeUpdate(); + } catch (Exception e) { + e.printStackTrace(); + return 0; + }finally{ + if(session!=null){ + session.clear(); + session.close(); + } + + } + } + + /**sql语句修改删除记录*/ + public int updateorDelBySql(String sql)throws Exception{ + Session session = super.getHibernateTemplate().getSessionFactory().openSession(); + try { + Query query = session.createSQLQuery(sql); + return query.executeUpdate(); + } catch (Exception e) { + e.printStackTrace(); + return 0; + }finally{ + if(session!=null){ + session.clear(); + session.close(); + } + } + + } + + /**查询设定的记录条数据*/ + public List<T> findBySet(String hql,int num)throws Exception{ + Session session = super.getHibernateTemplate().getSessionFactory().openSession(); + try { + Query query = session.createQuery(hql); + query.setMaxResults(num); + return query.list(); + } catch (Exception e) { + e.printStackTrace(); + return null; + }finally{ + if(session!=null){ + session.clear(); + session.close(); + } + } + + + } + + /**批量插入*/ + public void addPi(List<T> o){ + if(o!=null){ + Session session = super.getHibernateTemplate().getSessionFactory().openSession(); + try { + + session.beginTransaction(); + for(int i=0;i<o.size();i++){ + session.saveOrUpdate(o.get(i)); + } + session.beginTransaction().commit(); + } catch (Exception e) { + e.printStackTrace(); + session.beginTransaction().rollback(); + }finally{ + session.flush(); + session.clear(); + session.close(); + } + } + } + + /**批量更新*/ + public void updatePi(List<T> o) throws Exception{ + if(o!=null){ + Session session = super.getHibernateTemplate().getSessionFactory().openSession(); + try { + + session.beginTransaction(); + for(int i=0;i<o.size();i++){ + session.update(o.get(i)); + } + session.beginTransaction().commit(); + + + } catch (Exception e) { + e.printStackTrace(); + session.beginTransaction().rollback(); + }finally{ + session.flush(); + session.clear(); + session.close(); + } + } + } + + + /**批量更新*/ + public void saveandupdatePi(List<T> o) throws Exception{ + if(o!=null){ + Session session = super.getHibernateTemplate().getSessionFactory().openSession(); + try { + + session.beginTransaction(); + for(int i=0;i<o.size();i++){ + session.saveOrUpdate(o.get(i)); + } + session.beginTransaction().commit(); + + + } catch (Exception e) { + e.printStackTrace(); + session.beginTransaction().rollback(); + }finally{ + session.flush(); + session.clear(); + session.close(); + } + } + } + + /**sql语句查询*/ + public List findBySql(String sql){ + Session session=null; + try { + session =super.getHibernateTemplate().getSessionFactory(). + openSession(); + return session.createSQLQuery(sql).list(); + } catch (Exception e) { + e.printStackTrace(); + }finally{ + if(session!=null){ + session.clear(); + session.close(); + } + } + return null; + } +} diff --git b/.svn/pristine/2e/2e6d043a90ab100471f2cb2ace09b5134931631c.svn-base a/.svn/pristine/2e/2e6d043a90ab100471f2cb2ace09b5134931631c.svn-base new file mode 100644 index 0000000..9e7ce4a --- /dev/null +++ a/.svn/pristine/2e/2e6d043a90ab100471f2cb2ace09b5134931631c.svn-base @@ -0,0 +1,27 @@ +package com.espeed.yxy.dao; + +import java.util.List; + +import com.espeed.centre.pojo.CentreUser; +/** + * 项目名称: 统一验证中心系统 + * 版权所有: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 技术支持: info@21gmail.com + * 单元名称: 跟踪配置Dao + * 开始时间: 2018.04.08 + * 开发人员: 陈南巧 + */ +public interface CentreUserDao { + /**实体插入*/ + public int addPojo(CentreUser o)throws Exception; + /**实体编辑*/ + public void updatePojo(CentreUser o)throws Exception; + /**HQL查询*/ + public List<CentreUser> findByHql(String hql)throws Exception; + /**SQL查询*/ + public List<Object> findBySqlFind(String sql)throws Exception; + /**HQL更新*/ + public void updateByHql(String hql)throws Exception; + /**HQL查询数量*/ + public int findByHqlCount(String hql)throws Exception; +} diff --git b/.svn/pristine/32/32c146cbbd38041ec3598eb8ba4beec112348b3d.svn-base a/.svn/pristine/32/32c146cbbd38041ec3598eb8ba4beec112348b3d.svn-base new file mode 100644 index 0000000..61bd4a5 Binary files /dev/null and a/.svn/pristine/32/32c146cbbd38041ec3598eb8ba4beec112348b3d.svn-base differ diff --git b/.svn/pristine/33/3306a165afa81938fc3d8a0948e891de9f6b192b.svn-base a/.svn/pristine/33/3306a165afa81938fc3d8a0948e891de9f6b192b.svn-base new file mode 100644 index 0000000..1e9f71b Binary files /dev/null and a/.svn/pristine/33/3306a165afa81938fc3d8a0948e891de9f6b192b.svn-base differ diff --git b/.svn/pristine/36/36e34f2a3722f061eaf48213f95f5011f1bb33ee.svn-base a/.svn/pristine/36/36e34f2a3722f061eaf48213f95f5011f1bb33ee.svn-base new file mode 100644 index 0000000..fbb49cb --- /dev/null +++ a/.svn/pristine/36/36e34f2a3722f061eaf48213f95f5011f1bb33ee.svn-base @@ -0,0 +1,67 @@ +package com.espeed.yxy.dao.impl; + +import java.util.List; + +import com.espeed.yxy.dao.YxySmtpSendSelfOversetDao; +import com.espeed.yxy.pojo.YxySendMailDetail; +import com.espeed.yxy.pojo.YxySmtpSendSelfOverset; +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: SMTP发送量 DAO实现类 + * 开始时间: 2013.11.27 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +public class YxySmtpSendSelfOversetDaoImpl extends HibernateBaseDAOImpl<YxySmtpSendSelfOverset, Long> implements YxySmtpSendSelfOversetDao{ + +// /**查询该账号的发送量信息*/ +// public List<YxySmtpSendSelfOverset> findBySmtpAccount(String account)throws Exception { +// String hql="from YxySmtpSendSelfOverset where smtp_send_self_over_account='"+account+"'"; +// return super.getAll(hql); +// } +// /**添加该账号的已发量信息*/ +// public void addSendSelfSet(YxySmtpSendSelfOverset o) throws Exception { +// super.add(o); +// +// } +// /**更新已发量*/ +// public void updateSendSelfSet(YxySmtpSendSelfOverset o) throws Exception { +// super.update(o); +// +// } + + /**批量插入*/ + public void addPiPojo(List<YxySmtpSendSelfOverset> o)throws Exception{ + super.addPi(o); + } + + /**实体添加*/ + public int addPojo(YxySmtpSendSelfOverset o)throws Exception{ + return super.add(o); + } + + /**HQL查询*/ + public List<YxySmtpSendSelfOverset> findByHql(String hql)throws Exception{ + return super.getAll(hql); + } + + /**SQL查询*/ + public List<Object> findbysql(String sql)throws Exception{ + return super.findBySql(sql); + } + + /**SQL更新*/ + public void updateBySql(String sql)throws Exception{ + super.updateorDelBySql(sql); + } + + /**HQL更新*/ + public void updateByHql(String hql)throws Exception{ + super.updateorDelByHql(hql); + } +} diff --git b/.svn/pristine/38/380ef5226de2c85ff3b38cbfefeea881c5fce09d.svn-base a/.svn/pristine/38/380ef5226de2c85ff3b38cbfefeea881c5fce09d.svn-base new file mode 100644 index 0000000..0539039 Binary files /dev/null and a/.svn/pristine/38/380ef5226de2c85ff3b38cbfefeea881c5fce09d.svn-base differ diff --git b/.svn/pristine/38/38c90711c808c02521db203ea2273681dafcdacf.svn-base a/.svn/pristine/38/38c90711c808c02521db203ea2273681dafcdacf.svn-base new file mode 100644 index 0000000..e1ef5be --- /dev/null +++ a/.svn/pristine/38/38c90711c808c02521db203ea2273681dafcdacf.svn-base @@ -0,0 +1,68 @@ +package com.espeed.yxy.pojo; + +import java.io.Serializable; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: smtp自配最大发送量实体(营销游) + * 开始时间: 2013.12.09 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ + +@Entity +@Table(name="yxy_smtp_send_self_set") +public class YxySmtpSendSelfSet implements Serializable{ + + private int smtp_send_self_set_id;//自配smtp发送量限制id + private String smtp_send_self_set_account;//服务器账号 + private int smtp_send_self_set_tennum;//10分钟最大发送量 + private int smtp_send_self_set_hournum;//60分钟最大发送量 + private int smtp_send_self_set_daynum;//一天最大发送量 + + @Id + @GeneratedValue(strategy=GenerationType.AUTO) + public int getSmtp_send_self_set_id() { + return smtp_send_self_set_id; + } + public void setSmtp_send_self_set_id(int smtpSendSelfSetId) { + smtp_send_self_set_id = smtpSendSelfSetId; + } + public int getSmtp_send_self_set_tennum() { + return smtp_send_self_set_tennum; + } + public void setSmtp_send_self_set_tennum(int smtpSendSelfSetTennum) { + smtp_send_self_set_tennum = smtpSendSelfSetTennum; + } + public int getSmtp_send_self_set_hournum() { + return smtp_send_self_set_hournum; + } + public void setSmtp_send_self_set_hournum(int smtpSendSelfSetHournum) { + smtp_send_self_set_hournum = smtpSendSelfSetHournum; + } + public int getSmtp_send_self_set_daynum() { + return smtp_send_self_set_daynum; + } + public void setSmtp_send_self_set_daynum(int smtpSendSelfSetDaynum) { + smtp_send_self_set_daynum = smtpSendSelfSetDaynum; + } + public String getSmtp_send_self_set_account() { + return smtp_send_self_set_account; + } + public void setSmtp_send_self_set_account(String smtpSendSelfSetAccount) { + smtp_send_self_set_account = smtpSendSelfSetAccount; + } + + + +} diff --git b/.svn/pristine/3a/3add7db809843f194d36310ca05e94b2c90a2d91.svn-base a/.svn/pristine/3a/3add7db809843f194d36310ca05e94b2c90a2d91.svn-base new file mode 100644 index 0000000..cc94295 --- /dev/null +++ a/.svn/pristine/3a/3add7db809843f194d36310ca05e94b2c90a2d91.svn-base @@ -0,0 +1,312 @@ +package com.espeed.webmail.pojo; + +import java.io.Serializable; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Transient; + +/** +* +* @项目名称: 科飞管理后台系统 +* @版权所有: 深圳市科飞时速网络技术有限公司(0755-88843776) +* @技术支持: info@21gmail.com +* @单元名称: crm_customer_info表CrmCustomerInfo实体类 +* @开始时间: 2018-09-27 +* @开发人员: 杨志钊 +*/ + +@Entity +@Table(name = "crm_customer_info") +public class CrmCustomerInfo implements Serializable { + + private static final long serialVersionUID = 1L; + + private int id;//主键id + + private int customer_id;//客户id + + private String year_established;//公司成立时间 + + private String business_type;//商业类型 + + private String platforms_selling;//销售平台 + + private String main_products;//主营产品 + + private String operational_address;//经营地址 + + private String joined_alibaba_time;//加入alibaba.com时间 + + private String Inquiries_product;//询盘产品 + + private String annual_purchasing_volume;//年采购额 + + private String primary_sourcing_purpose;//采购目的 + + private String average_sourcing_frequency;//平均采购频率 + + private String preferred_supplier_qualifications;//偏好供应商类型 + + private String preferred_industries;//偏好行业 + + private String registered_years;//注册年限 + + private String days_signed_in;//登录天数 + + private String product_views;//产品浏览数 + + private String searches;//搜索次数 + + private String valid_inquiries_sentTo;//有效询盘数/ 回复询盘数 + + private String spam_inquiries;//被标为垃圾询盘数 + + private String valid_rfqs_submitted;//有效RFQ数 + + private String quotations_receivedRead;//收到报价数/ 查看报价数 + + private String listed_contact;//被添加联系人数 + + private String add_blacklist;//被添加黑名单数 + + private String recent_searches;//最近搜索词 + + private String most_sourcing_industries;//最常采购行业 + + private String latest_buying_requests;//最新采购需求,多个用###隔开 + + private String latest_inquiries;//最近询盘产品,多个用###隔开 + + private String create_time;//记录创建时间 + + private String modify_time;//记录最后修改时间 + + private String about_us;//关于我们 + + @Id + @GeneratedValue(strategy=GenerationType.AUTO) + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + public int getCustomer_id() { + return customer_id; + } + + public void setCustomer_id(int customer_id) { + this.customer_id = customer_id; + } + public String getYear_established() { + return year_established; + } + + public void setYear_established(String year_established) { + this.year_established = year_established; + } + public String getBusiness_type() { + return business_type; + } + + public void setBusiness_type(String business_type) { + this.business_type = business_type; + } + public String getPlatforms_selling() { + return platforms_selling; + } + + public void setPlatforms_selling(String platforms_selling) { + this.platforms_selling = platforms_selling; + } + public String getMain_products() { + return main_products; + } + + public void setMain_products(String main_products) { + this.main_products = main_products; + } + public String getOperational_address() { + return operational_address; + } + + public void setOperational_address(String operational_address) { + this.operational_address = operational_address; + } + public String getJoined_alibaba_time() { + return joined_alibaba_time; + } + + public void setJoined_alibaba_time(String joined_alibaba_time) { + this.joined_alibaba_time = joined_alibaba_time; + } + public String getInquiries_product() { + return Inquiries_product; + } + + public void setInquiries_product(String Inquiries_product) { + this.Inquiries_product = Inquiries_product; + } + public String getAnnual_purchasing_volume() { + return annual_purchasing_volume; + } + + public void setAnnual_purchasing_volume(String annual_purchasing_volume) { + this.annual_purchasing_volume = annual_purchasing_volume; + } + public String getPrimary_sourcing_purpose() { + return primary_sourcing_purpose; + } + + public void setPrimary_sourcing_purpose(String primary_sourcing_purpose) { + this.primary_sourcing_purpose = primary_sourcing_purpose; + } + public String getAverage_sourcing_frequency() { + return average_sourcing_frequency; + } + + public void setAverage_sourcing_frequency(String average_sourcing_frequency) { + this.average_sourcing_frequency = average_sourcing_frequency; + } + public String getPreferred_supplier_qualifications() { + return preferred_supplier_qualifications; + } + + public void setPreferred_supplier_qualifications(String preferred_supplier_qualifications) { + this.preferred_supplier_qualifications = preferred_supplier_qualifications; + } + public String getPreferred_industries() { + return preferred_industries; + } + + public void setPreferred_industries(String preferred_industries) { + this.preferred_industries = preferred_industries; + } + public String getRegistered_years() { + return registered_years; + } + + public void setRegistered_years(String registered_years) { + this.registered_years = registered_years; + } + public String getDays_signed_in() { + return days_signed_in; + } + + public void setDays_signed_in(String days_signed_in) { + this.days_signed_in = days_signed_in; + } + public String getProduct_views() { + return product_views; + } + + public void setProduct_views(String product_views) { + this.product_views = product_views; + } + public String getSearches() { + return searches; + } + + public void setSearches(String searches) { + this.searches = searches; + } + public String getValid_inquiries_sentTo() { + return valid_inquiries_sentTo; + } + + public void setValid_inquiries_sentTo(String valid_inquiries_sentTo) { + this.valid_inquiries_sentTo = valid_inquiries_sentTo; + } + public String getSpam_inquiries() { + return spam_inquiries; + } + + public void setSpam_inquiries(String spam_inquiries) { + this.spam_inquiries = spam_inquiries; + } + public String getValid_rfqs_submitted() { + return valid_rfqs_submitted; + } + + public void setValid_rfqs_submitted(String valid_rfqs_submitted) { + this.valid_rfqs_submitted = valid_rfqs_submitted; + } + public String getQuotations_receivedRead() { + return quotations_receivedRead; + } + + public void setQuotations_receivedRead(String quotations_receivedRead) { + this.quotations_receivedRead = quotations_receivedRead; + } + public String getListed_contact() { + return listed_contact; + } + + public void setListed_contact(String listed_contact) { + this.listed_contact = listed_contact; + } + public String getAdd_blacklist() { + return add_blacklist; + } + + public void setAdd_blacklist(String add_blacklist) { + this.add_blacklist = add_blacklist; + } + public String getRecent_searches() { + return recent_searches; + } + + public void setRecent_searches(String recent_searches) { + this.recent_searches = recent_searches; + } + public String getMost_sourcing_industries() { + return most_sourcing_industries; + } + + public void setMost_sourcing_industries(String most_sourcing_industries) { + this.most_sourcing_industries = most_sourcing_industries; + } + public String getLatest_buying_requests() { + return latest_buying_requests; + } + + public void setLatest_buying_requests(String latest_buying_requests) { + this.latest_buying_requests = latest_buying_requests; + } + public String getLatest_inquiries() { + return latest_inquiries; + } + + public void setLatest_inquiries(String latest_inquiries) { + this.latest_inquiries = latest_inquiries; + } + public String getCreate_time() { + return create_time; + } + + public void setCreate_time(String create_time) { + this.create_time = create_time; + } + public String getModify_time() { + return modify_time; + } + + public void setModify_time(String modify_time) { + this.modify_time = modify_time; + } + + @Transient + public String getAbout_us() { + return about_us; + } + + public void setAbout_us(String about_us) { + this.about_us = about_us; + } + + } diff --git b/.svn/pristine/3d/3dc44c710897604c3792cc3543952571b2ea8f3a.svn-base a/.svn/pristine/3d/3dc44c710897604c3792cc3543952571b2ea8f3a.svn-base new file mode 100644 index 0000000..121e680 --- /dev/null +++ a/.svn/pristine/3d/3dc44c710897604c3792cc3543952571b2ea8f3a.svn-base @@ -0,0 +1,108 @@ +package com.espeed.centre.pojo; + +import java.io.Serializable; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; +/** + * 项目名称: 统一验证中心系统 + * 版权所有: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 技术支持: info@21gmail.com + * 单元名称: 营销邮开发客户配置实体类 + * 开始时间: 2018.04.08 + * 开发人员: 陈南巧 + */ +@Entity +@Table(name="centre_yxyedm_newcustomer") +public class CentreYxyedmNewcustomer implements Serializable +{ + private static final long serialVersionUID = 1L; + private int id;//主键id + private String sender_email;//发件人邮箱 + private String reply_email;//回复人邮箱 + private String sender_name;//发件人名称 + private String allow_user;//指定营销人员,多个以逗号分割 + private int company_id;//企业id + private String company_domain;//企业域名 + private String domain;//域名 + private int spf_status;//spf状态,0不可用,1可以用 + private int mx_status;//mx状态,0不可用,1可以用 + private int status;//状态,0不可用,1可以用 + private int type;//类型,0自有域名,1待发模式 + @Id + @GeneratedValue(strategy=GenerationType.AUTO) + public int getId() { + return id; + } + public void setId(int id) { + this.id = id; + } + public String getSender_email() { + return sender_email; + } + public void setSender_email(String sender_email) { + this.sender_email = sender_email; + } + public String getReply_email() { + return reply_email; + } + public void setReply_email(String reply_email) { + this.reply_email = reply_email; + } + public String getSender_name() { + return sender_name; + } + public void setSender_name(String sender_name) { + this.sender_name = sender_name; + } + public String getAllow_user() { + return allow_user; + } + public void setAllow_user(String allow_user) { + this.allow_user = allow_user; + } + public int getCompany_id() { + return company_id; + } + public void setCompany_id(int company_id) { + this.company_id = company_id; + } + public String getCompany_domain() { + return company_domain; + } + public void setCompany_domain(String company_domain) { + this.company_domain = company_domain; + } + public String getDomain() { + return domain; + } + public void setDomain(String domain) { + this.domain = domain; + } + public int getSpf_status() { + return spf_status; + } + public void setSpf_status(int spf_status) { + this.spf_status = spf_status; + } + public int getMx_status() { + return mx_status; + } + public void setMx_status(int mx_status) { + this.mx_status = mx_status; + } + public int getStatus() { + return status; + } + public void setStatus(int status) { + this.status = status; + } + public int getType() { + return type; + } + public void setType(int type) { + this.type = type; + } +} diff --git b/.svn/pristine/3e/3e12540b55b2230bde28684c26246530fd11b96c.svn-base a/.svn/pristine/3e/3e12540b55b2230bde28684c26246530fd11b96c.svn-base new file mode 100644 index 0000000..9396ce1 --- /dev/null +++ a/.svn/pristine/3e/3e12540b55b2230bde28684c26246530fd11b96c.svn-base @@ -0,0 +1,74 @@ +package com.espeed.yxy.tool; + +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; + +import javax.sql.DataSource; + +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 获取数据库连接的工具类 + * 开始时间: 2013.10.1 + * 程 序 员: 芮瑞 + * 最后修改: 2014-02-25 + * 备 注:用于从连接池中获取数据源,获取数据库连接 + */ +public class DBUtil +{ + private static DataSource dataSource; + + //获得连接 + public static Connection getConnection() throws SQLException + { + dataSource = (DataSource) SpringFactory.getObject("dataSource"); + + return dataSource.getConnection(); + } + + + /* + * 关闭数据库连接 + */ + public static void close(ResultSet rs,Statement st,Connection conn) + { + + if(rs!=null) + { try { + rs.close(); + } catch (SQLException e) { + e.printStackTrace(); + }finally{ + if(st!=null){ + try { + st.close(); + } catch (SQLException e) { + e.printStackTrace(); + }finally{ + if(conn!=null){ + try { + conn.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + } + } + } + } + } + } + public static void main(String[] args) throws SQLException + { + System.out.println(DBUtil.getConnection()); + } + + + + +} + \ No newline at end of file diff --git b/.svn/pristine/40/4058ca983dd275363bd454393e1889c2ba978c74.svn-base a/.svn/pristine/40/4058ca983dd275363bd454393e1889c2ba978c74.svn-base new file mode 100644 index 0000000..c15ca90 Binary files /dev/null and a/.svn/pristine/40/4058ca983dd275363bd454393e1889c2ba978c74.svn-base differ diff --git b/.svn/pristine/40/40fb048097caeacdb11dbb33b5755854d89efdeb.svn-base a/.svn/pristine/40/40fb048097caeacdb11dbb33b5755854d89efdeb.svn-base new file mode 100644 index 0000000..41e230f Binary files /dev/null and a/.svn/pristine/40/40fb048097caeacdb11dbb33b5755854d89efdeb.svn-base differ diff --git b/.svn/pristine/41/41dfc0a6c92707948578891c51d98c6443be63cc.svn-base a/.svn/pristine/41/41dfc0a6c92707948578891c51d98c6443be63cc.svn-base new file mode 100644 index 0000000..05bd71b --- /dev/null +++ a/.svn/pristine/41/41dfc0a6c92707948578891c51d98c6443be63cc.svn-base @@ -0,0 +1 @@ +Window \ No newline at end of file diff --git b/.svn/pristine/44/447bcf0d93a7680330fae2bdf5c9bae0a477b8c2.svn-base a/.svn/pristine/44/447bcf0d93a7680330fae2bdf5c9bae0a477b8c2.svn-base new file mode 100644 index 0000000..65a66ce --- /dev/null +++ a/.svn/pristine/44/447bcf0d93a7680330fae2bdf5c9bae0a477b8c2.svn-base @@ -0,0 +1,103 @@ +package com.espeed.plan; + +import java.util.ArrayList; +import java.util.List; +import java.util.Properties; + +import javax.mail.Transport; + +import com.espeed.yxy.pojo.YxyMarketingPlan; +import com.espeed.yxy.pojo.YxySendSmtpInfo; +import com.espeed.yxy.pojo.YxyUserAddress; +import com.espeed.yxy.service.YxyMarketingPlanService; +import com.espeed.yxy.service.YxySendMailService; +import com.espeed.yxy.tool.DES_Encrypt; + +/*** + * + * @author 谢勇 + * 计划执行类 + * + */ +public class PlanRunClass { + + public void planrun(YxyMarketingPlanService planservice,YxySendMailService mailservice,YxySendSmtpInfo smtpinfo,YxyMarketingPlan planinfo){ + try { + //判断此计划是否有地址 + int addressgroupid=planinfo.getPlan_groupid(); + String loginid = planinfo.getLoginid();//账号 + String domain = planinfo.getDomain();//域名 + int plan_differen = planinfo.getPlan_differen();//区分客户的本地和CRM库 0:本地 1:CRM + + //SMTP参数 + String host=smtpinfo.getSmtp_service_number();//服务器 + String account=smtpinfo.getSmtp_service_account();//账号 + String password=smtpinfo.getSmtp_service_password();//密码 + int isssl=smtpinfo.getSmtp_is_ssl();//是否SSL加密 + String port=smtpinfo.getSmtp_service_port();//端口号 + + //查询地址 + List<YxyUserAddress> addresslist=planservice.findAddressByGroupid(addressgroupid,plan_differen,loginid,domain,planinfo.getOther_name()); + if(addresslist.size()>0){ + List<Object> isTong=connectionService(host,account,password,isssl,port); + if(isTong.get(0).toString().equals("1")){ + + }else{ + System.out.println("服务器验证失败!"); + } + } + + + + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** 连接邮件服务器,验证用户名,密码*/ + public static List<Object> connectionService(String host,String servername,String serverpaswd,int isssl,String port) { + List<Object> result=new ArrayList<Object>(); + result.add(0); + result.add(0); + result.add(0); + + Properties props =new Properties(); + Transport transport =null; + + props.put("mail.smtp.host", host); + props.put("mail.smtp.auth", "true");/** 设定发送邮件时需要进行身份验证*/ + javax.mail.Session mailSession = javax.mail.Session.getInstance(props); + mailSession.setDebug(false); + //判断是否需要ssl验证 + String ishost=host.split("\\.")[1]; + if(isssl==1){ + if("gmail".equals(ishost)){ + props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory"); + props.put("mail.smtp.socketFactory.fallback", "false"); + props.put("mail.smtp.port", port); + props.put("mail.smtp.socketFactory.port", port); + }else{ + props.put("mail.smtp.starttls.enable","true"); + props.put("mail.smtp.port", port); + } + } + try { + //解密密码 + DES_Encrypt desEncrypt = new DES_Encrypt(); + desEncrypt.setKey("06"); + desEncrypt.setDesString(serverpaswd); + serverpaswd=desEncrypt.getStrM();//smtp密码需要解密 + + transport = mailSession.getTransport("smtp"); + transport.connect(host, servername, serverpaswd); + + result.set(0, 1); + result.set(1, props); + result.set(2, transport); + } catch (Exception e) { + e.printStackTrace(); + System.out.println("验证失败"); + } + return result; + } +} diff --git b/.svn/pristine/44/449ea46b27426eb846611a90b2fb8b4dcf271191.svn-base a/.svn/pristine/44/449ea46b27426eb846611a90b2fb8b4dcf271191.svn-base new file mode 100644 index 0000000..3f306b6 Binary files /dev/null and a/.svn/pristine/44/449ea46b27426eb846611a90b2fb8b4dcf271191.svn-base differ diff --git b/.svn/pristine/46/460d135d42d59a7779b4702131079099a7bb1273.svn-base a/.svn/pristine/46/460d135d42d59a7779b4702131079099a7bb1273.svn-base new file mode 100644 index 0000000..74a7ab0 --- /dev/null +++ a/.svn/pristine/46/460d135d42d59a7779b4702131079099a7bb1273.svn-base @@ -0,0 +1,33 @@ +package com.espeed.yxy.tool; + +import java.sql.CallableStatement; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; + +import javax.servlet.http.HttpServlet; + +public class ServiceInit extends HttpServlet{ + + private Connection conn; + private ResultSet rs; + private PreparedStatement pst; + + //项目初始化 + public void init(){ + //更新待发邮件状态 + try { + //获取数据库链接 + conn=DBUtil.getConnection(); + String sql="update yxy_send_mail_master set isuse=0"; + pst=conn.prepareStatement(sql); + pst.executeUpdate(); + + System.out.println("服务启动初始化成功!"); + } catch (Exception e) { + System.out.println("服务启动初始化失败!"); + }finally{ + DBUtil.close(rs, pst, conn); + } + } +} diff --git b/.svn/pristine/47/47042b8bbeb4ca09b7785c0e56283f88f7e3d29e.svn-base a/.svn/pristine/47/47042b8bbeb4ca09b7785c0e56283f88f7e3d29e.svn-base new file mode 100644 index 0000000..1952312 --- /dev/null +++ a/.svn/pristine/47/47042b8bbeb4ca09b7785c0e56283f88f7e3d29e.svn-base @@ -0,0 +1,238 @@ +package com.espeed.yxy.tool; +import java.io.BufferedReader; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.io.OutputStream; +import java.security.Key; +import java.security.SecureRandom; +import javax.crypto.Cipher; +import javax.crypto.CipherInputStream; +import javax.crypto.CipherOutputStream; +import javax.crypto.KeyGenerator; +import javax.crypto.SecretKey; +import javax.crypto.SecretKeyFactory; +import javax.crypto.spec.DESKeySpec; + +import sun.misc.BASE64Decoder; +import sun.misc.BASE64Encoder; +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: DES加密工具类(营销游) + * 开始时间: 2013.12.09 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +public class Encrypt { + /** 密钥算法*/ + private static final String KEY_ALGORITHM = "DES"; + private static final String DEFAULT_CIPHER_ALGORITHM = "DES/ECB/PKCS5Padding"; + + static byte[] byteArray=null; + /** 初始化密钥*/ + public static byte[] initSecretKey() throws Exception{ + //返回生成指定算法的秘密密钥的 KeyGenerator 对象 + KeyGenerator kg = KeyGenerator.getInstance("DES"); + //初始化此密钥生成器,使其具有确定的密钥大小 + kg.init(56); + //生成一个密钥 + SecretKey secretKey = kg.generateKey(); + byteArray=secretKey.getEncoded(); + return secretKey.getEncoded(); + } + + /**转换密钥*/ + private static Key toKey() throws Exception{ + //实例化DES密钥规则 + DESKeySpec dks = new DESKeySpec(byteArray); + //实例化密钥工厂 + SecretKeyFactory skf = SecretKeyFactory.getInstance("DES"); + //生成密钥 ,工厂中对密钥进行处理加工 + SecretKey secretKey = skf.generateSecret(dks); + return secretKey; + } + + /**获得密钥*/ + public static Key getKey() throws Exception { + Key kp =toKey(); + return kp; + } + + +/**文件加密需要传入一个流跟一个文件保存的路径*/ + public static Object encrypt(InputStream is, String dest) throws Exception { + Cipher cipher = Cipher.getInstance("DES"); + //初始化密钥 + initSecretKey(); + //获得密钥 + Object key =getKey(); + cipher.init(Cipher.ENCRYPT_MODE,(Key)key); + //写入文件 + OutputStream out = new FileOutputStream(dest); + CipherInputStream cis = new CipherInputStream(is, cipher); + byte[] buffer = new byte[1024]; + int r; + while ((r = cis.read(buffer)) > 0) { + out.write(buffer, 0, r); + } + //数据库保存需要一个字符 + BASE64Encoder enc=new BASE64Encoder(); + String string=enc.encode(byteArray); + cis.close(); + is.close(); + out.close(); + return string; + } + /**文件解密返回一个流*/ + public static InputStream decrypt(String file,Key key) throws IOException { + CipherInputStream cis = null; + InputStream is =null; + try { + Cipher cipher = Cipher.getInstance("DES"); + cipher.init(Cipher.DECRYPT_MODE,key); + is = new FileInputStream(file); + cis = new CipherInputStream(is, cipher); + + } catch (Exception e) { + e.printStackTrace(); + return null; + } + return cis; + + } + + /**通过传过来的流生成文件*/ + public static void decrypt(String outfile,String fileName,CipherInputStream in) throws Exception { + File file=new File(outfile); + if(!file.exists()){ + file.mkdirs(); + } + OutputStream out = new FileOutputStream(outfile+"\\"+fileName); + byte[] buffer = new byte[1024]; + int r; + while ((r = in.read(buffer)) >= 0) { + out.write(buffer, 0, r); + } + out.close(); + in.close(); + } + + /**文件解密返回一个字符串*/ + public static String decryptAndGetString(String file,Key key) throws Exception { + Cipher cipher = Cipher.getInstance("DES"); + cipher.init(Cipher.DECRYPT_MODE,key); + InputStream is = new FileInputStream(file); + CipherInputStream cis = new CipherInputStream(is, cipher); + + return convertStreamToString(cis); + + } + public static String inputStream2String(InputStream is) throws IOException{ + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + int i=-1; + while((i=is.read())!=-1){ + baos.write(i); + } + return baos.toString(); + } + + public static String convertStreamToString(InputStream is) { + + BufferedReader reader = new BufferedReader(new InputStreamReader(is)); + + StringBuilder sb = new StringBuilder(); + + + + String line = null; + + try { + + while ((line = reader.readLine()) != null) { + + sb.append(line + "/n"); + + } + + } catch (IOException e) { + + e.printStackTrace(); + + } finally { + + try { + + is.close(); + + } catch (IOException e) { + + e.printStackTrace(); + + } + + } + + + + return sb.toString(); + + } + + /**转换密钥*/ + public static Key toKey(byte[] key) throws Exception{ + //实例化DES密钥规则 + DESKeySpec dks = new DESKeySpec(key); + //实例化密钥工厂 + SecretKeyFactory skf = SecretKeyFactory.getInstance("DES"); + //生成密钥 ,工厂中对密钥进行处理加工 + SecretKey secretKey = skf.generateSecret(dks); + return secretKey; + } + + + + public static void main(String[] args){ + + /* Encrypt.saveDesKey(); + System.out.println("生成key"); + Encrypt.getKey(); + System.out.println("获取key"); + try { + Encrypt.encrypt("d:\\dd.eml", "d:\\e.eml"); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + System.out.println("加密");*/ + try { + //Encrypt.decrypt("d:\\dddd.eml", "d:\\ccc.eml"); + BASE64Decoder enc=new BASE64Decoder(); + Key a=Encrypt.toKey(enc.decodeBuffer("MQ5RobbCg8s=")); + System.out.println("qqq"+Encrypt.decryptAndGetString("H:\\test.txt",a)); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + System.out.println("解密"); +// System.out.println("加密");*/ +// try { +// Encrypt.decrypt("c:/test.txt", "d:\\ccc.eml"); +// } catch (Exception e) { +// // TODO Auto-generated catch block +// e.printStackTrace(); +// } +// System.out.println("解密"); + } + +} \ No newline at end of file diff --git b/.svn/pristine/4b/4b6e2fe1ae0ff9a8ce9b1e63af52257ad080bfb4.svn-base a/.svn/pristine/4b/4b6e2fe1ae0ff9a8ce9b1e63af52257ad080bfb4.svn-base new file mode 100644 index 0000000..5e015f1 --- /dev/null +++ a/.svn/pristine/4b/4b6e2fe1ae0ff9a8ce9b1e63af52257ad080bfb4.svn-base @@ -0,0 +1,67 @@ +package com.espeed.yxy.dao.impl; + +import java.util.List; + +import com.espeed.yxy.dao.YxySendSmtpInfoDao; +import com.espeed.yxy.pojo.YxySendMailDetail; +import com.espeed.yxy.pojo.YxySendSmtpInfo; +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: SMTP DAO实现类 + * 开始时间: 2013.11.27 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +public class YxySendSmtpInfoDaoImpl extends HibernateBaseDAOImpl<YxySendSmtpInfo,Long> implements YxySendSmtpInfoDao{ + +// /**查询可用的smtp*/ +// public List<YxySendSmtpInfo> findAllSmtp(int num) throws Exception { +// String hql="from YxySendSmtpInfo where smtp_service_isuse=0 or smtp_service_isuse=1 order by smtp_service_userdate"; +// return super.getAll(hql); +// } +// /**更新smtp状态*/ +// public void updateSmtpStatus(YxySendSmtpInfo o) throws Exception { +// super.update(o); +// +// } +// /**HQL查询*/ +// public List<YxySendSmtpInfo> findByHql(String hql) throws Exception { +// +// return super.getAll(hql); +// } + + /**批量插入*/ + public void addPiPojo(List<YxySendSmtpInfo> o)throws Exception{ + super.addPi(o); + } + + /**实体添加*/ + public int addPojo(YxySendSmtpInfo o)throws Exception{ + return super.add(o); + } + + /**HQL查询*/ + public List<YxySendSmtpInfo> findByHql(String hql)throws Exception{ + return super.getAll(hql); + } + + /**SQL查询*/ + public List<Object> findbysql(String sql)throws Exception{ + return super.findBySql(sql); + } + + /**SQL更新*/ + public void updateBySql(String sql)throws Exception{ + super.updateorDelBySql(sql); + } + + /**HQL更新*/ + public void updateByHql(String hql)throws Exception{ + super.updateorDelByHql(hql); + } +} diff --git b/.svn/pristine/4c/4c1aad0c4323ee4d030f5f10edc39458d272b565.svn-base a/.svn/pristine/4c/4c1aad0c4323ee4d030f5f10edc39458d272b565.svn-base new file mode 100644 index 0000000..7281c59 --- /dev/null +++ a/.svn/pristine/4c/4c1aad0c4323ee4d030f5f10edc39458d272b565.svn-base @@ -0,0 +1,104 @@ +package com.espeed.yxy.service; + +import java.util.List; +import java.util.Map; + +import com.espeed.centre.pojo.CentreTrackSet; +import com.espeed.centre.pojo.CentreYxyedmNewcustomer; +import com.espeed.centre.pojo.CentreYxyedmOldcustomer; +import com.espeed.yxy.pojo.YxySendMailDetail; +import com.espeed.yxy.pojo.YxySendMailMaster; +import com.espeed.yxy.pojo.YxySendSmtpInfo; +import com.espeed.yxy.pojo.YxySmtpSendSelfOverset; +import com.espeed.yxy.pojo.YxySmtpSendSelfSet; +import com.espeed.yxy.pojo.YxySmtpSendSet; +import com.espeed.yxy.pojo.YxySmtpSuffixSet; +import com.espeed.yxy.pojo.YxySysParamatersValue; +import com.espeed.yxy.pojo.YxyUserAddress; +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 邮件发送service业务接口(营销游) + * 开始时间: 2013.12.09 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +public interface YxySendMailService { + + //------------------------待发邮件操作模块----------------------------- + /**查询所有待发邮件*/ + public List<YxySendMailMaster> findByMailNum(int mailNum)throws Exception; + /**修改邮件使用状态*/ + public void updateMailUseStatus(int mailid, int isuse,String timer)throws Exception; + /**修改邮件异常量*/ + public void updateMailExpStatus(int mailid,int expnum)throws Exception; + /**同时修改待发邮件状态与基本邮件信息状态*/ + public void updateMailStatus(int status,int mailid,String mailuid)throws Exception; + /**加入待发邮件*/ + public void addMailMaster(YxySendMailMaster master,List<YxyUserAddress> sendaddress,int planid,int plan_differen)throws Exception; + /**更新待发邮件图片与附件路径*/ + public void updatepicattrpath(int masterid,String picpath,String attrpath)throws Exception; + /**根据hql获取待发邮件*/ + public List<YxySendMailMaster> getMailMasterByHql(String hql)throws Exception; + //------------------------待发地址操作模块----------------------------- + /**根据待发邮件ID查询待发地址*/ + public List<YxySendMailDetail> findAddressByMailID(int mailID)throws Exception; + /**修改此地址为已发送*/ + public void updateMailDetailstatus(int addressid)throws Exception; + /**更新地址状态为异常地址*/ + public void updateExp(int addressid,int expnum)throws Exception; + /**根据邮件ID查询是否还存在待发地址*/ + public boolean isHaveAddress(int mailid)throws Exception; + //------------------------SMTP操作模块--------------------------------- + /**查询所有SMTP*/ + public List<YxySendSmtpInfo> findSmtpInfoSetNum()throws Exception; + /**更新smtp使用状态*/ + public void updateSmtpUseStatus(int status,int smtpid,String nowdate)throws Exception; + /**更新smtp状态所有的*/ + public void updatesmtpstatus()throws Exception; + /**根据客户类型查询smtp*/ + public YxySendSmtpInfo findSmtpInfoByCusType(List<YxySendSmtpInfo> smtp_list,int cus_type)throws Exception; + /**查找自主域名投递的smtp*/ + public YxySendSmtpInfo findSmtpInfoByCusType2(List<YxySendSmtpInfo> smtp_list,YxySendMailMaster master)throws Exception; + //------------------------SMTP后缀设置参数模块------------------------- + /**查询后缀信息*/ + public List<YxySmtpSuffixSet> findAllSmtpSuffixSet()throws Exception; + + + //------------------------SMTP后缀发送量模块---------------------------- + /**查询该smtp对应后缀在时间段的发送量*/ + public List<YxySmtpSendSet> findAllSmtpSendSet(String smtpservice,String nowDay)throws Exception; + /**删除后缀已发量信息*/ + public void delmSmtpSet(String smtpService)throws Exception; + /**更新发送量信息*/ + public void updateSmtpSet(List<YxySmtpSendSet> o)throws Exception; + //------------------------控制参数模块--------------------------------- + /**code查询控制参数(有用户级返回用户级,否则返回默认参数)*/ + public String findCompanyParamByCode(String code,String loginid,String domain)throws Exception; + /**paraid查询企业级控制参数*/ + public List<YxySysParamatersValue> findCompanyParamValues(String domian,int para_id)throws Exception; + + //------------------------自配SMTP发送量模块----------------------------- + /**通过smtpID查询此smtp的发送参数*/ + public List<YxySmtpSendSelfSet> findSendSelfSetByService(String smtpservice)throws Exception; + /**查询自配账号的已发送量信息*/ + public List<YxySmtpSendSelfOverset> findBySmtpAccount(String account)throws Exception; + /**添加自配账号的已发量信息*/ + public void addSendSelfSet(YxySmtpSendSelfOverset o)throws Exception; + /**更新自配已发量*/ + public void updateSendSelfSet(YxySmtpSendSelfOverset o)throws Exception; + /**查询SMTP判断是否阻塞*/ + public void updateinitsmtpstatus()throws Exception; + /**获取跟踪配置信息*/ + public List<CentreTrackSet> getTrackSetByHql(String hql)throws Exception; + /**获取开发客户配置信息*/ + public List<CentreYxyedmNewcustomer> getNewCustomerSet(String hql)throws Exception; + /**获取盘活客户配置信息*/ + public List<CentreYxyedmOldcustomer> getOldCustomerSet(String hql)throws Exception; + /**获取用户信息*/ + public List<Object> getUserInfoBySql(String sql)throws Exception; +} diff --git b/.svn/pristine/4c/4cad1d8997e44b7335cd2661bb5e2ff2b6e8d7a2.svn-base a/.svn/pristine/4c/4cad1d8997e44b7335cd2661bb5e2ff2b6e8d7a2.svn-base new file mode 100644 index 0000000..2b96abe --- /dev/null +++ a/.svn/pristine/4c/4cad1d8997e44b7335cd2661bb5e2ff2b6e8d7a2.svn-base @@ -0,0 +1,67 @@ +package com.espeed.yxy.pojo; + +import java.io.Serializable; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: smtp后缀设置信息实体(营销游) + * 开始时间: 2013.12.09 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ + +@Entity +@Table(name="yxy_smtp_suffix_set") +public class YxySmtpSuffixSet implements Serializable{ + + private int smtp_suffix_id ;//主键ID + private String smtp_suffix_name;//smtp后缀名 + private int smtp_suffix_ten;//该后缀十分钟发送量 + private int smtp_suffix_hour;//该后缀一个小时发送量 + private int smtp_suffix_day;//该后缀一天发送量 + + @Id + @GeneratedValue(strategy=GenerationType.AUTO) + public int getSmtp_suffix_id() { + return smtp_suffix_id; + } + public void setSmtp_suffix_id(int smtpSuffixId) { + smtp_suffix_id = smtpSuffixId; + } + public String getSmtp_suffix_name() { + return smtp_suffix_name; + } + public void setSmtp_suffix_name(String smtpSuffixName) { + smtp_suffix_name = smtpSuffixName; + } + public int getSmtp_suffix_ten() { + return smtp_suffix_ten; + } + public void setSmtp_suffix_ten(int smtpSuffixTen) { + smtp_suffix_ten = smtpSuffixTen; + } + public int getSmtp_suffix_hour() { + return smtp_suffix_hour; + } + public void setSmtp_suffix_hour(int smtpSuffixHour) { + smtp_suffix_hour = smtpSuffixHour; + } + public int getSmtp_suffix_day() { + return smtp_suffix_day; + } + public void setSmtp_suffix_day(int smtpSuffixDay) { + smtp_suffix_day = smtpSuffixDay; + } + + +} diff --git b/.svn/pristine/4d/4de7236a816661f1cab98965439ff5d18f6ae024.svn-base a/.svn/pristine/4d/4de7236a816661f1cab98965439ff5d18f6ae024.svn-base new file mode 100644 index 0000000..25fa414 --- /dev/null +++ a/.svn/pristine/4d/4de7236a816661f1cab98965439ff5d18f6ae024.svn-base @@ -0,0 +1,21 @@ +package com.espeed.yxy.dao.impl; + +import java.util.List; +import com.espeed.yxy.dao.YxyMarketingPlanDao; +import com.espeed.yxy.pojo.YxyMarketingPlan; + +public class YxyMarketingPlanDaoImpl extends HibernateBaseDAOImpl<YxyMarketingPlan, Long> implements YxyMarketingPlanDao { + + /**HQL查询*/ + public List<YxyMarketingPlan> findByHql(String hql)throws Exception{ + return super.getAll(hql); + } + /**指定条记录*/ + public List<YxyMarketingPlan> findByHqlSet(String hql,int num)throws Exception{ + return super.findBySet(hql, num); + } + /**HQL更新*/ + public void updateByHql(String hql)throws Exception{ + super.updateorDelByHql(hql); + } +} diff --git b/.svn/pristine/4e/4ea71601f844c4b90d22195bbdb58979281bb8b6.svn-base a/.svn/pristine/4e/4ea71601f844c4b90d22195bbdb58979281bb8b6.svn-base new file mode 100644 index 0000000..0f42d60 Binary files /dev/null and a/.svn/pristine/4e/4ea71601f844c4b90d22195bbdb58979281bb8b6.svn-base differ diff --git b/.svn/pristine/4f/4f18a3919022af59d14d69cc890cb2109b942074.svn-base a/.svn/pristine/4f/4f18a3919022af59d14d69cc890cb2109b942074.svn-base new file mode 100644 index 0000000..c75b11f --- /dev/null +++ a/.svn/pristine/4f/4f18a3919022af59d14d69cc890cb2109b942074.svn-base @@ -0,0 +1,40 @@ +package com.espeed.yxy.dao.impl; + +import java.util.List; + +import com.espeed.centre.pojo.CentreYxyedmOldcustomer; +import com.espeed.yxy.dao.CentreYxyedmOldcustomerDao; +/** + * 项目名称: 统一验证中心系统 + * 版权所有: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 技术支持: info@21gmail.com + * 单元名称: 营销邮盘活客户配置Dao实现类 + * 开始时间: 2018.04.08 + * 开发人员: 陈南巧 + */ +public class CentreYxyedmOldcustomerDaoImpl extends CentreHibernateBaseDAOImpl<CentreYxyedmOldcustomer, Long> implements CentreYxyedmOldcustomerDao { + /**实体插入*/ + public int addPojo(CentreYxyedmOldcustomer o)throws Exception{ + return super.add(o); + } + /**实体编辑*/ + public void updatePojo(CentreYxyedmOldcustomer o)throws Exception{ + super.update(o); + } + /**HQL查询*/ + public List<CentreYxyedmOldcustomer> findByHql(String hql)throws Exception{ + return super.getAll(hql); + } + /**HQL查询数量*/ + public int findByHqlCount(String hql)throws Exception{ + return super.count(hql); + } + /**SQL查询*/ + public List<Object> findBySqlFind(String sql)throws Exception{ + return super.findBySql(sql); + } + /**HQL更新*/ + public void updateByHql(String hql)throws Exception{ + super.updateorDelBySql(hql); + } +} diff --git b/.svn/pristine/4f/4fd4c6110e9bca3a655b717eb2e5920febb8403d.svn-base a/.svn/pristine/4f/4fd4c6110e9bca3a655b717eb2e5920febb8403d.svn-base new file mode 100644 index 0000000..faea056 Binary files /dev/null and a/.svn/pristine/4f/4fd4c6110e9bca3a655b717eb2e5920febb8403d.svn-base differ diff --git b/.svn/pristine/56/561e1c6e587002df7ed28c9be163cc218619c8d4.svn-base a/.svn/pristine/56/561e1c6e587002df7ed28c9be163cc218619c8d4.svn-base new file mode 100644 index 0000000..630d9fe Binary files /dev/null and a/.svn/pristine/56/561e1c6e587002df7ed28c9be163cc218619c8d4.svn-base differ diff --git b/.svn/pristine/56/56a0dc58b7f3a9c83bb9aac083acf4ee405b8c5b.svn-base a/.svn/pristine/56/56a0dc58b7f3a9c83bb9aac083acf4ee405b8c5b.svn-base new file mode 100644 index 0000000..a0f0ccd Binary files /dev/null and a/.svn/pristine/56/56a0dc58b7f3a9c83bb9aac083acf4ee405b8c5b.svn-base differ diff --git b/.svn/pristine/58/58385f8e456166cacf5ce8c4b183410ed015f212.svn-base a/.svn/pristine/58/58385f8e456166cacf5ce8c4b183410ed015f212.svn-base new file mode 100644 index 0000000..282e1c6 --- /dev/null +++ a/.svn/pristine/58/58385f8e456166cacf5ce8c4b183410ed015f212.svn-base @@ -0,0 +1,52 @@ +package com.espeed.yxy.dao.impl; + +import java.util.List; + +import com.espeed.webmail.pojo.YxyCustomerEmail; +import com.espeed.yxy.dao.YxyCustomerEmailDao; + +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 分类下的所有dao实现类(营销游) + * 开始时间: 2015.04.08 + * 程 序 员: 陈南巧 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +public class YxyCustomerEmailDaoImpl extends WebmailHibernateBaseDAOImpl<YxyCustomerEmail, Long> implements YxyCustomerEmailDao{ + + /**实体插入*/ + public int addPojo(YxyCustomerEmail o)throws Exception{ + return super.add(o); + } + /**实体编辑*/ + public void updatePojo(YxyCustomerEmail o)throws Exception{ + super.update(o); + } + /**HQL查询*/ + public List<YxyCustomerEmail> findByHql(String hql)throws Exception{ + return super.getAll(hql); + } + /**HQL数量查询*/ + public int findByHqlCount(String hql)throws Exception{ + return super.count(hql); + } + /**指定条记录*/ + public List<YxyCustomerEmail> findByHqlSet(String hql,int num)throws Exception{ + return super.findBySet(hql, num); + } + + /**SQL查询*/ + public List<Object> findBySqlQuery(String sql)throws Exception{ + return super.findBySql(sql); + } + /**HQL更新*/ + public void updateByHql(String hql)throws Exception{ + super.updateorDelBySql(hql); + } + +} diff --git b/.svn/pristine/5a/5ac5dc01d211bd588d43ecaa39c5fe1108b3260c.svn-base a/.svn/pristine/5a/5ac5dc01d211bd588d43ecaa39c5fe1108b3260c.svn-base new file mode 100644 index 0000000..dd7eef5 --- /dev/null +++ a/.svn/pristine/5a/5ac5dc01d211bd588d43ecaa39c5fe1108b3260c.svn-base @@ -0,0 +1,128 @@ +package com.espeed.yxy.pojo; + +import java.io.Serializable; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; + +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: smtp实体(营销游) + * 开始时间: 2013.12.09 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +@Entity +@Table(name="yxy_send_smtp_info") +public class YxySendSmtpInfo implements Serializable{ + private static final long serialVersionUID = 1L; + private int smtp_service_id;//主键ID + private String smtp_service_number;//smtp服务器 + private String smtp_service_account;//smtp账号 + private String smtp_service_password;//smtp密码 + private int smtp_service_isyxy;//是自配还是运营0默认自配1:运营 + private String smtp_service_creatdate;//创建时间 + private String smtp_service_userdate;//发第一封的时间 + private int smtp_service_isuse;//该smtp是否可用...0可用1不可用 + private int smtp_service_sendNum;//smtp发送封数 + private String smtp_user_loginid;//用户账号 + private String smtp_user_domain;//用户所属域名 + private int smtp_is_ssl;//是否使用SSL加密 + private String smtp_service_port;//端口 + private int smtp_service_type;//0:新客户营销,1:老客户跟进,2:自主域名投递 + + @Id + @GeneratedValue(strategy=GenerationType.AUTO) + public int getSmtp_service_id() { + return smtp_service_id; + } + public void setSmtp_service_id(int smtpServiceId) { + smtp_service_id = smtpServiceId; + } + public String getSmtp_service_number() { + return smtp_service_number; + } + public void setSmtp_service_number(String smtpServiceNumber) { + smtp_service_number = smtpServiceNumber; + } + public String getSmtp_service_account() { + return smtp_service_account; + } + public void setSmtp_service_account(String smtpServiceAccount) { + smtp_service_account = smtpServiceAccount; + } + public String getSmtp_service_password() { + return smtp_service_password; + } + public void setSmtp_service_password(String smtpServicePassword) { + smtp_service_password = smtpServicePassword; + } + public String getSmtp_service_creatdate() { + return smtp_service_creatdate; + } + public void setSmtp_service_creatdate(String smtpServiceCreatdate) { + smtp_service_creatdate = smtpServiceCreatdate; + } + public String getSmtp_service_userdate() { + return smtp_service_userdate; + } + public void setSmtp_service_userdate(String smtpServiceUserdate) { + smtp_service_userdate = smtpServiceUserdate; + } + public int getSmtp_service_isuse() { + return smtp_service_isuse; + } + public void setSmtp_service_isuse(int smtpServiceIsuse) { + smtp_service_isuse = smtpServiceIsuse; + } + public int getSmtp_service_sendNum() { + return smtp_service_sendNum; + } + public void setSmtp_service_sendNum(int smtpServiceSendNum) { + smtp_service_sendNum = smtpServiceSendNum; + } + public int getSmtp_service_isyxy() { + return smtp_service_isyxy; + } + public void setSmtp_service_isyxy(int smtpServiceIsyxy) { + smtp_service_isyxy = smtpServiceIsyxy; + } + public String getSmtp_user_loginid() { + return smtp_user_loginid; + } + public void setSmtp_user_loginid(String smtpUserLoginid) { + smtp_user_loginid = smtpUserLoginid; + } + public String getSmtp_user_domain() { + return smtp_user_domain; + } + public void setSmtp_user_domain(String smtpUserDomain) { + smtp_user_domain = smtpUserDomain; + } + public int getSmtp_is_ssl() { + return smtp_is_ssl; + } + public void setSmtp_is_ssl(int smtp_is_ssl) { + this.smtp_is_ssl = smtp_is_ssl; + } + public String getSmtp_service_port() { + return smtp_service_port; + } + public void setSmtp_service_port(String smtp_service_port) { + this.smtp_service_port = smtp_service_port; + } + public int getSmtp_service_type() { + return smtp_service_type; + } + public void setSmtp_service_type(int smtp_service_type) { + this.smtp_service_type = smtp_service_type; + } +} diff --git b/.svn/pristine/5a/5ae74e0fa5ff2d23eb12c8205afba1ff66382c2c.svn-base a/.svn/pristine/5a/5ae74e0fa5ff2d23eb12c8205afba1ff66382c2c.svn-base new file mode 100644 index 0000000..4683052 --- /dev/null +++ a/.svn/pristine/5a/5ae74e0fa5ff2d23eb12c8205afba1ff66382c2c.svn-base @@ -0,0 +1,51 @@ +package com.espeed.centre.pojo; + +import java.io.Serializable; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; +/** + * 项目名称: 统一验证中心系统 + * 版权所有: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 技术支持: info@21gmail.com + * 单元名称: 中央数据库用户实体类 + * 开始时间: 2017.09.29 + * 开发人员: 陈南巧 + */ +@Entity +@Table(name="centre_user") +public class CentreUser implements Serializable{ + private static final long serialVersionUID = 1L; + private int user_id;//用户id + private String user_name;//姓名 + private String login_id;//帐号 + private int company_id;//企业id + @Id + @GeneratedValue(strategy=GenerationType.AUTO) + public int getUser_id() { + return user_id; + } + public void setUser_id(int user_id) { + this.user_id = user_id; + } + public String getLogin_id() { + return login_id; + } + public void setLogin_id(String login_id) { + this.login_id = login_id; + } + public int getCompany_id() { + return company_id; + } + public void setCompany_id(int company_id) { + this.company_id = company_id; + } + public String getUser_name() { + return user_name; + } + public void setUser_name(String user_name) { + this.user_name = user_name; + } +} diff --git b/.svn/pristine/5c/5cd40f56e86b43b0e1b7cc9a53b4cdb1dd10e55a.svn-base a/.svn/pristine/5c/5cd40f56e86b43b0e1b7cc9a53b4cdb1dd10e55a.svn-base new file mode 100644 index 0000000..9042580 --- /dev/null +++ a/.svn/pristine/5c/5cd40f56e86b43b0e1b7cc9a53b4cdb1dd10e55a.svn-base @@ -0,0 +1,21 @@ +package com.espeed.yxy.dao.impl; + +import java.util.List; +import com.espeed.yxy.dao.YxyMarketingWeekDao; +import com.espeed.yxy.pojo.YxyMarketingWeek; + +public class YxyMarketingWeekDaoImpl extends HibernateBaseDAOImpl<YxyMarketingWeek, Long> implements YxyMarketingWeekDao { + + /**HQL查询*/ + public List<YxyMarketingWeek> findByHql(String hql)throws Exception{ + return super.getAll(hql); + } + /**指定条记录*/ + public List<YxyMarketingWeek> findByHqlSet(String hql,int num)throws Exception{ + return super.findBySet(hql, num); + } + /**HQL更新*/ + public void updateByHql(String hql) throws Exception { + super.updateorDelByHql(hql); + } +} diff --git b/.svn/pristine/5d/5d3ccc056b6f056dbf0dddfdf43894b9065a8f94.svn-base a/.svn/pristine/5d/5d3ccc056b6f056dbf0dddfdf43894b9065a8f94.svn-base new file mode 100644 index 0000000..c8c4dbb Binary files /dev/null and a/.svn/pristine/5d/5d3ccc056b6f056dbf0dddfdf43894b9065a8f94.svn-base differ diff --git b/.svn/pristine/5e/5eba9bcfc10f12cce877bd53eb24f4bac1269f89.svn-base a/.svn/pristine/5e/5eba9bcfc10f12cce877bd53eb24f4bac1269f89.svn-base new file mode 100644 index 0000000..b2d73da --- /dev/null +++ a/.svn/pristine/5e/5eba9bcfc10f12cce877bd53eb24f4bac1269f89.svn-base @@ -0,0 +1,56 @@ +<?xml version="1.0" encoding="UTF-8"?> +<web-app version="2.5" + xmlns="http://java.sun.com/xml/ns/javaee" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://java.sun.com/xml/ns/javaee + http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> + + <filter> + <filter-name>openSessionInView</filter-name> + <filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class> + </filter> + + <filter-mapping> + <filter-name>openSessionInView</filter-name> + <url-pattern>/*</url-pattern> + </filter-mapping> + + + + + <!-- 配置spring监听器 --> + <context-param> + <param-name>contextConfigLocation</param-name> + <param-value>classpath:applicationContext.xml</param-value> + </context-param> + <listener> + <listener-class> + org.springframework.web.context.ContextLoaderListener + </listener-class> + </listener> + + <!-- Spring乱码处理 --> + <filter> + <filter-name>characterEncoding</filter-name> + <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class> + <init-param> + <param-name>encoding</param-name> + <param-value>UTF-8</param-value> + </init-param> + <init-param> + <param-name>forceEncoding</param-name> + <param-value>true</param-value> + </init-param> + </filter> + + <welcome-file-list> + <welcome-file>index.jsp</welcome-file> + </welcome-file-list> + + <!-- 开机运行方法 --> + <servlet> + <servlet-name>initServlet</servlet-name> + <servlet-class>com.espeed.yxy.tool.ServiceInit</servlet-class> + <load-on-startup>1</load-on-startup> + </servlet> +</web-app> diff --git b/.svn/pristine/5e/5ef222d7906bb1b1b4b684ea995ba00c9b4af829.svn-base a/.svn/pristine/5e/5ef222d7906bb1b1b4b684ea995ba00c9b4af829.svn-base new file mode 100644 index 0000000..ca7055a --- /dev/null +++ a/.svn/pristine/5e/5ef222d7906bb1b1b4b684ea995ba00c9b4af829.svn-base @@ -0,0 +1,42 @@ +package com.espeed.yxy.dao; + +import java.util.List; +import com.espeed.yxy.pojo.YxySendSmtpInfo; + +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: SMTP DAO(营销游) + * 开始时间: 2013.12.09 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +public interface YxySendSmtpInfoDao { +// /**查询可用的smtp*/ +// public List<YxySendSmtpInfo> findAllSmtp(int num)throws Exception; +// /**更新smtp状态*/ +// public void updateSmtpStatus(YxySendSmtpInfo o)throws Exception; +// /**HQL查询*/ +// public List<YxySendSmtpInfo> findByHql(String hql)throws Exception; + /**批量插入*/ + public void addPiPojo(List<YxySendSmtpInfo> o)throws Exception; + + /**实体添加*/ + public int addPojo(YxySendSmtpInfo o)throws Exception; + + /**HQL查询*/ + public List<YxySendSmtpInfo> findByHql(String hql)throws Exception; + + /**SQL查询*/ + public List<Object> findbysql(String sql)throws Exception; + + /**SQL更新*/ + public void updateBySql(String sql)throws Exception; + + /**HQL更新*/ + public void updateByHql(String hql)throws Exception; +} diff --git b/.svn/pristine/61/6192eba9690fd0c40bdbd1d9537ee98a5d89acea.svn-base a/.svn/pristine/61/6192eba9690fd0c40bdbd1d9537ee98a5d89acea.svn-base new file mode 100644 index 0000000..6d93b6c Binary files /dev/null and a/.svn/pristine/61/6192eba9690fd0c40bdbd1d9537ee98a5d89acea.svn-base differ diff --git b/.svn/pristine/61/61fa4b50d2555001c7050cc4f291cf27bed4c3dc.svn-base a/.svn/pristine/61/61fa4b50d2555001c7050cc4f291cf27bed4c3dc.svn-base new file mode 100644 index 0000000..f1ce22a --- /dev/null +++ a/.svn/pristine/61/61fa4b50d2555001c7050cc4f291cf27bed4c3dc.svn-base @@ -0,0 +1,260 @@ +package com.espeed.yxy.pojo; + +import java.io.Serializable; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Transient; +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 邮件基本信息实体(营销游) + * 开始时间: 2013.12.09 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +@Entity +@Table(name="yxy_send_mail_master_base") +public class YxySendMailMasterBase implements Serializable{ + private static final long serialVersionUID = 1L; + private int send_mail_id;//发送邮件ID + private String user_loginid;//创建用户账号 + private String user_domain;//创建用户域名 + private String create_time;//创建时间 + private int is_unsubscribe;//是否退订 + private int unsubscribe_language;//退订选择语言(0.中文1.英文) + private int include_link;//是否包含嵌入链接 + private String link_context;//链接地址 + private String mail_account;//发送邮箱账号 + private String sender;//发件人 + private String send_email;//发件人邮箱 + private String reply_email;//回复邮箱 + private String subject;//主题 + private int auto_change_subject;//是否多主题变换 + private String body;//邮件正文 + private String attarchment_path ;//附件保存路径 + private String image_path;//图片保存路径 + private String eml_file_path;//EML文件路径 + private String eml_encode_key;//EML文件KEY + private int mail_size;//邮件大小 + private int plans_send;//是否定时发送 + private String plans_send_time;//定时发送时间 + private int status ;//处理状态 + private int folder_id;//所属文件夹ID + private String mail_uid; //mail唯一性标识 + private int is_high_precision;//是否使用高精准发信 + private int exptionnum;//发送过程中异常的次数 + private String txtaddresspath;//txt地址文件路径 + private int send_num;//发送量 + private int isuse;//是否使用中 + private int sendci;//发送次数 + private int iscrm;//是不是老客户营销 + private int isold; + @Id + @GeneratedValue(strategy=GenerationType.AUTO) + public int getSend_mail_id() { + return send_mail_id; + } + public void setSend_mail_id(int sendMailId) { + send_mail_id = sendMailId; + } + public String getUser_loginid() { + return user_loginid; + } + public void setUser_loginid(String userLoginid) { + user_loginid = userLoginid; + } + public String getUser_domain() { + return user_domain; + } + public void setUser_domain(String userDomain) { + user_domain = userDomain; + } + public String getCreate_time() { + return create_time; + } + public void setCreate_time(String createTime) { + create_time = createTime; + } + public int getIs_unsubscribe() { + return is_unsubscribe; + } + public void setIs_unsubscribe(int isUnsubscribe) { + is_unsubscribe = isUnsubscribe; + } + public int getUnsubscribe_language() { + return unsubscribe_language; + } + public void setUnsubscribe_language(int unsubscribeLanguage) { + unsubscribe_language = unsubscribeLanguage; + } + public int getInclude_link() { + return include_link; + } + public void setInclude_link(int includeLink) { + include_link = includeLink; + } + public String getLink_context() { + return link_context; + } + public void setLink_context(String linkContext) { + link_context = linkContext; + } + public String getMail_account() { + return mail_account; + } + public void setMail_account(String mailAccount) { + mail_account = mailAccount; + } + public String getSender() { + return sender; + } + public void setSender(String sender) { + this.sender = sender; + } + public String getSend_email() { + return send_email; + } + public void setSend_email(String sendEmail) { + send_email = sendEmail; + } + public String getReply_email() { + return reply_email; + } + public void setReply_email(String replyEmail) { + reply_email = replyEmail; + } + public String getSubject() { + return subject; + } + public void setSubject(String subject) { + this.subject = subject; + } + public int getAuto_change_subject() { + return auto_change_subject; + } + public void setAuto_change_subject(int autoChangeSubject) { + auto_change_subject = autoChangeSubject; + } + public String getBody() { + return body; + } + public void setBody(String body) { + this.body = body; + } + public String getAttarchment_path() { + return attarchment_path; + } + public void setAttarchment_path(String attarchmentPath) { + attarchment_path = attarchmentPath; + } + public String getImage_path() { + return image_path; + } + public void setImage_path(String imagePath) { + image_path = imagePath; + } + public String getEml_file_path() { + return eml_file_path; + } + public void setEml_file_path(String emlFilePath) { + eml_file_path = emlFilePath; + } + public String getEml_encode_key() { + return eml_encode_key; + } + public void setEml_encode_key(String emlEncodeKey) { + eml_encode_key = emlEncodeKey; + } + public int getMail_size() { + return mail_size; + } + public void setMail_size(int mailSize) { + mail_size = mailSize; + } + public int getPlans_send() { + return plans_send; + } + public void setPlans_send(int plansSend) { + plans_send = plansSend; + } + public String getPlans_send_time() { + return plans_send_time; + } + public void setPlans_send_time(String plansSendTime) { + plans_send_time = plansSendTime; + } + public int getStatus() { + return status; + } + public void setStatus(int status) { + this.status = status; + } + public int getFolder_id() { + return folder_id; + } + public void setFolder_id(int folderId) { + folder_id = folderId; + } + public String getMail_uid() { + return mail_uid; + } + public void setMail_uid(String mailUid) { + mail_uid = mailUid; + } + public int getIs_high_precision() { + return is_high_precision; + } + public void setIs_high_precision(int isHighPrecision) { + is_high_precision = isHighPrecision; + } + public int getExptionnum() { + return exptionnum; + } + public void setExptionnum(int exptionnum) { + this.exptionnum = exptionnum; + } + public String getTxtaddresspath() { + return txtaddresspath; + } + public void setTxtaddresspath(String txtaddresspath) { + this.txtaddresspath = txtaddresspath; + } + public int getSend_num() { + return send_num; + } + public void setSend_num(int sendNum) { + send_num = sendNum; + } + public int getIsuse() { + return isuse; + } + public void setIsuse(int isuse) { + this.isuse = isuse; + } + public int getSendci() { + return sendci; + } + public void setSendci(int sendci) { + this.sendci = sendci; + } + public int getIscrm() { + return iscrm; + } + public void setIscrm(int iscrm) { + this.iscrm = iscrm; + } + public int getIsold() { + return isold; + } + public void setIsold(int isold) { + this.isold = isold; + } +} diff --git b/.svn/pristine/65/655e7a7414071aea80946e20bab966286584b31b.svn-base a/.svn/pristine/65/655e7a7414071aea80946e20bab966286584b31b.svn-base new file mode 100644 index 0000000..479ed47 --- /dev/null +++ a/.svn/pristine/65/655e7a7414071aea80946e20bab966286584b31b.svn-base @@ -0,0 +1,811 @@ +package com.espeed.yxy.mail; + +import java.io.File; +import java.io.PrintWriter; +import java.io.StringWriter; +import java.net.URLEncoder; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Date; +import java.util.HashSet; +import java.util.List; +import java.util.Properties; +import java.util.Random; +import java.util.Set; + +import javax.activation.DataHandler; +import javax.activation.FileDataSource; +import javax.mail.Message; +import javax.mail.Transport; +import javax.mail.internet.InternetAddress; +import javax.mail.internet.MimeBodyPart; +import javax.mail.internet.MimeMessage; +import javax.mail.internet.MimeMultipart; +import javax.mail.internet.MimeUtility; + +import org.jsoup.Jsoup; +import org.jsoup.nodes.Document; +import org.jsoup.nodes.Element; +import org.jsoup.select.Elements; + +import com.espeed.centre.pojo.CentreTrackSet; +import com.espeed.centre.pojo.CentreYxyedmNewcustomer; +import com.espeed.centre.pojo.CentreYxyedmOldcustomer; +import com.espeed.yxy.pojo.YxySendMailDetail; +import com.espeed.yxy.pojo.YxySendMailMaster; +import com.espeed.yxy.pojo.YxySendSmtpInfo; +import com.espeed.yxy.service.YxySendMailService; +import com.espeed.yxy.tool.ConfigPath; +import com.espeed.yxy.tool.LogsTool; +import com.espeed.yxy.util.AnalysisMail; +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 邮件发送方法(营销游) + * 开始时间: 2013.12.09 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +public class YxySendMail { + + //个人版营销邮的域名集合 + private static String[] domainArray = new String[]{ + "waimaoyou.cn","tomex.com.cn","mkonegroup.com","cposl.com", + "chinastonefactory.com","bf6-led.com","yexinglonggroup.com","wheelnutcn.com", + "aokwater.com","hesunny-international.com","szkring.com","sumaonetting.com", + "trsolidcontrol.com","ywksmy.com","sschgroup.com","tf_accessories.com", + "moeatsu.com","chipsen.com","aishine.com","cnbigjeans.com" + }; + + /**发送邮件(业务判断)*/ + public void sendMailMethod(List<YxySendMailDetail> addressList,YxySendMailService sendmailservice,YxySendSmtpInfo SmtpInfo,YxySendMailMaster mailinfo,Properties props,Transport transport){ + //变量定义 + int mailid=0;//邮件ID + String mailuid="";//邮件UID + int addressid=0;//地址ID + int expnum=0;//地址异常量 + try { + mailid=mailinfo.getSend_mail_id();//邮件ID + mailuid=mailinfo.getMail_uid();//邮件UID + //变量赋值 + MimeMessage mimeMsg = null; //MIME邮件对象 + String servername=SmtpInfo.getSmtp_service_account();//smtp账号 + javax.mail.Session mailSession = null; + + //是自配还是运营 + //int isyxy=SmtpInfo.getSmtp_service_isyxy(); + + //此邮件所属用户ID + String loginid=mailinfo.getUser_loginid(); + loginid=loginid.replaceAll(" ", ""); + String domain=mailinfo.getUser_domain(); + domain=domain.replaceAll(" ", ""); + //用户eml文件路径 + String useremlpath=sendmailservice.findCompanyParamByCode("yxy_user_data_save_path",loginid,domain); + if(useremlpath==null||useremlpath.equals("")||useremlpath.equals("-1")){ + //系统级 + useremlpath=sendmailservice.findCompanyParamByCode("yxy_domain_save_path",loginid,domain); + } + mailSession = javax.mail.Session.getInstance(props); + //以下判断是个人版营销邮还是易外销营销邮 + String centersys=ConfigPath.getYxyServicePath();//默认是易外销营销邮 + if(Arrays.asList(domainArray).contains(mailinfo.getUser_domain())){//是单独营销邮 + centersys=ConfigPath.getYxyServicePath2(); + } + //3.收件人 + InternetAddress[] sendTo = new InternetAddress[addressList.size()]; + //4.加入点读服务器访问地址 + String nurl = ""; + if(mailinfo.getIsold()==0 || mailinfo.getIsold()==5 || mailinfo.getIsold()==6)//新客户营销 + { + nurl=ConfigPath.getClickService(); + } + else if(mailinfo.getIsold()==1 || mailinfo.getIsold()==4)//老客户跟进或CRM库超标发送 + { + nurl=ConfigPath.getClickService2(); + } + else if(mailinfo.getIsold()==2 || mailinfo.getIsold()==3)//代发模式或自有域名 + { + //获取跟踪配置信息 + String track_hql = "from CentreTrackSet where company_doamin = '"+mailinfo.getUser_domain()+"' and type = 1 and status = 1"; + List<CentreTrackSet> tracks = sendmailservice.getTrackSetByHql(track_hql); + if(tracks.size() > 0){//有跟踪配置信息则使用配置里面的链接 + nurl = "http://"+tracks.get(0).getDomain()+"/"; + }else{//否则使用默认的老客户跟进链接 + nurl=ConfigPath.getClickService2(); + } + } + else{//否则取默认的老客户跟进链接 + nurl=ConfigPath.getClickService2(); + } + //6.解析eml文件获取内容 + AnalysisMail paxlmail=new AnalysisMail(); + String emlpath=mailinfo.getEml_file_path().replace("#####", useremlpath); + List paxlresult=paxlmail.ParseEmlMethod(emlpath, mailinfo.getEml_encode_key()); + + //内容 + String mailcontext=paxlresult.get(0).toString(); + + //是否加入链接地址 + String linkaddress=""; + if(mailinfo.getInclude_link()==1){ + if(mailinfo.getUnsubscribe_language()==1){//英文 + linkaddress= "<p align=\"center\" style=\"color: #999999;font-size: 12px;\">Access to more detailed :" + + "<a href=\""+ mailinfo.getLink_context() + "\">" + "webpage" + + "</a></p>"; + }else{ + linkaddress= "<p align=\"center\" style=\"color: #999999;font-size: 12px;\">如无法正常显示,请点击:<a href=\"" + + mailinfo.getLink_context() + "\">" + "网页链接" + + "</a></p>"; + } + mailcontext=mailcontext+linkaddress; + } + + //设置from、to等信息 + mimeMsg = new javax.mail.internet.MimeMessage(mailSession); + + //之前的新客户营销、之前的老客户跟进、CRM库自有域名、CRM库超标、新客户营销-自有域名 + if(mailinfo.getIsold()==0 || + mailinfo.getIsold()==1 || + mailinfo.getIsold()==3 || + mailinfo.getIsold()==4 || + mailinfo.getIsold()==5){ + //发件人 + String sender = mailinfo.getSender(); + //发件人地址 + String sendEmail = mailinfo.getSend_email().replace("_", ""); + //回复地址 + String replyEmail = mailinfo.getReply_email().replace("_", ""); + //邮件中的sender + InternetAddress senderAddr = new InternetAddress(servername,sender,"UTF-8"); + mimeMsg.setSender(senderAddr); + //邮件中的from + InternetAddress fromAddr = new InternetAddress(sendEmail,sender,"UTF-8"); + mimeMsg.setFrom(fromAddr); + //邮件中的reply + InternetAddress replyAddr = new InternetAddress(replyEmail); + mimeMsg.setReplyTo(new InternetAddress[]{replyAddr}); + }else if(mailinfo.getIsold()==2){//CRM库代发模式 + String hql = "from CentreYxyedmOldcustomer where company_domain = '"+domain+"'"; + List<CentreYxyedmOldcustomer> oldset = sendmailservice.getOldCustomerSet(hql); + if(oldset.size() > 0){//有配置信息 + //发件人 + String sender = oldset.get(0).getSender_name(); + //发件人地址 + String sendEmail = oldset.get(0).getSender_email().replace("_", ""); + //回复地址 + String replyEmail = mailinfo.getReply_email().replace("_", ""); + //邮件中的sender + InternetAddress senderAddr = new InternetAddress(servername,sender,"UTF-8"); + mimeMsg.setSender(senderAddr); + //邮件中的from + InternetAddress fromAddr = new InternetAddress(sendEmail,sender,"UTF-8"); + mimeMsg.setFrom(fromAddr); + //邮件中的reply + InternetAddress replyAddr = new InternetAddress(replyEmail); + mimeMsg.setReplyTo(new InternetAddress[]{replyAddr}); + }else{//无配置信息 + //发件人 + String sender = mailinfo.getSender(); + //发件人地址 + String sendEmail = mailinfo.getSend_email().replace("_", ""); + //回复地址 + String replyEmail = mailinfo.getReply_email().replace("_", ""); + //邮件中的sender + InternetAddress senderAddr = new InternetAddress(servername,sender,"UTF-8"); + mimeMsg.setSender(senderAddr); + //邮件中的from + InternetAddress fromAddr = new InternetAddress(sendEmail,sender,"UTF-8"); + mimeMsg.setFrom(fromAddr); + //邮件中的reply + InternetAddress replyAddr = new InternetAddress(replyEmail); + mimeMsg.setReplyTo(new InternetAddress[]{replyAddr}); + } + }else if(mailinfo.getIsold()==6){//新客户营销-自有域名超标或代发模式没超标 + String hql = "from CentreYxyedmNewcustomer where company_domain = '"+domain+"'"; + List<CentreYxyedmNewcustomer> newset = sendmailservice.getNewCustomerSet(hql); + if(newset.size() > 0){//有配置信息 + if(newset.get(0).getType() == 1){//代发模式没超标 + //发件人 + String sender = newset.get(0).getSender_name(); + //发件人地址 + String sendEmail = newset.get(0).getSender_email().replace("_", ""); + //回复地址 + String replyEmail = mailinfo.getReply_email().replace("_", ""); + //邮件中的sender + InternetAddress senderAddr = new InternetAddress(servername,sender,"UTF-8"); + mimeMsg.setSender(senderAddr); + //邮件中的from + InternetAddress fromAddr = new InternetAddress(sendEmail,sender,"UTF-8"); + mimeMsg.setFrom(fromAddr); + //邮件中的reply + InternetAddress replyAddr = new InternetAddress(replyEmail); + mimeMsg.setReplyTo(new InternetAddress[]{replyAddr}); + }else{//自有域名超标 + //发件人 + String sender = mailinfo.getSender(); + //发件人地址 + String sendEmail = mailinfo.getSend_email().replace("_", ""); + //回复地址 + String replyEmail = mailinfo.getReply_email().replace("_", ""); + //邮件中的sender + InternetAddress senderAddr = new InternetAddress(servername,sender,"UTF-8"); + mimeMsg.setSender(senderAddr); + //邮件中的from + InternetAddress fromAddr = new InternetAddress(sendEmail,sender,"UTF-8"); + mimeMsg.setFrom(fromAddr); + //邮件中的reply + InternetAddress replyAddr = new InternetAddress(replyEmail); + mimeMsg.setReplyTo(new InternetAddress[]{replyAddr}); + } + }else{//无配置信息 + //发件人 + String sender = mailinfo.getSender(); + //发件人地址 + String sendEmail = mailinfo.getSend_email().replace("_", ""); + //回复地址 + String replyEmail = mailinfo.getReply_email().replace("_", ""); + //邮件中的sender + InternetAddress senderAddr = new InternetAddress(servername,sender,"UTF-8"); + mimeMsg.setSender(senderAddr); + //邮件中的from + InternetAddress fromAddr = new InternetAddress(sendEmail,sender,"UTF-8"); + mimeMsg.setFrom(fromAddr); + //邮件中的reply + InternetAddress replyAddr = new InternetAddress(replyEmail); + mimeMsg.setReplyTo(new InternetAddress[]{replyAddr}); + } + } + + //设置信件头的发送日期 + mimeMsg.setSentDate(new Date()); + + //定义附件 + String parstattr=""; + String attrPath[]=null; + String attrName[]=null; + if(mailinfo.getAttarchment_path()!=null&&!mailinfo.getAttarchment_path().equals("")){ + //包含的多个附件拆解 + String[] splitPath=mailinfo.getAttarchment_path().split("##P##"); + if(splitPath.length>=2){ + attrPath=splitPath[1].split(",");//定义附件名 + attrName=new String[attrPath.length]; + for(int a=0;a<attrPath.length;a++){ + String[] splitStr=attrPath[a].split("#####"); + attrPath[a]=centersys+"\\mailtempfile\\"+domain+"\\"+loginid+"\\attachment\\"+splitStr[0];//附件路径 + attrName[a]=splitStr[1]; + //判断是否存在文件 + File f=new File(attrPath[a]); + if(!f.exists()){//如果不存在则重新解析 + parstattr=paxlmail.parsePicOrAttr(emlpath, mailinfo.getEml_encode_key(),1, centersys+"\\mailtempfile\\"+domain+"\\"+loginid+"\\attachment\\"); + String[] attrresult=parstattr.split(",");//多个分割 + parstattr=centersys+"##P##"+parstattr; + attrPath=new String[attrresult.length]; + attrName=new String[attrresult.length]; + for(int s=0;s<attrresult.length;s++){ + String[] attrname=attrresult[s].split("#####"); + attrPath[s]=centersys+"\\"+attrname[0]; + attrName[s]=attrname[1]; + } + break; + } + } + } + } + //定义图片part + String [] picPath=null; + String parstpic=""; + if(mailinfo.getImage_path()!=null&&!mailinfo.getImage_path().equals("")){ + picPath=mailinfo.getImage_path().split("#####"); + for(int i=0;i<picPath.length;i++){ + String picpath=centersys+"\\mailtempfile\\"+domain+"\\"+loginid+"\\pic\\"+picPath[i]; + //判断图片是否存在 + File f=new File(picpath); + if(!f.exists()){//如果不存在则重新解析 + parstpic=paxlmail.parsePicOrAttr(emlpath, mailinfo.getEml_encode_key(), 2, centersys+"\\mailtempfile\\"+domain+"\\"+loginid+"\\pic\\"); + picPath=parstpic.split("#####"); + break; + } + } + } + //更新邮件信息 + sendmailservice.updatepicattrpath(mailid, parstpic, parstattr); + //内容处理 + //1.内容加入点击地址 + mailcontext+="<img alt=\"trackimg\" src=\"" + nurl + "clickesemail.jsp?to=#RcevieEmail#&mailuid="+mailuid+"&loginid="+loginid+"&domain="+domain+"\" width=0 height=0 />"; + //2.判断是否加入退订 + String linkback=""; + //Header中的退订信息 + String listUnsubscribeStr=""; + if(mailinfo.getIs_unsubscribe()==1){ + listUnsubscribeStr=nurl+"Unsubscribe.jsp?loginid="+loginid+"&domain="+domain+"&mailuid="+mailuid+"&address=#RcevieEmail#"; + //显示中文还是英文 + if(mailinfo.getUnsubscribe_language()==2){//英文 + linkback= "<p align=\"center\" style=\"olor: #999999;font-size: 12px;\">If you don't want to receive these emails in the future,<a href=\"" + nurl + + "Unsubscribe.jsp?loginid=" + + loginid + + "&domain=" + domain + + "&mailuid=" + mailuid + + "&address=#RcevieEmail#" + + "\">" + "please.Unsubscribe,Thanks!" + "</a></p>"; + }else if(mailinfo.getUnsubscribe_language()==1){//中文 + linkback= "<p align=\"center\" style=\"color: #999999;font-size: 12px;\">如果您不需要此邮件,请点击:<a href=\"" + nurl + + "Unsubscribe.jsp?loginid=" + + loginid + + "&domain=" + domain + + "&mailuid=" + mailuid + + "&address=#RcevieEmail#" + + "\">" + "退订" + "</a></p>"; + }else if(mailinfo.getUnsubscribe_language()==3){//自定义 + linkback= "<p align=\"center\" style=\"color: #999999;font-size: 12px;\"><a href=\"" + nurl + + "Unsubscribe.jsp?loginid=" + + loginid + + "&domain=" + domain + + "&mailuid=" + mailuid + + "&address=#RcevieEmail#" + + "\">" + mailinfo.getUnstr() + "</a></p>"; + } + mailcontext+=linkback; + } + String subject=mailinfo.getSubject(); + + //设置X-Mailer + mimeMsg.setHeader("X-Mailer", "Yiwaixiao-EDM - SendMailer2.0"); + + //获取用户信息 + int user_id = 0; + int company_id = 0; + try{ + String sql = "select duser.user_id,dcom.company_id from centre_user as duser " + + "LEFT JOIN centre_company as dcom on duser.company_id = dcom.company_id " + + "where duser.login_id = '"+loginid+"' and dcom.domain = '"+domain+"'"; + List<Object> objects = sendmailservice.getUserInfoBySql(sql); + if(objects.size() > 0){ + Object[] obj_arr = (Object[])objects.get(0); + if(null!=obj_arr[0]){ + user_id = Integer.parseInt(obj_arr[0].toString()); + } + if(null!=obj_arr[1]){ + company_id = Integer.parseInt(obj_arr[1].toString()); + } + } + }catch (Exception e) { + + } + + //循环发送邮件 + for(int i=0;i<addressList.size();i++){ + try{ + String newListUnsubscribeStr=listUnsubscribeStr; + + addressid=addressList.get(i).getMail_id();//地址ID + expnum=addressList.get(i).getIsexp();//异常的量 + + String body=""; + String title=""; + //收件人姓名 + String receiveName=addressList.get(i).getReceiver(); + //企业名 + String company_variable=""; + if(addressList.get(i).getCompany_variable()!=null){ + company_variable=addressList.get(i).getCompany_variable(); + } + //变量名 + String variable=""; + if(addressList.get(i).getVariable()!=null){ + variable=addressList.get(i).getVariable(); + } + //加入内容高级变量 + body=mailcontext; + + boolean bodyok=true; + while(bodyok){ + if(body.indexOf("%ReceiverName%")!=-1){ + //过滤特殊字符 + body=body.replace("%ReceiverName%", receiveName); + }else{ + bodyok=false; + } + } + + boolean receok=true; + //替换点读收件人 + while(receok){ + if(body.indexOf("#RcevieEmail#")!=-1){ + newListUnsubscribeStr=listUnsubscribeStr.replace("#RcevieEmail#", addressList.get(i).getEmail());//替换收件人 + body=body.replace("#RcevieEmail#", addressList.get(i).getEmail());//替换收件人 + }else{ + receok=false; + } + } + //内容企业变量 + boolean bodycompanuok=true; + //替换相关信息 + while(bodycompanuok){ + if(body.indexOf("%titlecompany%")!=-1){ + body=body.replace("%titlecompany%",company_variable);//替换收件人 + }else{ + bodycompanuok=false; + } + } + //内容自定义变量 + boolean bodyselfok=true; + //替换相关信息 + while(bodyselfok){ + if(body.indexOf("%customesubject%")!=-1){ + body=body.replace("%customesubject%",variable);//替换收件人 + }else{ + bodyselfok=false; + } + } + + //加入主题,是否选择了多主题 + if(mailinfo.getSubject().indexOf("###_")!=-1){ + String []titlevalue=mailinfo.getSubject().split("###_"); + Random random = new Random(); + int number = random.nextInt(titlevalue.length); + subject=titlevalue[number]; + } + title=subject; + //主题姓名变量 + boolean titleok=true; + while(titleok){ + if(title.indexOf("%ReceiverName%")!=-1){ + title=title.replace("%ReceiverName%", receiveName); + }else{ + titleok=false; + } + } + + //主题企业变量 + boolean titlecomok=true; + while(titlecomok){ + if(title.indexOf("%titlecompany%")!=-1){ + title=title.replace("%titlecompany%", company_variable); + }else{ + titlecomok=false; + } + } + + //主题自定义变量 + boolean titlemyok=true; + while(titlemyok){ + if(title.indexOf("%customesubject%")!=-1){ + title=title.replace("%customesubject%", variable); + }else{ + titlemyok=false; + } + } + + //设置List-Unsubscribe + mimeMsg.removeHeader("List-Unsubscribe"); + mimeMsg.addHeader("List-Unsubscribe", "<"+newListUnsubscribeStr+">"); + + //主题加入邮件实体中 + //替换推广链接信息 + body=body.replace("?edmtitle=", "?edmtitle="+title); + mimeMsg.setSubject(title,"UTF-8"); + + //收件人 + sendTo[i] = new InternetAddress(addressList.get(i).getEmail().replace(" ", "")); + //接收者地址 + mimeMsg.setRecipient(Message.RecipientType.TO,sendTo[i]); + + //将邮件中各个部分组合到一个"mixed"型的 MimeMultipart 对象 + MimeMultipart multipart = null; + + //不同情况定义不同的邮件类型 + if(attrPath!=null&&attrPath.length>0){//有附件 + multipart = new MimeMultipart("mixed"); + if(picPath!=null&&picPath.length>0){//有图片 + //内容|图片MimeBodyPart + MimeBodyPart textAndPicBody = new MimeBodyPart(); + //内容|图片Multipart + MimeMultipart textAndPicMultipart = new MimeMultipart("related"); + //内容MimeBodyPart + MimeBodyPart textBody = new MimeBodyPart(); + //内容Multipart,包含plain和htmnl + MimeMultipart textMultipart = new MimeMultipart("alternative"); + //plain部分 + MimeBodyPart plainBody = new MimeBodyPart(); + String newPlainBody = body; + newPlainBody = newPlainBody.replaceAll("</?[^>]+>", ""); + newPlainBody = newPlainBody.replace(" ", ""); + newPlainBody = newPlainBody.replace(" ", ""); + plainBody.setContent(newPlainBody, "text/plain;charset=UTF-8"); + plainBody.setHeader("Content-Transfer-Encoding", "base64"); + textMultipart.addBodyPart(plainBody); + //html部分 + MimeBodyPart htmlBody = new MimeBodyPart(); + //替换跟踪统计信息 + if(body.indexOf("ywx-mark-track=\"true\"")!=-1){ + String newHtmlBody = body; + newHtmlBody = rebuildOriginalMail(newHtmlBody,addressList.get(i).getEmail(),mailuid,user_id,company_id); + htmlBody.setContent(newHtmlBody, "text/html;charset=UTF-8"); + }else{ + htmlBody.setContent(body, "text/html;charset=UTF-8"); + } + htmlBody.setHeader("Content-Transfer-Encoding", "quoted-printable"); + textMultipart.addBodyPart(htmlBody); + textBody.setContent(textMultipart); + textAndPicMultipart.addBodyPart(textBody); + //添加图片 + String pic=""; + for(int y=0;y<picPath.length;y++){ + if(picPath[y]!=null){ + pic+=centersys+"\\mailtempfile\\"+domain+"\\"+loginid+"\\pic\\"+picPath[y]+","; + } + } + String[] picpath=pic.split(","); + for(int j=0;j<picpath.length;j++){ + if(!picpath[j].equals("")){ + //正文的图片部分 + MimeBodyPart jpgBody = new MimeBodyPart(); + FileDataSource fds = new FileDataSource(picpath[j]); + jpgBody.setDataHandler(new DataHandler(fds)); + jpgBody.setFileName(fds.getName()); + jpgBody.setContentID("<IMG"+j+">"); + jpgBody.setHeader("Content-Type", "image/jpeg;name="+fds.getName()); + jpgBody.removeHeader("Content-Disposition"); + textAndPicMultipart.addBodyPart(jpgBody); + } + } + textAndPicBody.setContent(textAndPicMultipart); + multipart.addBodyPart(textAndPicBody); + }else{//无图片 + //内容部分 + MimeBodyPart textBody = new MimeBodyPart(); + MimeMultipart textMultipart = new MimeMultipart("alternative"); + //plain部分 + MimeBodyPart plainBody = new MimeBodyPart(); + String newPlainBody = body; + newPlainBody = newPlainBody.replaceAll("</?[^>]+>", ""); + newPlainBody = newPlainBody.replace(" ", ""); + newPlainBody = newPlainBody.replace(" ", ""); + plainBody.setContent(newPlainBody, "text/plain;charset=UTF-8"); + plainBody.setHeader("Content-Transfer-Encoding", "base64"); + textMultipart.addBodyPart(plainBody); + //html部分 + //替换跟踪统计信息 + MimeBodyPart htmlBody = new MimeBodyPart(); + if(body.indexOf("ywx-mark-track=\"true\"")!=-1){ + String newHtmlBody = body; + newHtmlBody = rebuildOriginalMail(newHtmlBody,addressList.get(i).getEmail(),mailuid,user_id,company_id); + htmlBody.setContent(newHtmlBody, "text/html;charset=UTF-8"); + }else{ + htmlBody.setContent(body, "text/html;charset=UTF-8"); + } + htmlBody.setHeader("Content-Transfer-Encoding", "quoted-printable"); + textMultipart.addBodyPart(htmlBody); + textBody.setContent(textMultipart); + multipart.addBodyPart(textBody); + } + for(int s=0;s<attrPath.length;s++){ + MimeBodyPart attachment = createAttachment(attrPath[s],attrName[s]); + multipart.addBodyPart(attachment); + } + }else if(picPath!=null&&picPath.length>0){//有图片 + multipart = new MimeMultipart("related"); + //内容部分 + MimeBodyPart textBody = new MimeBodyPart(); + MimeMultipart textMultipart = new MimeMultipart("alternative"); + //plain部分 + MimeBodyPart plainBody = new MimeBodyPart(); + String newPlainBody = body; + newPlainBody = newPlainBody.replaceAll("</?[^>]+>", ""); + newPlainBody = newPlainBody.replace(" ", ""); + newPlainBody = newPlainBody.replace(" ", ""); + plainBody.setContent(newPlainBody, "text/plain;charset=UTF-8"); + plainBody.setHeader("Content-Transfer-Encoding", "base64"); + textMultipart.addBodyPart(plainBody); + //html部分 + //替换跟踪统计信息 + MimeBodyPart htmlBody = new MimeBodyPart(); + if(body.indexOf("ywx-mark-track=\"true\"")!=-1){ + String newHtmlBody = body; + newHtmlBody = rebuildOriginalMail(newHtmlBody,addressList.get(i).getEmail(),mailuid,user_id,company_id); + htmlBody.setContent(newHtmlBody, "text/html;charset=UTF-8"); + }else{ + htmlBody.setContent(body, "text/html;charset=UTF-8"); + } + htmlBody.setHeader("Content-Transfer-Encoding", "quoted-printable"); + textMultipart.addBodyPart(htmlBody); + textBody.setContent(textMultipart); + multipart.addBodyPart(textBody); + //添加图片 + String pic=""; + for(int y=0;y<picPath.length;y++){ + if(picPath[y]!=null){ + pic+=centersys+"\\mailtempfile\\"+domain+"\\"+loginid+"\\pic\\"+picPath[y]+","; + } + } + String[] picpath=pic.split(","); + for(int j=0;j<picpath.length;j++){ + if(!picpath[j].equals("")){ + //正文的图片部分 + MimeBodyPart jpgBody = new MimeBodyPart(); + FileDataSource fds = new FileDataSource(picpath[j]); + jpgBody.setDataHandler(new DataHandler(fds)); + jpgBody.setFileName(fds.getName()); + jpgBody.setContentID("<IMG"+j+">"); + jpgBody.setHeader("Content-Type", "image/jpeg;name="+fds.getName()); + jpgBody.removeHeader("Content-Disposition"); + multipart.addBodyPart(jpgBody); + } + } + }else{//无附件无图片 + multipart = new MimeMultipart("alternative"); + //plain部分 + MimeBodyPart plainBody = new MimeBodyPart(); + String newPlainBody = body; + newPlainBody = newPlainBody.replaceAll("</?[^>]+>", ""); + newPlainBody = newPlainBody.replace(" ", ""); + newPlainBody = newPlainBody.replace(" ", ""); + plainBody.setContent(newPlainBody, "text/plain;charset=UTF-8"); + plainBody.setHeader("Content-Transfer-Encoding", "base64"); + multipart.addBodyPart(plainBody); + //html部分 + //替换跟踪统计信息 + MimeBodyPart htmlBody = new MimeBodyPart(); + if(body.indexOf("ywx-mark-track=\"true\"")!=-1){ + String newHtmlBody = body; + newHtmlBody = rebuildOriginalMail(newHtmlBody,addressList.get(i).getEmail(),mailuid,user_id,company_id); + htmlBody.setContent(newHtmlBody, "text/html;charset=UTF-8"); + }else{ + htmlBody.setContent(body, "text/html;charset=UTF-8"); + } + htmlBody.setHeader("Content-Transfer-Encoding", "quoted-printable"); + multipart.addBodyPart(htmlBody); + } + + //将上面混合型的 MimeMultipart 对象作为邮件内容并保存 + mimeMsg.setContent(multipart); + mimeMsg.saveChanges(); + + //发送邮件 + transport.sendMessage(mimeMsg,mimeMsg.getRecipients(Message.RecipientType.TO)); + //发送成功后修改该地址为已发送 + sendmailservice.updateMailDetailstatus(addressid); + //写入日志 + LogsTool.sendLogs(domain,loginid,"服务器:"+SmtpInfo.getSmtp_service_number()+"邮件ID:"+mailid+" 收件人:"+addressList.get(i).getEmail()+"发送成功"); + //输出到控制台 + System.out.println("邮件ID:"+mailid+"用户名:"+loginid+"@"+domain+"第"+i+"封总共"+addressList.size()+"封,服务器"+SmtpInfo.getSmtp_service_number()+"发送成功!"); + }catch (Exception e) { + //出现异常后更新此地址为异常地址 + expnum=expnum+1; + sendmailservice.updateExp(addressid,expnum); + //写入日志 + StringWriter sw = new StringWriter(); + e.printStackTrace(new PrintWriter(sw, true)); + String str = sw.toString(); + LogsTool.erroLogs("服务器:"+SmtpInfo.getSmtp_service_number()+"邮件ID为:"+mailid+"地址ID为:"+addressid+"地址发送异常!"+str); + continue; + } + } + System.out.println("邮件ID为:"+mailid+"所有的都发完了"); +// if(mailinfo.getIsold()==2)//开启的是独立域名发送 +// { +// int smtpsendnum = ConfigPath.getSmtpSendNum();//获取配置文件中的smtp发送数量 +// +// System.out.println("邮件ID为:"+mailid+"已经发送"+smtpsendnum+"封"); +// } +// else +// { +// System.out.println("邮件ID为:"+mailid+"所有的都发完了"); +// } + } catch (Exception e) { + //写入日志 + StringWriter sw = new StringWriter(); + e.printStackTrace(new PrintWriter(sw, true)); + String str = sw.toString(); + LogsTool.erroLogs("邮件ID为:"+mailid+"邮件发送异常!"+str); + }finally{ + try { + //更新邮件状态 + //循环完成后判断此邮件是否为已发 + boolean ishave=sendmailservice.isHaveAddress(mailid); + if(ishave){//还有 + sendmailservice.updateMailStatus(0,mailid,mailuid); + }else{//没有了 + sendmailservice.updateMailStatus(1,mailid,mailuid); + } + } catch (Exception e2) { + //写入日志 + StringWriter sw = new StringWriter(); + e2.printStackTrace(new PrintWriter(sw, true)); + String str = sw.toString(); + LogsTool.erroLogs("邮件发送方法异常!"+str); + } + } + } + + + /**根据传入的文件路径创建附件并返回*/ + public MimeBodyPart createAttachment(String filepath,String fileName) throws Exception { + MimeBodyPart attachmentPart = new MimeBodyPart(); + FileDataSource fds = new FileDataSource(filepath); + attachmentPart.setDataHandler(new DataHandler(fds)); + attachmentPart.setFileName(MimeUtility.encodeText(fileName,"UTF-8","B")); + return attachmentPart; + } + + /**根据传入的邮件正文body和文件路径创建图文并茂的正文部分 */ + public MimeBodyPart createContent(String body,String fileName) + throws Exception { + // 用于保存最终正文部分 + MimeBodyPart contentBody = new MimeBodyPart(); + // 用于组合文本和图片,"related"型的MimeMultipart对象 + MimeMultipart contentMulti = new MimeMultipart("related"); + //MimeMultipart contentMulti = new MimeMultipart("alternative"); + + + // 正文的文本部分 + MimeBodyPart textBody = new MimeBodyPart(); + textBody.setContent(body, "text/html;charset=UTF-8"); + textBody.setHeader("Content-Transfer-Encoding", "quoted-printable"); + contentMulti.addBodyPart(textBody); + +// // 正文的plain文本部分 +// MimeBodyPart textBody2 = new MimeBodyPart(); +// String newbody = body.replaceAll("</?[^>]+>", ""); +// textBody2.setContent(newbody, "text/plain;charset=UTF-8"); +// textBody2.setHeader("Content-Transfer-Encoding", "base64"); +// contentMulti.addBodyPart(textBody2); + + //图片部分 + if(!fileName.equals("")){ + String[] picpath=fileName.split(","); + for(int i=1;i<picpath.length+1;i++){ + if(!picpath[i-1].equals("")){ + //正文的图片部分 + MimeBodyPart jpgBody = new MimeBodyPart(); + FileDataSource fds = new FileDataSource(picpath[i-1]); + jpgBody.setDataHandler(new DataHandler(fds)); + jpgBody.setContentID("<IMG"+i+">"); + contentMulti.addBodyPart(jpgBody); + } + } + } + // 将上面"related"型的 MimeMultipart 对象作为邮件的正文 + contentBody.setContent(contentMulti); + return contentBody; + } + + //替换跟踪信息 + private String rebuildOriginalMail(String body, String to_mail, + String mail_uid, int user_id, int company_id) throws Exception { + Document doc = Jsoup.parse(body); + Elements elements = doc.select("a[ywx-mark-track=true]"); + if (elements.size() > 0) { + Set<String> set = new HashSet<String>(); + String href = null; + String url = null; + for (Element element : elements) { + href = element.attr("href"); + if (href != null && !href.trim().isEmpty()) { + set.add(href.trim() + "@espeed@" + element.text()); + } + } + if (set.size() > 0) { + String[] hres = null; + for (String hre : set) { + hres = hre.split("@espeed@"); + url = ConfigPath.getTrackUrl() + "/chain.jsp?ywxType=3&ywxUid=" + + user_id + "&ywxCid=" + company_id + "&ywxMid=" + + mail_uid + "&ywxMail=" + to_mail + "&ywxTo=" + + URLEncoder.encode(hres[0], "UTF-8"); + if (hres.length > 1) { + url += "&ywxTitle=" + URLEncoder.encode(hres[1], "UTF-8"); + } + //body = body.replace(hres[0], url); + body = body.replace("<a href=\""+hres[0]+"\"", "<a href=\""+url+"\""); + } + } + } + return body; + } +} diff --git b/.svn/pristine/65/65633b67415b32feb9bed3a433d63201444c3de5.svn-base a/.svn/pristine/65/65633b67415b32feb9bed3a433d63201444c3de5.svn-base new file mode 100644 index 0000000..eedee25 --- /dev/null +++ a/.svn/pristine/65/65633b67415b32feb9bed3a433d63201444c3de5.svn-base @@ -0,0 +1,23 @@ +package com.espeed.yxy.timer; + +public class MonitorQuartz { + + public void monitorMethod(){ + try { + //判断定时发送是否运行 + ThreadPoolTask s=ThreadPoolTask.getMethodInstance(); + int threadnum=s.getThreadNum(); + //System.out.println("最后一次执行的时间:"+SendMailTimer.nowtimer); + System.out.println("当前核心线程数量:"+threadnum); +// if(threadnum!=-1&&threadnum<5){ +// Thread.sleep(2000); +// InitializingCronTrigger.resume(); +// }else if(threadnum==-1&&!"".equals(SendMailTimer.nowtimer)){ +// Thread.sleep(2000); +// InitializingCronTrigger.resume(); +// } + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git b/.svn/pristine/6a/6ab0e99e2dc7aa926a17a9e3c817afb802b38e42.svn-base a/.svn/pristine/6a/6ab0e99e2dc7aa926a17a9e3c817afb802b38e42.svn-base new file mode 100644 index 0000000..b0321e8 --- /dev/null +++ a/.svn/pristine/6a/6ab0e99e2dc7aa926a17a9e3c817afb802b38e42.svn-base @@ -0,0 +1,52 @@ +package com.espeed.yxy.pojo; + +import java.io.Serializable; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; + +/*** + * + * @author xieyong + * 回复实体 + */ +@Entity +@Table(name="yxy_reply_info") +public class YxyReplyInfo implements Serializable{ + private static final long serialVersionUID = 1L; + private int replyid; + private String loginid;//用户 + private String domain;//所属域名 + private String replyemail;//回复地址 + + @Id + @GeneratedValue(strategy=GenerationType.AUTO) + public int getReplyid() { + return replyid; + } + public void setReplyid(int replyid) { + this.replyid = replyid; + } + public String getLoginid() { + return loginid; + } + public void setLoginid(String loginid) { + this.loginid = loginid; + } + public String getDomain() { + return domain; + } + public void setDomain(String domain) { + this.domain = domain; + } + + public String getReplyemail() { + return replyemail; + } + public void setReplyemail(String replyemail) { + this.replyemail = replyemail; + } +} diff --git b/.svn/pristine/6b/6bbb06049123230f98f24cef8c000de9802c646d.svn-base a/.svn/pristine/6b/6bbb06049123230f98f24cef8c000de9802c646d.svn-base new file mode 100644 index 0000000..bb35dc1 --- /dev/null +++ a/.svn/pristine/6b/6bbb06049123230f98f24cef8c000de9802c646d.svn-base @@ -0,0 +1,285 @@ +package com.espeed.yxy.tool; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 日期转换工具类(营销游) + * 开始时间: 2013.12.09 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +public class DateFormat { + private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日"); + private static SimpleDateFormat sdf2 = new SimpleDateFormat( + "yyyy-MM-dd hh:mm:ss"); + + /**将字符串转换日期*/ + public static Date dateToString(String str) { + + Date dateNum = null; + try { + dateNum = sdf.parse(str); + } catch (ParseException e) { + e.printStackTrace(); + } + return dateNum; + } + + /** 将字符串转换日期*/ + public static Date dateToString2(String str) { + Date dateNum = null; + try { + dateNum = sdf2.parse(str); + } catch (ParseException e) { + e.printStackTrace(); + } + return dateNum; + } + + /** 将日期转换为字符串*/ + public static String simpleDataFormat(Date date) {//yy必须小写,MM是月份,mm是分;HH是24小时制,而hh是12小时制*/ + String str = sdf.format(date); + return str; + } + + /**给定一个日期型字符串,返回加减n天后的日期型字符串*/ + public static String nDaysAfterOneDateString(String basicDate, int n) { + Date tmpDate = null; + try { + tmpDate = sdf2.parse(basicDate); + System.out.println(tmpDate); + } catch (Exception e) { + //日期型字符串格式错误 + } + long nDay = (tmpDate.getTime() / (24 * 60 * 60 * 1000) + 1 + n)* (24 * 60 * 60 * 1000); + tmpDate.setTime(nDay); + + return sdf2.format(tmpDate); + } + + /**给定一个日期,返回加减n天后的日期*/ + public static Date nDaysAfterOneDate(Date basicDate, int n) { + long nDay = (basicDate.getTime() / (24 * 60 * 60 * 1000) + 1 + n) + * (24 * 60 * 60 * 1000); + basicDate.setTime(nDay); + + return basicDate; + } + + /**判断日期为星期几,0为星期天,依此类推*/ + public static String dayOfWeek(String strdate) { + SimpleDateFormat df = new SimpleDateFormat("yyyy年MM月dd日"); + Date date = null; + try { + date = df.parse(strdate); + } catch (ParseException e) { + System.out.println("字符型转日期有异常"); + } + //首先定义一个calendar,必须使用getInstance()进行实例化 + Calendar aCalendar = Calendar.getInstance(); + //里面野可以直接插入date类型 + aCalendar.setTime(date); + //计算此日期是一周中的哪一天 + int x = aCalendar.get(Calendar.DAY_OF_WEEK) - 1; + String week = ""; + switch (x) { + case 0: + week = "星期天"; + break; + case 1: + week = "星期一"; + break; + case 2: + week = "星期二"; + break; + case 3: + week = "星期三"; + break; + case 4: + week = "星期四"; + break; + case 5: + week = "星期五"; + break; + case 6: + week = "星期六"; + break; + + } + return week; + } + + /**判断日期为星期几,0为星期天,依此类推*/ + public static int dayOfWeekNum(String strdate) { + SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd"); + Date date = null; + try { + date = df.parse(strdate); + } catch (ParseException e) { + System.out.println("字符型转日期有异常"); + } + //首先定义一个calendar,必须使用getInstance()进行实例化 + Calendar aCalendar = Calendar.getInstance(); + //里面野可以直接插入date类型 + aCalendar.setTime(date); + //计算此日期是一周中的哪一天 + int x = aCalendar.get(Calendar.DAY_OF_WEEK) - 1; + int week = 0; + switch (x) { + case 0: + week = 7; + break; + case 1: + week = 1; + break; + case 2: + week = 2; + break; + case 3: + week = 3; + break; + case 4: + week = 4; + break; + case 5: + week = 5; + break; + case 6: + week = 6; + break; + + } + return week; + } + + + /** 计算两个日期相隔的天数*/ + public static int nDaysBetweenTwoDate(Date firstDate, Date secondDate) { + int nDay = (int) ((secondDate.getTime() - firstDate.getTime()) / (24 * 60 * 60 * 1000)); + return nDay; + } + + /**计算两个日期相隔的天数*/ + public static int nDaysBetweenTwoDate(String firstString, String secondString) { + SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd"); + Date firstDate = null; + Date secondDate = null; + try { + firstDate = df.parse(firstString); + secondDate = df.parse(secondString); + } catch (Exception e) { + //日期型字符串格式错误 + } + + int nDay = (int) ((secondDate.getTime() - firstDate.getTime()) / (24 * 60 * 60 * 1000)); + + System.out.println("相差"+nDay+"天"); + return nDay; + } + + /** 某年某月有多少天*/ + public static int yearMonthDay(int year, int month) { + int day = 0; + if (((month >= 1) && (month <= 12)) && (year >= 0)) { + if (month == 2) { + if ((((year % 4) == 0) && ((year % 100) != 0))|| ((year % 400) == 0)) + day = 29; + else + day = 28; + } else { + if ((month == 1) || (month == 3) || (month == 5) + || (month == 7) || (month == 8) || (month == 10) + || (month == 12)) + + day = 31; + else + day = 30; + } + System.out.println(year + "年" + month + "月的天数为:" + day); + } else { + System.out.println("请输入正确的年月!"); + } + return day; + } + /**判断两时间相差的分钟数*/ + public static long minute1s(String beginDate,String endDate){ + + Date begin = null; + Date end = null; + SimpleDateFormat dfs = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + long minute1=0; + try { + begin = dfs.parse(beginDate); + end = dfs.parse(endDate); + + long between = (end.getTime() - begin.getTime()) / 1000;//除以1000是为了转换成秒 + minute1 = between / 60; + + } catch (Exception e) { + e.printStackTrace(); + } + return minute1; + + } + + + /**判断两时间相差的分钟数*/ + public static boolean isthisTimer(String nowTimer){ + + int hour=Integer.parseInt(nowTimer.split(":")[0]); + int minute=Integer.parseInt(nowTimer.split(":")[1]); + + System.out.println(nowTimer); + System.out.println(hour); + System.out.println(minute); + + if(hour==23||hour==0){ + if(hour==23&&minute>=30||hour==0&&minute<=30){ + return true; + }else{ + return false; + } + + }else{ + return false; + } + + } + + //获取当前时间加减后的日期 + public static String lastDays(int n){ + String resultdate=""; + try { + //获取几天之前的时间 + SimpleDateFormat formatDate = new SimpleDateFormat("yyyy-MM-dd"); //字符串转换 + Calendar c = Calendar.getInstance(); + c.setTimeInMillis(new Date().getTime()); + c.add(Calendar.DATE, n);//多少天后的日期 + Date date= new Date(c.getTimeInMillis()); //将c转换成Date + resultdate=formatDate.format(date); + } catch (Exception e) { + resultdate=""; + e.printStackTrace(); + } + return resultdate; + } + + public static void main(String[] args) { + try { + SimpleDateFormat df=new SimpleDateFormat("yyyy-MM-dd"); + String nowdate=df.format(new Date()); + System.out.println(minute1s("2016-10-10 10:10:00","2016-10-10 10:20:00")); + } catch (Exception e) { + e.printStackTrace(); + } + + } +} diff --git b/.svn/pristine/6f/6f3b8a24bf970f17289b234284c94f43eb42f0e4.svn-base a/.svn/pristine/6f/6f3b8a24bf970f17289b234284c94f43eb42f0e4.svn-base new file mode 100644 index 0000000..f1f4fdd Binary files /dev/null and a/.svn/pristine/6f/6f3b8a24bf970f17289b234284c94f43eb42f0e4.svn-base differ diff --git b/.svn/pristine/71/717b964df6ad40399e290d4b0e231ad16235cc31.svn-base a/.svn/pristine/71/717b964df6ad40399e290d4b0e231ad16235cc31.svn-base new file mode 100644 index 0000000..92eb101 --- /dev/null +++ a/.svn/pristine/71/717b964df6ad40399e290d4b0e231ad16235cc31.svn-base @@ -0,0 +1,15 @@ +package com.espeed.yxy.dao.impl; + +import java.util.List; + +import com.espeed.yxy.dao.YxyMailStencilDao; +import com.espeed.yxy.pojo.YxyMailStencil; + +public class YxyMailStencilDaoImpl extends HibernateBaseDAOImpl<YxyMailStencil, Long> implements YxyMailStencilDao { + + /**HQL查询*/ + public List<YxyMailStencil> findByHql(String hql)throws Exception{ + return super.getAll(hql); + } + +} diff --git b/.svn/pristine/71/718186593eb86156c43e0ff934106964b4a2b967.svn-base a/.svn/pristine/71/718186593eb86156c43e0ff934106964b4a2b967.svn-base new file mode 100644 index 0000000..0978ccb --- /dev/null +++ a/.svn/pristine/71/718186593eb86156c43e0ff934106964b4a2b967.svn-base @@ -0,0 +1,86 @@ +package com.espeed.yxy.tool; + +import java.io.File; + +/*** + * + * @author xieyong + * 生成删除文件 + */ +public class GreateAndDeleteFile { + + /**用于创建文件夹的方法*/ + public static void mkdir(String mkdirName)throws Exception{ + File dirFile = new File(mkdirName); + boolean bFile = dirFile.exists(); + if( bFile == true ) + { + System.out.println("The folder exists."); + } else { + System.out.println("The folder do not exist,now trying to create a one..."); + bFile = dirFile.mkdirs(); + if( bFile == true ) + { + System.out.println("Create successfully!"); + System.out.println("创建文件夹"); + } + else{ + + System.out.println("Disable to make the folder,please check the disk is full or not."); + System.out.println(" 文件夹创建失败,清确认磁盘没有写保护并且空件足够"); + } + } + + } + /**删除文件夹*/ + public static void deleteFile(File file){ + try { + if(file.exists()){ + if(file.isFile()){ + file.delete(); + }else if(file.isDirectory()){ + File files[] = file.listFiles(); + for(int i=0;i<files.length;i++){ + deleteFile(files[i]); + } + } + file.delete(); + }else{ + System.out.println("所删除的文件不存在!"+'\n'); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + /**用于创建文件的方法*/ + public static void createFile(String mkdirName) throws Exception{ + File dirFile = new File(mkdirName); + boolean bFile = dirFile.exists(); + if( bFile == true ) + { + System.out.println("The folder exists."); + } else { + System.out.println("The folder do not exist,now trying to create a one..."); + bFile = dirFile.createNewFile(); + if( bFile == true ) + { + System.out.println("Create successfully!"); + System.out.println("创建文件夹"); + } + else{ + + System.out.println("Disable to make the folder,please check the disk is full or not."); + System.out.println(" 文件夹创建失败,清确认磁盘没有写保护并且空件足够"); + } + } + + } + + public static void main(String[] agrs){ + GreateAndDeleteFile caf = new GreateAndDeleteFile(); + File file = new File("E:\\javawork\\.metadata\\.me_tcat\\webapps\\espeedYxyService\\mailtempfile\\21xmail.com\\xieyong\\attachment\\0d161f8a-7091-492c-bf1b-a394470a63a8.xls"); + caf.deleteFile(file); + } + +} diff --git b/.svn/pristine/71/71c704e349b5e79c8901cb6d4304b021d2751dbe.svn-base a/.svn/pristine/71/71c704e349b5e79c8901cb6d4304b021d2751dbe.svn-base new file mode 100644 index 0000000..214f912 --- /dev/null +++ a/.svn/pristine/71/71c704e349b5e79c8901cb6d4304b021d2751dbe.svn-base @@ -0,0 +1,101 @@ +package com.espeed.centre.pojo; + +import java.io.Serializable; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; +/** + * 项目名称: 统一验证中心系统 + * 版权所有: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 技术支持: info@21gmail.com + * 单元名称: 营销邮盘活客户配置实体类 + * 开始时间: 2018.04.08 + * 开发人员: 陈南巧 + */ +@Entity +@Table(name="centre_yxyedm_oldcustomer") +public class CentreYxyedmOldcustomer implements Serializable +{ + private static final long serialVersionUID = 1L; + private int id;//主键id + private String domain;//域名 + private int spf_status;//spf状态,0不可用,1可以用 + private int mx_status;//mx状态,0不可用,1可以用 + private String sender_email;//发件人邮箱 + private String reply_email;//回复人邮箱 + private String sender_name;//发件人名称 + private int status;//状态,0不可用,1可以用 + private int type;//类型,0自有域名,1待发模式 + private int company_id;//企业id + private String company_domain;//企业域名 + @Id + @GeneratedValue(strategy=GenerationType.AUTO) + public int getId() { + return id; + } + public void setId(int id) { + this.id = id; + } + public String getSender_email() { + return sender_email; + } + public void setSender_email(String sender_email) { + this.sender_email = sender_email; + } + public String getReply_email() { + return reply_email; + } + public void setReply_email(String reply_email) { + this.reply_email = reply_email; + } + public String getSender_name() { + return sender_name; + } + public void setSender_name(String sender_name) { + this.sender_name = sender_name; + } + public int getCompany_id() { + return company_id; + } + public void setCompany_id(int company_id) { + this.company_id = company_id; + } + public String getDomain() { + return domain; + } + public void setDomain(String domain) { + this.domain = domain; + } + public int getSpf_status() { + return spf_status; + } + public void setSpf_status(int spf_status) { + this.spf_status = spf_status; + } + public int getMx_status() { + return mx_status; + } + public void setMx_status(int mx_status) { + this.mx_status = mx_status; + } + public int getStatus() { + return status; + } + public void setStatus(int status) { + this.status = status; + } + public int getType() { + return type; + } + public void setType(int type) { + this.type = type; + } + public String getCompany_domain() { + return company_domain; + } + public void setCompany_domain(String company_domain) { + this.company_domain = company_domain; + } +} diff --git b/.svn/pristine/73/73738e145f833982c22719df1db08cae43e5abea.svn-base a/.svn/pristine/73/73738e145f833982c22719df1db08cae43e5abea.svn-base new file mode 100644 index 0000000..a7d55f1 --- /dev/null +++ a/.svn/pristine/73/73738e145f833982c22719df1db08cae43e5abea.svn-base @@ -0,0 +1,91 @@ +package com.espeed.yxy.pojo; + +import java.io.Serializable; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; + + +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 发件人配置 + * 开始时间: 2015.4.02 + * 程 序 员: 蒋俭 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ + + +@Entity +@Table(name="yxy_sender_set") +public class YxySenderSet implements Serializable{ + private int id;//发件人配置id + private String user_login;//登陆用户 + private String user_domain;//登陆域名 + private String sender;//发件人 + private String send_email;//发件人地址 + private String reply_name;//回复人名字 + private String reply_email;//回复人邮箱地址 + private int isdefault;//是否默认 + + @Id + @GeneratedValue(strategy=GenerationType.AUTO) + public int getId() { + return id; + } + public void setId(int id) { + this.id = id; + } + public String getUser_login() { + return user_login; + } + public void setUser_login(String userLogin) { + user_login = userLogin; + } + public String getUser_domain() { + return user_domain; + } + public void setUser_domain(String userDomain) { + user_domain = userDomain; + } + public String getSender() { + return sender; + } + public void setSender(String sender) { + this.sender = sender; + } + + public String getSend_email() { + return send_email; + } + public void setSend_email(String sendEmail) { + send_email = sendEmail; + } + public String getReply_name() { + return reply_name; + } + public void setReply_name(String replyName) { + reply_name = replyName; + } + public String getReply_email() { + return reply_email; + } + public void setReply_email(String replyEmail) { + reply_email = replyEmail; + } + public int getIsdefault() { + return isdefault; + } + public void setIsdefault(int isdefault) { + this.isdefault = isdefault; + } + + +} diff --git b/.svn/pristine/74/7436d76618b8de47179d4a1fd1cdaa0a88d62fe5.svn-base a/.svn/pristine/74/7436d76618b8de47179d4a1fd1cdaa0a88d62fe5.svn-base new file mode 100644 index 0000000..9a88e53 Binary files /dev/null and a/.svn/pristine/74/7436d76618b8de47179d4a1fd1cdaa0a88d62fe5.svn-base differ diff --git b/.svn/pristine/75/75c10f3358b969df4c81153ac92896b580e11f04.svn-base a/.svn/pristine/75/75c10f3358b969df4c81153ac92896b580e11f04.svn-base new file mode 100644 index 0000000..2e4aa25 --- /dev/null +++ a/.svn/pristine/75/75c10f3358b969df4c81153ac92896b580e11f04.svn-base @@ -0,0 +1,301 @@ +package com.espeed.yxy.util; + +import java.io.BufferedInputStream; +import java.io.BufferedOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.InputStream; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Random; + +import javax.crypto.CipherInputStream; +import javax.mail.BodyPart; +import javax.mail.Multipart; +import javax.mail.Part; +import javax.mail.Session; +import javax.mail.internet.MimeMessage; +import javax.mail.internet.MimeUtility; + +import com.espeed.yxy.tool.Encrypt; + +import sun.misc.BASE64Decoder; + +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 解析邮件(营销游) + * 开始时间: 2013.12.09 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +public class AnalysisMail { + + private MimeMessage msg; + private StringBuffer bodyText=new StringBuffer(); + public String attrname=""; + /**解析邮件*/ + public List ParseEmlMethod(String path,String key){ + //定义结果集 + List<String> result=new ArrayList<String>(); + try { + //System.setProperty("mail.mime.multipart.ignoreexistingboundaryparameter", "true"); + if(key!=null&&!key.equals("")){ + //解密邮件 + BASE64Decoder enc=new BASE64Decoder(); + //需要一个流 给它解密的流 + CipherInputStream CStream = null; + CStream =(CipherInputStream) Encrypt.decrypt(path,Encrypt.toKey(enc.decodeBuffer(key))); + + Session mailSession = Session.getDefaultInstance(System.getProperties(), null); + msg = new MimeMessage(mailSession, CStream); + }else{ + InputStream is =new FileInputStream(path); + Session mailSession = Session.getDefaultInstance(System.getProperties(), null); + msg = new MimeMessage(mailSession, is); + } + + + //获取内容 + getMailContent((Part) msg); + result.add(bodyText+""); + //saveAttachMent((Part) msg); + //result.add(attrName); + + } catch (Exception e) { + e.printStackTrace(); + } + + return result; + } + + /**解析附件或图片*/ + public String parsePicOrAttr(String emlpath,String key,int check,String savepath){ + try { + attrname=""; + if(key!=null&&!key.equals("")){ + //解密邮件 + BASE64Decoder enc=new BASE64Decoder(); + //需要一个流 给它解密的流 + CipherInputStream CStream = null; + CStream =(CipherInputStream) Encrypt.decrypt(emlpath,Encrypt.toKey(enc.decodeBuffer(key))); + + Session mailSession = Session.getDefaultInstance(System.getProperties(), null); + msg = new MimeMessage(mailSession, CStream); + }else{ + InputStream is =new FileInputStream(emlpath); + Session mailSession = Session.getDefaultInstance(System.getProperties(), null); + msg = new MimeMessage(mailSession, is); + } + //处理图片与附件 + saveAttachMent((Part)msg,check,savepath); + } catch (Exception e) { + e.printStackTrace(); + } + return attrname; + } + + /**获取内容*/ + public void getMailContent(Part part) throws Exception { + String contenttype = part.getContentType(); + int nameindex = contenttype.indexOf("name"); + boolean conname = false; + if (nameindex != -1) + conname = true; + + if (part.isMimeType("text/plain") && !conname) { + bodyText.append(part.getContent()); + + } else if (part.isMimeType("text/html") && !conname) { + bodyText.append(part.getContent()); + + } else if (part.isMimeType("multipart/*")) { + Multipart multipart = (Multipart) part.getContent(); + int counts = multipart.getCount(); + for (int i = 0; i < counts; i++) { + getMailContent(multipart.getBodyPart(i)); + } + + } else if (part.isMimeType("message/rfc822")) { + getMailContent((Part) part.getContent()); + + } else { + + } + } + + /**附件与图片*/ + public void saveAttachMent(Part part,int check,String savepath) { + try { + boolean isPic=false; + String filename=""; + String [] contentid=null;//是否有图片 + if(part.isMimeType("multipart/*")){ + Multipart mp = (Multipart)part.getContent(); + for(int i=0;i<mp.getCount();i++){ + BodyPart mpart = mp.getBodyPart(i); + String disposition=""; + disposition = mpart.getDisposition(); + if((disposition != null) &&((disposition.equals(Part.ATTACHMENT))||(disposition.equals(Part.INLINE)))){ + filename = mpart.getFileName(); + filename = MimeUtility.decodeText(filename); + //是否是图片 + contentid=mpart.getHeader("Content-ID"); + if(contentid!=null){//说明是图片 + isPic=true; + } + //判断是解析图片还是附件 + if(check==1){//附件 + if(!isPic){ + saveFile(filename,mpart.getInputStream(),savepath,check); + } + }else{//图片 + if(isPic){ + saveFile(filename,mpart.getInputStream(),savepath,check); + } + } + }else if(mpart.isMimeType("multipart/*")){ + saveAttachMent(mpart,check,savepath); + }else if(mpart.isMimeType("message/rfc822")){ + filename = mpart.getFileName(); + filename=MimeUtility.decodeText(filename); + //是否是图片 + contentid=mpart.getHeader("Content-ID"); + if(contentid!=null){//说明是图片 + isPic=true; + } + //判断是解析图片还是附件 + if(check==1){//附件 + if(!isPic){ + saveFile(filename,mpart.getInputStream(),savepath,check); + } + }else{//图片 + if(isPic){ + saveFile(filename,mpart.getInputStream(),savepath,check); + } + } + } + } + }else if(part.isMimeType("message/rfc822")){ + saveAttachMent((Part)part.getContent(),check,savepath); + }else if(part.isMimeType("application/octet-stream")){ + filename=part.getFileName(); + contentid=part.getHeader("Content-ID"); + if(contentid!=null){//说明是图片 + isPic=true; + } + //判断是解析图片还是附件 + if(check==1){//附件 + if(!isPic){ + saveFile(filename,part.getInputStream(),savepath,check); + } + }else{//图片 + if(isPic){ + saveFile(filename,part.getInputStream(),savepath,check); + } + } + } + } catch (Exception e) { + e.printStackTrace(); + System.out.println("erro:保存附件异常!"); + } + } + + /**真正的保存附件到指定目录*/ + private void saveFile(String fileName,InputStream in,String savepath,int check){ + try { + //重新取名 + String savaname="";//指定保存的名字 + //时间命名 + SimpleDateFormat df=new SimpleDateFormat("yyyyMMddHHmmssSSS"); + String nowtime=df.format(new Date()); + savaname=nowtime; + + String base = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; //生成字符串从此序列中取 + Random random = new Random(); + StringBuffer sb = new StringBuffer(); + for (int i=0;i<5;i++) { + int number = random.nextInt(base.length()); + sb.append(base.charAt(number)); + } + savaname+=sb.toString(); + + //附件名编码解析 + if(fileName.contains("=?")||fileName.contains("?B")){ + fileName=fileName.replace(" ", ""); + fileName=MimeUtility.decodeText(fileName); + }else{ + String newstr=fileName.replace("?", ""); + newstr=new String(newstr.getBytes("iso-8859-1")); + if(!newstr.contains("?")){ + fileName=new String(fileName.getBytes("iso-8859-1")); + } + } + //取得文件后缀 + String[] typearry=fileName.split("\\."); + String filetype=typearry[typearry.length-1]; + //如果是图片则使用新随即名称 + if(check==1){//附件 + attrname+=savaname+"."+filetype+"#####"+fileName+","; + }else{//图片 + attrname+=savaname+"."+filetype+"#####"; + } + String osName = System.getProperty("os.name"); + String storedir = savepath; + String separator = ""; + if (osName == null) + osName = ""; + if (osName.toLowerCase().indexOf("win") != -1) { + separator = "\\"; + if (storedir == null || storedir.equals("")) + storedir = "c:\\tmp"; + }else { + separator = "/"; + storedir = "/tmp"; + } + File storefile = new File(storedir + separator); + if(!storefile.exists()){ + storefile.mkdirs(); + } + BufferedOutputStream bos = null; + BufferedInputStream bis = null; + try { + bos = new BufferedOutputStream(new FileOutputStream(storefile+"//"+ savaname+"."+filetype)); + bis = new BufferedInputStream(in); + int c; + while ((c = bis.read()) != -1) { + bos.write(c); + bos.flush(); + } + }catch (Exception exception) { + exception.printStackTrace(); + }finally { + bos.close(); + bis.close(); + } + } catch (Exception e) { + e.printStackTrace(); + System.out.println("erro:保存附件到指定目录异常!"); + } + } + + /**获得系统相对路径*/ + public String path(){; + String pathew = this.getClass().getClassLoader().getResource("/").getPath(); + pathew = pathew.substring(1, pathew.length()); + pathew = pathew.replace("/WEB-INF/classes/",""); + return pathew; + } + + public static void main(String[] args) { + AnalysisMail paxlmail=new AnalysisMail(); + List result = paxlmail.ParseEmlMethod("f:\\emily20161221170720.eml",""); + } +} diff --git b/.svn/pristine/76/76ef4a469d124677822f8789cac340209083acf3.svn-base a/.svn/pristine/76/76ef4a469d124677822f8789cac340209083acf3.svn-base new file mode 100644 index 0000000..923029f --- /dev/null +++ a/.svn/pristine/76/76ef4a469d124677822f8789cac340209083acf3.svn-base @@ -0,0 +1,39 @@ +package com.espeed.yxy.tool; + +import org.springframework.beans.BeansException; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 获取springApplicationContext中Bean的工具类 + * 开始时间: 2013.10.1 + * 程 序 员: 芮瑞 + * 最后修改: 2014-02-25 + * 备 注:功能主要包括(对企业的增删改查) + */ +public class SpringFactory implements ApplicationContextAware +{ + private static ApplicationContext context; + + public void setApplicationContext(ApplicationContext context) + throws BeansException + { + this.context = context; + } + /** + * + * @param id要获取的springBean的id + * @return + */ + public static Object getObject(String id) { + Object object = null; + object = context.getBean(id); + return object; + } + + +} diff --git b/.svn/pristine/78/784ef6762133b8a7f5b164901cf87b561d2c0783.svn-base a/.svn/pristine/78/784ef6762133b8a7f5b164901cf87b561d2c0783.svn-base new file mode 100644 index 0000000..c0ba115 --- /dev/null +++ a/.svn/pristine/78/784ef6762133b8a7f5b164901cf87b561d2c0783.svn-base @@ -0,0 +1,57 @@ +package com.espeed.yxy.dao.impl; + +import java.util.List; + +import com.espeed.yxy.dao.YxySysParamatersValueDao; +import com.espeed.yxy.pojo.YxySendMailDetail; +import com.espeed.yxy.pojo.YxySysParamatersValue; +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 控制参数值Dao实现类(营销游) + * 开始时间: 2013.12.09 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +public class YxySysParamatersValueDaoImpl extends HibernateBaseDAOImpl<YxySysParamatersValue, Long> implements YxySysParamatersValueDao{ + +// /**查询用户控制参数值*/ +// public List<YxySysParamatersValue> findParamatersValueByParaId(String loginid,String domain) throws Exception { +// String hql="from YxySysParamatersValue where owner_loginid='"+loginid+"' and company_domain='"+domain+"'"; +// return super.getAll(hql); +// } + + /**批量插入*/ + public void addPiPojo(List<YxySysParamatersValue> o)throws Exception{ + super.addPi(o); + } + + /**实体添加*/ + public int addPojo(YxySysParamatersValue o)throws Exception{ + return super.add(o); + } + + /**HQL查询*/ + public List<YxySysParamatersValue> findByHql(String hql)throws Exception{ + return super.getAll(hql); + } + + /**SQL查询*/ + public List<Object> findbysql(String sql)throws Exception{ + return super.findBySql(sql); + } + + /**SQL更新*/ + public void updateBySql(String sql)throws Exception{ + super.updateorDelBySql(sql); + } + + /**HQL更新*/ + public void updateByHql(String hql)throws Exception{ + super.updateorDelByHql(hql); + } +} diff --git b/.svn/pristine/7a/7a54fdd4b287886ce2cfc17fa90530f4a704f8d9.svn-base a/.svn/pristine/7a/7a54fdd4b287886ce2cfc17fa90530f4a704f8d9.svn-base new file mode 100644 index 0000000..450c482 --- /dev/null +++ a/.svn/pristine/7a/7a54fdd4b287886ce2cfc17fa90530f4a704f8d9.svn-base @@ -0,0 +1,38 @@ +package com.espeed.yxy.dao; + +import java.util.List; +import com.espeed.yxy.pojo.YxySysParamaters; + +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 控制参数DAO + * 开始时间: 2013.11.27 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +public interface YxyParamaterDao { + /**查询控制参数*/ + //public List<YxySysParamaters> findParamaterByCode(int level)throws Exception; + /**批量插入*/ + public void addPiPojo(List<YxySysParamaters> o)throws Exception; + + /**实体添加*/ + public int addPojo(YxySysParamaters o)throws Exception; + + /**HQL查询*/ + public List<YxySysParamaters> findByHql(String hql)throws Exception; + + /**SQL查询*/ + public List<Object> findbysql(String sql)throws Exception; + + /**SQL更新*/ + public void updateBySql(String sql)throws Exception; + + /**HQL更新*/ + public void updateByHql(String hql)throws Exception; +} diff --git b/.svn/pristine/7a/7ad595617b6c4b5476eb1c4bf7c16fccacaf7f5b.svn-base a/.svn/pristine/7a/7ad595617b6c4b5476eb1c4bf7c16fccacaf7f5b.svn-base new file mode 100644 index 0000000..8b221d4 --- /dev/null +++ a/.svn/pristine/7a/7ad595617b6c4b5476eb1c4bf7c16fccacaf7f5b.svn-base @@ -0,0 +1,313 @@ +package com.espeed.yxy.timer; + +import java.io.PrintWriter; +import java.io.Serializable; +import java.io.StringWriter; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; +import java.util.concurrent.LinkedBlockingDeque; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; +import com.espeed.yxy.mail.YxysendMethod; +import com.espeed.yxy.pojo.YxySendMailMaster; +import com.espeed.yxy.pojo.YxySendSmtpInfo; +import com.espeed.yxy.service.YxySendMailService; +import com.espeed.yxy.tool.DateFormat; +import com.espeed.yxy.tool.LogsTool; +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 手动收邮件后台线程池 + * 开始时间: 2013.09.02 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +public class ThreadPoolTask implements Runnable,Serializable{ + + private static final long serialVersionUID = 0; + private static ThreadPoolExecutor threadPool=null; + private static ThreadPoolTask threadpooltask=null; + + private YxySendMailService service; + private YxySendSmtpInfo smtpinfo; + private YxySendMailMaster mailinfo; + //private List<YxySmtpSuffixSet> suffixtList; + + //无参构造方法 + ThreadPoolTask(){ + } + //传递参数 + //ThreadPoolTask(YxySendMailService service,YxySendSmtpInfo smtpinfo,YxySendMailMaster mailinfo,List<YxySmtpSuffixSet> suffixtList){ + ThreadPoolTask(YxySendMailService service,YxySendSmtpInfo smtpinfo,YxySendMailMaster mailinfo){ + this.service=service; + this.smtpinfo=smtpinfo; + this.mailinfo=mailinfo; + //this.suffixtList=suffixtList; + } + + //单例方法 + public static ThreadPoolTask getMethodInstance(){ + if(threadpooltask==null){ + //System.out.println("创建新对像了"); + threadpooltask=new ThreadPoolTask(); + } + return threadpooltask; + } + + //线程池 + public static ThreadPoolExecutor getInstance(int bigThread){ + if(threadPool==null){ + threadPool=new ThreadPoolExecutor(20,23,50, + TimeUnit.SECONDS,new LinkedBlockingDeque<Runnable>(23), + new ThreadPoolExecutor.DiscardOldestPolicy()); + } + return threadPool; + } + //线程池运行方法 + //public synchronized void getResult(YxySendMailService service,List<YxySendSmtpInfo> smtplist,List<YxySendMailMaster> mailList) { + public synchronized void getResult(YxySendMailService service,List<YxySendSmtpInfo> smtplist) { + threadPool=getInstance(20); + int queue=threadPool.getQueue().size(); + System.out.println("队列:"+queue); + List<YxySendSmtpInfo> new_smtplist = smtplist; + try{ + //根据smtp类型获取对应的类型的待发邮件 + String hql = "from YxySendMailMaster where isuse=0 and (status=0 or status=2) order by create_time"; + List<YxySendMailMaster> masters = service.getMailMasterByHql(hql); + if(masters.size()>0){ + //当前时间 + SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String nowdate = df.format(new Date()); + //循环待发邮件 + for(YxySendMailMaster master : masters){ + //看看还有没有smtp + if(new_smtplist.size() == 0){ + System.out.println("SMTP已经匹配完毕!"); + break; + } + if(master.getPlans_send()==1){//定时邮件 + //判断是否定时时间到了当前时间 + long minytelcha= DateFormat.minute1s(nowdate,master.getPlans_send_time()); + if(minytelcha>0){//定时时间还没到 + continue; + } + } + //该封邮件去smtp集合里面匹配对应的smtp + for(YxySendSmtpInfo smtp : new_smtplist){ + //0-0(新客户营销),1-1(本地库跟进) + if((master.getIsold()==smtp.getSmtp_service_type()) + && (smtp.getSmtp_service_type() == 0 || smtp.getSmtp_service_type() == 1)) + { + //从smtp集合中去除该smtp + new_smtplist.remove(smtp); + //修改SMTP状态为正在使用 + service.updateSmtpUseStatus(1, smtp.getSmtp_service_id(), ""); + Thread.sleep(1000); + System.out.println("smtp服务器:"+smtp.getSmtp_service_id()+",类型:"+smtp.getSmtp_service_type()+"->负责发送邮件:"+master.getSend_mail_id()+",类型:"+master.getIsold()); + //调用线程进行发送 + threadPool.execute(new ThreadPoolTask(service,smtp,master)); + //退出smtp匹配循环 + break; + } + //2-2(CRM库代发模式) + if((master.getIsold()==smtp.getSmtp_service_type()) + && smtp.getSmtp_service_type() == 2) + { + //必须用自己企业的SMTP + if(smtp.getSmtp_user_domain()!=null&&smtp.getSmtp_user_domain().equals(master.getUser_domain())){ + //从smtp集合中去除该smtp + new_smtplist.remove(smtp); + //修改SMTP状态为正在使用 + service.updateSmtpUseStatus(1, smtp.getSmtp_service_id(), ""); + Thread.sleep(1000); + System.out.println("smtp服务器:"+smtp.getSmtp_service_id()+",类型:"+smtp.getSmtp_service_type()+"->负责发送邮件:"+master.getSend_mail_id()+",类型:"+master.getIsold()); + //调用线程进行发送 + threadPool.execute(new ThreadPoolTask(service,smtp,master)); + //退出smtp匹配循环 + break; + } + } + //3-3(CRM库自有域名),5-5(新客户营销-自有域名) + if((master.getIsold()==smtp.getSmtp_service_type()) + && (smtp.getSmtp_service_type() == 3 || smtp.getSmtp_service_type() == 5)) + { + //必须用自己的smtp + if(smtp.getSmtp_user_domain()!=null + && smtp.getSmtp_user_domain().equals(master.getUser_domain()) + && smtp.getSmtp_user_loginid()!=null + && smtp.getSmtp_user_loginid().equals(master.getUser_loginid())){ + //从smtp集合中去除该smtp + new_smtplist.remove(smtp); + //修改SMTP状态为正在使用 + service.updateSmtpUseStatus(1, smtp.getSmtp_service_id(), ""); + Thread.sleep(1000); + System.out.println("smtp服务器:"+smtp.getSmtp_service_id()+",类型:"+smtp.getSmtp_service_type()+"->负责发送邮件:"+master.getSend_mail_id()+",类型:"+master.getIsold()); + //调用线程进行发送 + threadPool.execute(new ThreadPoolTask(service,smtp,master)); + //退出smtp匹配循环 + break; + } + } + //盘活客户超标使用之前的老客户跟进发送 + if(master.getIsold()==4&&smtp.getSmtp_service_type()==1){ + //从smtp集合中去除该smtp + new_smtplist.remove(smtp); + //修改SMTP状态为正在使用 + service.updateSmtpUseStatus(1, smtp.getSmtp_service_id(), ""); + Thread.sleep(1000); + System.out.println("smtp服务器:"+smtp.getSmtp_service_id()+",类型:"+smtp.getSmtp_service_type()+"->负责发送邮件:"+master.getSend_mail_id()+",类型:"+master.getIsold()); + //调用线程进行发送 + threadPool.execute(new ThreadPoolTask(service,smtp,master)); + //退出smtp匹配循环 + break; + } + //开发客户超标使用之前的新客户营销发送 + if(master.getIsold()==6&&smtp.getSmtp_service_type()==0){ + //从smtp集合中去除该smtp + new_smtplist.remove(smtp); + //修改SMTP状态为正在使用 + service.updateSmtpUseStatus(1, smtp.getSmtp_service_id(), ""); + Thread.sleep(1000); + System.out.println("smtp服务器:"+smtp.getSmtp_service_id()+",类型:"+smtp.getSmtp_service_type()+"->负责发送邮件:"+master.getSend_mail_id()+",类型:"+master.getIsold()); + //调用线程进行发送 + threadPool.execute(new ThreadPoolTask(service,smtp,master)); + //退出smtp匹配循环 + break; + } + +// //处理新客户营销或本地客户库的发送或超标的CRM库发送 +// if(master.getIsold()==smtp.getSmtp_service_type()&&(master.getIsold()==0||master.getIsold()==1)){ +// //从smtp集合中去除该smtp +// new_smtplist.remove(smtp); +// //修改SMTP状态为正在使用 +// service.updateSmtpUseStatus(1, smtp.getSmtp_service_id(), ""); +// Thread.sleep(1000); +// System.out.println("smtp服务器:"+smtp.getSmtp_service_id()+"负责发送邮件:"+master.getSend_mail_id()); +// //调用线程进行发送 +// threadPool.execute(new ThreadPoolTask(service,smtp,master)); +// //退出smtp匹配循环 +// break; +// } +// //处理代发模式,当前邮件的域名都使用该smtp发送 +// if(master.getIsold()==smtp.getSmtp_service_type()&&master.getIsold()==2){ +// //是同一个域名则可以发送 +// if(smtp.getSmtp_user_domain()!=null&&smtp.getSmtp_user_domain().equals(master.getUser_domain())){ +// //从smtp集合中去除该smtp +// new_smtplist.remove(smtp); +// //修改SMTP状态为正在使用 +// service.updateSmtpUseStatus(1, smtp.getSmtp_service_id(), ""); +// Thread.sleep(1000); +// System.out.println("smtp服务器:"+smtp.getSmtp_service_id()+"负责发送邮件:"+master.getSend_mail_id()); +// //调用线程进行发送 +// threadPool.execute(new ThreadPoolTask(service,smtp,master)); +// //退出smtp匹配循环 +// break; +// } +// } +// //处理自有域名,当前邮件的域名只能使用自己的smtp发送 +// if(master.getIsold()==smtp.getSmtp_service_type()&&master.getIsold()==3){ +// //是同一个域名则可以发送 +// if(smtp.getSmtp_user_domain()!=null&& +// smtp.getSmtp_user_domain().equals(master.getUser_domain())&& +// smtp.getSmtp_user_loginid()!=null&&smtp.getSmtp_user_loginid().equals(master.getUser_loginid())){ +// //从smtp集合中去除该smtp +// new_smtplist.remove(smtp); +// //修改SMTP状态为正在使用 +// service.updateSmtpUseStatus(1, smtp.getSmtp_service_id(), ""); +// Thread.sleep(1000); +// System.out.println("smtp服务器:"+smtp.getSmtp_service_id()+"负责发送邮件:"+master.getSend_mail_id()); +// //调用线程进行发送 +// threadPool.execute(new ThreadPoolTask(service,smtp,master)); +// //退出smtp匹配循环 +// break; +// } +// } + } + } + }else{ + System.out.println("没有待发邮件!"); + } + }catch (Exception e) { + e.printStackTrace(); + } + + + + +// threadPool=getInstance(20); +// int queue=threadPool.getQueue().size(); +// System.out.println("队列:"+queue); +// List<YxySendSmtpInfo> new_smtplist = smtplist; +// //邮件加入线程池 +// for(int j=0;j<mailList.size();j++){ +// try { +// if(queue>=23){ +// System.out.println("队列已满!"); +// break; +// } +// +// YxySendSmtpInfo smtpinfo = null; +// +// if(mailList.get(j).getIsold()==2)//自主域名投递 +// { +// //选择合适的自主域名投递smtp +// smtpinfo = service.findSmtpInfoByCusType2(new_smtplist, mailList.get(j)); +// } +// else//不是自主域名投递则按之前的业务实现 +// { +// //根据客户类型进行选择smtp服务器 +// smtpinfo = service.findSmtpInfoByCusType(new_smtplist,mailList.get(j).getIsold()); +// } +// if(null==smtpinfo)//没对应的smtp则执行下一循环 +// { +// continue; +// } +// //去除满足的smtp服务器 +// new_smtplist.remove(smtpinfo); +// //修改SMTP状态 +// service.updateSmtpUseStatus(1, smtpinfo.getSmtp_service_id(), ""); +// Thread.sleep(1000); +// System.out.println("smtp服务器:"+smtpinfo.getSmtp_service_id()+"负责发送邮件:"+mailList.get(j).getSend_mail_id()); +// threadPool.execute(new ThreadPoolTask(service,smtpinfo,mailList.get(j))); +//// //修改SMTP状态 +//// service.updateSmtpUseStatus(1, smtplist.get(j).getSmtp_service_id(), ""); +//// Thread.sleep(1000); +//// threadPool.execute(new ThreadPoolTask(service,smtplist.get(j),mailList.get(j))); +// } catch (Exception e) { +// e.printStackTrace(); +// } +// } + } + //获取线程量 + public int getThreadNum(){ + if(threadPool==null){ + return -1; + }else{ + return threadPool.getActiveCount(); + } + } + //start + public void run(){ + try { + //调用发邮件方法 + YxysendMethod.sendMethodImpl(service, smtpinfo,mailinfo); + } catch (Exception e) { + e.printStackTrace(); + //写入日志 + StringWriter sw = new StringWriter(); + e.printStackTrace(new PrintWriter(sw, true)); + String str = sw.toString(); + LogsTool.erroLogs(str); + } + //此线程任务完成后重新获取线程池的数量 +// synchronized (this) { +// threadPool.shutdown(); +// } + } + +} diff --git b/.svn/pristine/7b/7bdc88952c1a586033deca722e0f2b542db3f2ff.svn-base a/.svn/pristine/7b/7bdc88952c1a586033deca722e0f2b542db3f2ff.svn-base new file mode 100644 index 0000000..ac0d85b Binary files /dev/null and a/.svn/pristine/7b/7bdc88952c1a586033deca722e0f2b542db3f2ff.svn-base differ diff --git b/.svn/pristine/7e/7e1846e4a19a45753c02a3e998ecaa096072077a.svn-base a/.svn/pristine/7e/7e1846e4a19a45753c02a3e998ecaa096072077a.svn-base new file mode 100644 index 0000000..0e271bc --- /dev/null +++ a/.svn/pristine/7e/7e1846e4a19a45753c02a3e998ecaa096072077a.svn-base @@ -0,0 +1,113 @@ +package com.espeed.yxy.tool; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.net.URISyntaxException; +import java.util.Properties; +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 配置文件读取工具类(营销游) + * 开始时间: 2013.12.09 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +public class ConfigPath { + + static Properties p = loadPropertyFile("config.properties"); + + public static String getFilePth(){ + return p.get("cfgFilePath")+""; + } + + public static String getXmlFilePth(){ + return p.get("xmlFilePath")+""; + } + + /**读取配置的最大线程量*/ + public static int getThreadNum(){ + return Integer.parseInt(p.get("threadNum")+""); + } + /**获取点读服务路径*/ + public static String getClickService(){ + return p.get("clickserviceurl")+""; + } + /**获取点读服务路径(业务修改后)*/ + public static String getClickService2() + { + return p.get("clickserviceurl2")+""; + } + /**获取营销服务器路径(易外销)*/ + public static String getYxyServicePath(){ + return p.get("yxywebmailpath")+""; + } + /**获取营销服务器路径(单独)*/ + public static String getYxyServicePath2(){ + return p.get("yxywebmailpath2")+""; + } + /**获取一个smtp发送邮件数量*/ + public static int getSmtpSendNum(){ + return Integer.parseInt(p.get("smtpsendnum").toString()); + } + /**webmail定时器URL*/ + public static String getWebMailTimeUrl(){ + return p.get("webmailtimeurl")+""; + } + /**webmail接口URL*/ + public static String getWebmailInterfaceUrl(){ + return p.get("webmailinterfaceurl")+""; + } + /**地址发送异常数量*/ + public static int getSendExpNum(){ + return Integer.parseInt(p.get("sendexpnum").toString()); + } + /**获取超链接跟踪url*/ + public static String getTrackUrl(){ + return p.getProperty("trackurl"); + } + + /**加载配置文件*/ + public static Properties loadPropertyFile(String fullFile) { + String webRootPath = null; + if ( fullFile.equals("")) + throw new IllegalArgumentException("Properties file path can not be null : " + fullFile); + try { + webRootPath = ConfigPath.class.getClassLoader().getResource("").toURI().getPath(); + } catch (URISyntaxException e1) { + e1.printStackTrace(); + } + webRootPath = new File(webRootPath).getParent(); + InputStream inputStream = null; + Properties p = null; + try { + inputStream = new FileInputStream(new File(webRootPath+ File.separator + fullFile)); + p = new Properties(); + p.load(inputStream); + + } catch (FileNotFoundException e) { + throw new IllegalArgumentException("Properties file not found: " + + fullFile); + } catch (IOException e) { + throw new IllegalArgumentException( + "Properties file can not be loading: " + fullFile); + } finally { + try { + if (inputStream != null) + inputStream.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + return p; + } + + + +} diff --git b/.svn/pristine/7e/7e92361cd474050588ac4d9b982613e87e32cd76.svn-base a/.svn/pristine/7e/7e92361cd474050588ac4d9b982613e87e32cd76.svn-base new file mode 100644 index 0000000..80c0ca8 Binary files /dev/null and a/.svn/pristine/7e/7e92361cd474050588ac4d9b982613e87e32cd76.svn-base differ diff --git b/.svn/pristine/7e/7efedc2fc4220a129c57e5a2e29c69b896252b83.svn-base a/.svn/pristine/7e/7efedc2fc4220a129c57e5a2e29c69b896252b83.svn-base new file mode 100644 index 0000000..e68c4f8 --- /dev/null +++ a/.svn/pristine/7e/7efedc2fc4220a129c57e5a2e29c69b896252b83.svn-base @@ -0,0 +1,179 @@ +package com.espeed.yxy.dao.impl; + +import java.io.Serializable; +import java.util.List; +import org.hibernate.Query; +import org.hibernate.Session; +import org.springframework.orm.hibernate3.support.HibernateDaoSupport; + +import com.espeed.yxy.dao.HibernateBaseDAO; + +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 通用dao操作接口实现类 + * 开始时间: 2013.09.22 + * 程 序 员: 谢勇 + * 最后修改: 2014-02-26 + * 备 注: 实现通用的增删改查操作,被其他dao所继承使用 + */ + +public abstract class WebmailHibernateBaseDAOImpl<T extends Serializable ,Pk extends Serializable> extends HibernateDaoSupport + implements HibernateBaseDAO<T, Pk> { + /** + * ------------------------------常用CRUD操作----------------------------------------- + */ + /**增加记录 (返回新增加记录的主键)*/ + public int add(T o) throws Exception { + return (Integer) super.getHibernateTemplate().save(o); + } + + /**增加记录(无返回值)*/ + public void adddate(T o) throws Exception { + super.getHibernateTemplate().save(o); + } + + /**修改记录*/ + public void update(T o) throws Exception { + super.getHibernateTemplate().update(o); + } + + /**删除记录*/ + public void del(T o) throws Exception { + super.getHibernateTemplate().delete(o); + } + + /**添加或更新*/ + public void saveOrUpdate(T o) throws Exception { + super.getHibernateTemplate().saveOrUpdate(o); + } + + /**根据ID获取一条数据*/ + @SuppressWarnings("unchecked") + public T get(Class<T> t,Pk pk) throws Exception { + return (T) super.getHibernateTemplate().get(t, pk); + } + + /**根据ID获取一条数据*/ + @SuppressWarnings("unchecked") + public T load(Class<T> t,Pk pk) throws Exception { + return (T) super.getHibernateTemplate().load(t, pk); + } + + /**根据hql进行条件查询*/ + @SuppressWarnings("unchecked") + public List<T> getAll(String hql) throws Exception { + return super.getHibernateTemplate().find(hql); + } + + /**条件查询*/ + @SuppressWarnings("unchecked") + public List<T> getAll(String whereHql, Object... params) throws Exception { + return super.getHibernateTemplate().find(whereHql,params); + } + + /* + * -------------------------------查询总记录数----------------------------------------- + */ + /**根据条件查询总记录*/ + public int count(String hql) throws Exception { + List result=super.getHibernateTemplate().find(hql); + if(result.size()>0&&result.get(0)!=null&&!result.get(0).equals("null")){ + return Long.valueOf(result.get(0).toString()).intValue(); + //return Integer.valueOf(result.get(0).toString()); + }else{ + return 0; + } + //return Integer.valueOf(super.getHibernateTemplate().find(hql).get(0).toString()); + } + + /**根据条件和参数查询总记录*/ + public int count(String hql, Object... params) throws Exception { + return Integer.valueOf(super.getHibernateTemplate().find(hql,params).get(0).toString()); + } + + /**HQL语句修改删除记录*/ + public int updateorDelBySql(String hql){ + Query query = null; + int result=0; + Session session =null; + session=super.getHibernateTemplate().getSessionFactory().openSession(); + query = session.createQuery(hql); + result = query.executeUpdate(); + return result; + } + + /**sql语句修改删除记录*/ + public int updateorDelSql(String sql){ + Query query = null; + int result=0; + Session session =null; + try { + session=super.getHibernateTemplate().getSessionFactory().openSession(); + query = session.createSQLQuery(sql); + result = query.executeUpdate(); + } catch (Exception e) { + e.printStackTrace(); + }finally{ + if(session!=null){ + session.clear(); + session.close(); + } + } + + return result; + } + + /**查询设定的记录条数据*/ + public List<T> findBySet(String hql,int num){ + Session session = null; + Query query=null; + try { + session=super.getHibernateTemplate().getSessionFactory().openSession(); + query = session.createQuery(hql); + query.setMaxResults(num); + return query.list(); + } catch (Exception e) { + e.printStackTrace(); + }finally{ + if(session!=null){ + session.clear(); + session.close(); + } + } + return null; + } + + /**批量插入*/ + public void addPi(List<T> o)throws Exception{ + Session session = super.getHibernateTemplate().getSessionFactory().openSession(); + if(o!=null){ + session.beginTransaction(); + for(int i=0;i<o.size();i++){ + session.saveOrUpdate(o.get(i)); + } + session.beginTransaction().commit(); + } + } + + /**sql语句查询 + * @throws Exception */ + public List findBySql(String sql) throws Exception{ + Session session=null; + try { + session =super.getHibernateTemplate().getSessionFactory().openSession(); + return session.createSQLQuery(sql).list(); + } catch (Exception e) { + e.printStackTrace(); + }finally{ + if(session!=null){ + session.clear(); + session.close(); + } + } + return null; + } +} diff --git b/.svn/pristine/7f/7f13874843342a8615ccaf5d51516086330b55b4.svn-base a/.svn/pristine/7f/7f13874843342a8615ccaf5d51516086330b55b4.svn-base new file mode 100644 index 0000000..256fbea --- /dev/null +++ a/.svn/pristine/7f/7f13874843342a8615ccaf5d51516086330b55b4.svn-base @@ -0,0 +1,40 @@ +package com.espeed.yxy.dao.impl; + +import java.util.List; + +import com.espeed.centre.pojo.CentreTrackSet; +import com.espeed.yxy.dao.CentreTrackSetDao; +/** + * 项目名称: 统一验证中心系统 + * 版权所有: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 技术支持: info@21gmail.com + * 单元名称: 营销邮开发客户配置Dao实现类 + * 开始时间: 2018.04.08 + * 开发人员: 陈南巧 + */ +public class CentreTrackSetDaoImpl extends CentreHibernateBaseDAOImpl<CentreTrackSet, Long> implements CentreTrackSetDao { + /**实体插入*/ + public int addPojo(CentreTrackSet o)throws Exception{ + return super.add(o); + } + /**实体编辑*/ + public void updatePojo(CentreTrackSet o)throws Exception{ + super.update(o); + } + /**HQL查询*/ + public List<CentreTrackSet> findByHql(String hql)throws Exception{ + return super.getAll(hql); + } + /**HQL查询数量*/ + public int findByHqlCount(String hql)throws Exception{ + return super.count(hql); + } + /**SQL查询*/ + public List<Object> findBySqlFind(String sql)throws Exception{ + return super.findBySql(sql); + } + /**HQL更新*/ + public void updateByHql(String hql)throws Exception{ + super.updateorDelBySql(hql); + } +} diff --git b/.svn/pristine/80/80e24d6e4b90c4bb218b5edae6dc9cb76204c3d2.svn-base a/.svn/pristine/80/80e24d6e4b90c4bb218b5edae6dc9cb76204c3d2.svn-base new file mode 100644 index 0000000..7c0927a --- /dev/null +++ a/.svn/pristine/80/80e24d6e4b90c4bb218b5edae6dc9cb76204c3d2.svn-base @@ -0,0 +1,696 @@ +package com.espeed.yxy.service.impl; + +import java.io.File; +import java.io.FileWriter; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.Date; +import java.util.List; + +import org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory; +import org.springframework.beans.BeanUtils; + +import com.espeed.centre.pojo.CentreTrackSet; +import com.espeed.centre.pojo.CentreYxyedmNewcustomer; +import com.espeed.centre.pojo.CentreYxyedmOldcustomer; +import com.espeed.yxy.dao.CentreTrackSetDao; +import com.espeed.yxy.dao.CentreUserDao; +import com.espeed.yxy.dao.CentreYxyedmNewcustomerDao; +import com.espeed.yxy.dao.CentreYxyedmOldcustomerDao; +import com.espeed.yxy.dao.YxyParamaterDao; +import com.espeed.yxy.dao.YxyReplyInfoDao; +import com.espeed.yxy.dao.YxySendFilterAddressDao; +import com.espeed.yxy.dao.YxySendMailDetailDao; +import com.espeed.yxy.dao.YxySendMailMasterBaseDao; +import com.espeed.yxy.dao.YxySendMailMasterDao; +import com.espeed.yxy.dao.YxySendSmtpInfoDao; +import com.espeed.yxy.dao.YxySmtpSendSelfOversetDao; +import com.espeed.yxy.dao.YxySmtpSendSelfSetDao; +import com.espeed.yxy.dao.YxySmtpSendSetDao; +import com.espeed.yxy.dao.YxySmtpSuffixSetDao; +import com.espeed.yxy.dao.YxySysParamatersValueDao; +import com.espeed.yxy.pojo.YxyReplyInfo; +import com.espeed.yxy.pojo.YxySendFilterAddress; +import com.espeed.yxy.pojo.YxySendMailDetail; +import com.espeed.yxy.pojo.YxySendMailMaster; +import com.espeed.yxy.pojo.YxySendMailMasterBase; +import com.espeed.yxy.pojo.YxySendSmtpInfo; +import com.espeed.yxy.pojo.YxySmtpSendSelfOverset; +import com.espeed.yxy.pojo.YxySmtpSendSelfSet; +import com.espeed.yxy.pojo.YxySmtpSendSet; +import com.espeed.yxy.pojo.YxySmtpSuffixSet; +import com.espeed.yxy.pojo.YxySysParamaters; +import com.espeed.yxy.pojo.YxySysParamatersValue; +import com.espeed.yxy.pojo.YxyUserAddress; +import com.espeed.yxy.service.YxySendMailService; +import com.espeed.yxy.tool.ConfigPath; +import com.espeed.yxy.tool.DateFormat; +import com.espeed.yxy.tool.createAndDeleteFile; +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 邮件发送service业务接口实现类(营销游) + * 开始时间: 2013.12.09 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +public class YxySendMailServiceImpl implements YxySendMailService{ + + //------------------------待发邮件操作模块----------------------------- + /**查询所有待发邮件*/ + public List<YxySendMailMaster> findByMailNum(int mailNum) throws Exception { + //正常可用的对象集合 + List<YxySendMailMaster> copymail=new ArrayList<YxySendMailMaster>(); + //数据库返回的结果集 + String hql="from YxySendMailMaster where isuse=0 and (status=0 or status=2) order by create_time"; + List<YxySendMailMaster> sendmailList=yxysendmailmasterdao.findByHql(hql); + if(sendmailList.size()>0){ + //当前时间 + SimpleDateFormat df=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String nowdate=df.format(new Date()); + //相隔分数 + long minytelcha=0; + //判断是不是定时邮件 + for(int i=0;i<sendmailList.size();i++){ + //如果等于指定条的相同则不在比较 + if(copymail.size()==mailNum){ + break; + } + if(sendmailList.get(i).getPlans_send()==1){//是定时邮件 + //判断是否定时时间到了当前时间 + minytelcha= DateFormat.minute1s(nowdate,sendmailList.get(i).getPlans_send_time()); + if(minytelcha<0){//如果在此时间内则加入该对象 + copymail.add(sendmailList.get(i)); + } + }else{//不是定时邮件 + copymail.add(sendmailList.get(i)); + } + } + return copymail; + }else{ + return sendmailList; + } + } + + /**修改邮件使用状态*/ + public void updateMailUseStatus(int mailid, int isuse,String timer) throws Exception { + String hql=""; + if(!timer.equals("")){ + hql="update YxySendMailMaster set isuse="+isuse+",result_remark='"+timer+"' where send_mail_id="+mailid; + }else{ + hql="update YxySendMailMaster set isuse="+isuse+" where send_mail_id="+mailid; + } + yxysendmailmasterdao.updateByHql(hql); + } + + /**修改邮件异常量*/ + public void updateMailExpStatus(int mailid, int expnum) throws Exception { + String hql="update YxySendMailMaster set exptionnum="+expnum+",isuse=0 where send_mail_id="+mailid; + yxysendmailmasterdao.updateByHql(hql); + } + /**同时修改待发邮件状态与基本邮件信息状态*/ + public void updateMailStatus(int status,int mailid, String mailuid) throws Exception { + String hql="update YxySendMailMaster set status="+status+" where send_mail_id="+mailid; + String sql="update yxy_send_mail_master_base set status="+status+" where mail_uid='"+mailuid+"'"; + yxysendmailmasterdao.updateByHql(hql); + yxysendmailmasterdao.updateBySql(sql); + } + + /**加入待发邮件*/ + public void addMailMaster(YxySendMailMaster master,List<YxyUserAddress> addresslist,int planid,int plan_differen)throws Exception { + String loginid=master.getUser_loginid(); + String domain=master.getUser_domain(); + + String customerids = "";//客户的id + //定义邮件基本信息实体 + YxySendMailMasterBase masterbase=new YxySendMailMasterBase(); + //复制对象 + BeanUtils.copyProperties(master,masterbase); + //插入待发邮件 + //int mailid=yxysendmailmasterdao.addPojo(master); + //插入基本邮件信息 + //int baseid=mailmasterbasedao.addPojo(masterbase); + //待发地址 + List<YxySendMailDetail> detaillist=new ArrayList<YxySendMailDetail>(); + //查询回复 + String hql="from YxyReplyInfo where loginid='"+loginid+"' and domain='"+domain+"'"; + List<YxyReplyInfo> replylist=replydao.findByHql(hql); + //查询过滤 + String filterhql="from YxySendFilterAddress where filteraddrloginid='"+loginid+"' and filteraddrdomain='"+domain+"'"; + List<YxySendFilterAddress> filterlist=filterdao.findByHql(filterhql); + //待发地址处理(去掉回复的,用户过滤的) + for(int i=0;i<addresslist.size();i++){ + String email=addresslist.get(i).getUser_addr_email();//地址 + for(int j=0;j<replylist.size();j++){ + if(email.equals(replylist.get(j).getReplyemail())){ + break; + } + } + for(int s=0;s<filterlist.size();s++){ + if(email.indexOf(filterlist.get(s).getFilteraddress())!=-1){ + break; + } + } + + customerids += addresslist.get(i).getUser_addr_id()+",";//当有多个地址进行拼接 + + //待发地址对象 + YxySendMailDetail detail=new YxySendMailDetail(); + detail.setCompany_variable(addresslist.get(i).getCompany_variable()); + detail.setEmail(email); + detail.setEmail_suffix(""); + detail.setIsexp(0); + detail.setPlanid(planid); + detail.setPlans_send_time(null); + detail.setReceiver(addresslist.get(i).getUser_addr_name()); + detail.setStatus(0); + detail.setLoginid(loginid); + detail.setDomain(domain); + //加入集合 + detaillist.add(detail); + } + //赋值 + masterbase.setSend_num(detaillist.size()); + + //将地址生成txt文件(存放路径:域名+用户名+当前时间) + StringBuffer writestr=new StringBuffer(); + if(detaillist.size()>0){ + writestr.append(masterbase.getCreate_time()+"发送的邮件地址\r\n"); + for(int i=0;i<detaillist.size();i++){ + writestr.append(detaillist.get(i).getEmail()+"\r\n"); + } + //项目路进(默认是易外销的营销邮) + String pathew = ConfigPath.getYxyServicePath(); + if(plan_differen == 0){//如果是本地库则切换成单独营销邮的路径 + pathew = ConfigPath.getYxyServicePath2(); + } + SimpleDateFormat dfs=new SimpleDateFormat("yyyyMMddHHmmssSSS"); + String nowFilename=dfs.format(new Date()); + String filename=nowFilename+".txt"; + String txtsavepath=pathew+"\\userSaveFile\\"+domain+"\\"+loginid+"\\"+filename; + File f=new File(pathew+"\\userSaveFile\\"+domain+"\\"+loginid); + if(!f.exists()){ + f.mkdirs(); + } + createAndDeleteFile.createFile(txtsavepath); + System.out.println(txtsavepath); + //写入文件 + FileWriter w = new FileWriter(txtsavepath, true); + w.write(writestr.toString()); + w.close(); + + masterbase.setTxtaddresspath(filename); + } + + //插入待发邮件 + int mailid=yxysendmailmasterdao.addPojo(master); + //插入基本邮件信息 + int baseid=mailmasterbasedao.addPojo(masterbase); + + for(YxySendMailDetail detail : detaillist) + { + detail.setBase_mail_id(baseid); + detail.setSend_mail_id(mailid); + } + + //plan_differen > 0 是客户管理的,否则就是本地库的 + if(plan_differen > 0) + { + //判断客户id + if(!"".equals(customerids)){//不能为空,当有多个 + customerids = customerids.substring(0,customerids.length()-1); + } + try{ + //访问webmail接口URL + String url =ConfigPath.getWebmailInterfaceUrl()+"/webmailWebservice/yxyaddfollowupwebservice?wsdl"; + JaxWsDynamicClientFactory dcf = JaxWsDynamicClientFactory.newInstance(); + org.apache.cxf.endpoint.Client client = dcf.createClient(url); + client.invoke("addFollowup",customerids,0,loginid,domain,masterbase.getSubject(),baseid); + }catch (Exception e) { + System.out.println("添加跟进记录异常..."); + e.printStackTrace(); + } + } + + yxysendmaildetaildao.addPiPojo(detaillist); + } + + /**更新待发邮件图片与附件路径*/ + public void updatepicattrpath(int masterid, String picpath, String attrpath)throws Exception { + String hql=""; + if(!"".equals(picpath)&&!"".equals(attrpath)){ + hql="update YxySendMailMaster set image_path='"+picpath+"',attarchment_path='"+attrpath+"' where send_mail_id="+masterid; + yxysendmailmasterdao.updateByHql(hql); + }else if(!"".equals(picpath)){ + hql="update YxySendMailMaster set image_path='"+picpath+"' where send_mail_id="+masterid; + yxysendmailmasterdao.updateByHql(hql); + }else if(!"".equals(attrpath)){ + hql="update YxySendMailMaster set attarchment_path='"+attrpath+"' where send_mail_id="+masterid; + yxysendmailmasterdao.updateByHql(hql); + } + } + + /**根据hql获取待发邮件*/ + public List<YxySendMailMaster> getMailMasterByHql(String hql)throws Exception{ + return yxysendmailmasterdao.findByHql(hql); + } + + //------------------------待发地址操作模块----------------------------- + /**查询指定条待发地址*/ + public List<YxySendMailDetail> findAddressByMailID(int mailid) throws Exception { + String hql="from YxySendMailDetail where status=0 and send_mail_id="+mailid; + return yxysendmaildetaildao.findByHql(hql); + } + /**修改此地址为已发送*/ + public void updateMailDetailstatus(int addressid) throws Exception { + String hql="update YxySendMailDetail set status=1 where mail_id="+addressid; + yxysendmaildetaildao.updateByHql(hql); + } + /**更新地址状态为异常地址*/ + public void updateExp(int addressid,int expnum) throws Exception { + if(expnum>=ConfigPath.getSendExpNum()){//该收件地址异常数量已经大于配置文件中的数量 + String hql="update YxySendMailDetail set status=1,isexp="+expnum+" where mail_id="+addressid; + yxysendmaildetaildao.updateByHql(hql); + }else{//不大于 + String hql="update YxySendMailDetail set isexp="+expnum+" where mail_id="+addressid; + yxysendmaildetaildao.updateByHql(hql); + } + } + /**根据邮件ID查询是否还存在待发地址*/ + public boolean isHaveAddress(int mailid) throws Exception { + String hql="select count(*) from YxySendMailDetail where send_mail_id="+mailid+" and status=0"; + List resultlist=yxysendmaildetaildao.findByHql(hql); + int num=0; + if(resultlist.size()>0){ + Object obj=resultlist.get(0); + num=Integer.parseInt(obj.toString()); + } + if(num>0){ + return true; + }else{ + return false; + } + } + //------------------------SMTP操作模块--------------------------------- + /**查询可用SMTP*/ + public List<YxySendSmtpInfo> findSmtpInfoSetNum() throws Exception { + + //当前时间 +// SimpleDateFormat df=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); +// String nowdate=df.format(new Date()); + + //集合定义 + List<YxySendSmtpInfo> resmtp=new ArrayList<YxySendSmtpInfo>(); + //查询SMTP信息 + //String hql="from YxySendSmtpInfo where smtp_service_isuse=0 or smtp_service_isuse=1 order by smtp_service_userdate"; + String hql="from YxySendSmtpInfo where smtp_service_isuse=0"; + return yxysendsmtpinfodao.findByHql(hql); + +// String useDate=""; +// long timers=0; +// +// //判断SMTP是否可用 +// for(int i=0;i<smtplist.size();i++){ +// //如果是正在使用中的话判断是否是可用了 +// if(smtplist.get(i).getSmtp_service_isuse()==0){//有未使用的直接返回未使用的 +// resmtp.add(smtplist.get(i)); +// }else{//正在使用中的 +// useDate =smtplist.get(i).getSmtp_service_userdate();//SMTP最后使用的时间 +// //判断两时间的相差量 +// timers=DateFormat.minute1s(useDate, nowdate); +// if(timers>120){//如果两个小时都没使用则在次使用 +// //String hql1="update YxySendSmtpInfo set smtp_service_isuse=0 where smtp_service_id="+smtplist.get(i).getSmtp_service_id(); +// //yxysendsmtpinfodao.updateByHql(hql1); +// resmtp.add(smtplist.get(i)); +// }else{ +// continue; +// } +// } +// } +// return resmtp; + } + + + /**更新smtp使用状态*/ + public void updateSmtpUseStatus(int status,int smtpid,String nowdate) throws Exception { + String hql1=""; + if(nowdate.equals("")){ + hql1="update YxySendSmtpInfo set smtp_service_isuse="+status+" where smtp_service_id="+smtpid; + }else{ + hql1="update YxySendSmtpInfo set smtp_service_isuse="+status+",smtp_service_userdate='"+nowdate+"' where smtp_service_id="+smtpid; + } + + yxysendsmtpinfodao.updateByHql(hql1); + } + + /**更新smtp状态所有的*/ + public void updatesmtpstatus()throws Exception{ + String hql="update YxySendSmtpInfo set smtp_service_isuse=1 where smtp_service_isuse=0"; + yxysendsmtpinfodao.updateByHql(hql); + } + + /**根据客户类型查询smtp*/ + public YxySendSmtpInfo findSmtpInfoByCusType(List<YxySendSmtpInfo> smtp_list,int cus_type)throws Exception + { + YxySendSmtpInfo smtpinfo = null; + + for(int i = 0; i < smtp_list.size(); i++) + { + if(cus_type == 0)//新客户营销 + { + //该smtp是新客户营销且是可用的 + if(smtp_list.get(i).getSmtp_service_type() == 0) + { + smtpinfo = smtp_list.get(i); + + break; + } + } + else if(cus_type == 1)//老客户跟进 + { + //该smtp是老客户跟进且是可用的 + if(smtp_list.get(i).getSmtp_service_type() == 1) + { + smtpinfo = smtp_list.get(i); + + break; + } + } + } + + return smtpinfo; + } + + /**查找自主域名投递的smtp*/ + public YxySendSmtpInfo findSmtpInfoByCusType2(List<YxySendSmtpInfo> smtp_list,YxySendMailMaster master)throws Exception + { + YxySendSmtpInfo smtpinfo = null; + + String loginid = master.getUser_loginid();//邮件所属帐号 + + String domain = master.getUser_domain();//邮件所属域名 + + //保存满足的smtp集合 + List<YxySendSmtpInfo> new_smtp_list = new ArrayList<YxySendSmtpInfo>(); + + for(YxySendSmtpInfo info : smtp_list) + { + String smtp_user_loginid = info.getSmtp_user_loginid();//smtp所属帐号 + + String smtp_user_domain = info.getSmtp_user_domain();//smtp所属域名 + + int smtp_service_type = info.getSmtp_service_type();//smtp类型 + + //smtp类型是自主域名投递且smtp是当前邮件所属用户且域名 + if(smtp_service_type == 2 && + loginid.equals(smtp_user_loginid) && domain.equals(smtp_user_domain)) + { + //把发第一封的时间为Null的smtp设置为空字符串否则下面进行排序时会出现空指针异常 + if(info.getSmtp_service_userdate() == null) + { + info.setSmtp_service_userdate(""); + } + + //添加到集合中 + new_smtp_list.add(info); + } + } + + //判断满足集合是否有元素 + if(new_smtp_list.size() > 0) + { + //按时间进行排序,时间后的排最后 + Collections.sort(new_smtp_list, new Comparator<YxySendSmtpInfo>(){ + @Override + public int compare(YxySendSmtpInfo o1, YxySendSmtpInfo o2) { + return o1.getSmtp_service_userdate().compareTo(o2.getSmtp_service_userdate()); + } + }); + + //取第一个smtp即最先使用的smtp + smtpinfo = new_smtp_list.get(0); + } + + return smtpinfo; + } + + //------------------------SMTP后缀设置参数模块------------------------- + /**查询后缀信息*/ + public List<YxySmtpSuffixSet> findAllSmtpSuffixSet() throws Exception { + String hql="from YxySmtpSuffixSet"; + return yxysmtpsuffixsetdao.findByHql(hql); + } + //------------------------SMTP后缀发送量模块---------------------------- + /**查询该smtp对应后缀在时间段的发送量*/ + public List<YxySmtpSendSet> findAllSmtpSendSet(String smtpservice,String nowDay) throws Exception { + String hql="from YxySmtpSendSet where smtp_send_set_service='"+smtpservice+"' and smtp_send_set_daydate='"+nowDay+"'"; + return yxysmtpsendsetdao.findByHql(hql); + } + + /**删除后缀已发量信息*/ + public void delmSmtpSet(String smtpService) throws Exception { + String hql="delete YxySmtpSendSet where smtp_send_set_service='"+smtpService+"'"; + yxysmtpsendsetdao.updateByHql(hql); + } + + /**更新发送量信息*/ + public void updateSmtpSet(List<YxySmtpSendSet> o) throws Exception { + yxysmtpsendsetdao.addPiPojo(o); + + } + //------------------------控制参数模块--------------------------------- + /**查询控制参数通过传的是系统级还是用户级*/ + public String findCompanyParamByCode(String code,String loginid,String domain) throws Exception { + //查询此code的paramid + String hql="from YxySysParamaters where para_code='"+code+"'"; + List<YxySysParamaters> paraslist=yxysysparamaterdao.findByHql(hql); + if(paraslist.size()>0){ + int paramid=paraslist.get(0).getPara_id(); + int level=paraslist.get(0).getOwner_type();//所属等级 + String defaultvalue=paraslist.get(0).getDefault_value();//默认值 + if(level==4){//用户级 + //查询参数值 + String hql1="from YxySysParamatersValue where para_id="+paramid+" and owner_loginid='"+loginid+"' and company_domain='"+domain+"'"; + List<YxySysParamatersValue> paraValue=yxysysparamatersvaluedao.findByHql(hql1); + if(paraValue.size()>0){ + return paraValue.get(0).getPara_value(); + }else{ + return defaultvalue; + } + }else{//系统级 + //查询参数值 + String hql1="from YxySysParamatersValue where para_id="+paramid+" and company_domain='"+domain+"'"; + List<YxySysParamatersValue> paraValue=yxysysparamatersvaluedao.findByHql(hql1); + if(paraValue.size()>0){ + return paraValue.get(0).getPara_value(); + }else{ + return defaultvalue; + } + } + + }else{ + return "-1"; + } + } + + /**paraid查询企业级控制参数*/ + public List<YxySysParamatersValue> findCompanyParamValues(String domian,int para_id)throws Exception + { + String hql = "from YxySysParamatersValue where owner_type = 1 and company_domain = '"+domian+"' and para_id = "+para_id; + + return yxysysparamatersvaluedao.findByHql(hql); + } + + //------------------------自配SMTP发送量模块----------------------------- + /**通过smtpID查询此smtp的发送参数*/ + public List<YxySmtpSendSelfSet> findSendSelfSetByService(String smtpservice)throws Exception { + String hql="from YxySmtpSendSelfSet where smtp_send_self_set_account='"+smtpservice+"' or smtp_send_self_set_account='domain'"; + return yxysmtpsendselfsetdao.findByHql(hql); + } + /**查询自配账号的已发送量信息*/ + public List<YxySmtpSendSelfOverset> findBySmtpAccount(String account) + throws Exception { + String hql="from YxySmtpSendSelfOverset where smtp_send_self_over_account='"+account+"'"; + return yxysmtpsendselfoversetdao.findByHql(hql); + } + /**添加自配的已发量信息*/ + public void addSendSelfSet(YxySmtpSendSelfOverset o) throws Exception { + yxysmtpsendselfoversetdao.addPojo(o); + } + /**更新已发量*/ + public void updateSendSelfSet(YxySmtpSendSelfOverset o) throws Exception { + yxysmtpsendselfoversetdao.addPojo(o); + + } + + /**查询SMTP判断是否阻塞*/ + public void updateinitsmtpstatus()throws Exception{ + //查询smtp + String hql="from YxySendSmtpInfo where smtp_service_isuse=1"; + List<YxySendSmtpInfo> smtplist=yxysendsmtpinfodao.findByHql(hql); + + //当前时间 + SimpleDateFormat df=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String nowdate=df.format(new Date()); + + //循环判断 + String usetime=""; + int smtpid=0; + for(int i=0;i<smtplist.size();i++){ + smtpid=smtplist.get(i).getSmtp_service_id(); + //判断使用时间是否超过一个小时 + usetime=smtplist.get(i).getSmtp_service_userdate(); + if(usetime!=null&&!"".equals(usetime)){ + long cha=DateFormat.minute1s(usetime, nowdate); + //大于一个小时则改状态为0 + if(cha>=60){ + String updatehql="update YxySendSmtpInfo set smtp_service_isuse=0 where smtp_service_id="+smtpid; + yxysendsmtpinfodao.updateByHql(updatehql); + } + } + } + } + + /**获取跟踪配置信息*/ + public List<CentreTrackSet> getTrackSetByHql(String hql)throws Exception{ + return centretracksetdao.findByHql(hql); + } + + /**获取开发客户配置信息*/ + public List<CentreYxyedmNewcustomer> getNewCustomerSet(String hql)throws Exception{ + return centreyxyedmnewcustomerdao.findByHql(hql); + } + + /**获取盘活客户配置信息*/ + public List<CentreYxyedmOldcustomer> getOldCustomerSet(String hql)throws Exception{ + return centreyxyedmoldcustomerdao.findByHql(hql); + } + + /**获取用户信息*/ + public List<Object> getUserInfoBySql(String sql)throws Exception{ + return centreuserdao.findBySqlFind(sql); + } + + private YxySendMailMasterDao yxysendmailmasterdao;//待发邮件dao + private YxySendMailMasterBaseDao mailmasterbasedao;//邮件基本信息dao + private YxySendMailDetailDao yxysendmaildetaildao;//待发地址dao + private YxySendSmtpInfoDao yxysendsmtpinfodao;//smtp dao + private YxySmtpSuffixSetDao yxysmtpsuffixsetdao;//smtp 后缀dao + private YxySmtpSendSetDao yxysmtpsendsetdao;//smtp后缀发送量 + private YxySmtpSendSelfSetDao yxysmtpsendselfsetdao;//自配smtp发送量限制 + private YxySmtpSendSelfOversetDao yxysmtpsendselfoversetdao;//自配smtp已发送量信息. + private YxyParamaterDao yxysysparamaterdao; + private YxySysParamatersValueDao yxysysparamatersvaluedao; + private YxyReplyInfoDao replydao;//回复dao + private YxySendFilterAddressDao filterdao;//过滤dao + private CentreTrackSetDao centretracksetdao;//跟踪配置dao + private CentreYxyedmNewcustomerDao centreyxyedmnewcustomerdao;//营销开发客户配置dao + private CentreYxyedmOldcustomerDao centreyxyedmoldcustomerdao;//营销盘活客户配置dao + private CentreUserDao centreuserdao;//用户dao + public YxySendMailMasterDao getYxysendmailmasterdao() { + return yxysendmailmasterdao; + } + public void setYxysendmailmasterdao(YxySendMailMasterDao yxysendmailmasterdao) { + this.yxysendmailmasterdao = yxysendmailmasterdao; + } + public YxySendMailDetailDao getYxysendmaildetaildao() { + return yxysendmaildetaildao; + } + public void setYxysendmaildetaildao(YxySendMailDetailDao yxysendmaildetaildao) { + this.yxysendmaildetaildao = yxysendmaildetaildao; + } + public YxySendSmtpInfoDao getYxysendsmtpinfodao() { + return yxysendsmtpinfodao; + } + public void setYxysendsmtpinfodao(YxySendSmtpInfoDao yxysendsmtpinfodao) { + this.yxysendsmtpinfodao = yxysendsmtpinfodao; + } + public YxySmtpSuffixSetDao getYxysmtpsuffixsetdao() { + return yxysmtpsuffixsetdao; + } + public void setYxysmtpsuffixsetdao(YxySmtpSuffixSetDao yxysmtpsuffixsetdao) { + this.yxysmtpsuffixsetdao = yxysmtpsuffixsetdao; + } + public YxySmtpSendSetDao getYxysmtpsendsetdao() { + return yxysmtpsendsetdao; + } + public void setYxysmtpsendsetdao(YxySmtpSendSetDao yxysmtpsendsetdao) { + this.yxysmtpsendsetdao = yxysmtpsendsetdao; + } + public YxySmtpSendSelfSetDao getYxysmtpsendselfsetdao() { + return yxysmtpsendselfsetdao; + } + public void setYxysmtpsendselfsetdao(YxySmtpSendSelfSetDao yxysmtpsendselfsetdao) { + this.yxysmtpsendselfsetdao = yxysmtpsendselfsetdao; + } + public YxySmtpSendSelfOversetDao getYxysmtpsendselfoversetdao() { + return yxysmtpsendselfoversetdao; + } + public void setYxysmtpsendselfoversetdao( + YxySmtpSendSelfOversetDao yxysmtpsendselfoversetdao) { + this.yxysmtpsendselfoversetdao = yxysmtpsendselfoversetdao; + } + public YxyParamaterDao getYxysysparamaterdao() { + return yxysysparamaterdao; + } + public void setYxysysparamaterdao(YxyParamaterDao yxysysparamaterdao) { + this.yxysysparamaterdao = yxysysparamaterdao; + } + public YxySysParamatersValueDao getYxysysparamatersvaluedao() { + return yxysysparamatersvaluedao; + } + public void setYxysysparamatersvaluedao( + YxySysParamatersValueDao yxysysparamatersvaluedao) { + this.yxysysparamatersvaluedao = yxysysparamatersvaluedao; + } + public YxySendMailMasterBaseDao getMailmasterbasedao() { + return mailmasterbasedao; + } + public void setMailmasterbasedao(YxySendMailMasterBaseDao mailmasterbasedao) { + this.mailmasterbasedao = mailmasterbasedao; + } + public YxyReplyInfoDao getReplydao() { + return replydao; + } + public void setReplydao(YxyReplyInfoDao replydao) { + this.replydao = replydao; + } + public YxySendFilterAddressDao getFilterdao() { + return filterdao; + } + public void setFilterdao(YxySendFilterAddressDao filterdao) { + this.filterdao = filterdao; + } + public CentreTrackSetDao getCentretracksetdao() { + return centretracksetdao; + } + public void setCentretracksetdao(CentreTrackSetDao centretracksetdao) { + this.centretracksetdao = centretracksetdao; + } + public CentreYxyedmNewcustomerDao getCentreyxyedmnewcustomerdao() { + return centreyxyedmnewcustomerdao; + } + public void setCentreyxyedmnewcustomerdao( + CentreYxyedmNewcustomerDao centreyxyedmnewcustomerdao) { + this.centreyxyedmnewcustomerdao = centreyxyedmnewcustomerdao; + } + public CentreYxyedmOldcustomerDao getCentreyxyedmoldcustomerdao() { + return centreyxyedmoldcustomerdao; + } + public void setCentreyxyedmoldcustomerdao( + CentreYxyedmOldcustomerDao centreyxyedmoldcustomerdao) { + this.centreyxyedmoldcustomerdao = centreyxyedmoldcustomerdao; + } + public CentreUserDao getCentreuserdao() { + return centreuserdao; + } + public void setCentreuserdao(CentreUserDao centreuserdao) { + this.centreuserdao = centreuserdao; + } +} diff --git b/.svn/pristine/81/81f66d4994ebce36788d3393c06d43deeac5bea2.svn-base a/.svn/pristine/81/81f66d4994ebce36788d3393c06d43deeac5bea2.svn-base new file mode 100644 index 0000000..955c9de --- /dev/null +++ a/.svn/pristine/81/81f66d4994ebce36788d3393c06d43deeac5bea2.svn-base @@ -0,0 +1,29 @@ +package com.espeed.yxy.dao.impl; + +import java.util.List; + +import com.espeed.yxy.dao.YxyUserAddressDao; +import com.espeed.yxy.pojo.YxyUserAddress; + +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 用户地址库dao实现类(营销游) + * 开始时间: 2013.12.09 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +public class YxyUserAddressDaoImpl extends HibernateBaseDAOImpl<YxyUserAddress, Long> implements YxyUserAddressDao{ + + + /**HQL查询*/ + public List<YxyUserAddress> findByHql(String hql)throws Exception{ + return super.getAll(hql); + } + + +} diff --git b/.svn/pristine/82/8249dd3ef4f0a6f251efa38671238f12861053aa.svn-base a/.svn/pristine/82/8249dd3ef4f0a6f251efa38671238f12861053aa.svn-base new file mode 100644 index 0000000..74e6863 Binary files /dev/null and a/.svn/pristine/82/8249dd3ef4f0a6f251efa38671238f12861053aa.svn-base differ diff --git b/.svn/pristine/87/87ab9531e1222351568346cf9057a0cae36112b8.svn-base a/.svn/pristine/87/87ab9531e1222351568346cf9057a0cae36112b8.svn-base new file mode 100644 index 0000000..3bd5d0a --- /dev/null +++ a/.svn/pristine/87/87ab9531e1222351568346cf9057a0cae36112b8.svn-base @@ -0,0 +1 @@ +org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git b/.svn/pristine/88/88b21d1ef06323beff58664cffa62848c033ecd2.svn-base a/.svn/pristine/88/88b21d1ef06323beff58664cffa62848c033ecd2.svn-base new file mode 100644 index 0000000..8f692f4 Binary files /dev/null and a/.svn/pristine/88/88b21d1ef06323beff58664cffa62848c033ecd2.svn-base differ diff --git b/.svn/pristine/89/890cc0f716f191f8151630910b7305aa6153c3e9.svn-base a/.svn/pristine/89/890cc0f716f191f8151630910b7305aa6153c3e9.svn-base new file mode 100644 index 0000000..432e8f0 Binary files /dev/null and a/.svn/pristine/89/890cc0f716f191f8151630910b7305aa6153c3e9.svn-base differ diff --git b/.svn/pristine/89/892682c25adf0a105f1400d949da8651a9e3bae1.svn-base a/.svn/pristine/89/892682c25adf0a105f1400d949da8651a9e3bae1.svn-base new file mode 100644 index 0000000..d9729d6 --- /dev/null +++ a/.svn/pristine/89/892682c25adf0a105f1400d949da8651a9e3bae1.svn-base @@ -0,0 +1,12 @@ +#Fri May 22 17:05:27 CST 2015 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 diff --git b/.svn/pristine/8a/8ac85f9f6c270bfd7dfd04358c0a8c87ba845d2d.svn-base a/.svn/pristine/8a/8ac85f9f6c270bfd7dfd04358c0a8c87ba845d2d.svn-base new file mode 100644 index 0000000..f28f12c --- /dev/null +++ a/.svn/pristine/8a/8ac85f9f6c270bfd7dfd04358c0a8c87ba845d2d.svn-base @@ -0,0 +1,21 @@ +#命名注意:XXurl指http://此种路径 path指绝对路径如E://bbs//abc +#配置的最大线程量 +threadNum=10 +#点读服务URL(新客户营销) +clickserviceurl=http://ying01.yingyanso.win/ +#点读服务URL(老客户跟进) +clickserviceurl2=http://ying01.yingyanso.win/ +#营销webmail本地绝对路径(易外销的营销邮) +yxywebmailpath=E\://javapros//.metadata//.me_tcat//webapps//espeedYxyService +#营销webmail本地绝对路径(单独的营销邮) +yxywebmailpath2=E\://javapros//.metadata//.me_tcat//webapps//espeedYxyService +#webmail定时器URL +webmailtimeurl=http://localhost:8080/espeedCenterServiceLast +#一个smtp发送邮件数量 +smtpsendnum=3 +#webmail接口服务器URL +webmailinterfaceurl=http://webinterface120117.21gmail.com:81 +#一个地址发送异常数量 +sendexpnum=3 +#超链接跟踪url +trackurl=https\://tongji.shenyingshejiao.net \ No newline at end of file diff --git b/.svn/pristine/8b/8ba2a9d7b9c4c05c33ab62542bd99bb5b3716c0a.svn-base a/.svn/pristine/8b/8ba2a9d7b9c4c05c33ab62542bd99bb5b3716c0a.svn-base new file mode 100644 index 0000000..819159a --- /dev/null +++ a/.svn/pristine/8b/8ba2a9d7b9c4c05c33ab62542bd99bb5b3716c0a.svn-base @@ -0,0 +1,59 @@ +package com.espeed.yxy.pojo; + +import java.io.Serializable; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; + +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 过滤分组地址(营销游) + * 开始时间: 2013.12.09 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ + +@Entity +@Table(name="yxy_send_filter_address") +public class YxySendFilterAddress implements Serializable{ + private static final long serialVersionUID = 1L; + private int filteraddrid;//ID + private String filteraddress;//地址或域名 + private String filteraddrloginid;//用户账号 + private String filteraddrdomain;//用户域名 + + @Id + @GeneratedValue(strategy=GenerationType.AUTO) + public int getFilteraddrid() { + return filteraddrid; + } + public void setFilteraddrid(int filteraddrid) { + this.filteraddrid = filteraddrid; + } + public String getFilteraddress() { + return filteraddress; + } + public void setFilteraddress(String filteraddress) { + this.filteraddress = filteraddress; + } + public String getFilteraddrloginid() { + return filteraddrloginid; + } + public void setFilteraddrloginid(String filteraddrloginid) { + this.filteraddrloginid = filteraddrloginid; + } + public String getFilteraddrdomain() { + return filteraddrdomain; + } + public void setFilteraddrdomain(String filteraddrdomain) { + this.filteraddrdomain = filteraddrdomain; + } +} diff --git b/.svn/pristine/8d/8dc246e94ff0dd7b108c35d573f05af8bd33f49b.svn-base a/.svn/pristine/8d/8dc246e94ff0dd7b108c35d573f05af8bd33f49b.svn-base new file mode 100644 index 0000000..04be6c5 --- /dev/null +++ a/.svn/pristine/8d/8dc246e94ff0dd7b108c35d573f05af8bd33f49b.svn-base @@ -0,0 +1,96 @@ +package com.espeed.yxy.mail; + +import java.io.Serializable; +import java.util.List; +import java.util.concurrent.ArrayBlockingQueue; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; + +import com.espeed.yxy.pojo.YxySendMailMaster; +import com.espeed.yxy.pojo.YxySendSmtpInfo; +import com.espeed.yxy.pojo.YxySmtpSendSet; +import com.espeed.yxy.pojo.YxySmtpSuffixSet; +import com.espeed.yxy.service.YxySendMailService; +import com.espeed.yxy.tool.GetRondom; +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 发送邮件线程池创建(营销游) + * 开始时间: 2013.12.09 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +public class YxythreadWork implements Runnable,Serializable{ + private static ThreadPoolExecutor threadPool=null; + private static YxythreadWork yxythreadwork=null; + private YxySendMailService YxySendMailService;//service + private YxySendSmtpInfo SmtpInfo;//smtp服务器 + private YxySendMailMaster mailinfo;//邮件信息 + private List<YxySmtpSuffixSet> smtpsuffixsetList;//后缀信息 + /**无参构造方法*/ + YxythreadWork(){ + + } + /**参数传递*/ + YxythreadWork(YxySendMailService YxySendMailService,YxySendSmtpInfo SmtpInfo,YxySendMailMaster mailinfo,List<YxySmtpSuffixSet> smtpsuffixsetList){ + this.YxySendMailService=YxySendMailService; + this.SmtpInfo=SmtpInfo; + this.mailinfo=mailinfo; + this.smtpsuffixsetList=smtpsuffixsetList; + } + + /**单例方法*/ + public static YxythreadWork getMethodInstance(){ + if(yxythreadwork==null){ + yxythreadwork=new YxythreadWork(); + } + return yxythreadwork; + } + + /**线程池*/ + public static ThreadPoolExecutor getInstance(int bigThread){ + threadPool=new ThreadPoolExecutor(bigThread,bigThread+2,100, + TimeUnit.SECONDS,new ArrayBlockingQueue(4000), + new ThreadPoolExecutor.DiscardOldestPolicy()); + return threadPool; + } + + /**线程池任务*/ + public void getResult(YxySendMailService YxySendMailService,List<YxySendSmtpInfo> SmtpInfoList,List<YxySendMailMaster> mailinfoList,List<YxySmtpSuffixSet> smtpsuffixsetList,int bigThread) { + threadPool=getInstance(bigThread); + for(int i=0;i<mailinfoList.size();i++){ + try { + threadPool.execute(new YxythreadWork(YxySendMailService,SmtpInfoList.get(i),mailinfoList.get(i),smtpsuffixsetList)); + + } catch (Exception e) { + System.out.println("加入新线程失败!"); + } + } + + } + + //获取线程量 + public int getThreadNum(){ + return threadPool.getActiveCount(); + } + + /**线程处理方法*/ + public void run(){ + try { + //调用发邮件方法 + //YxysendMethod.sendMethodImpl(YxySendMailService, SmtpInfo,mailinfo,smtpsuffixsetList); + } catch (Exception e) { + System.out.println("线程调用方法有问题!"); + } + + //此线程任务完成后重新获取线程池的数量 + synchronized (this) { + threadPool.shutdown(); + } + } +} + diff --git b/.svn/pristine/90/907643292ffc5501cb1ef742a780055be15a06b9.svn-base a/.svn/pristine/90/907643292ffc5501cb1ef742a780055be15a06b9.svn-base new file mode 100644 index 0000000..b33aab0 --- /dev/null +++ a/.svn/pristine/90/907643292ffc5501cb1ef742a780055be15a06b9.svn-base @@ -0,0 +1,62 @@ +package com.espeed.yxy.pojo; + +import java.io.Serializable; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; + +@Entity +@Table(name="yxy_marketing_week") +public class YxyMarketingWeek implements Serializable{ + + private int week_id; + private int week_value;//周期值 + private int plan_id;//计划ID + private int mode_id;//模版ID + private int isexecution;//是否执行 + private String week_day;//执行具体时间与周对应 + + @Id + @GeneratedValue(strategy=GenerationType.AUTO) + public int getWeek_id() { + return week_id; + } + public void setWeek_id(int weekId) { + week_id = weekId; + } + public int getWeek_value() { + return week_value; + } + public void setWeek_value(int weekValue) { + week_value = weekValue; + } + public int getPlan_id() { + return plan_id; + } + public void setPlan_id(int planId) { + plan_id = planId; + } + public int getMode_id() { + return mode_id; + } + public void setMode_id(int modeId) { + mode_id = modeId; + } + public int getIsexecution() { + return isexecution; + } + public void setIsexecution(int isexecution) { + this.isexecution = isexecution; + } + public String getWeek_day() { + return week_day; + } + public void setWeek_day(String weekDay) { + week_day = weekDay; + } + + +} diff --git b/.svn/pristine/90/909c38fa842ad8c59bc79fce1ed4d7b90573858b.svn-base a/.svn/pristine/90/909c38fa842ad8c59bc79fce1ed4d7b90573858b.svn-base new file mode 100644 index 0000000..19dcd73 --- /dev/null +++ a/.svn/pristine/90/909c38fa842ad8c59bc79fce1ed4d7b90573858b.svn-base @@ -0,0 +1,43 @@ +package com.espeed.yxy.dao; + +import java.util.List; +import com.espeed.yxy.pojo.YxySmtpSendSelfOverset; + +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 自配smtp已发送量统计(营销游) + * 开始时间: 2013.12.09 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +public interface YxySmtpSendSelfOversetDao { + +// /**查询该账号的发送量信息*/ +// public List<YxySmtpSendSelfOverset> findBySmtpAccount(String account)throws Exception; +// /**添加该账号的已发量信息*/ +// public void addSendSelfSet(YxySmtpSendSelfOverset o)throws Exception; +// /**更新已发量*/ +// public void updateSendSelfSet(YxySmtpSendSelfOverset o)throws Exception; + /**批量插入*/ + public void addPiPojo(List<YxySmtpSendSelfOverset> o)throws Exception; + + /**实体添加*/ + public int addPojo(YxySmtpSendSelfOverset o)throws Exception; + + /**HQL查询*/ + public List<YxySmtpSendSelfOverset> findByHql(String hql)throws Exception; + + /**SQL查询*/ + public List<Object> findbysql(String sql)throws Exception; + + /**SQL更新*/ + public void updateBySql(String sql)throws Exception; + + /**HQL更新*/ + public void updateByHql(String hql)throws Exception; +} diff --git b/.svn/pristine/91/911a8f2748a9c4e561280a695f35390b74232616.svn-base a/.svn/pristine/91/911a8f2748a9c4e561280a695f35390b74232616.svn-base new file mode 100644 index 0000000..f19e6df --- /dev/null +++ a/.svn/pristine/91/911a8f2748a9c4e561280a695f35390b74232616.svn-base @@ -0,0 +1,56 @@ +package com.espeed.yxy.dao.impl; + +import java.util.List; + +import com.espeed.yxy.dao.YxySmtpSendSelfSetDao; +import com.espeed.yxy.pojo.YxySendMailDetail; +import com.espeed.yxy.pojo.YxySmtpSendSelfSet; +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: smtp的发送参数 DAO实现类 + * 开始时间: 2013.11.27 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +public class YxySmtpSendSelfSetDaoImpl extends HibernateBaseDAOImpl<YxySmtpSendSelfSet, Long> implements YxySmtpSendSelfSetDao{ +// /**通过smtpID查询此smtp的发送参数*/ +// public List<YxySmtpSendSelfSet> findSendSelfSetByService(String smtpservice) throws Exception { +// String hql="from YxySmtpSendSelfSet where smtp_send_self_set_account='"+smtpservice+"' or smtp_send_self_set_account='domain'"; +// return super.getAll(hql); +// } + + /**批量插入*/ + public void addPiPojo(List<YxySmtpSendSelfSet> o)throws Exception{ + super.addPi(o); + } + + /**实体添加*/ + public int addPojo(YxySmtpSendSelfSet o)throws Exception{ + return super.add(o); + } + + /**HQL查询*/ + public List<YxySmtpSendSelfSet> findByHql(String hql)throws Exception{ + return super.getAll(hql); + } + + /**SQL查询*/ + public List<Object> findbysql(String sql)throws Exception{ + return super.findBySql(sql); + } + + /**SQL更新*/ + public void updateBySql(String sql)throws Exception{ + super.updateorDelBySql(sql); + } + + /**HQL更新*/ + public void updateByHql(String hql)throws Exception{ + super.updateorDelByHql(hql); + } +} diff --git b/.svn/pristine/92/924e4715c55b219958c975a1a14c9fa9316465d0.svn-base a/.svn/pristine/92/924e4715c55b219958c975a1a14c9fa9316465d0.svn-base new file mode 100644 index 0000000..eb7b5da --- /dev/null +++ a/.svn/pristine/92/924e4715c55b219958c975a1a14c9fa9316465d0.svn-base @@ -0,0 +1,19 @@ +package com.espeed.yxy.dao.impl; + +import java.util.List; + +import com.espeed.yxy.dao.YxyReplyInfoDao; +import com.espeed.yxy.pojo.YxyReplyInfo; + +/** + * + * @author 谢勇 + * 回复dao接口实现类 + */ +public class YxyReplyInfoDaoImpl extends HibernateBaseDAOImpl<YxyReplyInfo, Long> implements YxyReplyInfoDao{ + + /**HQL查询*/ + public List<YxyReplyInfo> findByHql(String hql)throws Exception{ + return super.getAll(hql); + } +} diff --git b/.svn/pristine/94/94f0de8a5bf4a8e9fdb4d0e6326e474606196fa2.svn-base a/.svn/pristine/94/94f0de8a5bf4a8e9fdb4d0e6326e474606196fa2.svn-base new file mode 100644 index 0000000..54d0153 --- /dev/null +++ a/.svn/pristine/94/94f0de8a5bf4a8e9fdb4d0e6326e474606196fa2.svn-base @@ -0,0 +1,36 @@ +package com.espeed.yxy.dao; + +import java.util.List; + +import com.espeed.webmail.pojo.YxyCustomerEmail; + +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 分类下的所有dao(营销游) + * 开始时间: 2015.04.08 + * 程 序 员: 陈南巧 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +public interface YxyCustomerEmailDao { + /**实体插入*/ + public int addPojo(YxyCustomerEmail o)throws Exception; + /**实体编辑*/ + public void updatePojo(YxyCustomerEmail o)throws Exception; + /**HQL查询*/ + public List<YxyCustomerEmail> findByHql(String hql)throws Exception; + /**HQL数量查询*/ + public int findByHqlCount(String hql)throws Exception; + /**指定条记录*/ + public List<YxyCustomerEmail> findByHqlSet(String hql,int num)throws Exception; + /**HQL查询分页*/ + //public List<YxyCustomerEmail> findByHqlPage(String hql,String hqlcount,PageBean pb)throws Exception; + /**SQL查询*/ + public List<Object> findBySqlQuery(String sql)throws Exception; + /**HQL更新*/ + public void updateByHql(String hql)throws Exception; +} diff --git b/.svn/pristine/95/953cc7fa27be2163c000b51ea1b0a4aced940e5a.svn-base a/.svn/pristine/95/953cc7fa27be2163c000b51ea1b0a4aced940e5a.svn-base new file mode 100644 index 0000000..69b5585 --- /dev/null +++ a/.svn/pristine/95/953cc7fa27be2163c000b51ea1b0a4aced940e5a.svn-base @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/> + <classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.WebProject"> + <attributes> + <attribute name="hide" value="true"/> + </attributes> + </classpathentry> + <classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/> + <classpathentry kind="src" path="WebRoot"/> + <classpathentry kind="output" path=""/> +</classpath> diff --git b/.svn/pristine/95/95791fee27eb330f153d6494b2215c3e73c626a4.svn-base a/.svn/pristine/95/95791fee27eb330f153d6494b2215c3e73c626a4.svn-base new file mode 100644 index 0000000..f53fa1f --- /dev/null +++ a/.svn/pristine/95/95791fee27eb330f153d6494b2215c3e73c626a4.svn-base @@ -0,0 +1,16 @@ +package com.espeed.yxy.dao; + +import java.util.List; + +import com.espeed.yxy.pojo.YxySendFilterAddress; + +/** + * + * @author 谢勇 + * 用户过滤接口 + */ +public interface YxySendFilterAddressDao { + + /**HQL查询*/ + public List<YxySendFilterAddress> findByHql(String hql)throws Exception; +} diff --git b/.svn/pristine/96/96c652da727ce313ba63db4f81524e217905fe44.svn-base a/.svn/pristine/96/96c652da727ce313ba63db4f81524e217905fe44.svn-base new file mode 100644 index 0000000..eaec980 --- /dev/null +++ a/.svn/pristine/96/96c652da727ce313ba63db4f81524e217905fe44.svn-base @@ -0,0 +1,39 @@ +package com.espeed.yxy.dao; + +import java.io.Serializable; +import java.util.List; +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: hbernate常用方法接口(营销邮) + * 开始时间: 2013.11.27 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +public interface HibernateBaseDAO<T extends Serializable ,Pk extends Serializable> { + /**增加记录*/ + int add(T o)throws Exception; + /**修改记录*/ + void update(T o)throws Exception; + /**删除记录*/ + void del(T o)throws Exception; + /**添加或更新*/ + void saveOrUpdate(T o)throws Exception; + /**根据ID获取一条数据*/ + T get(Class<T> t,Pk pk)throws Exception; + /**根据ID获取一条数据*/ + T load(Class<T> t,Pk pk)throws Exception; + /**根据hql进行条件查询*/ + List<T> getAll(String hql)throws Exception; + /**条件查询*/ + List<T> getAll(String whereHql,Object...params)throws Exception; + //-------------------------------查询总记录数-----------------------------------------*/ + /**根据条件查询总记录*/ + public int count(String hql) throws Exception; + /**根据条件和参数查询总记录*/ + public int count(String hql, Object... params) throws Exception; +} diff --git b/.svn/pristine/97/97d03461dc1c04ffc636dcb2579aae7724a78ef2.svn-base a/.svn/pristine/97/97d03461dc1c04ffc636dcb2579aae7724a78ef2.svn-base new file mode 100644 index 0000000..084ef6e Binary files /dev/null and a/.svn/pristine/97/97d03461dc1c04ffc636dcb2579aae7724a78ef2.svn-base differ diff --git b/.svn/pristine/98/9832988b69b726a3bde54716f5f78510a5c5131a.svn-base a/.svn/pristine/98/9832988b69b726a3bde54716f5f78510a5c5131a.svn-base new file mode 100644 index 0000000..5b7bef5 --- /dev/null +++ a/.svn/pristine/98/9832988b69b726a3bde54716f5f78510a5c5131a.svn-base @@ -0,0 +1,102 @@ +package com.espeed.yxy.pojo; + +import java.io.Serializable; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: smtp后缀发送信息实体(营销游) + * 开始时间: 2013.12.09 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ + +@Entity +@Table(name="yxy_smtp_send_set") +public class YxySmtpSendSet implements Serializable{ + + private int smtp_send_set_id;//smtp对应的后缀发送时间统计ID + private String smtp_send_set_service;//smtp服务器 + private String smtp_send_set_accout;//smtp账号 + private String smtp_send_set_suffix;//后缀 + private int smtp_send_set_tennum;//10分钟发送量 + private int smtp_send_set_hournum;// 一小时发送量 + private int smtp_send_set_daynum;// 一天发送量 + private String smtp_send_set_tendate;//十分钟时间 + private String smtp_send_set_hourdate;//一小时间 + private String smtp_send_set_daydate;//一天时间 + + @Id + @GeneratedValue(strategy=GenerationType.AUTO) + public int getSmtp_send_set_id() { + return smtp_send_set_id; + } + public void setSmtp_send_set_id(int smtpSendSetId) { + smtp_send_set_id = smtpSendSetId; + } + public String getSmtp_send_set_service() { + return smtp_send_set_service; + } + public void setSmtp_send_set_service(String smtpSendSetService) { + smtp_send_set_service = smtpSendSetService; + } + public String getSmtp_send_set_suffix() { + return smtp_send_set_suffix; + } + public void setSmtp_send_set_suffix(String smtpSendSetSuffix) { + smtp_send_set_suffix = smtpSendSetSuffix; + } + public int getSmtp_send_set_tennum() { + return smtp_send_set_tennum; + } + public void setSmtp_send_set_tennum(int smtpSendSetTennum) { + smtp_send_set_tennum = smtpSendSetTennum; + } + public int getSmtp_send_set_hournum() { + return smtp_send_set_hournum; + } + public void setSmtp_send_set_hournum(int smtpSendSetHournum) { + smtp_send_set_hournum = smtpSendSetHournum; + } + public int getSmtp_send_set_daynum() { + return smtp_send_set_daynum; + } + public void setSmtp_send_set_daynum(int smtpSendSetDaynum) { + smtp_send_set_daynum = smtpSendSetDaynum; + } + public String getSmtp_send_set_tendate() { + return smtp_send_set_tendate; + } + public void setSmtp_send_set_tendate(String smtpSendSetTendate) { + smtp_send_set_tendate = smtpSendSetTendate; + } + public String getSmtp_send_set_hourdate() { + return smtp_send_set_hourdate; + } + public void setSmtp_send_set_hourdate(String smtpSendSetHourdate) { + smtp_send_set_hourdate = smtpSendSetHourdate; + } + public String getSmtp_send_set_daydate() { + return smtp_send_set_daydate; + } + public void setSmtp_send_set_daydate(String smtpSendSetDaydate) { + smtp_send_set_daydate = smtpSendSetDaydate; + } + public String getSmtp_send_set_accout() { + return smtp_send_set_accout; + } + public void setSmtp_send_set_accout(String smtpSendSetAccout) { + smtp_send_set_accout = smtpSendSetAccout; + } + + +} diff --git b/.svn/pristine/98/983416e612875bdcf877dad4c9d5d77ae37e06ee.svn-base a/.svn/pristine/98/983416e612875bdcf877dad4c9d5d77ae37e06ee.svn-base new file mode 100644 index 0000000..29fabcc Binary files /dev/null and a/.svn/pristine/98/983416e612875bdcf877dad4c9d5d77ae37e06ee.svn-base differ diff --git b/.svn/pristine/9e/9efdb3eecc59dc5874a3b596c6245b63a464c400.svn-base a/.svn/pristine/9e/9efdb3eecc59dc5874a3b596c6245b63a464c400.svn-base new file mode 100644 index 0000000..5efb138 --- /dev/null +++ a/.svn/pristine/9e/9efdb3eecc59dc5874a3b596c6245b63a464c400.svn-base @@ -0,0 +1,541 @@ +package com.espeed.yxy.pojo; + +import java.io.Serializable; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 待发邮件实体(营销游) + * 开始时间: 2013.12.09 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ + +@Entity +@Table(name="yxy_send_mail_master") +public class YxySendMailMaster implements Serializable{ + private static final long serialVersionUID = 1L; + private int send_mail_id;//发送邮件ID + private String user_loginid;//创建用户账号 + private String user_domain;//创建用户域名 + private String create_time;//创建时间 +// private String setYYtime;//截取后的时间(年月日) +// private String setHHtime;//截取后的时间(时分秒) +// private int mass_flag;//是否群发邮件 +// private int yxy_flag;//是否营销邮邮件 +// private int separate_flag;//是否分别发送 + private int isuse;//是否使用中 +// private int allow_proxy;//是否允许代发 + private int is_unsubscribe;//是否退订 + private int unsubscribe_language;//退订选择语言(1.中文2.英文,3自定义) + private String unstr;//退订字符(自定义) +// private int front_send_flag;//是否前台直发 + private int include_link;//是否包含嵌入链接 + private String link_context;//链接地址 + //private int include_variable;//是否包含邮件变量 + //private String variable_file_path;//邮件变量文件路径 +// private int interval_flag;//是否间隔发送 +// private int Interval_minute ;//间隔时间' +// private int per_send_count;//每批发送邮件数' +// private int random_flag; +// private int use_espeed_flag; + private String mail_account;//发送邮箱账号 + private String sender;//发件人 + private String send_email;//发件人邮箱 + private String reply_email;//回复邮箱 + private String subject;//主题 +// private String setsubject;//截取后的主题 + private int auto_change_subject;//是否多主题变换 + private String body;//邮件正文 +// private int attachment_count;//包含附件数量 +// private int attachment_size;//附件大小 + private String attarchment_path ;//附件保存路径 +// private int image_count ;//包含图片数量 +// private int image_size;//图片大小 + private String image_path;//图片保存路径 + private String eml_file_path;//EML文件路径 + private String eml_encode_key;//EML文件KEY + private int mail_size;//邮件大小 + private int plans_send;//是否定时发送 + private String plans_send_time;//定时发送时间 +// private int convert_time_zone;//是否转换时区发送 +// private int important_flag;//是否重要邮件 +// private int urgent_flag;//是否紧急邮件 +// private int delete_flag ;//删除标识 +// private String result_remark;//发送情况摘要 +// private String remark;//邮件备注 +// private String keywords;//关键词 + private int status ;//处理状态 +// private int star_flag;//是否星标邮件 +// private int lock_flag;//锁定标识 +// private int secure_flag ;//保密标识 +// private int need_auditing;//是否需要审核 +// private int auditing_flag;//审核标识 +// private String auditing_operator;//审核人', +// private String auditing_time;//审核时间 +// private int has_folder;//是否已归档 +// private int has_classify;//是否已分类 +// private int has_tips;//是否有标签 +// private int reply_mail_count;//回复邮件总数 + private int sendci;//发送次数 + private int folder_id;//所属文件夹ID + private String mail_uid; //mail唯一性标识 + private int is_high_precision;//是否使用高精准发信 + private int exptionnum;//发送过程中异常的次数 + private int iscrm;//是不是老客户营销 + private int isold;//0新客户跟进,1老客户营销,2代发模式,3自有域名 + @Id + @GeneratedValue(strategy=GenerationType.AUTO) + public int getSend_mail_id() { + return send_mail_id; + } + public void setSend_mail_id(int sendMailId) { + send_mail_id = sendMailId; + } + public String getCreate_time() { + return create_time; + } + public void setCreate_time(String createTime) { + create_time = createTime; + } +// public int getMass_flag() { +// return mass_flag; +// } +// public void setMass_flag(int massFlag) { +// mass_flag = massFlag; +// } +// public int getYxy_flag() { +// return yxy_flag; +// } +// public void setYxy_flag(int yxyFlag) { +// yxy_flag = yxyFlag; +// } +// public int getSeparate_flag() { +// return separate_flag; +// } +// public void setSeparate_flag(int separateFlag) { +// separate_flag = separateFlag; +// } +// public int getAllow_proxy() { +// return allow_proxy; +// } +// public void setAllow_proxy(int allowProxy) { +// allow_proxy = allowProxy; +// } +// public int getFront_send_flag() { +// return front_send_flag; +// } +// public void setFront_send_flag(int frontSendFlag) { +// front_send_flag = frontSendFlag; +// } + public int getInclude_link() { + return include_link; + } + public void setInclude_link(int includeLink) { + include_link = includeLink; + } +// public int getInclude_variable() { +// return include_variable; +// } +// public void setInclude_variable(int includeVariable) { +// include_variable = includeVariable; +// } +// public String getVariable_file_path() { +// return variable_file_path; +// } +// public void setVariable_file_path(String variableFilePath) { +// variable_file_path = variableFilePath; +// } +// public int getInterval_flag() { +// return interval_flag; +// } +// public void setInterval_flag(int intervalFlag) { +// interval_flag = intervalFlag; +// } +// public int getInterval_minute() { +// return Interval_minute; +// } +// public void setInterval_minute(int intervalMinute) { +// Interval_minute = intervalMinute; +// } +// public int getPer_send_count() { +// return per_send_count; +// } +// public void setPer_send_count(int perSendCount) { +// per_send_count = perSendCount; +// } +// public int getRandom_flag() { +// return random_flag; +// } +// public void setRandom_flag(int randomFlag) { +// random_flag = randomFlag; +// } +// public int getUse_espeed_flag() { +// return use_espeed_flag; +// } +// public void setUse_espeed_flag(int useEspeedFlag) { +// use_espeed_flag = useEspeedFlag; +// } + public String getMail_account() { + return mail_account; + } + public void setMail_account(String mailAccount) { + mail_account = mailAccount; + } + public String getSender() { + return sender; + } + public void setSender(String sender) { + this.sender = sender; + } + public String getSend_email() { + return send_email; + } + public void setSend_email(String sendEmail) { + send_email = sendEmail; + } + public String getReply_email() { + return reply_email; + } + public void setReply_email(String replyEmail) { + reply_email = replyEmail; + } + public String getSubject() { + return subject; + } + public void setSubject(String subject) { + this.subject = subject; + } + public int getAuto_change_subject() { + return auto_change_subject; + } + public void setAuto_change_subject(int autoChangeSubject) { + auto_change_subject = autoChangeSubject; + } + +// @Transient +// public String getBody() { +// return body; +// } +// public void setBody(String body) { +// this.body = body; +// } +// public int getAttachment_count() { +// return attachment_count; +// } +// public void setAttachment_count(int attachmentCount) { +// attachment_count = attachmentCount; +// } +// public int getAttachment_size() { +// return attachment_size; +// } +// public void setAttachment_size(int attachmentSize) { +// attachment_size = attachmentSize; +// } + public String getAttarchment_path() { + return attarchment_path; + } + public void setAttarchment_path(String attarchmentPath) { + attarchment_path = attarchmentPath; + } +// public int getImage_count() { +// return image_count; +// } +// public void setImage_count(int imageCount) { +// image_count = imageCount; +// } +// public int getImage_size() { +// return image_size; +// } +// public void setImage_size(int imageSize) { +// image_size = imageSize; +// } + public String getImage_path() { + return image_path; + } + public void setImage_path(String imagePath) { + image_path = imagePath; + } + public String getEml_file_path() { + return eml_file_path; + } + public void setEml_file_path(String emlFilePath) { + eml_file_path = emlFilePath; + } + public String getEml_encode_key() { + return eml_encode_key; + } + public void setEml_encode_key(String emlEncodeKey) { + eml_encode_key = emlEncodeKey; + } +// public int getMail_size() { +// return mail_size; +// } +// public void setMail_size(int mailSize) { +// mail_size = mailSize; +// } + public int getPlans_send() { + return plans_send; + } + public void setPlans_send(int plansSend) { + plans_send = plansSend; + } + public String getPlans_send_time() { + return plans_send_time; + } + public void setPlans_send_time(String plansSendTime) { + plans_send_time = plansSendTime; + } +// public int getConvert_time_zone() { +// return convert_time_zone; +// } +// public void setConvert_time_zone(int convertTimeZone) { +// convert_time_zone = convertTimeZone; +// } +// public int getImportant_flag() { +// return important_flag; +// } +// public void setImportant_flag(int importantFlag) { +// important_flag = importantFlag; +// } +// public int getUrgent_flag() { +// return urgent_flag; +// } +// public void setUrgent_flag(int urgentFlag) { +// urgent_flag = urgentFlag; +// } +// public int getDelete_flag() { +// return delete_flag; +// } +// public void setDelete_flag(int deleteFlag) { +// delete_flag = deleteFlag; +// } +// public String getResult_remark() { +// return result_remark; +// } +// public void setResult_remark(String resultRemark) { +// result_remark = resultRemark; +// } +// public String getRemark() { +// return remark; +// } +// public void setRemark(String remark) { +// this.remark = remark; +// } +// public String getKeywords() { +// return keywords; +// } +// public void setKeywords(String keywords) { +// this.keywords = keywords; +// } +// public int getStatus() { +// return status; +// } +// public void setStatus(int status) { +// this.status = status; +// } +// public int getStar_flag() { +// return star_flag; +// } +// public void setStar_flag(int starFlag) { +// star_flag = starFlag; +// } +// public int getLock_flag() { +// return lock_flag; +// } +// public void setLock_flag(int lockFlag) { +// lock_flag = lockFlag; +// } +// public int getSecure_flag() { +// return secure_flag; +// } +// public void setSecure_flag(int secureFlag) { +// secure_flag = secureFlag; +// } +// public int getNeed_auditing() { +// return need_auditing; +// } +// public void setNeed_auditing(int needAuditing) { +// need_auditing = needAuditing; +// } +// public int getAuditing_flag() { +// return auditing_flag; +// } +// public void setAuditing_flag(int auditingFlag) { +// auditing_flag = auditingFlag; +// } +// public String getAuditing_operator() { +// return auditing_operator; +// } +// public void setAuditing_operator(String auditingOperator) { +// auditing_operator = auditingOperator; +// } +// public String getAuditing_time() { +// return auditing_time; +// } +// public void setAuditing_time(String auditingTime) { +// auditing_time = auditingTime; +// } +// public int getHas_folder() { +// return has_folder; +// } +// public void setHas_folder(int hasFolder) { +// has_folder = hasFolder; +// } +// public int getHas_classify() { +// return has_classify; +// } +// public void setHas_classify(int hasClassify) { +// has_classify = hasClassify; +// } +// public int getHas_tips() { +// return has_tips; +// } +// public void setHas_tips(int hasTips) { +// has_tips = hasTips; +// } +// public int getReply_mail_count() { +// return reply_mail_count; +// } +// public void setReply_mail_count(int replyMailCount) { +// reply_mail_count = replyMailCount; +// } +// public int getFolder_id() { +// return folder_id; +// } +// public void setFolder_id(int folderId) { +// folder_id = folderId; +// } + public int getIsuse() { + return isuse; + } + public void setIsuse(int isuse) { + this.isuse = isuse; + } +// +// @Transient +// public String getSetsubject() { +// return setsubject; +// } +// public void setSetsubject(String setsubject) { +// this.setsubject = setsubject; +// } +// @Transient +// public String getSetYYtime() { +// return setYYtime; +// } +// public void setSetYYtime(String setYYtime) { +// this.setYYtime = setYYtime; +// } +// @Transient +// public String getSetHHtime() { +// return setHHtime; +// } +// public void setSetHHtime(String setHHtime) { +// this.setHHtime = setHHtime; +// } + public String getMail_uid() { + return mail_uid; + } + public void setMail_uid(String mailUid) { + mail_uid = mailUid; + } + public int getIs_high_precision() { + return is_high_precision; + } + public void setIs_high_precision(int isHighPrecision) { + is_high_precision = isHighPrecision; + } + public String getLink_context() { + return link_context; + } + public void setLink_context(String linkContext) { + link_context = linkContext; + } + public int getIs_unsubscribe() { + return is_unsubscribe; + } + public void setIs_unsubscribe(int isUnsubscribe) { + is_unsubscribe = isUnsubscribe; + } + public int getUnsubscribe_language() { + return unsubscribe_language; + } + public void setUnsubscribe_language(int unsubscribeLanguage) { + unsubscribe_language = unsubscribeLanguage; + } + public String getUser_loginid() { + return user_loginid; + } + public void setUser_loginid(String userLoginid) { + user_loginid = userLoginid; + } + public String getUser_domain() { + return user_domain; + } + public void setUser_domain(String userDomain) { + user_domain = userDomain; + } + public int getExptionnum() { + return exptionnum; + } + public void setExptionnum(int exptionnum) { + this.exptionnum = exptionnum; + } + public String getBody() { + return body; + } + public void setBody(String body) { + this.body = body; + } + public int getFolder_id() { + return folder_id; + } + public void setFolder_id(int folderId) { + folder_id = folderId; + } + public int getStatus() { + return status; + } + public void setStatus(int status) { + this.status = status; + } + public int getMail_size() { + return mail_size; + } + public void setMail_size(int mailSize) { + mail_size = mailSize; + } + public int getSendci() { + return sendci; + } + public void setSendci(int sendci) { + this.sendci = sendci; + } + public String getUnstr() { + return unstr; + } + public void setUnstr(String unstr) { + this.unstr = unstr; + } + public int getIscrm() { + return iscrm; + } + public void setIscrm(int iscrm) { + this.iscrm = iscrm; + } + public int getIsold() { + return isold; + } + public void setIsold(int isold) { + this.isold = isold; + } +} diff --git b/.svn/pristine/9f/9f5b7fa80dc24164f999a1a7548b8a21aebe63f3.svn-base a/.svn/pristine/9f/9f5b7fa80dc24164f999a1a7548b8a21aebe63f3.svn-base new file mode 100644 index 0000000..6d225b7 Binary files /dev/null and a/.svn/pristine/9f/9f5b7fa80dc24164f999a1a7548b8a21aebe63f3.svn-base differ diff --git b/.svn/pristine/9f/9f5fcf3a273f21d8646944b3d7e6a61d80f9d986.svn-base a/.svn/pristine/9f/9f5fcf3a273f21d8646944b3d7e6a61d80f9d986.svn-base new file mode 100644 index 0000000..1308147 --- /dev/null +++ a/.svn/pristine/9f/9f5fcf3a273f21d8646944b3d7e6a61d80f9d986.svn-base @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="src" path="src"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> + <classpathentry kind="con" path="melibrary.com.genuitec.eclipse.j2eedt.core.MYECLIPSE_JAVAEE_5_CONTAINER"/> + <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/JoSQL-2.1.jar"/> + <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/antlr-2.7.6.jar"/> + <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/asm-3.3.1.jar"/> + <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/aspectjweaver.jar"/> + <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/c3p0-0.9.1.2.jar"/> + <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/cglib-2.2.jar"/> + <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/commons-collections-3.1.jar"/> + <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/commons-dbcp.jar"/> + <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/commons-logging-1.1.1.jar"/> + <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/commons-pool.jar"/> + <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/dom4j-1.6.1.jar"/> + <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/gentlyWEB-utils-1.1.jar"/> + <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/hibernate-jpa-2.0-api-1.0.1.Final.jar"/> + <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/hibernate3.jar"/> + <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/javassist-3.12.0.GA.jar"/> + <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/jta-1.1.jar"/> + <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/log4j.jar"/> + <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/mail.jar"/> + <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/mysql-connector-java-5.1.6-bin.jar"/> + <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/quartz.jar"/> + <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/slf4j-api-1.6.1.jar"/> + <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/spring-beans.jar"/> + <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/spring-context.jar"/> + <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/spring-core-3.2.0.M1-javadoc.jar"/> + <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/spring-web.jar"/> + <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/spring.jar"/> + <classpathentry kind="output" path="WebRoot/WEB-INF/classes"/> +</classpath> diff --git b/.svn/pristine/a2/a26ec4a6da76acfe9e73510fa94e056902750a78.svn-base a/.svn/pristine/a2/a26ec4a6da76acfe9e73510fa94e056902750a78.svn-base new file mode 100644 index 0000000..30b0f54 --- /dev/null +++ a/.svn/pristine/a2/a26ec4a6da76acfe9e73510fa94e056902750a78.svn-base @@ -0,0 +1,103 @@ +package com.espeed.yxy.tool; +import java.security.*; +import javax.crypto.*; +import sun.misc.*; +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: DES加密解密工具类 + * 开始时间: 2013.09.02 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +public class DES_Encrypt +{ + private Key key; + private byte[] byteMi = null; + private byte[] byteMing = null; + private String strMi= ""; + private String strM= ""; + /**根据参数生成KEY*/ + public void setKey(String strKey)throws Exception{ + KeyGenerator _generator = KeyGenerator.getInstance("DES"); + _generator.init(new SecureRandom(strKey.getBytes())); + this.key = _generator.generateKey(); + _generator=null; + } + + /**加密String明文输入,String密文输出 */ + public void setEncString(String strMing)throws Exception{ + BASE64Encoder base64en = new BASE64Encoder(); + + this.byteMing = strMing.getBytes("UTF8"); + this.byteMi = this.getEncCode(this.byteMing); + this.strMi = base64en.encode(this.byteMi); + this.byteMing = null; + this.byteMi = null; + } + /**加密以byte[]明文输入,byte[]密文输出 */ + private byte[] getEncCode(byte[] byteS)throws Exception{ + byte[] byteFina = null; + Cipher cipher; + + cipher = Cipher.getInstance("DES"); + cipher.init(Cipher.ENCRYPT_MODE,key); + byteFina = cipher.doFinal(byteS); + cipher = null; + + return byteFina; + } + + /** 解密:以String密文输入,String明文输出*/ + public void setDesString(String strMi)throws Exception{ + BASE64Decoder base64De = new BASE64Decoder(); + this.byteMi = base64De.decodeBuffer(strMi); + this.byteMing = this.getDesCode(byteMi); + this.strM = new String(byteMing,"UTF8"); + base64De = null; + byteMing = null; + byteMi = null; + } + + /** 解密以byte[]密文输入,以byte[]明文输出 */ + private byte[] getDesCode(byte[] byteD)throws Exception{ + Cipher cipher; + byte[] byteFina=null; + cipher = Cipher.getInstance("DES"); + cipher.init(Cipher.DECRYPT_MODE,key); + byteFina = cipher.doFinal(byteD); + cipher=null; + return byteFina; + } + /**返回加密后的密文strMi*/ + public String getStrMi() + { + return strMi; + } + /**返回解密后的明文*/ + public String getStrM() + { + return strM; + } + + public static void main (String[] args) throws Exception + { + DES_Encrypt desEncrypt = new DES_Encrypt(); + desEncrypt.setKey("06"); + desEncrypt.setEncString("15113887519BBs"); + System.out.println("加密后: "+desEncrypt.getStrMi()); + + //desEncrypt.setDesString("77K/j0NmDm9ZsWbbiw2f8g=="); + //System.out.println(desEncrypt.getStrM()); + + + } + + + + +} \ No newline at end of file diff --git b/.svn/pristine/a2/a29a6b9e89875c1c535ac1906017496b37002f1f.svn-base a/.svn/pristine/a2/a29a6b9e89875c1c535ac1906017496b37002f1f.svn-base new file mode 100644 index 0000000..f2ebb2e --- /dev/null +++ a/.svn/pristine/a2/a29a6b9e89875c1c535ac1906017496b37002f1f.svn-base @@ -0,0 +1,179 @@ +package com.espeed.yxy.dao.impl; + +import java.io.Serializable; +import java.util.List; +import org.hibernate.Query; +import org.hibernate.Session; +import org.springframework.orm.hibernate3.support.HibernateDaoSupport; + +import com.espeed.yxy.dao.HibernateBaseDAO; + +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 通用dao操作接口实现类 + * 开始时间: 2013.09.22 + * 程 序 员: 谢勇 + * 最后修改: 2014-02-26 + * 备 注: 实现通用的增删改查操作,被其他dao所继承使用 + */ + +public abstract class CentreHibernateBaseDAOImpl<T extends Serializable ,Pk extends Serializable> extends HibernateDaoSupport + implements HibernateBaseDAO<T, Pk> { + /** + * ------------------------------常用CRUD操作----------------------------------------- + */ + /**增加记录 (返回新增加记录的主键)*/ + public int add(T o) throws Exception { + return (Integer) super.getHibernateTemplate().save(o); + } + + /**增加记录(无返回值)*/ + public void adddate(T o) throws Exception { + super.getHibernateTemplate().save(o); + } + + /**修改记录*/ + public void update(T o) throws Exception { + super.getHibernateTemplate().update(o); + } + + /**删除记录*/ + public void del(T o) throws Exception { + super.getHibernateTemplate().delete(o); + } + + /**添加或更新*/ + public void saveOrUpdate(T o) throws Exception { + super.getHibernateTemplate().saveOrUpdate(o); + } + + /**根据ID获取一条数据*/ + @SuppressWarnings("unchecked") + public T get(Class<T> t,Pk pk) throws Exception { + return (T) super.getHibernateTemplate().get(t, pk); + } + + /**根据ID获取一条数据*/ + @SuppressWarnings("unchecked") + public T load(Class<T> t,Pk pk) throws Exception { + return (T) super.getHibernateTemplate().load(t, pk); + } + + /**根据hql进行条件查询*/ + @SuppressWarnings("unchecked") + public List<T> getAll(String hql) throws Exception { + return super.getHibernateTemplate().find(hql); + } + + /**条件查询*/ + @SuppressWarnings("unchecked") + public List<T> getAll(String whereHql, Object... params) throws Exception { + return super.getHibernateTemplate().find(whereHql,params); + } + + /* + * -------------------------------查询总记录数----------------------------------------- + */ + /**根据条件查询总记录*/ + public int count(String hql) throws Exception { + List result=super.getHibernateTemplate().find(hql); + if(result.size()>0&&result.get(0)!=null&&!result.get(0).equals("null")){ + return Long.valueOf(result.get(0).toString()).intValue(); + //return Integer.valueOf(result.get(0).toString()); + }else{ + return 0; + } + //return Integer.valueOf(super.getHibernateTemplate().find(hql).get(0).toString()); + } + + /**根据条件和参数查询总记录*/ + public int count(String hql, Object... params) throws Exception { + return Integer.valueOf(super.getHibernateTemplate().find(hql,params).get(0).toString()); + } + + /**HQL语句修改删除记录*/ + public int updateorDelBySql(String hql){ + Query query = null; + int result=0; + Session session =null; + session=super.getHibernateTemplate().getSessionFactory().openSession(); + query = session.createQuery(hql); + result = query.executeUpdate(); + return result; + } + + /**sql语句修改删除记录*/ + public int updateorDelSql(String sql){ + Query query = null; + int result=0; + Session session =null; + try { + session=super.getHibernateTemplate().getSessionFactory().openSession(); + query = session.createSQLQuery(sql); + result = query.executeUpdate(); + } catch (Exception e) { + e.printStackTrace(); + }finally{ + if(session!=null){ + session.clear(); + session.close(); + } + } + + return result; + } + + /**查询设定的记录条数据*/ + public List<T> findBySet(String hql,int num){ + Session session = null; + Query query=null; + try { + session=super.getHibernateTemplate().getSessionFactory().openSession(); + query = session.createQuery(hql); + query.setMaxResults(num); + return query.list(); + } catch (Exception e) { + e.printStackTrace(); + }finally{ + if(session!=null){ + session.clear(); + session.close(); + } + } + return null; + } + + /**批量插入*/ + public void addPi(List<T> o)throws Exception{ + Session session = super.getHibernateTemplate().getSessionFactory().openSession(); + if(o!=null){ + session.beginTransaction(); + for(int i=0;i<o.size();i++){ + session.saveOrUpdate(o.get(i)); + } + session.beginTransaction().commit(); + } + } + + /**sql语句查询 + * @throws Exception */ + public List findBySql(String sql) throws Exception{ + Session session=null; + try { + session =super.getHibernateTemplate().getSessionFactory().openSession(); + return session.createSQLQuery(sql).list(); + } catch (Exception e) { + e.printStackTrace(); + }finally{ + if(session!=null){ + session.clear(); + session.close(); + } + } + return null; + } +} diff --git b/.svn/pristine/a2/a2b462ccd95df4bee47fe8370576ab6466275615.svn-base a/.svn/pristine/a2/a2b462ccd95df4bee47fe8370576ab6466275615.svn-base new file mode 100644 index 0000000..5b6a2a9 --- /dev/null +++ a/.svn/pristine/a2/a2b462ccd95df4bee47fe8370576ab6466275615.svn-base @@ -0,0 +1,83 @@ +package com.espeed.yxy.tool; + +import java.io.File; + +/** +* 用于创建文件夹的方法 +* @param mkdirName +*/ +public class createAndDeleteFile { + + /**创建文件夹*/ + public static void mkdir(String mkdirName)throws Exception{ + + File dirFile = new File(mkdirName); + boolean bFile = dirFile.exists(); + if( bFile == true ) + { + System.out.println("The folder exists."); + } else { + System.out.println("The folder do not exist,now trying to create a one..."); + bFile = dirFile.mkdirs(); + if( bFile == true ) + { + System.out.println("Create successfully!"); + System.out.println("创建文件夹"); + } + else{ + + System.out.println("Disable to make the folder,please check the disk is full or not."); + System.out.println(" 文件夹创建失败,清确认磁盘没有写保护并且空件足够"); + } + } + + } + /**删除文件夹*/ + public static void deleteFile(File file){ + try { + if(file.exists()){ + if(file.isFile()){ + file.delete(); + }else if(file.isDirectory()){ + File files[] = file.listFiles(); + for(int i=0;i<files.length;i++){ + deleteFile(files[i]); + } + } + file.delete(); + }else{ + System.out.println("所删除的文件不存在!"+'\n'); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + /**用于创建文件的方法 */ + public static void createFile(String mkdirName) throws Exception{ + File dirFile = new File(mkdirName); + boolean bFile = dirFile.exists(); + if( bFile == true ){ + System.out.println("The folder exists."); + }else{ + System.out.println("The folder do not exist,now trying to create a one..."); + bFile = dirFile.createNewFile(); + if( bFile == true ){ + System.out.println("Create successfully!"); + System.out.println("创建文件夹"); + }else{ + System.out.println("Disable to make the folder,please check the disk is full or not."); + System.out.println(" 文件夹创建失败,清确认磁盘没有写保护并且空件足够"); + } + } + + } + + public static void main(String[] agrs){ + createAndDeleteFile caf = new createAndDeleteFile(); + File file = new File("J:mail\\xieyong435298846@qq.comdraft7320131122195807.eml"); + caf.deleteFile(file); + //mkdir("c:/aa/aa/aa"); + } + +} diff --git b/.svn/pristine/a3/a378fd07cee53a5119bca39323dca0f72fd7af4d.svn-base a/.svn/pristine/a3/a378fd07cee53a5119bca39323dca0f72fd7af4d.svn-base new file mode 100644 index 0000000..57b4ba2 --- /dev/null +++ a/.svn/pristine/a3/a378fd07cee53a5119bca39323dca0f72fd7af4d.svn-base @@ -0,0 +1,33 @@ +package com.espeed.yxy.timer; + +import com.espeed.yxy.service.YxySendMailService; + +/*** + * + * @author 谢勇 + * 初始化数据库相关数据 + */ +public class InitDatebase { + + /**初始化SMTP状态*/ + public void initsmtpstatus(){ + try { + //查询SMTP判断是否阻塞 + yxysendmailservice.updateinitsmtpstatus(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + private YxySendMailService yxysendmailservice;//发信service + + public YxySendMailService getYxysendmailservice() { + return yxysendmailservice; + } + + public void setYxysendmailservice(YxySendMailService yxysendmailservice) { + this.yxysendmailservice = yxysendmailservice; + } + + +} diff --git b/.svn/pristine/a8/a8a9ea79254f3ef1ee4c9d705be55cd9c0374b7c.svn-base a/.svn/pristine/a8/a8a9ea79254f3ef1ee4c9d705be55cd9c0374b7c.svn-base new file mode 100644 index 0000000..7357e39 --- /dev/null +++ a/.svn/pristine/a8/a8a9ea79254f3ef1ee4c9d705be55cd9c0374b7c.svn-base @@ -0,0 +1,89 @@ +package com.espeed.yxy.pojo; + +import java.io.Serializable; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; + +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 模版 + * 开始时间: 2013.12.09 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ + +@Entity +@Table(name="yxy_mail_stencil") +public class YxyMailStencil implements Serializable{ + + private int stencil_id;//ID + private String stencil_name;//模版名称 + private String stencil_body;//模版内容 + private int stencil_type;//模版类别ID + private int stencil_level;//模版等级(系统级1,企业级2,用户级3) + private String stencil_time;//时间 + private String stencil_loginid;//账号 + private String stencil_domain;//域名 + + @Id + @GeneratedValue(strategy=GenerationType.AUTO) + public int getStencil_id() { + return stencil_id; + } + public void setStencil_id(int stencilId) { + stencil_id = stencilId; + } + public String getStencil_name() { + return stencil_name; + } + public void setStencil_name(String stencilName) { + stencil_name = stencilName; + } + public String getStencil_body() { + return stencil_body; + } + public void setStencil_body(String stencilBody) { + stencil_body = stencilBody; + } + public int getStencil_type() { + return stencil_type; + } + public void setStencil_type(int stencilType) { + stencil_type = stencilType; + } + public int getStencil_level() { + return stencil_level; + } + public void setStencil_level(int stencilLevel) { + stencil_level = stencilLevel; + } + public String getStencil_time() { + return stencil_time; + } + public void setStencil_time(String stencilTime) { + stencil_time = stencilTime; + } + public String getStencil_loginid() { + return stencil_loginid; + } + public void setStencil_loginid(String stencilLoginid) { + stencil_loginid = stencilLoginid; + } + public String getStencil_domain() { + return stencil_domain; + } + public void setStencil_domain(String stencilDomain) { + stencil_domain = stencilDomain; + } + + +} diff --git b/.svn/pristine/a9/a91109e9395cbaf01dbc523192ed07b91c64585c.svn-base a/.svn/pristine/a9/a91109e9395cbaf01dbc523192ed07b91c64585c.svn-base new file mode 100644 index 0000000..dba8aa9 --- /dev/null +++ a/.svn/pristine/a9/a91109e9395cbaf01dbc523192ed07b91c64585c.svn-base @@ -0,0 +1,40 @@ +package com.espeed.yxy.dao.impl; + +import java.util.List; + +import com.espeed.centre.pojo.CentreUser; +import com.espeed.yxy.dao.CentreUserDao; +/** + * 项目名称: 统一验证中心系统 + * 版权所有: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 技术支持: info@21gmail.com + * 单元名称: 营销邮开发客户配置Dao实现类 + * 开始时间: 2018.04.08 + * 开发人员: 陈南巧 + */ +public class CentreUserDaoImpl extends CentreHibernateBaseDAOImpl<CentreUser, Long> implements CentreUserDao { + /**实体插入*/ + public int addPojo(CentreUser o)throws Exception{ + return super.add(o); + } + /**实体编辑*/ + public void updatePojo(CentreUser o)throws Exception{ + super.update(o); + } + /**HQL查询*/ + public List<CentreUser> findByHql(String hql)throws Exception{ + return super.getAll(hql); + } + /**HQL查询数量*/ + public int findByHqlCount(String hql)throws Exception{ + return super.count(hql); + } + /**SQL查询*/ + public List<Object> findBySqlFind(String sql)throws Exception{ + return super.findBySql(sql); + } + /**HQL更新*/ + public void updateByHql(String hql)throws Exception{ + super.updateorDelBySql(hql); + } +} diff --git b/.svn/pristine/ab/abd9866a3925f520778eb67bd14146b998028df7.svn-base a/.svn/pristine/ab/abd9866a3925f520778eb67bd14146b998028df7.svn-base new file mode 100644 index 0000000..72aa060 --- /dev/null +++ a/.svn/pristine/ab/abd9866a3925f520778eb67bd14146b998028df7.svn-base @@ -0,0 +1,51 @@ +package com.espeed.yxy.dao; + +import java.util.List; +import com.espeed.yxy.pojo.YxySendMailDetail; + +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 待发邮件地址DAO(营销游) + * 开始时间: 2013.12.09 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +public interface YxySendMailDetailDao { + +// /**根据待发邮件ID查询待发地址*/ +// public List<YxySendMailDetail> findAddressByMailID(int mailID)throws Exception; +// +// /**修改此地址为已发送*/ +// public void updateMailDetailstatus(int addressID)throws Exception; +// +// /**HQL更新*/ +// public void updateByHql(String hql)throws Exception; +// +// /**HQL查询*/ +// public List findbyHql(String hqld)throws Exception; + /**批量插入*/ + public void addPiPojo(List<YxySendMailDetail> o)throws Exception; + + /**实体添加*/ + public int addPojo(YxySendMailDetail o)throws Exception; + + /**HQL查询*/ + public List<YxySendMailDetail> findByHql(String hql)throws Exception; + + /**指定条记录*/ + public List<YxySendMailDetail> findByHqlSet(String hql,int num)throws Exception; + + /**SQL查询*/ + public List<Object> findbysql(String sql)throws Exception; + + /**SQL更新*/ + public void updateBySql(String sql)throws Exception; + + /**HQL更新*/ + public void updateByHql(String hql)throws Exception; +} diff --git b/.svn/pristine/ac/acfeb4de1d8925ed2cfa46a5afb3d25f229e6cab.svn-base a/.svn/pristine/ac/acfeb4de1d8925ed2cfa46a5afb3d25f229e6cab.svn-base new file mode 100644 index 0000000..421f665 --- /dev/null +++ a/.svn/pristine/ac/acfeb4de1d8925ed2cfa46a5afb3d25f229e6cab.svn-base @@ -0,0 +1,70 @@ +package com.espeed.yxy.pojo; + +import java.io.Serializable; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; + +/** + * 客户发送邮件的统计实体 + * @author 陈南巧 + */ +@Entity +@Table(name="yxy_send_count") +public class YxySendCount implements Serializable{ + private static final long serialVersionUID = 1L; + private int id;//主键id + private int user_id;//用户id + private int company_id;//企业id + private int customer_id;//客户id + private int send_counts;//发送封数 + private String send_date;//发送日期 + private String send_time;//发送时间 + @Id + @GeneratedValue(strategy=GenerationType.AUTO) + public int getId() { + return id; + } + public void setId(int id) { + this.id = id; + } + public int getUser_id() { + return user_id; + } + public void setUser_id(int user_id) { + this.user_id = user_id; + } + public int getCompany_id() { + return company_id; + } + public void setCompany_id(int company_id) { + this.company_id = company_id; + } + public int getCustomer_id() { + return customer_id; + } + public void setCustomer_id(int customer_id) { + this.customer_id = customer_id; + } + public int getSend_counts() { + return send_counts; + } + public void setSend_counts(int send_counts) { + this.send_counts = send_counts; + } + public String getSend_date() { + return send_date; + } + public void setSend_date(String send_date) { + this.send_date = send_date; + } + public String getSend_time() { + return send_time; + } + public void setSend_time(String send_time) { + this.send_time = send_time; + } +} diff --git b/.svn/pristine/ae/ae26800639875bd9adf8be4eb21c6cb0c42822fd.svn-base a/.svn/pristine/ae/ae26800639875bd9adf8be4eb21c6cb0c42822fd.svn-base new file mode 100644 index 0000000..63bbefe --- /dev/null +++ a/.svn/pristine/ae/ae26800639875bd9adf8be4eb21c6cb0c42822fd.svn-base @@ -0,0 +1,197 @@ +package com.espeed.yxy.timer; + +import java.io.PrintWriter; +import java.io.StringWriter; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; + +import com.espeed.centre.pojo.CentreYxyedmOldcustomer; +import com.espeed.yxy.pojo.YxyMailStencil; +import com.espeed.yxy.pojo.YxyMarketingPlan; +import com.espeed.yxy.pojo.YxyMarketingWeek; +import com.espeed.yxy.pojo.YxySendMailMaster; +import com.espeed.yxy.pojo.YxySenderSet; +import com.espeed.yxy.pojo.YxyUserAddress; +import com.espeed.yxy.service.YxyMarketingPlanService; +import com.espeed.yxy.service.YxySendMailService; +import com.espeed.yxy.tool.GetRandom; +import com.espeed.yxy.tool.GreateEmlFile; +import com.espeed.yxy.tool.LogsTool; + +/*** + * + * @author 谢勇 + * 营销计划定时器方法 + * + */ + +public class MarketingPlanTime { + public static boolean isrun=false; + /**营销计划执行*/ + public void marketingmethod(){ + if(!isrun){ + try { + isrun=true; + System.out.println("营销计划开始执行..."); + //是否有可执行的营销计划 + List<YxyMarketingPlan> planlist=marketingplanservice.findHavePlan(); + if(planlist.size()>0){ + //当前时间 + SimpleDateFormat df=new SimpleDateFormat("yyyy-MM-dd"); + SimpleDateFormat df2=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String nowtime=df2.format(new Date()); + String nowdate=df.format(new Date()); + //如果有营销计划则生成待发邮件 + for(int i=0;i<planlist.size();i++){ + int planaddressid=planlist.get(i).getPlan_groupid();//计划地址id + int plan_differen = planlist.get(i).getPlan_differen();//区分客户的本地和CRM库 0:本地 1:CRM + //查询营销计划选择的模版 + List<YxyMarketingWeek> weeklist=planlist.get(i).getWeeklist(); + //模版信息 + YxyMailStencil stencil=new YxyMailStencil(); + int weekid=0;//周期时间 + int weekok=0;//周期是否执行完成 + boolean ishaveplan=false; + //选择当日周几的计划 + for(int j=0;j<weeklist.size();j++){ + if(nowdate.equals(weeklist.get(j).getWeek_day())&&weeklist.get(j).getIsexecution()==0){ + ishaveplan=true; + weekid=weeklist.get(j).getWeek_id(); + //获取模版信息 + stencil=marketingplanservice.findStencilInfo(weeklist.get(j).getMode_id()); + break; + }else if(weeklist.get(j).getIsexecution()==1){ + weekok++; + } + } + if(weekok==weeklist.size()){//所有周期执行完毕则改为已执行 + marketingplanservice.updatePlanStatus(planlist.get(i).getPlan_id(), 1); + }else{//未执行完毕则改为正在执行 + marketingplanservice.updatePlanStatus(planlist.get(i).getPlan_id(), -1); + } + //判断是否有执行计划 + if(ishaveplan){ + //是否有模版 + if(stencil.getStencil_id()>0){ + String loginid=planlist.get(i).getLoginid(); + String domain=planlist.get(i).getDomain(); + //查询发件人 + YxySenderSet sender=marketingplanservice.findSender(loginid, domain); + if(sender!=null){ + SimpleDateFormat df1=new SimpleDateFormat("yyyyMMddHHmmssSSS"); + String romdate=df1.format(new Date()); + + //生成待发邮件 + YxySendMailMaster master=new YxySendMailMaster(); + master.setSubject(stencil.getStencil_name());//主题 + master.setSender(sender.getSender());//发件人姓名 + master.setSend_email(sender.getSend_email());//发件人地址 + master.setReply_email(sender.getReply_email());//回复地址 + master.setBody(stencil.getStencil_body());//内容 + master.setUser_loginid(loginid);//用户账号 + master.setSendci(1); + master.setUser_domain(domain);//用户域名 + master.setCreate_time(nowtime);//创建时间 + master.setFolder_id(0);//所属文件类别ID + master.setStatus(0);//邮件所属状态 + master.setPlans_send(0); + master.setPlans_send_time(null); + if(plan_differen==1 || plan_differen==3 + || plan_differen==5 || plan_differen==7 + || plan_differen==9 || plan_differen == 11){//CRM库选择的时候才进行查询盘活客户配置信息 + //查询盘活客户配置信息 + CentreYxyedmOldcustomer old_set = marketingplanservice.getOldCusSet(domain); + if(old_set != null){//有配置信息 + if(old_set.getStatus() == 1){//状态是可用的 + if(old_set.getType() == 0){//自有域名 + master.setIsold(3); + }else{//代发模式 + master.setIsold(2); + } + }else{//状态不可用 + master.setIsold(1);//老客户营销邮 + } + }else{//无配置信息 + master.setIsold(1);//老客户营销邮 + } + }else if(plan_differen==2 || plan_differen==4 + || plan_differen==6 || plan_differen==8 + || plan_differen==10 || plan_differen==12){//CRM库发送但超标了 + master.setIsold(4); + }else{//本地库选择的时候还是老客户营销 + master.setIsold(1);//老客户营销邮 + } + String random=GetRandom.getRandomString(10);//获取随机数据制定邮件唯一码 + String mailUID=loginid+romdate+random;//邮件唯一码由用户域名+时间格式+随机数 + master.setMail_uid(mailUID);//加入唯一码 + //用户eml文件路径 + String useremlpath=marketingplanservice.findCompanyParamByCode("yxy_user_data_save_path",loginid,domain); + if(useremlpath==null||useremlpath.equals("")||useremlpath.equals("-1")){ + //系统级 + useremlpath=marketingplanservice.findCompanyParamByCode("yxy_domain_save_path",loginid,domain); + } + //eml存放路径 + String emlsavepath=domain+"/"+loginid+"/plan"; + //生成eml文件 + List resulteml=GreateEmlFile.GreateMail(master,loginid,domain,"",useremlpath+"/"+emlsavepath); + + int emlsize=Integer.parseInt(resulteml.get(0).toString());//eml文件大小以K存储 + String emlpath=((String)resulteml.get(1));//eml文件存放路径 + emlpath=emlpath.replace(useremlpath, "#####"); + String emlkey=(String)resulteml.get(2);//emlKEY + String picpath=resulteml.get(4).toString();//图片路径 + //加入本地eml文件信息(待发表) + master.setEml_encode_key(emlkey); + master.setEml_file_path(emlpath); + master.setMail_size(emlsize); + master.setImage_path(picpath); + //查询地址 + List<YxyUserAddress> sendaddress=marketingplanservice.findAddressByGroupid(planaddressid,plan_differen,loginid,domain,planlist.get(i).getOther_name()); + //插入到待发表里 + yxysendmailservice.addMailMaster(master,sendaddress,planlist.get(i).getPlan_id(),plan_differen); + } + //更新为已执行 + marketingplanservice.updateWeekStatus(weekid,1); + }else{ + //更新为已执行 + marketingplanservice.updateWeekStatus(weekid,1); + } + System.out.println("营销执行计划id:"+planlist.get(0).getPlan_id()+",周期id:"+weekid+"执行完毕..."); + } + } + }else{ + System.out.println("未检测到待执行的营销计划..."); + } + System.out.println("执行计划顺利完成!"); + } catch (Exception e) { + System.out.println("执行计划异常了..."); + //写入日志 + StringWriter sw = new StringWriter(); + e.printStackTrace(new PrintWriter(sw, true)); + String str = sw.toString(); + LogsTool.marketPlanLogs(str); + } + isrun=false; + }else{ + System.out.println("执行计划还未完!"); + } + } + + private YxyMarketingPlanService marketingplanservice;//计划service + private YxySendMailService yxysendmailservice;//邮件 + + public YxyMarketingPlanService getMarketingplanservice() { + return marketingplanservice; + } + public void setMarketingplanservice(YxyMarketingPlanService marketingplanservice) { + this.marketingplanservice = marketingplanservice; + } + public YxySendMailService getYxysendmailservice() { + return yxysendmailservice; + } + public void setYxysendmailservice(YxySendMailService yxysendmailservice) { + this.yxysendmailservice = yxysendmailservice; + } + +} diff --git b/.svn/pristine/af/afa859297282d3708cc3e1dfa59c7317b2499571.svn-base a/.svn/pristine/af/afa859297282d3708cc3e1dfa59c7317b2499571.svn-base new file mode 100644 index 0000000..fbdb2f2 --- /dev/null +++ a/.svn/pristine/af/afa859297282d3708cc3e1dfa59c7317b2499571.svn-base @@ -0,0 +1,39 @@ +package com.espeed.yxy.dao; + +import java.util.List; +import com.espeed.yxy.pojo.YxySmtpSendSelfSet; + +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 自配smtp发送量Dao接口(营销游) + * 开始时间: 2013.12.09 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +public interface YxySmtpSendSelfSetDao{ + +// /**通过smtpID查询此smtp的发送参数*/ +// public List<YxySmtpSendSelfSet> findSendSelfSetByService(String smtpservice)throws Exception; + /**批量插入*/ + public void addPiPojo(List<YxySmtpSendSelfSet> o)throws Exception; + + /**实体添加*/ + public int addPojo(YxySmtpSendSelfSet o)throws Exception; + + /**HQL查询*/ + public List<YxySmtpSendSelfSet> findByHql(String hql)throws Exception; + + /**SQL查询*/ + public List<Object> findbysql(String sql)throws Exception; + + /**SQL更新*/ + public void updateBySql(String sql)throws Exception; + + /**HQL更新*/ + public void updateByHql(String hql)throws Exception; +} diff --git b/.svn/pristine/b0/b0f50ba442a7d7074c326fcc4534e0f54858c934.svn-base a/.svn/pristine/b0/b0f50ba442a7d7074c326fcc4534e0f54858c934.svn-base new file mode 100644 index 0000000..7e773d3 --- /dev/null +++ a/.svn/pristine/b0/b0f50ba442a7d7074c326fcc4534e0f54858c934.svn-base @@ -0,0 +1,51 @@ +package com.espeed.yxy.dao.impl; + +import java.util.List; + +import com.espeed.yxy.dao.YxySmtpSuffixSetDao; +import com.espeed.yxy.pojo.YxySendMailDetail; +import com.espeed.yxy.pojo.YxySmtpSuffixSet; +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: SMTP 后缀设置信息Dao实现类(营销游) + * 开始时间: 2013.12.09 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +public class YxySmtpSuffixSetDaoImpl extends HibernateBaseDAOImpl<YxySmtpSuffixSet,Long> implements YxySmtpSuffixSetDao{ + + /**批量插入*/ + public void addPiPojo(List<YxySmtpSuffixSet> o)throws Exception{ + super.addPi(o); + } + + /**实体添加*/ + public int addPojo(YxySmtpSuffixSet o)throws Exception{ + return super.add(o); + } + + /**HQL查询*/ + public List<YxySmtpSuffixSet> findByHql(String hql)throws Exception{ + return super.getAll(hql); + } + + /**SQL查询*/ + public List<Object> findbysql(String sql)throws Exception{ + return super.findBySql(sql); + } + + /**SQL更新*/ + public void updateBySql(String sql)throws Exception{ + super.updateorDelBySql(sql); + } + + /**HQL更新*/ + public void updateByHql(String hql)throws Exception{ + super.updateorDelByHql(hql); + } +} diff --git b/.svn/pristine/b2/b2e65b5638b618b04879dbdb886651379bdc212f.svn-base a/.svn/pristine/b2/b2e65b5638b618b04879dbdb886651379bdc212f.svn-base new file mode 100644 index 0000000..909c93e --- /dev/null +++ a/.svn/pristine/b2/b2e65b5638b618b04879dbdb886651379bdc212f.svn-base @@ -0,0 +1,119 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + 邮件service配置文件 + --> +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:aop="http://www.springframework.org/schema/aop" + xmlns:tx="http://www.springframework.org/schema/tx" + xsi:schemaLocation=" + http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd + http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd + http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd"> + + <!-- 发邮件service--> + <bean id="yxysendmailservice" class="com.espeed.yxy.service.impl.YxySendMailServiceImpl"> + <!-- 待发邮件DAO --> + <property name="yxysendmailmasterdao"> + <ref bean="yxysendmailmasterdao"/> + </property> + <property name="mailmasterbasedao"> + <ref bean="mailmasterbasedao"/> + </property> + <!-- 待发邮件地址DAO --> + <property name="yxysendmaildetaildao"> + <ref bean="yxysendmaildetaildao"/> + </property> + <!-- SMTP DAO --> + <property name="yxysendsmtpinfodao"> + <ref bean="yxysendsmtpinfodao"/> + </property> + <!-- SMTP 后缀配置DAO --> + <property name="yxysmtpsuffixsetdao"> + <ref bean="yxysmtpsuffixsetdao"/> + </property> + <!-- SMTP 后缀发送量DAO --> + <property name="yxysmtpsendsetdao"> + <ref bean="yxysmtpsendsetdao"/> + </property> + <!-- 自配SMTP已发送量DAO --> + <property name="yxysmtpsendselfoversetdao"> + <ref bean="yxysmtpsendselfoversetdao"/> + </property> + <!--自配SMTP发送量限制 DAO--> + <property name="yxysmtpsendselfsetdao"> + <ref bean="yxysmtpsendselfsetdao"/> + </property> + <!--控制参数 DAO--> + <property name="yxysysparamaterdao"> + <ref bean="yxysysparamaterdao"/> + </property> + <property name="yxysysparamatersvaluedao"> + <ref bean="yxysysparamatersvaluedao"/> + </property> + <!-- 回复dao --> + <property name="replydao"> + <ref bean="replydao"/> + </property> + <!-- 过滤dao --> + <property name="filterdao"> + <ref bean="filterdao"/> + </property> + <!-- 跟踪配置dao --> + <property name="centretracksetdao"> + <ref bean="centretracksetdao"/> + </property> + <!-- 营销开发客户配置dao --> + <property name="centreyxyedmnewcustomerdao"> + <ref bean="centreyxyedmnewcustomerdao"/> + </property> + <!-- 营销盘活客户配置dao --> + <property name="centreyxyedmoldcustomerdao"> + <ref bean="centreyxyedmoldcustomerdao"/> + </property> + <!-- 用户dao --> + <property name="centreuserdao"> + <ref bean="centreuserdao"></ref> + </property> + </bean> + + <!-- 营销计划service --> + <bean id="marketingplanservice" class="com.espeed.yxy.service.impl.YxyMarketingPlanServiceImpl"> + <property name="marketingplandao"> + <ref bean="marketingplandao"/> + </property> + <property name="marketingweekdao"> + <ref bean="marketingweekdao"/> + </property> + <property name="addressdao"> + <ref bean="addressdao"/> + </property> + <property name="stencildao"> + <ref bean="stencildao"/> + </property> + <property name="senderdao"> + <ref bean="senderdao"/> + </property> + <property name="yxysysparamaterdao"> + <ref bean="yxysysparamaterdao"/> + </property> + <property name="yxysysparamatersvaluedao"> + <ref bean="yxysysparamatersvaluedao"/> + </property> + <property name="yxycustomeremaildao"> + <ref bean="yxycustomeremaildao"/> + </property> + <property name="centreyxyedmoldcustomerdao"> + <ref bean="centreyxyedmoldcustomerdao"/> + </property> + <property name="centreuserdao"> + <ref bean="centreuserdao"/> + </property> + <property name="crmcustomerinfodao"> + <ref bean="crmcustomerinfodao"/> + </property> + <property name="yxysendcountdao"> + <ref bean="yxysendcountdao"/> + </property> + </bean> +</beans> diff --git b/.svn/pristine/b3/b37efa1932fe57158df665afa93b6f183e9dfe8a.svn-base a/.svn/pristine/b3/b37efa1932fe57158df665afa93b6f183e9dfe8a.svn-base new file mode 100644 index 0000000..e3eb8ec Binary files /dev/null and a/.svn/pristine/b3/b37efa1932fe57158df665afa93b6f183e9dfe8a.svn-base differ diff --git b/.svn/pristine/b3/b39dedcd1fa2345079a057efac30b015ae73c567.svn-base a/.svn/pristine/b3/b39dedcd1fa2345079a057efac30b015ae73c567.svn-base new file mode 100644 index 0000000..5273670 Binary files /dev/null and a/.svn/pristine/b3/b39dedcd1fa2345079a057efac30b015ae73c567.svn-base differ diff --git b/.svn/pristine/b8/b8c04b0aef514ac7086e8c66a1376185c5a98045.svn-base a/.svn/pristine/b8/b8c04b0aef514ac7086e8c66a1376185c5a98045.svn-base new file mode 100644 index 0000000..dd8dabb --- /dev/null +++ a/.svn/pristine/b8/b8c04b0aef514ac7086e8c66a1376185c5a98045.svn-base @@ -0,0 +1,89 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + spring数据库、整合其它框架配置文件 +--> +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:aop="http://www.springframework.org/schema/aop" + xmlns:tx="http://www.springframework.org/schema/tx" + xsi:schemaLocation=" + http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd + http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd + http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd"> + + <!-- 配置数据源 --> + <bean id="webmailDataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> + <property name="driverClassName"> + <value>com.mysql.jdbc.Driver</value> + </property> + <property name="url"> + <value>jdbc:mysql://localhost:3306/webmailbase?useUnicode=true&characterEncoding=utf8</value> + </property> + <property name="username"> + <value>root</value> + </property> + <property name="password"> + <value>sz1234567890</value> + </property> + <property name="maxActive"> + <value>100</value> + </property> + <property name="maxIdle"> + <value>50</value> + </property> + <property name="initialSize"> + <value>30</value> + </property> + <property name="maxWait"> + <value>10000</value> + </property> + <property name="defaultAutoCommit"> + <value>true</value> + </property> + <property name="removeAbandoned"> + <value>true</value> + </property> + <property name="removeAbandonedTimeout"> + <value>300</value> + </property> + <property name="logAbandoned"> + <value>false</value> + </property> + <property name="validationQuery"> + <value>select 1</value> + </property> + <property name="testOnBorrow"> + <value>true</value> + </property> + </bean> + + <!-- 配置注解sessionFactory --> + <bean id="webmailSessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"> + <property name="dataSource" ref="webmailDataSource" /> + <property name="packagesToScan"> + <list> + <value>com.espeed.webmail.pojo</value> + </list> + </property> + <property name="hibernateProperties"> + <props> + <prop key="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</prop> + <prop key="hibernate.show_sql">false</prop> + <prop key="hibernate.generate_statistics">true</prop> + <prop key="hibernate.connetion.release_mode">auto</prop> + <prop key="hibernate.cache.use_query_cache">false</prop> + <prop key="hibernate.cache.use_second_level_cache">false</prop> + </props> + </property> + </bean> + + <!--配置公共的hibernate方法注解 --> + <bean id="webmailAnnHibernateBaseDAO" class="com.espeed.yxy.dao.impl.CentreHibernateBaseDAOImpl" abstract="true" scope="prototype"> + <property name="sessionFactory" ref="webmailSessionFactory"/> + </bean> + + <!-- 客户dao --> + <bean id="yxycustomeremaildao" class="com.espeed.yxy.dao.impl.YxyCustomerEmailDaoImpl" parent="webmailAnnHibernateBaseDAO"></bean> + <!-- 阿里巴巴客户dao --> + <bean id="crmcustomerinfodao" class="com.espeed.yxy.dao.impl.CrmCustomerInfoDaoImpl" parent="webmailAnnHibernateBaseDAO"></bean> +</beans> diff --git b/.svn/pristine/b9/b918f7cf38cb41ea9d99fc3bf9ed6b7c383ed63b.svn-base a/.svn/pristine/b9/b918f7cf38cb41ea9d99fc3bf9ed6b7c383ed63b.svn-base new file mode 100644 index 0000000..6b7876f --- /dev/null +++ a/.svn/pristine/b9/b918f7cf38cb41ea9d99fc3bf9ed6b7c383ed63b.svn-base @@ -0,0 +1,153 @@ +package com.espeed.yxy.pojo; + +import java.io.Serializable; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Transient; +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 用户地址库(营销游) + * 开始时间: 2013.12.09 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ + +@Entity +@Table(name="yxy_user_address") +public class YxyUserAddress implements Serializable{ + private static final long serialVersionUID = 1L; + private int user_addr_id;//ID + private int user_addr_type_id;//所属类别ID + private String user_loginid;//用户账号 + private String user_domain;//用户所属域名 + private String user_addr_name;//姓名 + private String user_addr_email;//地址 + private String user_addr_web;//公司网址 + private String user_addr_add_date;//地址添加日期 + private String user_addr_modify_date;//地址修改日期 + private String user_addr_sex;//所属地址性别 + private int isrepeat;//是否重复/ + private int user_addr_status;//状态 + private String user_send_time;//发送时间 + private int user_send_num;//发送数 + private String variable;//自定义主题变量 + private String company_variable;//企业名称变量 + private String user_addr_variable;//自定义地址变量 + + @Id + @GeneratedValue(strategy=GenerationType.AUTO) + public int getUser_addr_id() { + return user_addr_id; + } + public void setUser_addr_id(int userAddrId) { + user_addr_id = userAddrId; + } + public int getUser_addr_type_id() { + return user_addr_type_id; + } + public void setUser_addr_type_id(int userAddrTypeId) { + user_addr_type_id = userAddrTypeId; + } + public String getUser_addr_name() { + return user_addr_name; + } + public void setUser_addr_name(String userAddrName) { + user_addr_name = userAddrName; + } + public String getUser_addr_email() { + return user_addr_email; + } + public void setUser_addr_email(String userAddrEmail) { + user_addr_email = userAddrEmail; + } + public String getUser_addr_add_date() { + return user_addr_add_date; + } + public void setUser_addr_add_date(String userAddrAddDate) { + user_addr_add_date = userAddrAddDate; + } + public String getUser_addr_modify_date() { + return user_addr_modify_date; + } + public void setUser_addr_modify_date(String userAddrModifyDate) { + user_addr_modify_date = userAddrModifyDate; + } + public String getUser_addr_sex() { + return user_addr_sex; + } + public void setUser_addr_sex(String userAddrSex) { + user_addr_sex = userAddrSex; + } + @Transient + public int getIsrepeat() { + return isrepeat; + } + public void setIsrepeat(int isrepeat) { + this.isrepeat = isrepeat; + } + public String getUser_loginid() { + return user_loginid; + } + public void setUser_loginid(String userLoginid) { + user_loginid = userLoginid; + } + public String getUser_domain() { + return user_domain; + } + public void setUser_domain(String userDomain) { + user_domain = userDomain; + } + public int getUser_addr_status() { + return user_addr_status; + } + public void setUser_addr_status(int userAddrStatus) { + user_addr_status = userAddrStatus; + } + public String getUser_send_time() { + return user_send_time; + } + public void setUser_send_time(String user_send_time) { + this.user_send_time = user_send_time; + } + public int getUser_send_num() { + return user_send_num; + } + public void setUser_send_num(int user_send_num) { + this.user_send_num = user_send_num; + } + @Transient + public String getVariable() { + return variable; + } + public void setVariable(String variable) { + this.variable = variable; + } + public String getCompany_variable() { + return company_variable; + } + public void setCompany_variable(String companyVariable) { + company_variable = companyVariable; + } + public String getUser_addr_variable() { + return user_addr_variable; + } + public void setUser_addr_variable(String userAddrVariable) { + user_addr_variable = userAddrVariable; + } + public String getUser_addr_web() { + return user_addr_web; + } + public void setUser_addr_web(String userAddrWeb) { + user_addr_web = userAddrWeb; + } + +} diff --git b/.svn/pristine/b9/b99be012e187f4b466fd65f6bd3502d304c5fd88.svn-base a/.svn/pristine/b9/b99be012e187f4b466fd65f6bd3502d304c5fd88.svn-base new file mode 100644 index 0000000..9ec1c6e --- /dev/null +++ a/.svn/pristine/b9/b99be012e187f4b466fd65f6bd3502d304c5fd88.svn-base @@ -0,0 +1,28 @@ +package com.espeed.yxy.dao; + +import java.util.List; + +import com.espeed.centre.pojo.CentreTrackSet; + +/** + * 项目名称: 统一验证中心系统 + * 版权所有: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 技术支持: info@21gmail.com + * 单元名称: 跟踪配置Dao + * 开始时间: 2018.04.08 + * 开发人员: 陈南巧 + */ +public interface CentreTrackSetDao { + /**实体插入*/ + public int addPojo(CentreTrackSet o)throws Exception; + /**实体编辑*/ + public void updatePojo(CentreTrackSet o)throws Exception; + /**HQL查询*/ + public List<CentreTrackSet> findByHql(String hql)throws Exception; + /**SQL查询*/ + public List<Object> findBySqlFind(String sql)throws Exception; + /**HQL更新*/ + public void updateByHql(String hql)throws Exception; + /**HQL查询数量*/ + public int findByHqlCount(String hql)throws Exception; +} diff --git b/.svn/pristine/bd/bd339cb5da04e68d2b69028b5be5750e97b8f963.svn-base a/.svn/pristine/bd/bd339cb5da04e68d2b69028b5be5750e97b8f963.svn-base new file mode 100644 index 0000000..e0087fb Binary files /dev/null and a/.svn/pristine/bd/bd339cb5da04e68d2b69028b5be5750e97b8f963.svn-base differ diff --git b/.svn/pristine/c0/c0275740d497db1b28d11e1aeae7e3bdf0518303.svn-base a/.svn/pristine/c0/c0275740d497db1b28d11e1aeae7e3bdf0518303.svn-base new file mode 100644 index 0000000..9ff9a6b --- /dev/null +++ a/.svn/pristine/c0/c0275740d497db1b28d11e1aeae7e3bdf0518303.svn-base @@ -0,0 +1,33 @@ +package com.espeed.yxy.dao; + +import java.util.List; + +import com.espeed.yxy.pojo.YxySendMailMasterBase; + +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 邮件基本信息DAO(营销游) + * 开始时间: 2013.12.09 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +public interface YxySendMailMasterBaseDao { + + /**实体插入*/ + public int addPojo(YxySendMailMasterBase o)throws Exception; + /**实体编辑*/ + public void updatePojo(YxySendMailMasterBase o)throws Exception; + /**HQL查询*/ + public List<YxySendMailMasterBase> findByHql(String hql)throws Exception; + /**指定条记录*/ + public List<YxySendMailMasterBase> findByHqlSet(String hql,int num)throws Exception; + /**SQL查询*/ + public List<Object> findBySqlQuery(String sql)throws Exception; + /**HQL更新*/ + public void updateByHql(String hql)throws Exception; +} diff --git b/.svn/pristine/c0/c082f519aa189cdf6a4a201082011b8c9c68875b.svn-base a/.svn/pristine/c0/c082f519aa189cdf6a4a201082011b8c9c68875b.svn-base new file mode 100644 index 0000000..d7ab1c0 --- /dev/null +++ a/.svn/pristine/c0/c082f519aa189cdf6a4a201082011b8c9c68875b.svn-base @@ -0,0 +1,101 @@ +package com.espeed.yxy.tool; + +import java.io.File; +import java.io.FileWriter; +import java.text.SimpleDateFormat; +import java.util.Date; + +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 日志记录工具类 + * 开始时间: 2013.11.18 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +public class LogsTool{ + + /**邮件发送日志*/ + public static void sendLogs(String domain,String username,String value){ + try { + //以当前时间为日志文件名 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + String nowDate=sdf.format(new Date()); + //发生的时间 + SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String nowDates=sdf1.format(new Date()); + //组建路径 + String savePath="D:/yxysendlog/"+domain+"/"+username; + File files = new File(savePath); + if (!files.exists()) { + files.mkdirs(); + } + + //写入文件 + FileWriter w = new FileWriter(savePath+"/"+nowDate+".txt", true); + w.write(nowDates+": "+value+"\r\n"); + w.close(); + } catch (Exception e) { + e.printStackTrace(); + System.out.println("日志记录异常"); + } + } + + /**营销异常日志*/ + public static void erroLogs(String value){ + try { + //以当前时间为日志文件名 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + String nowDate=sdf.format(new Date()); + //发生的时间 + SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String nowDates=sdf1.format(new Date()); + //组建路径 + String savePath="D:/yxysenderro/"; + File files = new File(savePath); + if (!files.exists()) { + files.mkdirs(); + } + //写入文件 + FileWriter w = new FileWriter(savePath+nowDate+".txt", true); + w.write(nowDates+": "+value+"\r\n"); + w.close(); + } catch (Exception e) { + e.printStackTrace(); + System.out.println("日志记录异常"); + } + } + + /**执行计划异常日志*/ + public static void marketPlanLogs(String value){ + try { + //以当前时间为日志文件名 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + String nowDate=sdf.format(new Date()); + //发生的时间 + SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String nowDates=sdf1.format(new Date()); + //组建路径 + String savePath="D:/yxymarketplanerro/"; + File files = new File(savePath); + if (!files.exists()) { + files.mkdirs(); + } + //写入文件 + FileWriter w = new FileWriter(savePath+nowDate+".txt", true); + w.write(nowDates+": "+value+"\r\n"); + w.close(); + } catch (Exception e) { + e.printStackTrace(); + System.out.println("日志记录异常"); + } + } + + public static void main(String[] args) { + LogsTool.erroLogs("测试"); + } +} \ No newline at end of file diff --git b/.svn/pristine/c0/c0e4ef1fc22056c90835eae4a9c504eb6a7b8076.svn-base a/.svn/pristine/c0/c0e4ef1fc22056c90835eae4a9c504eb6a7b8076.svn-base new file mode 100644 index 0000000..adf9277 --- /dev/null +++ a/.svn/pristine/c0/c0e4ef1fc22056c90835eae4a9c504eb6a7b8076.svn-base @@ -0,0 +1,89 @@ +package com.espeed.yxy.pojo; + +import java.io.Serializable; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; + +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 自配smtp发送量统计(营销游) + * 开始时间: 2013.12.09 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +@Entity +@Table(name="yxy_smtp_send_self_overset") +public class YxySmtpSendSelfOverset implements Serializable{ + + private int smtp_send_self_over_id;//主键, + private String smtp_send_self_over_account;//smtp账号, + private int smtp_send_self_over_tennum ;//10分钟已发量, + private int smtp_send_self_over_hournum;// 一个小时已发量, + private int smtp_send_self_over_daynum;//一天已发量, + private String smtp_send_self_over_tendate;//最后记录的10分钟, + private String smtp_send_self_over_hourdate;//最后记录的60分钟, + private String smtp_send_self_over_daydate;// 最后记录的一天, + + @Id + @GeneratedValue(strategy=GenerationType.AUTO) + public int getSmtp_send_self_over_id() { + return smtp_send_self_over_id; + } + public void setSmtp_send_self_over_id(int smtpSendSelfOverId) { + smtp_send_self_over_id = smtpSendSelfOverId; + } + public String getSmtp_send_self_over_account() { + return smtp_send_self_over_account; + } + public void setSmtp_send_self_over_account(String smtpSendSelfOverAccount) { + smtp_send_self_over_account = smtpSendSelfOverAccount; + } + public int getSmtp_send_self_over_tennum() { + return smtp_send_self_over_tennum; + } + public void setSmtp_send_self_over_tennum(int smtpSendSelfOverTennum) { + smtp_send_self_over_tennum = smtpSendSelfOverTennum; + } + public int getSmtp_send_self_over_hournum() { + return smtp_send_self_over_hournum; + } + public void setSmtp_send_self_over_hournum(int smtpSendSelfOverHournum) { + smtp_send_self_over_hournum = smtpSendSelfOverHournum; + } + public int getSmtp_send_self_over_daynum() { + return smtp_send_self_over_daynum; + } + public void setSmtp_send_self_over_daynum(int smtpSendSelfOverDaynum) { + smtp_send_self_over_daynum = smtpSendSelfOverDaynum; + } + public String getSmtp_send_self_over_tendate() { + return smtp_send_self_over_tendate; + } + public void setSmtp_send_self_over_tendate(String smtpSendSelfOverTendate) { + smtp_send_self_over_tendate = smtpSendSelfOverTendate; + } + public String getSmtp_send_self_over_hourdate() { + return smtp_send_self_over_hourdate; + } + public void setSmtp_send_self_over_hourdate(String smtpSendSelfOverHourdate) { + smtp_send_self_over_hourdate = smtpSendSelfOverHourdate; + } + public String getSmtp_send_self_over_daydate() { + return smtp_send_self_over_daydate; + } + public void setSmtp_send_self_over_daydate(String smtpSendSelfOverDaydate) { + smtp_send_self_over_daydate = smtpSendSelfOverDaydate; + } + + + +} diff --git b/.svn/pristine/c2/c24b8490ae93ee384171adbec5077762fcffbd32.svn-base a/.svn/pristine/c2/c24b8490ae93ee384171adbec5077762fcffbd32.svn-base new file mode 100644 index 0000000..5c57c31 --- /dev/null +++ a/.svn/pristine/c2/c24b8490ae93ee384171adbec5077762fcffbd32.svn-base @@ -0,0 +1,112 @@ +package com.espeed.yxy.timer; + +import java.io.PrintWriter; +import java.io.StringWriter; +import java.util.ArrayList; +import java.util.List; +import java.util.Random; +import com.espeed.yxy.pojo.YxySendMailMaster; +import com.espeed.yxy.pojo.YxySendSmtpInfo; +import com.espeed.yxy.service.YxySendMailService; +import com.espeed.yxy.tool.LogsTool; + +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 定时器主方法(营销游) + * 开始时间: 2013.12.09 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +public class SendMailTimer { + + private YxySendMailService yxysendmailservice; + public static String nowtimer=""; + + /**定时器运行方法*/ + public void timerMethod(){ + + try { + System.out.println("新任务开始进来了!"); + ThreadPoolTask s=ThreadPoolTask.getMethodInstance(); + + //当前线程量 + System.out.println("当前线程量:"+s.getThreadNum()); + + //变量定义区 + //int smtpnum=0; + //int mailnum=0; + + //获取所有smtp + List<YxySendSmtpInfo> smtpinfoList= yxysendmailservice.findSmtpInfoSetNum(); + //yxysendmailservice.updatesmtpstatus();//更改选定smtp状态 + + //将smtp打乱 + List<YxySendSmtpInfo> newsmtpList=getRandom(smtpinfoList); + //smtpnum=newsmtpList.size(); + System.out.println("获取到了"+newsmtpList.size()+"个SMTP"); + //判断是否存在SMTP + if(newsmtpList.size()>0){ +// //判断是否有可待发邮件(指定条) +// List<YxySendMailMaster> mailList=yxysendmailservice.findByMailNum(smtpnum); +// mailnum=mailList.size(); +// System.out.println("新加入"+mailnum+"个邮件!"); +// if(mailnum>0){ +// //获取smtp后缀配置信息 +// //List<YxySmtpSuffixSet> smtpsuffixsetList=yxysendmailservice.findAllSmtpSuffixSet(); +// //调用线程池 +// //s.getResult(yxysendmailservice, newsmtpList, mailList, smtpsuffixsetList); +// s.getResult(yxysendmailservice, newsmtpList, mailList); +// }else{ +// System.out.println("没有待发邮件!"); +// } + //调用线程池 + s.getResult(yxysendmailservice, newsmtpList); + }else{ + System.out.println("没有可用SMTP!"); + } + + } catch (Exception e) { + System.out.println("定时器异常了..."); + e.printStackTrace(); + //写入日志 + StringWriter sw = new StringWriter(); + e.printStackTrace(new PrintWriter(sw, true)); + String str = sw.toString(); + LogsTool.erroLogs(str); + } + } + + + //将集合打乱 + public static List<YxySendSmtpInfo> getRandom(List<YxySendSmtpInfo> value){ + List<YxySendSmtpInfo> newSmtpList=new ArrayList<YxySendSmtpInfo>(); + int n = value.size(); + Random rand = new Random(); + boolean[] bool = new boolean[n]; + int num =0; + for (int i = 0; i<n; i++){ + do{ + //如果产生的数相同继续循环 + num = rand.nextInt(n); + }while(bool[num]); + bool[num] =true; + newSmtpList.add(value.get(num)); + } + return newSmtpList; + } + //------------------get set-------------------- + public YxySendMailService getYxysendmailservice() { + return yxysendmailservice; + } + + public void setYxysendmailservice(YxySendMailService yxysendmailservice) { + this.yxysendmailservice = yxysendmailservice; + } + +} + diff --git b/.svn/pristine/c2/c2d92400f8941516605ce22b885cd66c1d6bf8c0.svn-base a/.svn/pristine/c2/c2d92400f8941516605ce22b885cd66c1d6bf8c0.svn-base new file mode 100644 index 0000000..1484667 Binary files /dev/null and a/.svn/pristine/c2/c2d92400f8941516605ce22b885cd66c1d6bf8c0.svn-base differ diff --git b/.svn/pristine/c2/c2daa77d223b36c09108e47f55343e5cd635d46c.svn-base a/.svn/pristine/c2/c2daa77d223b36c09108e47f55343e5cd635d46c.svn-base new file mode 100644 index 0000000..2c39dc3 Binary files /dev/null and a/.svn/pristine/c2/c2daa77d223b36c09108e47f55343e5cd635d46c.svn-base differ diff --git b/.svn/pristine/c3/c3f93b66b4dac84874fa65f1562016e63d73ddee.svn-base a/.svn/pristine/c3/c3f93b66b4dac84874fa65f1562016e63d73ddee.svn-base new file mode 100644 index 0000000..e9248d1 Binary files /dev/null and a/.svn/pristine/c3/c3f93b66b4dac84874fa65f1562016e63d73ddee.svn-base differ diff --git b/.svn/pristine/c4/c4602abd376f77403a501fbf9ed77276b4d20025.svn-base a/.svn/pristine/c4/c4602abd376f77403a501fbf9ed77276b4d20025.svn-base new file mode 100644 index 0000000..0866042 --- /dev/null +++ a/.svn/pristine/c4/c4602abd376f77403a501fbf9ed77276b4d20025.svn-base @@ -0,0 +1,26 @@ +<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%> +<% +String path = request.getContextPath(); +String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; +%> + +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html> + <head> + <base href="<%=basePath%>"> + + <title>My JSP 'index.jsp' starting page</title> + <meta http-equiv="pragma" content="no-cache"> + <meta http-equiv="cache-control" content="no-cache"> + <meta http-equiv="expires" content="0"> + <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> + <meta http-equiv="description" content="This is my page"> + <!-- + <link rel="stylesheet" type="text/css" href="styles.css"> + --> + </head> + + <body> + This is my JSP page. <br> + </body> +</html> diff --git b/.svn/pristine/c4/c4735f42a6a2a77f817fa58712b5c3e030843b46.svn-base a/.svn/pristine/c4/c4735f42a6a2a77f817fa58712b5c3e030843b46.svn-base new file mode 100644 index 0000000..e709418 --- /dev/null +++ a/.svn/pristine/c4/c4735f42a6a2a77f817fa58712b5c3e030843b46.svn-base @@ -0,0 +1,152 @@ +package com.espeed.webmail.pojo; + +import java.io.Serializable; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Transient; + + +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 分类下的客户表(营销游) + * 开始时间: 2015.03.31 + * 程 序 员: 陈南巧 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +@Entity +@Table(name="crm_customer") +public class YxyCustomerEmail implements Serializable{ + private static final long serialVersionUID = 1L; + private int customer_id;//客户id + private String customer_name;//客户姓名 + private int user_id;//用户id + private int company_id;//企业id + private int classify_id;//分类id + private int delete_flag;//是否删除0:正常 -1:删除 + private int current_status;//客户当前状态: 0:正常 1:已加入公海 2:已加入共享 + private String customer_status;//客户状态 + private String partnership;//客户关系id + private int source_from_id;//客户来源 + private String prductid;//客户产品id,多个以逗号分割 + private int sales_status;//销售状态 + private String email;//主联系人邮箱地址 + private String full_name;//主联系人姓名 + private String last_contact_date;//最后联系时间 + private String enrol_time;//修改时间 + private int important_star;//客户的星级数量,默认值为1,一颗星 + @Id + @GeneratedValue(strategy=GenerationType.AUTO) + public int getCustomer_id() { + return customer_id; + } + public void setCustomer_id(int customer_id) { + this.customer_id = customer_id; + } + public String getCustomer_name() { + return customer_name; + } + public void setCustomer_name(String customer_name) { + this.customer_name = customer_name; + } + public int getUser_id() { + return user_id; + } + public void setUser_id(int user_id) { + this.user_id = user_id; + } + public int getCompany_id() { + return company_id; + } + public void setCompany_id(int company_id) { + this.company_id = company_id; + } + public int getClassify_id() { + return classify_id; + } + public void setClassify_id(int classify_id) { + this.classify_id = classify_id; + } + public int getDelete_flag() { + return delete_flag; + } + public void setDelete_flag(int delete_flag) { + this.delete_flag = delete_flag; + } + public int getCurrent_status() { + return current_status; + } + public void setCurrent_status(int current_status) { + this.current_status = current_status; + } + public String getCustomer_status() { + return customer_status; + } + public void setCustomer_status(String customer_status) { + this.customer_status = customer_status; + } + public String getPartnership() { + return partnership; + } + public void setPartnership(String partnership) { + this.partnership = partnership; + } + public int getSource_from_id() { + return source_from_id; + } + public void setSource_from_id(int source_from_id) { + this.source_from_id = source_from_id; + } + public String getPrductid() { + return prductid; + } + public void setPrductid(String prductid) { + this.prductid = prductid; + } + public int getSales_status() { + return sales_status; + } + public void setSales_status(int sales_status) { + this.sales_status = sales_status; + } + @Transient + public String getEmail() { + return email; + } + public void setEmail(String email) { + this.email = email; + } + @Transient + public String getFull_name() { + return full_name; + } + public void setFull_name(String full_name) { + this.full_name = full_name; + } + public String getLast_contact_date() { + return last_contact_date; + } + public void setLast_contact_date(String last_contact_date) { + this.last_contact_date = last_contact_date; + } + public String getEnrol_time() { + return enrol_time; + } + public void setEnrol_time(String enrol_time) { + this.enrol_time = enrol_time; + } + public int getImportant_star() { + return important_star; + } + public void setImportant_star(int important_star) { + this.important_star = important_star; + } +} diff --git b/.svn/pristine/c5/c5ab80f79cba7cd96654333e8925a506169bd4a2.svn-base a/.svn/pristine/c5/c5ab80f79cba7cd96654333e8925a506169bd4a2.svn-base new file mode 100644 index 0000000..7c9bf3c --- /dev/null +++ a/.svn/pristine/c5/c5ab80f79cba7cd96654333e8925a506169bd4a2.svn-base @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>espeedSendYingXiaoYouBase</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.wst.jsdt.core.javascriptValidator</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>com.genuitec.eclipse.j2eedt.core.WebClasspathBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>com.genuitec.eclipse.j2eedt.core.J2EEProjectValidator</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>com.genuitec.eclipse.j2eedt.core.DeploymentDescriptorValidator</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.wst.validation.validationbuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>com.genuitec.eclipse.ast.deploy.core.DeploymentBuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>com.genuitec.eclipse.ast.deploy.core.deploymentnature</nature> + <nature>com.genuitec.eclipse.j2eedt.core.webnature</nature> + <nature>org.eclipse.jdt.core.javanature</nature> + <nature>org.eclipse.wst.jsdt.core.jsNature</nature> + </natures> +</projectDescription> diff --git b/.svn/pristine/ca/ca34cc57c29471c5591520c92dfaac32ccf4226d.svn-base a/.svn/pristine/ca/ca34cc57c29471c5591520c92dfaac32ccf4226d.svn-base new file mode 100644 index 0000000..0349913 --- /dev/null +++ a/.svn/pristine/ca/ca34cc57c29471c5591520c92dfaac32ccf4226d.svn-base @@ -0,0 +1,68 @@ +package com.espeed.yxy.timer; + +import org.springframework.scheduling.quartz.CronTriggerBean; +import org.quartz.Scheduler; + + +public class InitializingCronTrigger{ + + + private static Scheduler scheduler; + + public void setScheduler(Scheduler scheduler){ + InitializingCronTrigger.scheduler = scheduler; + } + + public static boolean isrun(){ + boolean is=false; + try { + System.out.println(Scheduler.DEFAULT_GROUP); + //is= scheduler.isStarted("dotime",Scheduler.DEFAULT_GROUP); + } catch (Exception e) { + e.printStackTrace(); + } + return is; + } + //暂停 + public static void pasue(){ + try { + scheduler.pauseTrigger("dotime", Scheduler.DEFAULT_GROUP); + } catch (Exception e) { + e.printStackTrace(); + } + } + //恢复 + public static void resume(){ + try { + scheduler.resumeTrigger("dotime", Scheduler.DEFAULT_GROUP); + } catch (Exception e) { + e.printStackTrace(); + } + } + + //dotime 配置文件里面 - 是配置jobDetail和CronExpression�? + public static void updateTime(String expression){ + try { + /* + * 通过Scheduler.getTrigger("truggerName","GroupName")得到CronTriggerBean + * 通过setCronExpression方法设置时间 + * */ + CronTriggerBean trigger = (CronTriggerBean) scheduler.getTrigger("dotime", Scheduler.DEFAULT_GROUP); + + if(! trigger.getCronExpression().equalsIgnoreCase(expression)){ + + trigger.setCronExpression(expression); + + scheduler.rescheduleJob("dotime", Scheduler.DEFAULT_GROUP, trigger); + + } + + //trigger.setCronExpression(expression); + System.out.println(trigger.getName() + ":"+ trigger.getCronExpression()); + + } catch (Exception e) { + e.printStackTrace(); + } + } + +} diff --git b/.svn/pristine/cf/cf2365162c932f8758dec56b7a80f0973f989c7b.svn-base a/.svn/pristine/cf/cf2365162c932f8758dec56b7a80f0973f989c7b.svn-base new file mode 100644 index 0000000..842c4c3 --- /dev/null +++ a/.svn/pristine/cf/cf2365162c932f8758dec56b7a80f0973f989c7b.svn-base @@ -0,0 +1,28 @@ +package com.espeed.yxy.dao; + +import java.util.List; + +import com.espeed.centre.pojo.CentreYxyedmOldcustomer; + +/** + * 项目名称: 统一验证中心系统 + * 版权所有: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 技术支持: info@21gmail.com + * 单元名称: 营销邮盘活客户配置Dao + * 开始时间: 2018.04.08 + * 开发人员: 陈南巧 + */ +public interface CentreYxyedmOldcustomerDao { + /**实体插入*/ + public int addPojo(CentreYxyedmOldcustomer o)throws Exception; + /**实体编辑*/ + public void updatePojo(CentreYxyedmOldcustomer o)throws Exception; + /**HQL查询*/ + public List<CentreYxyedmOldcustomer> findByHql(String hql)throws Exception; + /**SQL查询*/ + public List<Object> findBySqlFind(String sql)throws Exception; + /**HQL更新*/ + public void updateByHql(String hql)throws Exception; + /**HQL查询数量*/ + public int findByHqlCount(String hql)throws Exception; +} diff --git b/.svn/pristine/cf/cf4f67dae5df4f9932ae7810f4548ef3e14dd35e.svn-base a/.svn/pristine/cf/cf4f67dae5df4f9932ae7810f4548ef3e14dd35e.svn-base new file mode 100644 index 0000000..3702b64 Binary files /dev/null and a/.svn/pristine/cf/cf4f67dae5df4f9932ae7810f4548ef3e14dd35e.svn-base differ diff --git b/.svn/pristine/cf/cf52547e4ae838f658169472ba4efb95670829e4.svn-base a/.svn/pristine/cf/cf52547e4ae838f658169472ba4efb95670829e4.svn-base new file mode 100644 index 0000000..38dd096 --- /dev/null +++ a/.svn/pristine/cf/cf52547e4ae838f658169472ba4efb95670829e4.svn-base @@ -0,0 +1,39 @@ +package com.espeed.yxy.dao; + +import java.util.List; +import com.espeed.yxy.pojo.YxySmtpSuffixSet; + +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: SMTP 后缀设置信息Dao接口(营销游) + * 开始时间: 2013.12.09 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +public interface YxySmtpSuffixSetDao { + +// /**查询后缀信息*/ +// public List<YxySmtpSuffixSet> findAllSmtpSuffixSet()throws Exception; + /**批量插入*/ + public void addPiPojo(List<YxySmtpSuffixSet> o)throws Exception; + + /**实体添加*/ + public int addPojo(YxySmtpSuffixSet o)throws Exception; + + /**HQL查询*/ + public List<YxySmtpSuffixSet> findByHql(String hql)throws Exception; + + /**SQL查询*/ + public List<Object> findbysql(String sql)throws Exception; + + /**SQL更新*/ + public void updateBySql(String sql)throws Exception; + + /**HQL更新*/ + public void updateByHql(String hql)throws Exception; +} diff --git b/.svn/pristine/cf/cf715cb3d10e5953766af90057e42184bac8b7aa.svn-base a/.svn/pristine/cf/cf715cb3d10e5953766af90057e42184bac8b7aa.svn-base new file mode 100644 index 0000000..30135f8 Binary files /dev/null and a/.svn/pristine/cf/cf715cb3d10e5953766af90057e42184bac8b7aa.svn-base differ diff --git b/.svn/pristine/d1/d1f2dea091eaf443dc08aea07ab6dd197c1ae510.svn-base a/.svn/pristine/d1/d1f2dea091eaf443dc08aea07ab6dd197c1ae510.svn-base new file mode 100644 index 0000000..394026d --- /dev/null +++ a/.svn/pristine/d1/d1f2dea091eaf443dc08aea07ab6dd197c1ae510.svn-base @@ -0,0 +1,15 @@ +package com.espeed.yxy.dao; + +import java.util.List; + +import com.espeed.yxy.pojo.YxyMailStencil; + +/*** + * + * @author 谢勇 + * 邮件模版 + */ +public interface YxyMailStencilDao { + /**HQL查询*/ + public List<YxyMailStencil> findByHql(String hql)throws Exception; +} diff --git b/.svn/pristine/d4/d4025a85aad55d4377e5abae99141a34aa884db7.svn-base a/.svn/pristine/d4/d4025a85aad55d4377e5abae99141a34aa884db7.svn-base new file mode 100644 index 0000000..7b51452 --- /dev/null +++ a/.svn/pristine/d4/d4025a85aad55d4377e5abae99141a34aa884db7.svn-base @@ -0,0 +1,14 @@ +package com.espeed.yxy.dao; + +import java.util.List; +import com.espeed.yxy.pojo.YxyMarketingPlan; + +public interface YxyMarketingPlanDao { + /**HQL查询*/ + public List<YxyMarketingPlan> findByHql(String hql)throws Exception; + /**指定条记录*/ + public List<YxyMarketingPlan> findByHqlSet(String hql,int num)throws Exception; + /**HQL更新*/ + public void updateByHql(String hql)throws Exception; + +} diff --git b/.svn/pristine/d5/d53eb7a9daa1c637ac80615517310dada3607122.svn-base a/.svn/pristine/d5/d53eb7a9daa1c637ac80615517310dada3607122.svn-base new file mode 100644 index 0000000..9b4d670 --- /dev/null +++ a/.svn/pristine/d5/d53eb7a9daa1c637ac80615517310dada3607122.svn-base @@ -0,0 +1,15 @@ +package com.espeed.yxy.dao; + +import java.util.List; +import com.espeed.yxy.pojo.YxyReplyInfo; + +/** + * + * @author 谢勇 + * 回复dao接口 + */ +public interface YxyReplyInfoDao { + + /**HQL查询*/ + public List<YxyReplyInfo> findByHql(String hql)throws Exception; +} diff --git b/.svn/pristine/d6/d6379aef6dbdb69d28813ad018e4e047131b2e65.svn-base a/.svn/pristine/d6/d6379aef6dbdb69d28813ad018e4e047131b2e65.svn-base new file mode 100644 index 0000000..2487646 --- /dev/null +++ a/.svn/pristine/d6/d6379aef6dbdb69d28813ad018e4e047131b2e65.svn-base @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:aop="http://www.springframework.org/schema/aop" + xmlns:tx="http://www.springframework.org/schema/tx" + xsi:schemaLocation=" + http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd + http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd + http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd"> + <import resource="springConfig/applicationContext_common.xml"/> + <import resource="springConfig/applicationContext_dao.xml"/> + <import resource="springConfig/applicationContext_service.xml"/> + <import resource="springConfig/applicationContext_timer.xml"/> + <import resource="springConfig/applicationContext_webmail.xml"/> + <import resource="springConfig/applicationContext_centre.xml"/> +</beans> diff --git b/.svn/pristine/d6/d6a15f2ec3909eba08f060eaca70eb1513b644ef.svn-base a/.svn/pristine/d6/d6a15f2ec3909eba08f060eaca70eb1513b644ef.svn-base new file mode 100644 index 0000000..60ccadb --- /dev/null +++ a/.svn/pristine/d6/d6a15f2ec3909eba08f060eaca70eb1513b644ef.svn-base @@ -0,0 +1,55 @@ +package com.espeed.yxy.dao.impl; +import java.util.List; +import com.espeed.yxy.dao.YxyParamaterDao; +import com.espeed.yxy.pojo.YxySysParamaters; + +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 控制参数DAO实现类 + * 开始时间: 2013.11.27 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +public class YxyParamaterDaoImpl extends HibernateBaseDAOImpl<YxySysParamaters, Long> implements YxyParamaterDao{ + + /**批量插入*/ + public void addPiPojo(List<YxySysParamaters> o)throws Exception{ + super.addPi(o); + } + + /**实体添加*/ + public int addPojo(YxySysParamaters o)throws Exception{ + return super.add(o); + } + + /**HQL查询*/ + public List<YxySysParamaters> findByHql(String hql)throws Exception{ + return super.getAll(hql); + } + + /**SQL查询*/ + public List<Object> findbysql(String sql)throws Exception{ + return super.findBySql(sql); + } + + /**SQL更新*/ + public void updateBySql(String sql)throws Exception{ + super.updateorDelBySql(sql); + } + + /**HQL更新*/ + public void updateByHql(String hql)throws Exception{ + super.updateorDelByHql(hql); + } +// /**通过code查询控制参数*/ +// public List<YxySysParamaters> findParamaterByCode(int level) throws Exception { +// String hql="from YxySysParamaters where owner_type="+level; +// return super.getAll(hql); +// } + +} diff --git b/.svn/pristine/d6/d6affd5459f16f7af705e988f21366868bdc999e.svn-base a/.svn/pristine/d6/d6affd5459f16f7af705e988f21366868bdc999e.svn-base new file mode 100644 index 0000000..277fbf9 --- /dev/null +++ a/.svn/pristine/d6/d6affd5459f16f7af705e988f21366868bdc999e.svn-base @@ -0,0 +1,77 @@ +package com.espeed.yxy.dao.impl; + +import java.util.List; + +import com.espeed.yxy.dao.YxySendMailDetailDao; +import com.espeed.yxy.pojo.YxySendMailDetail; +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 待发地址DAO实现类 + * 开始时间: 2013.11.27 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +public class YxySendMailDetailDaoImpl extends HibernateBaseDAOImpl<YxySendMailDetail, Long> implements YxySendMailDetailDao{ + +// /**根据待发邮件ID查询待发地址*/ +// public List<YxySendMailDetail> findAddressByMailID(int mailID) throws Exception { +// String hql="from YxySendMailDetail where status=0 and send_mail_id="+mailID; +// return super.getAll(hql); +// } +// /**修改此地址为已发送*/ +// public void updateMailDetailstatus(int addressID) throws Exception { +// String hql="update YxySendMailDetail set status=1 where mail_id="+addressID; +// super.updateorDelBySql(hql); +// } +// +// /**HQL更新*/ +// public void updateByHql(String hql) throws Exception { +// super.updateorDelBySql(hql); +// +// } +// +// /**HQL查询*/ +// public List findbyHql(String hql) throws Exception { +// return super.getAll(hql); +// } + + /**批量插入*/ + public void addPiPojo(List<YxySendMailDetail> o)throws Exception{ + super.addPi(o); + } + + /**实体添加*/ + public int addPojo(YxySendMailDetail o)throws Exception{ + return super.add(o); + } + + /**HQL查询*/ + public List<YxySendMailDetail> findByHql(String hql)throws Exception{ + return super.getAll(hql); + } + + /**指定条记录*/ + public List<YxySendMailDetail> findByHqlSet(String hql,int num)throws Exception{ + return super.findBySet(hql, num); + } + + /**SQL查询*/ + public List<Object> findbysql(String sql)throws Exception{ + return super.findBySql(sql); + } + + /**SQL更新*/ + public void updateBySql(String sql)throws Exception{ + super.updateorDelBySql(sql); + } + + /**HQL更新*/ + public void updateByHql(String hql)throws Exception{ + super.updateorDelByHql(hql); + } +} diff --git b/.svn/pristine/d7/d71d5ed650e56e69edb784d76bd59f7bf4779469.svn-base a/.svn/pristine/d7/d71d5ed650e56e69edb784d76bd59f7bf4779469.svn-base new file mode 100644 index 0000000..a64058d --- /dev/null +++ a/.svn/pristine/d7/d71d5ed650e56e69edb784d76bd59f7bf4779469.svn-base @@ -0,0 +1,3 @@ +#Fri May 22 17:05:27 CST 2015 +eclipse.preferences.version=1 +encoding/<project>=UTF-8 diff --git b/.svn/pristine/de/de89e870bbfc610356505c53e5b01f5f1417fbd7.svn-base a/.svn/pristine/de/de89e870bbfc610356505c53e5b01f5f1417fbd7.svn-base new file mode 100644 index 0000000..b3949c0 --- /dev/null +++ a/.svn/pristine/de/de89e870bbfc610356505c53e5b01f5f1417fbd7.svn-base @@ -0,0 +1,29 @@ +package com.espeed.yxy.tool; + +import javax.mail.Authenticator; +import javax.mail.PasswordAuthentication; + +public class Email_Autherticatorbean extends Authenticator { + private String m_username = null; + private String m_userpass = null; + + public void setUsername(String username) { + m_username = username; + } + + public void setUserpass(String userpass) { + m_userpass = userpass; + } + + public Email_Autherticatorbean(String username, String userpass) { + super(); + setUsername(username); + setUserpass(userpass); + + } + + public PasswordAuthentication getPasswordAuthentication() { + + return new PasswordAuthentication(m_username, m_userpass); + } +} diff --git b/.svn/pristine/de/dec1669fb6801b7328e01ad72fc9e10b69ea06c1.svn-base a/.svn/pristine/de/dec1669fb6801b7328e01ad72fc9e10b69ea06c1.svn-base new file mode 100644 index 0000000..b9ffc36 Binary files /dev/null and a/.svn/pristine/de/dec1669fb6801b7328e01ad72fc9e10b69ea06c1.svn-base differ diff --git b/.svn/pristine/df/df84436b1df46db073ab2c774593a8f8401ce9f5.svn-base a/.svn/pristine/df/df84436b1df46db073ab2c774593a8f8401ce9f5.svn-base new file mode 100644 index 0000000..ecd7ffc --- /dev/null +++ a/.svn/pristine/df/df84436b1df46db073ab2c774593a8f8401ce9f5.svn-base @@ -0,0 +1,38 @@ +package com.espeed.yxy.dao; + +import java.util.List; +import com.espeed.yxy.pojo.YxySendMailMaster; + +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 待发邮件DAO(营销游) + * 开始时间: 2013.12.09 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +public interface YxySendMailMasterDao { + + /**批量插入*/ + public void addPiPojo(List<YxySendMailMaster> o)throws Exception; + + /**实体添加*/ + public int addPojo(YxySendMailMaster o)throws Exception; + + /**HQL查询*/ + public List<YxySendMailMaster> findByHql(String hql)throws Exception; + + /**SQL查询*/ + public List<Object> findbysql(String sql)throws Exception; + + /**SQL更新*/ + public void updateBySql(String sql)throws Exception; + + /**HQL更新*/ + public void updateByHql(String hql)throws Exception; + +} diff --git b/.svn/pristine/e1/e119d8de7ff93ec07abdc3e9491dcf80aa455b0a.svn-base a/.svn/pristine/e1/e119d8de7ff93ec07abdc3e9491dcf80aa455b0a.svn-base new file mode 100644 index 0000000..6896671 --- /dev/null +++ a/.svn/pristine/e1/e119d8de7ff93ec07abdc3e9491dcf80aa455b0a.svn-base @@ -0,0 +1,28 @@ +package com.espeed.yxy.dao; + +import java.util.List; + +import com.espeed.centre.pojo.CentreYxyedmNewcustomer; + +/** + * 项目名称: 统一验证中心系统 + * 版权所有: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 技术支持: info@21gmail.com + * 单元名称: 营销邮开发客户配置Dao + * 开始时间: 2018.04.08 + * 开发人员: 陈南巧 + */ +public interface CentreYxyedmNewcustomerDao { + /**实体插入*/ + public int addPojo(CentreYxyedmNewcustomer o)throws Exception; + /**实体编辑*/ + public void updatePojo(CentreYxyedmNewcustomer o)throws Exception; + /**HQL查询*/ + public List<CentreYxyedmNewcustomer> findByHql(String hql)throws Exception; + /**SQL查询*/ + public List<Object> findBySqlFind(String sql)throws Exception; + /**HQL更新*/ + public void updateByHql(String hql)throws Exception; + /**HQL查询数量*/ + public int findByHqlCount(String hql)throws Exception; +} diff --git b/.svn/pristine/e2/e23cb23cbfa5a513a4bd6a01ce2e5f5188b10e2e.svn-base a/.svn/pristine/e2/e23cb23cbfa5a513a4bd6a01ce2e5f5188b10e2e.svn-base new file mode 100644 index 0000000..31066ef --- /dev/null +++ a/.svn/pristine/e2/e23cb23cbfa5a513a4bd6a01ce2e5f5188b10e2e.svn-base @@ -0,0 +1,28 @@ +package com.espeed.yxy.dao.impl; + +import java.util.List; + +import com.espeed.yxy.dao.YxySenderSetDao; +import com.espeed.yxy.pojo.YxySenderSet; + + +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 发件人配置 + * 开始时间: 2015.4.02 + * 程 序 员: 蒋俭 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ + +public class YxySenderSetDaoImpl extends HibernateBaseDAOImpl<YxySenderSet, Long>implements YxySenderSetDao { + + /**HQL查询*/ + public List<YxySenderSet> findByHql(String hql)throws Exception{ + return super.getAll(hql); + } +} diff --git b/.svn/pristine/e4/e4c21c1298b8fba467b4c7fbdbf763e8db141061.svn-base a/.svn/pristine/e4/e4c21c1298b8fba467b4c7fbdbf763e8db141061.svn-base new file mode 100644 index 0000000..134fb1f --- /dev/null +++ a/.svn/pristine/e4/e4c21c1298b8fba467b4c7fbdbf763e8db141061.svn-base @@ -0,0 +1,16 @@ +package com.espeed.yxy.dao; + +import java.util.List; +import com.espeed.yxy.pojo.YxyMarketingWeek; + + +public interface YxyMarketingWeekDao { + + /**HQL查询*/ + public List<YxyMarketingWeek> findByHql(String hql)throws Exception; + /**指定条记录*/ + public List<YxyMarketingWeek> findByHqlSet(String hql,int num)throws Exception; + /**HQL更新*/ + public void updateByHql(String hql)throws Exception; + +} diff --git b/.svn/pristine/e4/e4c99917cac6ec90d5aa7ac11cc9616a29b79398.svn-base a/.svn/pristine/e4/e4c99917cac6ec90d5aa7ac11cc9616a29b79398.svn-base new file mode 100644 index 0000000..e438354 Binary files /dev/null and a/.svn/pristine/e4/e4c99917cac6ec90d5aa7ac11cc9616a29b79398.svn-base differ diff --git b/.svn/pristine/e6/e6dc4430e89dbbee9be6e272dc23cc282b3e5121.svn-base a/.svn/pristine/e6/e6dc4430e89dbbee9be6e272dc23cc282b3e5121.svn-base new file mode 100644 index 0000000..de36053 --- /dev/null +++ a/.svn/pristine/e6/e6dc4430e89dbbee9be6e272dc23cc282b3e5121.svn-base @@ -0,0 +1,25 @@ +package com.espeed.yxy.dao; + +import java.util.List; + +import com.espeed.yxy.pojo.YxySenderSet; + + +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 发件人配置dao层 + * 开始时间: 2015.4.02 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +public interface YxySenderSetDao { + + /**HQL查询*/ + public List<YxySenderSet> findByHql(String hql)throws Exception; + +} diff --git b/.svn/pristine/e8/e8c9b247a0721a932933495a5bfd8b69c1ed6495.svn-base a/.svn/pristine/e8/e8c9b247a0721a932933495a5bfd8b69c1ed6495.svn-base new file mode 100644 index 0000000..ea57a3a --- /dev/null +++ a/.svn/pristine/e8/e8c9b247a0721a932933495a5bfd8b69c1ed6495.svn-base @@ -0,0 +1,23 @@ +package com.espeed.yxy.dao; + +import java.util.List; +import com.espeed.yxy.pojo.YxyUserAddress; + +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 用户地址库dao(营销游) + * 开始时间: 2013.12.09 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +public interface YxyUserAddressDao { + + /**HQL查询*/ + public List<YxyUserAddress> findByHql(String hql)throws Exception; + +} diff --git b/.svn/pristine/e9/e9759f643abd97d5ce9ea81d17b76e5533523321.svn-base a/.svn/pristine/e9/e9759f643abd97d5ce9ea81d17b76e5533523321.svn-base new file mode 100644 index 0000000..8ff7633 --- /dev/null +++ a/.svn/pristine/e9/e9759f643abd97d5ce9ea81d17b76e5533523321.svn-base @@ -0,0 +1,134 @@ +package com.espeed.yxy.pojo; + +import java.io.Serializable; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; + +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 待发邮件地址实体(营销游) + * 开始时间: 2013.12.09 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ + +@Entity +@Table(name="yxy_send_mail_detail") +public class YxySendMailDetail implements Serializable{ + private static final long serialVersionUID = 1L; + private int mail_id;//地址ID + private int send_mail_id;//发送邮件ID(待发邮件) + private int base_mail_id;//邮件基本信息ID + private String mail_uid;//邮件唯一标识 + private String receiver;//收件人 + private String email;//收件人邮箱 + private String plans_send_time;//计划发送时间 + private String email_suffix;//地址后缀 + private int status;//发送状态 + private int isexp;//异常 + private String company_variable;//企业名称 + private int planid;//计划id + private String variable;//自定义变量 + private String loginid;//帐号 + private String domain;//域名 + @Id + @GeneratedValue(strategy=GenerationType.AUTO) + public int getMail_id() { + return mail_id; + } + public void setMail_id(int mailId) { + mail_id = mailId; + } + public int getSend_mail_id() { + return send_mail_id; + } + public void setSend_mail_id(int sendMailId) { + send_mail_id = sendMailId; + } + public String getMail_uid() { + return mail_uid; + } + public void setMail_uid(String mailUid) { + mail_uid = mailUid; + } + public String getReceiver() { + return receiver; + } + public void setReceiver(String receiver) { + this.receiver = receiver; + } + public String getEmail() { + return email; + } + public void setEmail(String email) { + this.email = email; + } + public String getPlans_send_time() { + return plans_send_time; + } + public void setPlans_send_time(String plansSendTime) { + plans_send_time = plansSendTime; + } + public String getEmail_suffix() { + return email_suffix; + } + public void setEmail_suffix(String emailSuffix) { + email_suffix = emailSuffix; + } + public int getStatus() { + return status; + } + public void setStatus(int status) { + this.status = status; + } + public int getBase_mail_id() { + return base_mail_id; + } + public void setBase_mail_id(int baseMailId) { + base_mail_id = baseMailId; + } + public int getIsexp() { + return isexp; + } + public void setIsexp(int isexp) { + this.isexp = isexp; + } + public String getCompany_variable() { + return company_variable; + } + public void setCompany_variable(String companyVariable) { + company_variable = companyVariable; + } + public int getPlanid() { + return planid; + } + public void setPlanid(int planid) { + this.planid = planid; + } + public String getVariable() { + return variable; + } + public void setVariable(String variable) { + this.variable = variable; + } + public String getLoginid() { + return loginid; + } + public void setLoginid(String loginid) { + this.loginid = loginid; + } + public String getDomain() { + return domain; + } + public void setDomain(String domain) { + this.domain = domain; + } +} diff --git b/.svn/pristine/e9/e9777dfc72670daefdcc591b6453b875789cc2c7.svn-base a/.svn/pristine/e9/e9777dfc72670daefdcc591b6453b875789cc2c7.svn-base new file mode 100644 index 0000000..1417f36 --- /dev/null +++ a/.svn/pristine/e9/e9777dfc72670daefdcc591b6453b875789cc2c7.svn-base @@ -0,0 +1,41 @@ +package com.espeed.yxy.service; + +import java.util.List; + +import com.espeed.centre.pojo.CentreYxyedmOldcustomer; +import com.espeed.yxy.pojo.YxyMailStencil; +import com.espeed.yxy.pojo.YxyMarketingPlan; +import com.espeed.yxy.pojo.YxySenderSet; +import com.espeed.yxy.pojo.YxyUserAddress; + +/*** + * + * @author 谢勇 + * 计划service + */ +public interface YxyMarketingPlanService { + + /**是否有可执行的营销计划*/ + public List<YxyMarketingPlan> findHavePlan()throws Exception; + + /**根据地址分组查询地址*/ + public List<YxyUserAddress> findAddressByGroupid(int typeid,int plan_differen,String loginid,String domain,String other_name)throws Exception; + + /**查询模版*/ + public YxyMailStencil findStencilInfo(int stencilid)throws Exception; + + /**查询发件人*/ + public YxySenderSet findSender(String loginid,String domain)throws Exception; + + /**修改计划周期状态*/ + public void updateWeekStatus(int weekid,int status)throws Exception; + + /**修改计划状态*/ + public void updatePlanStatus(int planid,int status)throws Exception; + + /**code查询控制参数(有用户级返回用户级,否则返回默认参数)*/ + public String findCompanyParamByCode(String code,String loginid,String domain)throws Exception; + + /**获取EDM配置-盘活客户配置信息*/ + public CentreYxyedmOldcustomer getOldCusSet(String domain)throws Exception; +} diff --git b/.svn/pristine/e9/e9ffe6372adb05c24c5dfebc690bcede32bf524d.svn-base a/.svn/pristine/e9/e9ffe6372adb05c24c5dfebc690bcede32bf524d.svn-base new file mode 100644 index 0000000..70a7733 --- /dev/null +++ a/.svn/pristine/e9/e9ffe6372adb05c24c5dfebc690bcede32bf524d.svn-base @@ -0,0 +1,74 @@ +package com.espeed.yxy.pojo; + +import java.io.Serializable; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; + +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 控制参数值(营销游) + * 开始时间: 2013.12.09 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +@Entity +@Table(name="yxy_sys_paramaters_value") +public class YxySysParamatersValue implements Serializable{ + + private int id; + private int owner_type;//所有者类别 + private String owner_loginid;//用户账号 + private int para_id;//外键 + private String company_domain;//用户所属域名 + private String para_value;//参数值 + + @Id + @GeneratedValue(strategy=GenerationType.AUTO) + public int getId() { + return id; + } + public void setId(int id) { + this.id = id; + } + public int getOwner_type() { + return owner_type; + } + public void setOwner_type(int ownerType) { + owner_type = ownerType; + } + public String getOwner_loginid() { + return owner_loginid; + } + public void setOwner_loginid(String ownerLoginid) { + owner_loginid = ownerLoginid; + } + public int getPara_id() { + return para_id; + } + public void setPara_id(int paraId) { + para_id = paraId; + } + public String getCompany_domain() { + return company_domain; + } + public void setCompany_domain(String companyDomain) { + company_domain = companyDomain; + } + public String getPara_value() { + return para_value; + } + public void setPara_value(String paraValue) { + para_value = paraValue; + } + + +} diff --git b/.svn/pristine/ea/ea8bc0e6f8660f74b7805463b90da7e45c8052b0.svn-base a/.svn/pristine/ea/ea8bc0e6f8660f74b7805463b90da7e45c8052b0.svn-base new file mode 100644 index 0000000..59783b2 --- /dev/null +++ a/.svn/pristine/ea/ea8bc0e6f8660f74b7805463b90da7e45c8052b0.svn-base @@ -0,0 +1,70 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + 定时器配置文件 +--> +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:aop="http://www.springframework.org/schema/aop" + xmlns:tx="http://www.springframework.org/schema/tx" + xsi:schemaLocation=" + http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd + http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd + http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd"> + <!-- 营销发送定时器开始 --> + <bean id="quartjob" class="com.espeed.yxy.timer.SendMailTimer" > + <property name="yxysendmailservice" ref="yxysendmailservice"/> + </bean> + <bean id="objAndmethod" + class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean"> + <property name="targetObject" ref="quartjob" /> + <property name="targetMethod" value="timerMethod" /> + </bean> + <bean id="dotime" class="org.springframework.scheduling.quartz.CronTriggerBean"> + <property name="jobDetail"> + <ref bean="objAndmethod" /> + </property> + <property name="cronExpression"> + <!-- + <value>0/45 * * * * ?</value> + --> + <value>0 0/1 * * * ?</value> + </property> + </bean> + <!-- 营销发送定时器结束 --> + + <!-- 营销计划定时器开始 --> + <bean id="markplanjob" class="com.espeed.yxy.timer.MarketingPlanTime" > + <property name="marketingplanservice" ref="marketingplanservice"/> + <property name="yxysendmailservice" ref="yxysendmailservice"/> + </bean> + <bean id="planobjmethod" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean"> + <property name="targetObject" ref="markplanjob" /> + <property name="targetMethod" value="marketingmethod" /> + </bean> + <bean id="markplan" class="org.springframework.scheduling.quartz.CronTriggerBean"> + <property name="jobDetail"> + <ref bean="planobjmethod" /> + </property> + <property name="cronExpression"> + <value>0/50 * * * * ?</value> + </property> + </bean> + <!-- 营销计划定时器结束 --> + + <!-- 管理类 如果将lazy-init='false'那么容器启动就会执行调度程序 --> + <bean id="startQuartz" lazy-init="false" autowire="no" + class="org.springframework.scheduling.quartz.SchedulerFactoryBean"> + <property name="triggers" > + <list> + <ref bean="dotime"/> + <ref bean="markplan"/> + </list> + </property> + </bean> + + <!-- 注入scheduler --> + <bean id="updatetime" class="com.espeed.yxy.timer.InitializingCronTrigger"> + <property name="scheduler" ref="startQuartz" /> + </bean> + +</beans> diff --git b/.svn/pristine/ea/eaa9adc31af860110e647e1e641bc3f5e44652dc.svn-base a/.svn/pristine/ea/eaa9adc31af860110e647e1e641bc3f5e44652dc.svn-base new file mode 100644 index 0000000..bc53794 --- /dev/null +++ a/.svn/pristine/ea/eaa9adc31af860110e647e1e641bc3f5e44652dc.svn-base @@ -0,0 +1,43 @@ +package com.espeed.yxy.dao; + +import java.util.List; + +import com.espeed.webmail.pojo.CrmCustomerInfo; + +/** +* +* @项目名称: 科飞管理后台系统 +* @版权所有: 深圳市科飞时速网络技术有限公司(0755-88843776) +* @技术支持: info@21gmail.com +* @单元名称: 实体类CrmCustomerInfo的DAO接口 +* @开始时间: 2018-09-27 +* @开发人员: 杨志钊 +*/ + +public interface CrmCustomerInfoDao { + + /**实体插入*/ + public int addPojo(CrmCustomerInfo entity) throws Exception; + + /**实体编辑*/ + public void updatePojo(CrmCustomerInfo entity) throws Exception; + + /**HQL查询*/ + public List<CrmCustomerInfo> findByHql(String hql) throws Exception; + + /**HQL指定条查询*/ + public List<CrmCustomerInfo> findByHqlSet(String hql,int num) throws Exception; + + /**SQL查询*/ + public List<Object> findBySqlFind(String sql) throws Exception; + + /**HQL更新*/ + public void updateByHql(String hql) throws Exception; + + /**sql更新*/ + public void updateBySql(String sql) throws Exception; + + /**HQL查询数量*/ + public int findByHqlCount(String hql) throws Exception; + +} diff --git b/.svn/pristine/ee/ee0d2222e6b63e5b2896b4dcfc93cde63da513f4.svn-base a/.svn/pristine/ee/ee0d2222e6b63e5b2896b4dcfc93cde63da513f4.svn-base new file mode 100644 index 0000000..40d7daf --- /dev/null +++ a/.svn/pristine/ee/ee0d2222e6b63e5b2896b4dcfc93cde63da513f4.svn-base @@ -0,0 +1,109 @@ +package com.espeed.yxy.pojo; + +import java.io.Serializable; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; + +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 控制参数(营销游) + * 开始时间: 2013.12.09 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +@Entity +@Table(name="yxy_sys_paramaters") +public class YxySysParamaters implements Serializable{ + + private int para_id; + private int owner_type; + private int enable_flag;//启用标识,1:启用,0:未启用 + private int sort_number;//sort_number + private String para_kind;//分类名称 + private String para_code;//参数代码 + private String para_name;//参数名称 + private String para_desc;//参数描述 + private String para_datatype; + private String default_value;//默认值 + private String list_value;//侯选值 + + @Id + @GeneratedValue(strategy=GenerationType.AUTO) + public int getPara_id() { + return para_id; + } + public void setPara_id(int paraId) { + para_id = paraId; + } + public int getOwner_type() { + return owner_type; + } + public void setOwner_type(int ownerType) { + owner_type = ownerType; + } + public int getEnable_flag() { + return enable_flag; + } + public void setEnable_flag(int enableFlag) { + enable_flag = enableFlag; + } + public int getSort_number() { + return sort_number; + } + public void setSort_number(int sortNumber) { + sort_number = sortNumber; + } + public String getPara_kind() { + return para_kind; + } + public void setPara_kind(String paraKind) { + para_kind = paraKind; + } + public String getPara_code() { + return para_code; + } + public void setPara_code(String paraCode) { + para_code = paraCode; + } + public String getPara_name() { + return para_name; + } + public void setPara_name(String paraName) { + para_name = paraName; + } + public String getPara_desc() { + return para_desc; + } + public void setPara_desc(String paraDesc) { + para_desc = paraDesc; + } + public String getPara_datatype() { + return para_datatype; + } + public void setPara_datatype(String paraDatatype) { + para_datatype = paraDatatype; + } + public String getDefault_value() { + return default_value; + } + public void setDefault_value(String defaultValue) { + default_value = defaultValue; + } + public String getList_value() { + return list_value; + } + public void setList_value(String listValue) { + list_value = listValue; + } + + +} diff --git b/.svn/pristine/ef/ef06837e2109fd5feaae63411db7795efde287da.svn-base a/.svn/pristine/ef/ef06837e2109fd5feaae63411db7795efde287da.svn-base new file mode 100644 index 0000000..46ae43e --- /dev/null +++ a/.svn/pristine/ef/ef06837e2109fd5feaae63411db7795efde287da.svn-base @@ -0,0 +1,19 @@ +package com.espeed.yxy.dao.impl; + +import java.util.List; + +import com.espeed.yxy.dao.YxySendFilterAddressDao; +import com.espeed.yxy.pojo.YxySendFilterAddress; + +/** + * + * @author 谢勇 + * 用户过滤接口 + */ +public class YxySendFilterAddressDaoImpl extends HibernateBaseDAOImpl<YxySendFilterAddress, Long> implements YxySendFilterAddressDao{ + + /**HQL查询*/ + public List<YxySendFilterAddress> findByHql(String hql)throws Exception{ + return super.getAll(hql); + } +} diff --git b/.svn/pristine/ef/ef45992c79df192b899f0f69700cdddef566b243.svn-base a/.svn/pristine/ef/ef45992c79df192b899f0f69700cdddef566b243.svn-base new file mode 100644 index 0000000..834a230 --- /dev/null +++ a/.svn/pristine/ef/ef45992c79df192b899f0f69700cdddef566b243.svn-base @@ -0,0 +1,77 @@ +package com.espeed.yxy.dao.impl; + +import java.util.List; + +import com.espeed.yxy.dao.YxySmtpSendSetDao; +import com.espeed.yxy.pojo.YxySendMailDetail; +import com.espeed.yxy.pojo.YxySmtpSendSet; +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: smtp后缀 发送设置DAO实现类 + * 开始时间: 2013.11.27 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +public class YxySmtpSendSetDaoImpl extends HibernateBaseDAOImpl<YxySmtpSendSet,Long> implements YxySmtpSendSetDao{ + +// /**查询该smtp对应后缀在时间段的发送量*/ +// public List<YxySmtpSendSet> findAllSmtpSendSet(String smtpservice,String nowDay) throws Exception { +// String hql="from YxySmtpSendSet where smtp_send_set_service='"+smtpservice+"' and smtp_send_set_daydate='"+nowDay+"'"; +// return super.getAll(hql); +// } +// +// /**添加后缀发送量信息*/ +// public void addSmtpSendSet(YxySmtpSendSet o) throws Exception { +// super.add(o); +// } +// +// /**查询某smtp账号的已发量数据(作用于自配smtp)*/ +// public List<YxySmtpSendSet> findSmtpSetByAccount(String smtpaccount) throws Exception { +// String hql="from YxySmtpSendSet where smtp_send_set_accout='"+smtpaccount+"'"; +// return super.getAll(hql); +// } +// /**更新发送量信息*/ +// public void updateSmtpSet(List<YxySmtpSendSet> o)throws Exception{ +// super.saveandupdatePi(o); +// } +// /**hql删除*/ +// public void delByHql(String hql) throws Exception { +// super.updateorDelBySql(hql); +// +// } + + /**批量插入*/ + public void addPiPojo(List<YxySmtpSendSet> o)throws Exception{ + super.addPi(o); + } + + /**实体添加*/ + public int addPojo(YxySmtpSendSet o)throws Exception{ + return super.add(o); + } + + /**HQL查询*/ + public List<YxySmtpSendSet> findByHql(String hql)throws Exception{ + return super.getAll(hql); + } + + /**SQL查询*/ + public List<Object> findbysql(String sql)throws Exception{ + return super.findBySql(sql); + } + + /**SQL更新*/ + public void updateBySql(String sql)throws Exception{ + super.updateorDelBySql(sql); + } + + /**HQL更新*/ + public void updateByHql(String hql)throws Exception{ + super.updateorDelByHql(hql); + } +} diff --git b/.svn/pristine/f1/f1eaa8180f2e1955015172658c62cbd8fd2af4f3.svn-base a/.svn/pristine/f1/f1eaa8180f2e1955015172658c62cbd8fd2af4f3.svn-base new file mode 100644 index 0000000..e4e5b48 --- /dev/null +++ a/.svn/pristine/f1/f1eaa8180f2e1955015172658c62cbd8fd2af4f3.svn-base @@ -0,0 +1,46 @@ +package com.espeed.yxy.dao; + +import java.util.List; +import com.espeed.yxy.pojo.YxySmtpSendSet; +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 后缀发送量接口(营销游) + * 开始时间: 2013.12.09 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +public interface YxySmtpSendSetDao { + +// /**查询该smtp对应后缀在时间段的发送量通过smtp查询(作用于运营smtp)*/ +// public List<YxySmtpSendSet> findAllSmtpSendSet(String smtpservice,String nowDay)throws Exception; +// /**添加后缀发送量信息*/ +// public void addSmtpSendSet(YxySmtpSendSet o)throws Exception; +// /**查询某smtp账号的已发量数据(作用于自配smtp)*/ +// public List<YxySmtpSendSet> findSmtpSetByAccount(String smtpaccount)throws Exception; +// /**更新发送量信息*/ +// public void updateSmtpSet(List<YxySmtpSendSet> o)throws Exception; +// /**hql删除*/ +// public void delByHql(String hql)throws Exception; + /**批量插入*/ + public void addPiPojo(List<YxySmtpSendSet> o)throws Exception; + + /**实体添加*/ + public int addPojo(YxySmtpSendSet o)throws Exception; + + /**HQL查询*/ + public List<YxySmtpSendSet> findByHql(String hql)throws Exception; + + /**SQL查询*/ + public List<Object> findbysql(String sql)throws Exception; + + /**SQL更新*/ + public void updateBySql(String sql)throws Exception; + + /**HQL更新*/ + public void updateByHql(String hql)throws Exception; +} diff --git b/.svn/pristine/f3/f3f7ebee5a267acb887d832c5537979b5ab28d96.svn-base a/.svn/pristine/f3/f3f7ebee5a267acb887d832c5537979b5ab28d96.svn-base new file mode 100644 index 0000000..21b88eb --- /dev/null +++ a/.svn/pristine/f3/f3f7ebee5a267acb887d832c5537979b5ab28d96.svn-base @@ -0,0 +1,93 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + spring数据库、整合其它框架配置文件 +--> +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:aop="http://www.springframework.org/schema/aop" + xmlns:tx="http://www.springframework.org/schema/tx" + xsi:schemaLocation=" + http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd + http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd + http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd"> + + <!-- 配置数据源 --> + <bean id="centreDataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> + <property name="driverClassName"> + <value>com.mysql.jdbc.Driver</value> + </property> + <property name="url"> + <value>jdbc:mysql://localhost:3306/centredb?useUnicode=true&characterEncoding=utf8</value> + </property> + <property name="username"> + <value>root</value> + </property> + <property name="password"> + <value>sz1234567890</value> + </property> + <property name="maxActive"> + <value>100</value> + </property> + <property name="maxIdle"> + <value>50</value> + </property> + <property name="initialSize"> + <value>30</value> + </property> + <property name="maxWait"> + <value>10000</value> + </property> + <property name="defaultAutoCommit"> + <value>true</value> + </property> + <property name="removeAbandoned"> + <value>true</value> + </property> + <property name="removeAbandonedTimeout"> + <value>300</value> + </property> + <property name="logAbandoned"> + <value>false</value> + </property> + <property name="validationQuery"> + <value>select 1</value> + </property> + <property name="testOnBorrow"> + <value>true</value> + </property> + </bean> + + <!-- 配置注解sessionFactory --> + <bean id="centreSessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"> + <property name="dataSource" ref="centreDataSource" /> + <property name="packagesToScan"> + <list> + <value>com.espeed.centre.pojo</value> + </list> + </property> + <property name="hibernateProperties"> + <props> + <prop key="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</prop> + <prop key="hibernate.show_sql">false</prop> + <prop key="hibernate.generate_statistics">true</prop> + <prop key="hibernate.connetion.release_mode">auto</prop> + <prop key="hibernate.cache.use_query_cache">false</prop> + <prop key="hibernate.cache.use_second_level_cache">false</prop> + </props> + </property> + </bean> + + <!--配置公共的hibernate方法注解 --> + <bean id="centreAnnHibernateBaseDAO" class="com.espeed.yxy.dao.impl.CentreHibernateBaseDAOImpl" abstract="true" scope="prototype"> + <property name="sessionFactory" ref="centreSessionFactory"/> + </bean> + + <!-- 用户dao --> + <bean id="centreuserdao" class="com.espeed.yxy.dao.impl.CentreUserDaoImpl" parent="centreAnnHibernateBaseDAO"></bean> + <!-- 跟踪配置dao --> + <bean id="centretracksetdao" class="com.espeed.yxy.dao.impl.CentreTrackSetDaoImpl" parent="centreAnnHibernateBaseDAO"></bean> + <!-- 营销开发客户配置dao --> + <bean id="centreyxyedmnewcustomerdao" class="com.espeed.yxy.dao.impl.CentreYxyedmNewcustomerDaoImpl" parent="centreAnnHibernateBaseDAO"></bean> + <!-- 营销盘活客户配置dao --> + <bean id="centreyxyedmoldcustomerdao" class="com.espeed.yxy.dao.impl.CentreYxyedmOldcustomerDaoImpl" parent="centreAnnHibernateBaseDAO"></bean> +</beans> diff --git b/.svn/pristine/f6/f63565d25008e59a55394b215ec07defc7c0b78d.svn-base a/.svn/pristine/f6/f63565d25008e59a55394b215ec07defc7c0b78d.svn-base new file mode 100644 index 0000000..c35a14b --- /dev/null +++ a/.svn/pristine/f6/f63565d25008e59a55394b215ec07defc7c0b78d.svn-base @@ -0,0 +1,25 @@ +package com.espeed.yxy.dao; + +import java.util.List; +import com.espeed.yxy.pojo.YxySendCount; + +/** + * 客户发送邮件的统计Dao + * @author 陈南巧 + */ +public interface YxySendCountDao { + /**实体插入*/ + public int addPojo(YxySendCount o)throws Exception; + /**实体编辑*/ + public void updatePojo(YxySendCount o)throws Exception; + /**HQL查询*/ + public List<YxySendCount> findByHql(String hql)throws Exception; + /**HQL数量查询*/ + public int findByHqlCount(String hql)throws Exception; + /**指定条记录*/ + public List<YxySendCount> findByHqlSet(String hql,int num)throws Exception; + /**SQL查询*/ + public List<Object> findBySqlQuery(String sql)throws Exception; + /**HQL更新*/ + public void updateByHql(String hql)throws Exception; +} diff --git b/.svn/pristine/f6/f65d461db2f5cb505ac6c4e54492e3a5121a624c.svn-base a/.svn/pristine/f6/f65d461db2f5cb505ac6c4e54492e3a5121a624c.svn-base new file mode 100644 index 0000000..d9ae151 Binary files /dev/null and a/.svn/pristine/f6/f65d461db2f5cb505ac6c4e54492e3a5121a624c.svn-base differ diff --git b/.svn/pristine/f9/f981e7acd3401b500b8404fbfd3b98403774d709.svn-base a/.svn/pristine/f9/f981e7acd3401b500b8404fbfd3b98403774d709.svn-base new file mode 100644 index 0000000..cf4f978 --- /dev/null +++ a/.svn/pristine/f9/f981e7acd3401b500b8404fbfd3b98403774d709.svn-base @@ -0,0 +1,38 @@ +package com.espeed.yxy.dao; + +import java.util.List; +import com.espeed.yxy.pojo.YxySysParamatersValue; +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 控制参数值Dao(营销游) + * 开始时间: 2013.12.09 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +public interface YxySysParamatersValueDao { + +// /**通过paraid查询参数值*/ +// public List<YxySysParamatersValue> findParamatersValueByParaId(String loginid,String domain)throws Exception; + /**批量插入*/ + public void addPiPojo(List<YxySysParamatersValue> o)throws Exception; + + /**实体添加*/ + public int addPojo(YxySysParamatersValue o)throws Exception; + + /**HQL查询*/ + public List<YxySysParamatersValue> findByHql(String hql)throws Exception; + + /**SQL查询*/ + public List<Object> findbysql(String sql)throws Exception; + + /**SQL更新*/ + public void updateBySql(String sql)throws Exception; + + /**HQL更新*/ + public void updateByHql(String hql)throws Exception; +} diff --git b/.svn/pristine/fa/fa985ac860cd6a02bc4758133ff2ba99210b897b.svn-base a/.svn/pristine/fa/fa985ac860cd6a02bc4758133ff2ba99210b897b.svn-base new file mode 100644 index 0000000..cd7c655 --- /dev/null +++ a/.svn/pristine/fa/fa985ac860cd6a02bc4758133ff2ba99210b897b.svn-base @@ -0,0 +1,56 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!--邮件dao配置文件--> +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:aop="http://www.springframework.org/schema/aop" + xmlns:tx="http://www.springframework.org/schema/tx" + xsi:schemaLocation=" + http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd + http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd + http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd"> + + + <!--待发邮件DAO--> + <bean id="yxysendmailmasterdao" class="com.espeed.yxy.dao.impl.YxySendMailMasterDaoImpl" parent="hibernateBaseDAO"></bean> + <!--邮件DAO--> + <bean id="mailmasterbasedao" class="com.espeed.yxy.dao.impl.YxySendMailMasterBaseDaoImpl" parent="hibernateBaseDAO"></bean> + <!--待发地址DAO--> + <bean id="yxysendmaildetaildao" class="com.espeed.yxy.dao.impl.YxySendMailDetailDaoImpl" parent="hibernateBaseDAO"></bean> + <!--SMTP DAO--> + <bean id="yxysendsmtpinfodao" class="com.espeed.yxy.dao.impl.YxySendSmtpInfoDaoImpl" parent="hibernateBaseDAO"></bean> + <!--SMTP后缀设置信息 DAO--> + <bean id="yxysmtpsuffixsetdao" class="com.espeed.yxy.dao.impl.YxySmtpSuffixSetDaoImpl" parent="hibernateBaseDAO"></bean> + <!--SMTP后缀设置信息 DAO--> + <bean id="yxysmtpsendsetdao" class="com.espeed.yxy.dao.impl.YxySmtpSendSetDaoImpl" parent="hibernateBaseDAO"></bean> + <!--自配SMTP发送量信息 DAO--> + <bean id="yxysmtpsendselfoversetdao" class="com.espeed.yxy.dao.impl.YxySmtpSendSelfOversetDaoImpl" parent="hibernateBaseDAO"></bean> + <!--自配SMTP发送量限制 DAO--> + <bean id="yxysmtpsendselfsetdao" class="com.espeed.yxy.dao.impl.YxySmtpSendSelfSetDaoImpl" parent="hibernateBaseDAO"></bean> + <!--控制参数DAO--> + <bean id="yxysysparamaterdao" class="com.espeed.yxy.dao.impl.YxyParamaterDaoImpl" parent="hibernateBaseDAO"></bean> + <!--控制参数值DAO--> + <bean id="yxysysparamatersvaluedao" class="com.espeed.yxy.dao.impl.YxySysParamatersValueDaoImpl" parent="hibernateBaseDAO"></bean> + <!-- 营销计划dao --> + <bean id="marketingplandao" class="com.espeed.yxy.dao.impl.YxyMarketingPlanDaoImpl" parent="hibernateBaseDAO"></bean> + <!-- 用户地址dao --> + <bean id="addressdao" class="com.espeed.yxy.dao.impl.YxyUserAddressDaoImpl" parent="hibernateBaseDAO"></bean> + <!-- 模版dao --> + <bean id="stencildao" class="com.espeed.yxy.dao.impl.YxyMailStencilDaoImpl" parent="hibernateBaseDAO"></bean> + <!-- 计划周期dao --> + <bean id="marketingweekdao" class="com.espeed.yxy.dao.impl.YxyMarketingWeekDaoImpl" parent="hibernateBaseDAO"></bean> + <!-- 发件人dao --> + <bean id="senderdao" class="com.espeed.yxy.dao.impl.YxySenderSetDaoImpl" parent="hibernateBaseDAO"></bean> + <!-- 回复dao --> + <bean id="replydao" class="com.espeed.yxy.dao.impl.YxyReplyInfoDaoImpl" parent="hibernateBaseDAO"></bean> + <!-- 过滤dao --> + <bean id="filterdao" class="com.espeed.yxy.dao.impl.YxySendFilterAddressDaoImpl" parent="hibernateBaseDAO"></bean> + <!-- 分类下的客户DAO --> + <bean id="yxycustomeremaildao" class="com.espeed.yxy.dao.impl.YxyCustomerEmailDaoImpl" parent="hibernateBaseDAO"></bean> + <!-- 客户发送邮件的统计Dao --> + <bean id="yxysendcountdao" class="com.espeed.yxy.dao.impl.YxySendCountDaoImpl" parent="hibernateBaseDAO"></bean> + <!--配置公共的hibernate方法 --> + <bean id="hibernateBaseDAO" class="com.espeed.yxy.dao.impl.HibernateBaseDAOImpl" abstract="true" scope="prototype"> + <property name="sessionFactory" ref="sessionFactory"/> + </bean> +</beans> diff --git b/.svn/pristine/fb/fbd8bb77e6a693bd48cfb0a0d9bffc789c8ef189.svn-base a/.svn/pristine/fb/fbd8bb77e6a693bd48cfb0a0d9bffc789c8ef189.svn-base new file mode 100644 index 0000000..5664789 --- /dev/null +++ a/.svn/pristine/fb/fbd8bb77e6a693bd48cfb0a0d9bffc789c8ef189.svn-base @@ -0,0 +1,68 @@ +package com.espeed.centre.pojo; + +import java.io.Serializable; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; + +/** + * 项目名称: 统一验证中心系统 + * 版权所有: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 技术支持: info@21gmail.com + * 单元名称: 跟踪配置实体类 + * 开始时间: 2018.04.08 + * 开发人员: 陈南巧 + */ +@Entity +@Table(name="centre_track_set") +public class CentreTrackSet implements Serializable +{ + private static final long serialVersionUID = 1L; + private int id;//主键id + private String domain;//域名 + private int type;//类型,0:邮件跟踪,1:edm跟踪 + private int status;//状态,0不可用,1可以用 + private int company_id;//企业id + private String company_doamin;//企业域名 + @Id + @GeneratedValue(strategy=GenerationType.AUTO) + public int getId() { + return id; + } + public void setId(int id) { + this.id = id; + } + public String getDomain() { + return domain; + } + public void setDomain(String domain) { + this.domain = domain; + } + public int getType() { + return type; + } + public void setType(int type) { + this.type = type; + } + public int getStatus() { + return status; + } + public void setStatus(int status) { + this.status = status; + } + public int getCompany_id() { + return company_id; + } + public void setCompany_id(int company_id) { + this.company_id = company_id; + } + public String getCompany_doamin() { + return company_doamin; + } + public void setCompany_doamin(String company_doamin) { + this.company_doamin = company_doamin; + } +} diff --git b/.svn/pristine/fc/fc9fc0605e3bacd83fd735ff3abcdf1cfafad807.svn-base a/.svn/pristine/fc/fc9fc0605e3bacd83fd735ff3abcdf1cfafad807.svn-base new file mode 100644 index 0000000..9615e32 Binary files /dev/null and a/.svn/pristine/fc/fc9fc0605e3bacd83fd735ff3abcdf1cfafad807.svn-base differ diff --git b/.svn/wc.db a/.svn/wc.db new file mode 100644 index 0000000..d20c6ac Binary files /dev/null and a/.svn/wc.db differ diff --git b/.svn/wc.db-journal a/.svn/wc.db-journal new file mode 100644 index 0000000..e69de29 --- /dev/null +++ a/.svn/wc.db-journal diff --git b/WebRoot/META-INF/MANIFEST.MF a/WebRoot/META-INF/MANIFEST.MF new file mode 100644 index 0000000..254272e --- /dev/null +++ a/WebRoot/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Class-Path: + diff --git b/WebRoot/WEB-INF/config.properties a/WebRoot/WEB-INF/config.properties new file mode 100644 index 0000000..f28f12c --- /dev/null +++ a/WebRoot/WEB-INF/config.properties @@ -0,0 +1,21 @@ +#命名注意:XXurl指http://此种路径 path指绝对路径如E://bbs//abc +#配置的最大线程量 +threadNum=10 +#点读服务URL(新客户营销) +clickserviceurl=http://ying01.yingyanso.win/ +#点读服务URL(老客户跟进) +clickserviceurl2=http://ying01.yingyanso.win/ +#营销webmail本地绝对路径(易外销的营销邮) +yxywebmailpath=E\://javapros//.metadata//.me_tcat//webapps//espeedYxyService +#营销webmail本地绝对路径(单独的营销邮) +yxywebmailpath2=E\://javapros//.metadata//.me_tcat//webapps//espeedYxyService +#webmail定时器URL +webmailtimeurl=http://localhost:8080/espeedCenterServiceLast +#一个smtp发送邮件数量 +smtpsendnum=3 +#webmail接口服务器URL +webmailinterfaceurl=http://webinterface120117.21gmail.com:81 +#一个地址发送异常数量 +sendexpnum=3 +#超链接跟踪url +trackurl=https\://tongji.shenyingshejiao.net \ No newline at end of file diff --git b/WebRoot/WEB-INF/lib/JoSQL-2.1.jar a/WebRoot/WEB-INF/lib/JoSQL-2.1.jar new file mode 100644 index 0000000..9f59bc0 Binary files /dev/null and a/WebRoot/WEB-INF/lib/JoSQL-2.1.jar differ diff --git b/WebRoot/WEB-INF/lib/antlr-2.7.6.jar a/WebRoot/WEB-INF/lib/antlr-2.7.6.jar new file mode 100644 index 0000000..3702b64 Binary files /dev/null and a/WebRoot/WEB-INF/lib/antlr-2.7.6.jar differ diff --git b/WebRoot/WEB-INF/lib/asm-3.3.1.jar a/WebRoot/WEB-INF/lib/asm-3.3.1.jar new file mode 100644 index 0000000..f50f03f Binary files /dev/null and a/WebRoot/WEB-INF/lib/asm-3.3.1.jar differ diff --git b/WebRoot/WEB-INF/lib/aspectjweaver.jar a/WebRoot/WEB-INF/lib/aspectjweaver.jar new file mode 100644 index 0000000..e0087fb Binary files /dev/null and a/WebRoot/WEB-INF/lib/aspectjweaver.jar differ diff --git b/WebRoot/WEB-INF/lib/c3p0-0.9.1.2.jar a/WebRoot/WEB-INF/lib/c3p0-0.9.1.2.jar new file mode 100644 index 0000000..0f42d60 Binary files /dev/null and a/WebRoot/WEB-INF/lib/c3p0-0.9.1.2.jar differ diff --git b/WebRoot/WEB-INF/lib/cglib-2.2.jar a/WebRoot/WEB-INF/lib/cglib-2.2.jar new file mode 100644 index 0000000..084ef6e Binary files /dev/null and a/WebRoot/WEB-INF/lib/cglib-2.2.jar differ diff --git b/WebRoot/WEB-INF/lib/commons-collections-3.1.jar a/WebRoot/WEB-INF/lib/commons-collections-3.1.jar new file mode 100644 index 0000000..41e230f Binary files /dev/null and a/WebRoot/WEB-INF/lib/commons-collections-3.1.jar differ diff --git b/WebRoot/WEB-INF/lib/commons-dbcp.jar a/WebRoot/WEB-INF/lib/commons-dbcp.jar new file mode 100644 index 0000000..faea056 Binary files /dev/null and a/WebRoot/WEB-INF/lib/commons-dbcp.jar differ diff --git b/WebRoot/WEB-INF/lib/commons-logging-1.1.1.jar a/WebRoot/WEB-INF/lib/commons-logging-1.1.1.jar new file mode 100644 index 0000000..8758a96 Binary files /dev/null and a/WebRoot/WEB-INF/lib/commons-logging-1.1.1.jar differ diff --git b/WebRoot/WEB-INF/lib/commons-pool.jar a/WebRoot/WEB-INF/lib/commons-pool.jar new file mode 100644 index 0000000..e8de327 Binary files /dev/null and a/WebRoot/WEB-INF/lib/commons-pool.jar differ diff --git b/WebRoot/WEB-INF/lib/cxf-2.6.2.jar a/WebRoot/WEB-INF/lib/cxf-2.6.2.jar new file mode 100644 index 0000000..9a88e53 Binary files /dev/null and a/WebRoot/WEB-INF/lib/cxf-2.6.2.jar differ diff --git b/WebRoot/WEB-INF/lib/cxf-manifest.jar a/WebRoot/WEB-INF/lib/cxf-manifest.jar new file mode 100644 index 0000000..630d9fe Binary files /dev/null and a/WebRoot/WEB-INF/lib/cxf-manifest.jar differ diff --git b/WebRoot/WEB-INF/lib/cxf-services-sts-core-2.6.2.jar a/WebRoot/WEB-INF/lib/cxf-services-sts-core-2.6.2.jar new file mode 100644 index 0000000..e3eb8ec Binary files /dev/null and a/WebRoot/WEB-INF/lib/cxf-services-sts-core-2.6.2.jar differ diff --git b/WebRoot/WEB-INF/lib/cxf-services-wsn-api-2.6.2.jar a/WebRoot/WEB-INF/lib/cxf-services-wsn-api-2.6.2.jar new file mode 100644 index 0000000..e9248d1 Binary files /dev/null and a/WebRoot/WEB-INF/lib/cxf-services-wsn-api-2.6.2.jar differ diff --git b/WebRoot/WEB-INF/lib/cxf-services-wsn-core-2.6.2.jar a/WebRoot/WEB-INF/lib/cxf-services-wsn-core-2.6.2.jar new file mode 100644 index 0000000..9615e32 Binary files /dev/null and a/WebRoot/WEB-INF/lib/cxf-services-wsn-core-2.6.2.jar differ diff --git b/WebRoot/WEB-INF/lib/cxf-xjc-boolean-2.6.0.jar a/WebRoot/WEB-INF/lib/cxf-xjc-boolean-2.6.0.jar new file mode 100644 index 0000000..74e6863 Binary files /dev/null and a/WebRoot/WEB-INF/lib/cxf-xjc-boolean-2.6.0.jar differ diff --git b/WebRoot/WEB-INF/lib/cxf-xjc-bug671-2.6.0.jar a/WebRoot/WEB-INF/lib/cxf-xjc-bug671-2.6.0.jar new file mode 100644 index 0000000..30135f8 Binary files /dev/null and a/WebRoot/WEB-INF/lib/cxf-xjc-bug671-2.6.0.jar differ diff --git b/WebRoot/WEB-INF/lib/cxf-xjc-dv-2.6.0.jar a/WebRoot/WEB-INF/lib/cxf-xjc-dv-2.6.0.jar new file mode 100644 index 0000000..d9ae151 Binary files /dev/null and a/WebRoot/WEB-INF/lib/cxf-xjc-dv-2.6.0.jar differ diff --git b/WebRoot/WEB-INF/lib/cxf-xjc-runtime-2.6.0.jar a/WebRoot/WEB-INF/lib/cxf-xjc-runtime-2.6.0.jar new file mode 100644 index 0000000..e438354 Binary files /dev/null and a/WebRoot/WEB-INF/lib/cxf-xjc-runtime-2.6.0.jar differ diff --git b/WebRoot/WEB-INF/lib/cxf-xjc-ts-2.6.0.jar a/WebRoot/WEB-INF/lib/cxf-xjc-ts-2.6.0.jar new file mode 100644 index 0000000..6d93b6c Binary files /dev/null and a/WebRoot/WEB-INF/lib/cxf-xjc-ts-2.6.0.jar differ diff --git b/WebRoot/WEB-INF/lib/dom4j-1.6.1.jar a/WebRoot/WEB-INF/lib/dom4j-1.6.1.jar new file mode 100644 index 0000000..c8c4dbb Binary files /dev/null and a/WebRoot/WEB-INF/lib/dom4j-1.6.1.jar differ diff --git b/WebRoot/WEB-INF/lib/gentlyWEB-utils-1.1.jar a/WebRoot/WEB-INF/lib/gentlyWEB-utils-1.1.jar new file mode 100644 index 0000000..ac0d85b Binary files /dev/null and a/WebRoot/WEB-INF/lib/gentlyWEB-utils-1.1.jar differ diff --git b/WebRoot/WEB-INF/lib/hibernate-jpa-2.0-api-1.0.1.Final.jar a/WebRoot/WEB-INF/lib/hibernate-jpa-2.0-api-1.0.1.Final.jar new file mode 100644 index 0000000..1e9f71b Binary files /dev/null and a/WebRoot/WEB-INF/lib/hibernate-jpa-2.0-api-1.0.1.Final.jar differ diff --git b/WebRoot/WEB-INF/lib/hibernate3.jar a/WebRoot/WEB-INF/lib/hibernate3.jar new file mode 100644 index 0000000..73df7b1 Binary files /dev/null and a/WebRoot/WEB-INF/lib/hibernate3.jar differ diff --git b/WebRoot/WEB-INF/lib/javassist-3.12.0.GA.jar a/WebRoot/WEB-INF/lib/javassist-3.12.0.GA.jar new file mode 100644 index 0000000..8f692f4 Binary files /dev/null and a/WebRoot/WEB-INF/lib/javassist-3.12.0.GA.jar differ diff --git b/WebRoot/WEB-INF/lib/jsoup-1.11.3.jar a/WebRoot/WEB-INF/lib/jsoup-1.11.3.jar new file mode 100644 index 0000000..80c0ca8 Binary files /dev/null and a/WebRoot/WEB-INF/lib/jsoup-1.11.3.jar differ diff --git b/WebRoot/WEB-INF/lib/jta-1.1.jar a/WebRoot/WEB-INF/lib/jta-1.1.jar new file mode 100644 index 0000000..6d225b7 Binary files /dev/null and a/WebRoot/WEB-INF/lib/jta-1.1.jar differ diff --git b/WebRoot/WEB-INF/lib/log4j.jar a/WebRoot/WEB-INF/lib/log4j.jar new file mode 100644 index 0000000..a0f0ccd Binary files /dev/null and a/WebRoot/WEB-INF/lib/log4j.jar differ diff --git b/WebRoot/WEB-INF/lib/mail.jar a/WebRoot/WEB-INF/lib/mail.jar new file mode 100644 index 0000000..2c39dc3 Binary files /dev/null and a/WebRoot/WEB-INF/lib/mail.jar differ diff --git b/WebRoot/WEB-INF/lib/mysql-connector-java-5.1.6-bin.jar a/WebRoot/WEB-INF/lib/mysql-connector-java-5.1.6-bin.jar new file mode 100644 index 0000000..0539039 Binary files /dev/null and a/WebRoot/WEB-INF/lib/mysql-connector-java-5.1.6-bin.jar differ diff --git b/WebRoot/WEB-INF/lib/neethi-3.0.2.jar a/WebRoot/WEB-INF/lib/neethi-3.0.2.jar new file mode 100644 index 0000000..383efde Binary files /dev/null and a/WebRoot/WEB-INF/lib/neethi-3.0.2.jar differ diff --git b/WebRoot/WEB-INF/lib/quartz.jar a/WebRoot/WEB-INF/lib/quartz.jar new file mode 100644 index 0000000..1484667 Binary files /dev/null and a/WebRoot/WEB-INF/lib/quartz.jar differ diff --git b/WebRoot/WEB-INF/lib/slf4j-api-1.6.1.jar a/WebRoot/WEB-INF/lib/slf4j-api-1.6.1.jar new file mode 100644 index 0000000..f1f4fdd Binary files /dev/null and a/WebRoot/WEB-INF/lib/slf4j-api-1.6.1.jar differ diff --git b/WebRoot/WEB-INF/lib/spring-beans.jar a/WebRoot/WEB-INF/lib/spring-beans.jar new file mode 100644 index 0000000..3f306b6 Binary files /dev/null and a/WebRoot/WEB-INF/lib/spring-beans.jar differ diff --git b/WebRoot/WEB-INF/lib/spring-context.jar a/WebRoot/WEB-INF/lib/spring-context.jar new file mode 100644 index 0000000..29fabcc Binary files /dev/null and a/WebRoot/WEB-INF/lib/spring-context.jar differ diff --git b/WebRoot/WEB-INF/lib/spring-core-3.2.0.M1-javadoc.jar a/WebRoot/WEB-INF/lib/spring-core-3.2.0.M1-javadoc.jar new file mode 100644 index 0000000..61bd4a5 Binary files /dev/null and a/WebRoot/WEB-INF/lib/spring-core-3.2.0.M1-javadoc.jar differ diff --git b/WebRoot/WEB-INF/lib/spring-web.jar a/WebRoot/WEB-INF/lib/spring-web.jar new file mode 100644 index 0000000..432e8f0 Binary files /dev/null and a/WebRoot/WEB-INF/lib/spring-web.jar differ diff --git b/WebRoot/WEB-INF/lib/spring.jar a/WebRoot/WEB-INF/lib/spring.jar new file mode 100644 index 0000000..5273670 Binary files /dev/null and a/WebRoot/WEB-INF/lib/spring.jar differ diff --git b/WebRoot/WEB-INF/lib/wsdl4j-1.6.2.jar a/WebRoot/WEB-INF/lib/wsdl4j-1.6.2.jar new file mode 100644 index 0000000..b9ffc36 Binary files /dev/null and a/WebRoot/WEB-INF/lib/wsdl4j-1.6.2.jar differ diff --git b/WebRoot/WEB-INF/lib/xmlschema-core-2.0.3.jar a/WebRoot/WEB-INF/lib/xmlschema-core-2.0.3.jar new file mode 100644 index 0000000..c15ca90 Binary files /dev/null and a/WebRoot/WEB-INF/lib/xmlschema-core-2.0.3.jar differ diff --git b/WebRoot/WEB-INF/web.xml a/WebRoot/WEB-INF/web.xml new file mode 100644 index 0000000..b2d73da --- /dev/null +++ a/WebRoot/WEB-INF/web.xml @@ -0,0 +1,56 @@ +<?xml version="1.0" encoding="UTF-8"?> +<web-app version="2.5" + xmlns="http://java.sun.com/xml/ns/javaee" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://java.sun.com/xml/ns/javaee + http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> + + <filter> + <filter-name>openSessionInView</filter-name> + <filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class> + </filter> + + <filter-mapping> + <filter-name>openSessionInView</filter-name> + <url-pattern>/*</url-pattern> + </filter-mapping> + + + + + <!-- 配置spring监听器 --> + <context-param> + <param-name>contextConfigLocation</param-name> + <param-value>classpath:applicationContext.xml</param-value> + </context-param> + <listener> + <listener-class> + org.springframework.web.context.ContextLoaderListener + </listener-class> + </listener> + + <!-- Spring乱码处理 --> + <filter> + <filter-name>characterEncoding</filter-name> + <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class> + <init-param> + <param-name>encoding</param-name> + <param-value>UTF-8</param-value> + </init-param> + <init-param> + <param-name>forceEncoding</param-name> + <param-value>true</param-value> + </init-param> + </filter> + + <welcome-file-list> + <welcome-file>index.jsp</welcome-file> + </welcome-file-list> + + <!-- 开机运行方法 --> + <servlet> + <servlet-name>initServlet</servlet-name> + <servlet-class>com.espeed.yxy.tool.ServiceInit</servlet-class> + <load-on-startup>1</load-on-startup> + </servlet> +</web-app> diff --git b/WebRoot/index.jsp a/WebRoot/index.jsp new file mode 100644 index 0000000..0866042 --- /dev/null +++ a/WebRoot/index.jsp @@ -0,0 +1,26 @@ +<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%> +<% +String path = request.getContextPath(); +String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; +%> + +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html> + <head> + <base href="<%=basePath%>"> + + <title>My JSP 'index.jsp' starting page</title> + <meta http-equiv="pragma" content="no-cache"> + <meta http-equiv="cache-control" content="no-cache"> + <meta http-equiv="expires" content="0"> + <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> + <meta http-equiv="description" content="This is my page"> + <!-- + <link rel="stylesheet" type="text/css" href="styles.css"> + --> + </head> + + <body> + This is my JSP page. <br> + </body> +</html> diff --git b/src/applicationContext.xml a/src/applicationContext.xml new file mode 100644 index 0000000..2487646 --- /dev/null +++ a/src/applicationContext.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:aop="http://www.springframework.org/schema/aop" + xmlns:tx="http://www.springframework.org/schema/tx" + xsi:schemaLocation=" + http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd + http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd + http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd"> + <import resource="springConfig/applicationContext_common.xml"/> + <import resource="springConfig/applicationContext_dao.xml"/> + <import resource="springConfig/applicationContext_service.xml"/> + <import resource="springConfig/applicationContext_timer.xml"/> + <import resource="springConfig/applicationContext_webmail.xml"/> + <import resource="springConfig/applicationContext_centre.xml"/> +</beans> diff --git b/src/com/espeed/centre/pojo/CentreTrackSet.java a/src/com/espeed/centre/pojo/CentreTrackSet.java new file mode 100644 index 0000000..5664789 --- /dev/null +++ a/src/com/espeed/centre/pojo/CentreTrackSet.java @@ -0,0 +1,68 @@ +package com.espeed.centre.pojo; + +import java.io.Serializable; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; + +/** + * 项目名称: 统一验证中心系统 + * 版权所有: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 技术支持: info@21gmail.com + * 单元名称: 跟踪配置实体类 + * 开始时间: 2018.04.08 + * 开发人员: 陈南巧 + */ +@Entity +@Table(name="centre_track_set") +public class CentreTrackSet implements Serializable +{ + private static final long serialVersionUID = 1L; + private int id;//主键id + private String domain;//域名 + private int type;//类型,0:邮件跟踪,1:edm跟踪 + private int status;//状态,0不可用,1可以用 + private int company_id;//企业id + private String company_doamin;//企业域名 + @Id + @GeneratedValue(strategy=GenerationType.AUTO) + public int getId() { + return id; + } + public void setId(int id) { + this.id = id; + } + public String getDomain() { + return domain; + } + public void setDomain(String domain) { + this.domain = domain; + } + public int getType() { + return type; + } + public void setType(int type) { + this.type = type; + } + public int getStatus() { + return status; + } + public void setStatus(int status) { + this.status = status; + } + public int getCompany_id() { + return company_id; + } + public void setCompany_id(int company_id) { + this.company_id = company_id; + } + public String getCompany_doamin() { + return company_doamin; + } + public void setCompany_doamin(String company_doamin) { + this.company_doamin = company_doamin; + } +} diff --git b/src/com/espeed/centre/pojo/CentreUser.java a/src/com/espeed/centre/pojo/CentreUser.java new file mode 100644 index 0000000..4683052 --- /dev/null +++ a/src/com/espeed/centre/pojo/CentreUser.java @@ -0,0 +1,51 @@ +package com.espeed.centre.pojo; + +import java.io.Serializable; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; +/** + * 项目名称: 统一验证中心系统 + * 版权所有: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 技术支持: info@21gmail.com + * 单元名称: 中央数据库用户实体类 + * 开始时间: 2017.09.29 + * 开发人员: 陈南巧 + */ +@Entity +@Table(name="centre_user") +public class CentreUser implements Serializable{ + private static final long serialVersionUID = 1L; + private int user_id;//用户id + private String user_name;//姓名 + private String login_id;//帐号 + private int company_id;//企业id + @Id + @GeneratedValue(strategy=GenerationType.AUTO) + public int getUser_id() { + return user_id; + } + public void setUser_id(int user_id) { + this.user_id = user_id; + } + public String getLogin_id() { + return login_id; + } + public void setLogin_id(String login_id) { + this.login_id = login_id; + } + public int getCompany_id() { + return company_id; + } + public void setCompany_id(int company_id) { + this.company_id = company_id; + } + public String getUser_name() { + return user_name; + } + public void setUser_name(String user_name) { + this.user_name = user_name; + } +} diff --git b/src/com/espeed/centre/pojo/CentreYxyedmNewcustomer.java a/src/com/espeed/centre/pojo/CentreYxyedmNewcustomer.java new file mode 100644 index 0000000..121e680 --- /dev/null +++ a/src/com/espeed/centre/pojo/CentreYxyedmNewcustomer.java @@ -0,0 +1,108 @@ +package com.espeed.centre.pojo; + +import java.io.Serializable; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; +/** + * 项目名称: 统一验证中心系统 + * 版权所有: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 技术支持: info@21gmail.com + * 单元名称: 营销邮开发客户配置实体类 + * 开始时间: 2018.04.08 + * 开发人员: 陈南巧 + */ +@Entity +@Table(name="centre_yxyedm_newcustomer") +public class CentreYxyedmNewcustomer implements Serializable +{ + private static final long serialVersionUID = 1L; + private int id;//主键id + private String sender_email;//发件人邮箱 + private String reply_email;//回复人邮箱 + private String sender_name;//发件人名称 + private String allow_user;//指定营销人员,多个以逗号分割 + private int company_id;//企业id + private String company_domain;//企业域名 + private String domain;//域名 + private int spf_status;//spf状态,0不可用,1可以用 + private int mx_status;//mx状态,0不可用,1可以用 + private int status;//状态,0不可用,1可以用 + private int type;//类型,0自有域名,1待发模式 + @Id + @GeneratedValue(strategy=GenerationType.AUTO) + public int getId() { + return id; + } + public void setId(int id) { + this.id = id; + } + public String getSender_email() { + return sender_email; + } + public void setSender_email(String sender_email) { + this.sender_email = sender_email; + } + public String getReply_email() { + return reply_email; + } + public void setReply_email(String reply_email) { + this.reply_email = reply_email; + } + public String getSender_name() { + return sender_name; + } + public void setSender_name(String sender_name) { + this.sender_name = sender_name; + } + public String getAllow_user() { + return allow_user; + } + public void setAllow_user(String allow_user) { + this.allow_user = allow_user; + } + public int getCompany_id() { + return company_id; + } + public void setCompany_id(int company_id) { + this.company_id = company_id; + } + public String getCompany_domain() { + return company_domain; + } + public void setCompany_domain(String company_domain) { + this.company_domain = company_domain; + } + public String getDomain() { + return domain; + } + public void setDomain(String domain) { + this.domain = domain; + } + public int getSpf_status() { + return spf_status; + } + public void setSpf_status(int spf_status) { + this.spf_status = spf_status; + } + public int getMx_status() { + return mx_status; + } + public void setMx_status(int mx_status) { + this.mx_status = mx_status; + } + public int getStatus() { + return status; + } + public void setStatus(int status) { + this.status = status; + } + public int getType() { + return type; + } + public void setType(int type) { + this.type = type; + } +} diff --git b/src/com/espeed/centre/pojo/CentreYxyedmOldcustomer.java a/src/com/espeed/centre/pojo/CentreYxyedmOldcustomer.java new file mode 100644 index 0000000..214f912 --- /dev/null +++ a/src/com/espeed/centre/pojo/CentreYxyedmOldcustomer.java @@ -0,0 +1,101 @@ +package com.espeed.centre.pojo; + +import java.io.Serializable; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; +/** + * 项目名称: 统一验证中心系统 + * 版权所有: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 技术支持: info@21gmail.com + * 单元名称: 营销邮盘活客户配置实体类 + * 开始时间: 2018.04.08 + * 开发人员: 陈南巧 + */ +@Entity +@Table(name="centre_yxyedm_oldcustomer") +public class CentreYxyedmOldcustomer implements Serializable +{ + private static final long serialVersionUID = 1L; + private int id;//主键id + private String domain;//域名 + private int spf_status;//spf状态,0不可用,1可以用 + private int mx_status;//mx状态,0不可用,1可以用 + private String sender_email;//发件人邮箱 + private String reply_email;//回复人邮箱 + private String sender_name;//发件人名称 + private int status;//状态,0不可用,1可以用 + private int type;//类型,0自有域名,1待发模式 + private int company_id;//企业id + private String company_domain;//企业域名 + @Id + @GeneratedValue(strategy=GenerationType.AUTO) + public int getId() { + return id; + } + public void setId(int id) { + this.id = id; + } + public String getSender_email() { + return sender_email; + } + public void setSender_email(String sender_email) { + this.sender_email = sender_email; + } + public String getReply_email() { + return reply_email; + } + public void setReply_email(String reply_email) { + this.reply_email = reply_email; + } + public String getSender_name() { + return sender_name; + } + public void setSender_name(String sender_name) { + this.sender_name = sender_name; + } + public int getCompany_id() { + return company_id; + } + public void setCompany_id(int company_id) { + this.company_id = company_id; + } + public String getDomain() { + return domain; + } + public void setDomain(String domain) { + this.domain = domain; + } + public int getSpf_status() { + return spf_status; + } + public void setSpf_status(int spf_status) { + this.spf_status = spf_status; + } + public int getMx_status() { + return mx_status; + } + public void setMx_status(int mx_status) { + this.mx_status = mx_status; + } + public int getStatus() { + return status; + } + public void setStatus(int status) { + this.status = status; + } + public int getType() { + return type; + } + public void setType(int type) { + this.type = type; + } + public String getCompany_domain() { + return company_domain; + } + public void setCompany_domain(String company_domain) { + this.company_domain = company_domain; + } +} diff --git b/src/com/espeed/plan/PlanRunClass.java a/src/com/espeed/plan/PlanRunClass.java new file mode 100644 index 0000000..65a66ce --- /dev/null +++ a/src/com/espeed/plan/PlanRunClass.java @@ -0,0 +1,103 @@ +package com.espeed.plan; + +import java.util.ArrayList; +import java.util.List; +import java.util.Properties; + +import javax.mail.Transport; + +import com.espeed.yxy.pojo.YxyMarketingPlan; +import com.espeed.yxy.pojo.YxySendSmtpInfo; +import com.espeed.yxy.pojo.YxyUserAddress; +import com.espeed.yxy.service.YxyMarketingPlanService; +import com.espeed.yxy.service.YxySendMailService; +import com.espeed.yxy.tool.DES_Encrypt; + +/*** + * + * @author 谢勇 + * 计划执行类 + * + */ +public class PlanRunClass { + + public void planrun(YxyMarketingPlanService planservice,YxySendMailService mailservice,YxySendSmtpInfo smtpinfo,YxyMarketingPlan planinfo){ + try { + //判断此计划是否有地址 + int addressgroupid=planinfo.getPlan_groupid(); + String loginid = planinfo.getLoginid();//账号 + String domain = planinfo.getDomain();//域名 + int plan_differen = planinfo.getPlan_differen();//区分客户的本地和CRM库 0:本地 1:CRM + + //SMTP参数 + String host=smtpinfo.getSmtp_service_number();//服务器 + String account=smtpinfo.getSmtp_service_account();//账号 + String password=smtpinfo.getSmtp_service_password();//密码 + int isssl=smtpinfo.getSmtp_is_ssl();//是否SSL加密 + String port=smtpinfo.getSmtp_service_port();//端口号 + + //查询地址 + List<YxyUserAddress> addresslist=planservice.findAddressByGroupid(addressgroupid,plan_differen,loginid,domain,planinfo.getOther_name()); + if(addresslist.size()>0){ + List<Object> isTong=connectionService(host,account,password,isssl,port); + if(isTong.get(0).toString().equals("1")){ + + }else{ + System.out.println("服务器验证失败!"); + } + } + + + + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** 连接邮件服务器,验证用户名,密码*/ + public static List<Object> connectionService(String host,String servername,String serverpaswd,int isssl,String port) { + List<Object> result=new ArrayList<Object>(); + result.add(0); + result.add(0); + result.add(0); + + Properties props =new Properties(); + Transport transport =null; + + props.put("mail.smtp.host", host); + props.put("mail.smtp.auth", "true");/** 设定发送邮件时需要进行身份验证*/ + javax.mail.Session mailSession = javax.mail.Session.getInstance(props); + mailSession.setDebug(false); + //判断是否需要ssl验证 + String ishost=host.split("\\.")[1]; + if(isssl==1){ + if("gmail".equals(ishost)){ + props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory"); + props.put("mail.smtp.socketFactory.fallback", "false"); + props.put("mail.smtp.port", port); + props.put("mail.smtp.socketFactory.port", port); + }else{ + props.put("mail.smtp.starttls.enable","true"); + props.put("mail.smtp.port", port); + } + } + try { + //解密密码 + DES_Encrypt desEncrypt = new DES_Encrypt(); + desEncrypt.setKey("06"); + desEncrypt.setDesString(serverpaswd); + serverpaswd=desEncrypt.getStrM();//smtp密码需要解密 + + transport = mailSession.getTransport("smtp"); + transport.connect(host, servername, serverpaswd); + + result.set(0, 1); + result.set(1, props); + result.set(2, transport); + } catch (Exception e) { + e.printStackTrace(); + System.out.println("验证失败"); + } + return result; + } +} diff --git b/src/com/espeed/plan/PlanThreadPoolTask.java a/src/com/espeed/plan/PlanThreadPoolTask.java new file mode 100644 index 0000000..47f5ad6 --- /dev/null +++ a/src/com/espeed/plan/PlanThreadPoolTask.java @@ -0,0 +1,95 @@ +package com.espeed.plan; + +import java.io.Serializable; +import java.util.List; +import java.util.concurrent.ArrayBlockingQueue; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; +import com.espeed.yxy.pojo.YxyMarketingPlan; +import com.espeed.yxy.pojo.YxySendSmtpInfo; +import com.espeed.yxy.service.YxyMarketingPlanService; +import com.espeed.yxy.service.YxySendMailService; +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 手动收邮件后台线程池 + * 开始时间: 2013.09.02 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +public class PlanThreadPoolTask implements Runnable,Serializable{ + + private static final long serialVersionUID = 0; + private static ThreadPoolExecutor threadPool=null; + private static PlanThreadPoolTask threadpooltask=null; + + private YxyMarketingPlanService planservice;//计划service + private YxySendMailService mailservice;//邮件service + private YxySendSmtpInfo smtpinfo;//smtp集合 + private YxyMarketingPlan planinfo;//计划集合 + //无参构造方法 + PlanThreadPoolTask(){ + } + //传递参数 + PlanThreadPoolTask(YxyMarketingPlanService planservice,YxySendMailService mailservice,YxySendSmtpInfo smtpinfo,YxyMarketingPlan planinfo){ + this.planservice=planservice; + this.smtpinfo=smtpinfo; + this.smtpinfo=smtpinfo; + this.mailservice=mailservice; + } + + //单例方法 + public static PlanThreadPoolTask getMethodInstance(){ + if(threadpooltask==null){ + //System.out.println("创建新对像了"); + threadpooltask=new PlanThreadPoolTask(); + } + return threadpooltask; + } + + //线程池 + public static ThreadPoolExecutor getInstance(int bigThread){ + if(threadPool==null){ + threadPool=new ThreadPoolExecutor(bigThread,bigThread+2,100, + TimeUnit.SECONDS,new ArrayBlockingQueue<Runnable>(4000), + new ThreadPoolExecutor.DiscardOldestPolicy()); + } + return threadPool; + } + //线程池运行方法 + public synchronized void getResult(YxyMarketingPlanService planservice,YxySendMailService mailservice,List<YxySendSmtpInfo> smtplist,List<YxyMarketingPlan> planlist) { + threadPool=getInstance(10); + //计划加入线程池 + for(int j=0;j<planlist.size();j++){ + try { + threadPool.execute(new PlanThreadPoolTask(planservice,mailservice,smtplist.get(j),planlist.get(j))); + } catch (Exception e) { + e.printStackTrace(); + } + } + } + //获取线程量 + public int getThreadNum(){ + if(threadPool==null){ + return -1; + }else{ + return threadPool.getActiveCount(); + } + } + + //执行计划 + public void run(){ + try { + + + + } catch (Exception e) { + e.printStackTrace(); + } + } + +} diff --git b/src/com/espeed/webmail/pojo/CrmCustomerInfo.java a/src/com/espeed/webmail/pojo/CrmCustomerInfo.java new file mode 100644 index 0000000..cc94295 --- /dev/null +++ a/src/com/espeed/webmail/pojo/CrmCustomerInfo.java @@ -0,0 +1,312 @@ +package com.espeed.webmail.pojo; + +import java.io.Serializable; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Transient; + +/** +* +* @项目名称: 科飞管理后台系统 +* @版权所有: 深圳市科飞时速网络技术有限公司(0755-88843776) +* @技术支持: info@21gmail.com +* @单元名称: crm_customer_info表CrmCustomerInfo实体类 +* @开始时间: 2018-09-27 +* @开发人员: 杨志钊 +*/ + +@Entity +@Table(name = "crm_customer_info") +public class CrmCustomerInfo implements Serializable { + + private static final long serialVersionUID = 1L; + + private int id;//主键id + + private int customer_id;//客户id + + private String year_established;//公司成立时间 + + private String business_type;//商业类型 + + private String platforms_selling;//销售平台 + + private String main_products;//主营产品 + + private String operational_address;//经营地址 + + private String joined_alibaba_time;//加入alibaba.com时间 + + private String Inquiries_product;//询盘产品 + + private String annual_purchasing_volume;//年采购额 + + private String primary_sourcing_purpose;//采购目的 + + private String average_sourcing_frequency;//平均采购频率 + + private String preferred_supplier_qualifications;//偏好供应商类型 + + private String preferred_industries;//偏好行业 + + private String registered_years;//注册年限 + + private String days_signed_in;//登录天数 + + private String product_views;//产品浏览数 + + private String searches;//搜索次数 + + private String valid_inquiries_sentTo;//有效询盘数/ 回复询盘数 + + private String spam_inquiries;//被标为垃圾询盘数 + + private String valid_rfqs_submitted;//有效RFQ数 + + private String quotations_receivedRead;//收到报价数/ 查看报价数 + + private String listed_contact;//被添加联系人数 + + private String add_blacklist;//被添加黑名单数 + + private String recent_searches;//最近搜索词 + + private String most_sourcing_industries;//最常采购行业 + + private String latest_buying_requests;//最新采购需求,多个用###隔开 + + private String latest_inquiries;//最近询盘产品,多个用###隔开 + + private String create_time;//记录创建时间 + + private String modify_time;//记录最后修改时间 + + private String about_us;//关于我们 + + @Id + @GeneratedValue(strategy=GenerationType.AUTO) + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + public int getCustomer_id() { + return customer_id; + } + + public void setCustomer_id(int customer_id) { + this.customer_id = customer_id; + } + public String getYear_established() { + return year_established; + } + + public void setYear_established(String year_established) { + this.year_established = year_established; + } + public String getBusiness_type() { + return business_type; + } + + public void setBusiness_type(String business_type) { + this.business_type = business_type; + } + public String getPlatforms_selling() { + return platforms_selling; + } + + public void setPlatforms_selling(String platforms_selling) { + this.platforms_selling = platforms_selling; + } + public String getMain_products() { + return main_products; + } + + public void setMain_products(String main_products) { + this.main_products = main_products; + } + public String getOperational_address() { + return operational_address; + } + + public void setOperational_address(String operational_address) { + this.operational_address = operational_address; + } + public String getJoined_alibaba_time() { + return joined_alibaba_time; + } + + public void setJoined_alibaba_time(String joined_alibaba_time) { + this.joined_alibaba_time = joined_alibaba_time; + } + public String getInquiries_product() { + return Inquiries_product; + } + + public void setInquiries_product(String Inquiries_product) { + this.Inquiries_product = Inquiries_product; + } + public String getAnnual_purchasing_volume() { + return annual_purchasing_volume; + } + + public void setAnnual_purchasing_volume(String annual_purchasing_volume) { + this.annual_purchasing_volume = annual_purchasing_volume; + } + public String getPrimary_sourcing_purpose() { + return primary_sourcing_purpose; + } + + public void setPrimary_sourcing_purpose(String primary_sourcing_purpose) { + this.primary_sourcing_purpose = primary_sourcing_purpose; + } + public String getAverage_sourcing_frequency() { + return average_sourcing_frequency; + } + + public void setAverage_sourcing_frequency(String average_sourcing_frequency) { + this.average_sourcing_frequency = average_sourcing_frequency; + } + public String getPreferred_supplier_qualifications() { + return preferred_supplier_qualifications; + } + + public void setPreferred_supplier_qualifications(String preferred_supplier_qualifications) { + this.preferred_supplier_qualifications = preferred_supplier_qualifications; + } + public String getPreferred_industries() { + return preferred_industries; + } + + public void setPreferred_industries(String preferred_industries) { + this.preferred_industries = preferred_industries; + } + public String getRegistered_years() { + return registered_years; + } + + public void setRegistered_years(String registered_years) { + this.registered_years = registered_years; + } + public String getDays_signed_in() { + return days_signed_in; + } + + public void setDays_signed_in(String days_signed_in) { + this.days_signed_in = days_signed_in; + } + public String getProduct_views() { + return product_views; + } + + public void setProduct_views(String product_views) { + this.product_views = product_views; + } + public String getSearches() { + return searches; + } + + public void setSearches(String searches) { + this.searches = searches; + } + public String getValid_inquiries_sentTo() { + return valid_inquiries_sentTo; + } + + public void setValid_inquiries_sentTo(String valid_inquiries_sentTo) { + this.valid_inquiries_sentTo = valid_inquiries_sentTo; + } + public String getSpam_inquiries() { + return spam_inquiries; + } + + public void setSpam_inquiries(String spam_inquiries) { + this.spam_inquiries = spam_inquiries; + } + public String getValid_rfqs_submitted() { + return valid_rfqs_submitted; + } + + public void setValid_rfqs_submitted(String valid_rfqs_submitted) { + this.valid_rfqs_submitted = valid_rfqs_submitted; + } + public String getQuotations_receivedRead() { + return quotations_receivedRead; + } + + public void setQuotations_receivedRead(String quotations_receivedRead) { + this.quotations_receivedRead = quotations_receivedRead; + } + public String getListed_contact() { + return listed_contact; + } + + public void setListed_contact(String listed_contact) { + this.listed_contact = listed_contact; + } + public String getAdd_blacklist() { + return add_blacklist; + } + + public void setAdd_blacklist(String add_blacklist) { + this.add_blacklist = add_blacklist; + } + public String getRecent_searches() { + return recent_searches; + } + + public void setRecent_searches(String recent_searches) { + this.recent_searches = recent_searches; + } + public String getMost_sourcing_industries() { + return most_sourcing_industries; + } + + public void setMost_sourcing_industries(String most_sourcing_industries) { + this.most_sourcing_industries = most_sourcing_industries; + } + public String getLatest_buying_requests() { + return latest_buying_requests; + } + + public void setLatest_buying_requests(String latest_buying_requests) { + this.latest_buying_requests = latest_buying_requests; + } + public String getLatest_inquiries() { + return latest_inquiries; + } + + public void setLatest_inquiries(String latest_inquiries) { + this.latest_inquiries = latest_inquiries; + } + public String getCreate_time() { + return create_time; + } + + public void setCreate_time(String create_time) { + this.create_time = create_time; + } + public String getModify_time() { + return modify_time; + } + + public void setModify_time(String modify_time) { + this.modify_time = modify_time; + } + + @Transient + public String getAbout_us() { + return about_us; + } + + public void setAbout_us(String about_us) { + this.about_us = about_us; + } + + } diff --git b/src/com/espeed/webmail/pojo/YxyCustomerEmail.java a/src/com/espeed/webmail/pojo/YxyCustomerEmail.java new file mode 100644 index 0000000..e709418 --- /dev/null +++ a/src/com/espeed/webmail/pojo/YxyCustomerEmail.java @@ -0,0 +1,152 @@ +package com.espeed.webmail.pojo; + +import java.io.Serializable; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Transient; + + +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 分类下的客户表(营销游) + * 开始时间: 2015.03.31 + * 程 序 员: 陈南巧 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +@Entity +@Table(name="crm_customer") +public class YxyCustomerEmail implements Serializable{ + private static final long serialVersionUID = 1L; + private int customer_id;//客户id + private String customer_name;//客户姓名 + private int user_id;//用户id + private int company_id;//企业id + private int classify_id;//分类id + private int delete_flag;//是否删除0:正常 -1:删除 + private int current_status;//客户当前状态: 0:正常 1:已加入公海 2:已加入共享 + private String customer_status;//客户状态 + private String partnership;//客户关系id + private int source_from_id;//客户来源 + private String prductid;//客户产品id,多个以逗号分割 + private int sales_status;//销售状态 + private String email;//主联系人邮箱地址 + private String full_name;//主联系人姓名 + private String last_contact_date;//最后联系时间 + private String enrol_time;//修改时间 + private int important_star;//客户的星级数量,默认值为1,一颗星 + @Id + @GeneratedValue(strategy=GenerationType.AUTO) + public int getCustomer_id() { + return customer_id; + } + public void setCustomer_id(int customer_id) { + this.customer_id = customer_id; + } + public String getCustomer_name() { + return customer_name; + } + public void setCustomer_name(String customer_name) { + this.customer_name = customer_name; + } + public int getUser_id() { + return user_id; + } + public void setUser_id(int user_id) { + this.user_id = user_id; + } + public int getCompany_id() { + return company_id; + } + public void setCompany_id(int company_id) { + this.company_id = company_id; + } + public int getClassify_id() { + return classify_id; + } + public void setClassify_id(int classify_id) { + this.classify_id = classify_id; + } + public int getDelete_flag() { + return delete_flag; + } + public void setDelete_flag(int delete_flag) { + this.delete_flag = delete_flag; + } + public int getCurrent_status() { + return current_status; + } + public void setCurrent_status(int current_status) { + this.current_status = current_status; + } + public String getCustomer_status() { + return customer_status; + } + public void setCustomer_status(String customer_status) { + this.customer_status = customer_status; + } + public String getPartnership() { + return partnership; + } + public void setPartnership(String partnership) { + this.partnership = partnership; + } + public int getSource_from_id() { + return source_from_id; + } + public void setSource_from_id(int source_from_id) { + this.source_from_id = source_from_id; + } + public String getPrductid() { + return prductid; + } + public void setPrductid(String prductid) { + this.prductid = prductid; + } + public int getSales_status() { + return sales_status; + } + public void setSales_status(int sales_status) { + this.sales_status = sales_status; + } + @Transient + public String getEmail() { + return email; + } + public void setEmail(String email) { + this.email = email; + } + @Transient + public String getFull_name() { + return full_name; + } + public void setFull_name(String full_name) { + this.full_name = full_name; + } + public String getLast_contact_date() { + return last_contact_date; + } + public void setLast_contact_date(String last_contact_date) { + this.last_contact_date = last_contact_date; + } + public String getEnrol_time() { + return enrol_time; + } + public void setEnrol_time(String enrol_time) { + this.enrol_time = enrol_time; + } + public int getImportant_star() { + return important_star; + } + public void setImportant_star(int important_star) { + this.important_star = important_star; + } +} diff --git b/src/com/espeed/yxy/dao/CentreTrackSetDao.java a/src/com/espeed/yxy/dao/CentreTrackSetDao.java new file mode 100644 index 0000000..9ec1c6e --- /dev/null +++ a/src/com/espeed/yxy/dao/CentreTrackSetDao.java @@ -0,0 +1,28 @@ +package com.espeed.yxy.dao; + +import java.util.List; + +import com.espeed.centre.pojo.CentreTrackSet; + +/** + * 项目名称: 统一验证中心系统 + * 版权所有: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 技术支持: info@21gmail.com + * 单元名称: 跟踪配置Dao + * 开始时间: 2018.04.08 + * 开发人员: 陈南巧 + */ +public interface CentreTrackSetDao { + /**实体插入*/ + public int addPojo(CentreTrackSet o)throws Exception; + /**实体编辑*/ + public void updatePojo(CentreTrackSet o)throws Exception; + /**HQL查询*/ + public List<CentreTrackSet> findByHql(String hql)throws Exception; + /**SQL查询*/ + public List<Object> findBySqlFind(String sql)throws Exception; + /**HQL更新*/ + public void updateByHql(String hql)throws Exception; + /**HQL查询数量*/ + public int findByHqlCount(String hql)throws Exception; +} diff --git b/src/com/espeed/yxy/dao/CentreUserDao.java a/src/com/espeed/yxy/dao/CentreUserDao.java new file mode 100644 index 0000000..9e7ce4a --- /dev/null +++ a/src/com/espeed/yxy/dao/CentreUserDao.java @@ -0,0 +1,27 @@ +package com.espeed.yxy.dao; + +import java.util.List; + +import com.espeed.centre.pojo.CentreUser; +/** + * 项目名称: 统一验证中心系统 + * 版权所有: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 技术支持: info@21gmail.com + * 单元名称: 跟踪配置Dao + * 开始时间: 2018.04.08 + * 开发人员: 陈南巧 + */ +public interface CentreUserDao { + /**实体插入*/ + public int addPojo(CentreUser o)throws Exception; + /**实体编辑*/ + public void updatePojo(CentreUser o)throws Exception; + /**HQL查询*/ + public List<CentreUser> findByHql(String hql)throws Exception; + /**SQL查询*/ + public List<Object> findBySqlFind(String sql)throws Exception; + /**HQL更新*/ + public void updateByHql(String hql)throws Exception; + /**HQL查询数量*/ + public int findByHqlCount(String hql)throws Exception; +} diff --git b/src/com/espeed/yxy/dao/CentreYxyedmNewcustomerDao.java a/src/com/espeed/yxy/dao/CentreYxyedmNewcustomerDao.java new file mode 100644 index 0000000..6896671 --- /dev/null +++ a/src/com/espeed/yxy/dao/CentreYxyedmNewcustomerDao.java @@ -0,0 +1,28 @@ +package com.espeed.yxy.dao; + +import java.util.List; + +import com.espeed.centre.pojo.CentreYxyedmNewcustomer; + +/** + * 项目名称: 统一验证中心系统 + * 版权所有: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 技术支持: info@21gmail.com + * 单元名称: 营销邮开发客户配置Dao + * 开始时间: 2018.04.08 + * 开发人员: 陈南巧 + */ +public interface CentreYxyedmNewcustomerDao { + /**实体插入*/ + public int addPojo(CentreYxyedmNewcustomer o)throws Exception; + /**实体编辑*/ + public void updatePojo(CentreYxyedmNewcustomer o)throws Exception; + /**HQL查询*/ + public List<CentreYxyedmNewcustomer> findByHql(String hql)throws Exception; + /**SQL查询*/ + public List<Object> findBySqlFind(String sql)throws Exception; + /**HQL更新*/ + public void updateByHql(String hql)throws Exception; + /**HQL查询数量*/ + public int findByHqlCount(String hql)throws Exception; +} diff --git b/src/com/espeed/yxy/dao/CentreYxyedmOldcustomerDao.java a/src/com/espeed/yxy/dao/CentreYxyedmOldcustomerDao.java new file mode 100644 index 0000000..842c4c3 --- /dev/null +++ a/src/com/espeed/yxy/dao/CentreYxyedmOldcustomerDao.java @@ -0,0 +1,28 @@ +package com.espeed.yxy.dao; + +import java.util.List; + +import com.espeed.centre.pojo.CentreYxyedmOldcustomer; + +/** + * 项目名称: 统一验证中心系统 + * 版权所有: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 技术支持: info@21gmail.com + * 单元名称: 营销邮盘活客户配置Dao + * 开始时间: 2018.04.08 + * 开发人员: 陈南巧 + */ +public interface CentreYxyedmOldcustomerDao { + /**实体插入*/ + public int addPojo(CentreYxyedmOldcustomer o)throws Exception; + /**实体编辑*/ + public void updatePojo(CentreYxyedmOldcustomer o)throws Exception; + /**HQL查询*/ + public List<CentreYxyedmOldcustomer> findByHql(String hql)throws Exception; + /**SQL查询*/ + public List<Object> findBySqlFind(String sql)throws Exception; + /**HQL更新*/ + public void updateByHql(String hql)throws Exception; + /**HQL查询数量*/ + public int findByHqlCount(String hql)throws Exception; +} diff --git b/src/com/espeed/yxy/dao/CrmCustomerInfoDao.java a/src/com/espeed/yxy/dao/CrmCustomerInfoDao.java new file mode 100644 index 0000000..bc53794 --- /dev/null +++ a/src/com/espeed/yxy/dao/CrmCustomerInfoDao.java @@ -0,0 +1,43 @@ +package com.espeed.yxy.dao; + +import java.util.List; + +import com.espeed.webmail.pojo.CrmCustomerInfo; + +/** +* +* @项目名称: 科飞管理后台系统 +* @版权所有: 深圳市科飞时速网络技术有限公司(0755-88843776) +* @技术支持: info@21gmail.com +* @单元名称: 实体类CrmCustomerInfo的DAO接口 +* @开始时间: 2018-09-27 +* @开发人员: 杨志钊 +*/ + +public interface CrmCustomerInfoDao { + + /**实体插入*/ + public int addPojo(CrmCustomerInfo entity) throws Exception; + + /**实体编辑*/ + public void updatePojo(CrmCustomerInfo entity) throws Exception; + + /**HQL查询*/ + public List<CrmCustomerInfo> findByHql(String hql) throws Exception; + + /**HQL指定条查询*/ + public List<CrmCustomerInfo> findByHqlSet(String hql,int num) throws Exception; + + /**SQL查询*/ + public List<Object> findBySqlFind(String sql) throws Exception; + + /**HQL更新*/ + public void updateByHql(String hql) throws Exception; + + /**sql更新*/ + public void updateBySql(String sql) throws Exception; + + /**HQL查询数量*/ + public int findByHqlCount(String hql) throws Exception; + +} diff --git b/src/com/espeed/yxy/dao/HibernateBaseDAO.java a/src/com/espeed/yxy/dao/HibernateBaseDAO.java new file mode 100644 index 0000000..eaec980 --- /dev/null +++ a/src/com/espeed/yxy/dao/HibernateBaseDAO.java @@ -0,0 +1,39 @@ +package com.espeed.yxy.dao; + +import java.io.Serializable; +import java.util.List; +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: hbernate常用方法接口(营销邮) + * 开始时间: 2013.11.27 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +public interface HibernateBaseDAO<T extends Serializable ,Pk extends Serializable> { + /**增加记录*/ + int add(T o)throws Exception; + /**修改记录*/ + void update(T o)throws Exception; + /**删除记录*/ + void del(T o)throws Exception; + /**添加或更新*/ + void saveOrUpdate(T o)throws Exception; + /**根据ID获取一条数据*/ + T get(Class<T> t,Pk pk)throws Exception; + /**根据ID获取一条数据*/ + T load(Class<T> t,Pk pk)throws Exception; + /**根据hql进行条件查询*/ + List<T> getAll(String hql)throws Exception; + /**条件查询*/ + List<T> getAll(String whereHql,Object...params)throws Exception; + //-------------------------------查询总记录数-----------------------------------------*/ + /**根据条件查询总记录*/ + public int count(String hql) throws Exception; + /**根据条件和参数查询总记录*/ + public int count(String hql, Object... params) throws Exception; +} diff --git b/src/com/espeed/yxy/dao/YxyCustomerEmailDao.java a/src/com/espeed/yxy/dao/YxyCustomerEmailDao.java new file mode 100644 index 0000000..54d0153 --- /dev/null +++ a/src/com/espeed/yxy/dao/YxyCustomerEmailDao.java @@ -0,0 +1,36 @@ +package com.espeed.yxy.dao; + +import java.util.List; + +import com.espeed.webmail.pojo.YxyCustomerEmail; + +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 分类下的所有dao(营销游) + * 开始时间: 2015.04.08 + * 程 序 员: 陈南巧 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +public interface YxyCustomerEmailDao { + /**实体插入*/ + public int addPojo(YxyCustomerEmail o)throws Exception; + /**实体编辑*/ + public void updatePojo(YxyCustomerEmail o)throws Exception; + /**HQL查询*/ + public List<YxyCustomerEmail> findByHql(String hql)throws Exception; + /**HQL数量查询*/ + public int findByHqlCount(String hql)throws Exception; + /**指定条记录*/ + public List<YxyCustomerEmail> findByHqlSet(String hql,int num)throws Exception; + /**HQL查询分页*/ + //public List<YxyCustomerEmail> findByHqlPage(String hql,String hqlcount,PageBean pb)throws Exception; + /**SQL查询*/ + public List<Object> findBySqlQuery(String sql)throws Exception; + /**HQL更新*/ + public void updateByHql(String hql)throws Exception; +} diff --git b/src/com/espeed/yxy/dao/YxyMailStencilDao.java a/src/com/espeed/yxy/dao/YxyMailStencilDao.java new file mode 100644 index 0000000..394026d --- /dev/null +++ a/src/com/espeed/yxy/dao/YxyMailStencilDao.java @@ -0,0 +1,15 @@ +package com.espeed.yxy.dao; + +import java.util.List; + +import com.espeed.yxy.pojo.YxyMailStencil; + +/*** + * + * @author 谢勇 + * 邮件模版 + */ +public interface YxyMailStencilDao { + /**HQL查询*/ + public List<YxyMailStencil> findByHql(String hql)throws Exception; +} diff --git b/src/com/espeed/yxy/dao/YxyMarketingPlanDao.java a/src/com/espeed/yxy/dao/YxyMarketingPlanDao.java new file mode 100644 index 0000000..7b51452 --- /dev/null +++ a/src/com/espeed/yxy/dao/YxyMarketingPlanDao.java @@ -0,0 +1,14 @@ +package com.espeed.yxy.dao; + +import java.util.List; +import com.espeed.yxy.pojo.YxyMarketingPlan; + +public interface YxyMarketingPlanDao { + /**HQL查询*/ + public List<YxyMarketingPlan> findByHql(String hql)throws Exception; + /**指定条记录*/ + public List<YxyMarketingPlan> findByHqlSet(String hql,int num)throws Exception; + /**HQL更新*/ + public void updateByHql(String hql)throws Exception; + +} diff --git b/src/com/espeed/yxy/dao/YxyMarketingWeekDao.java a/src/com/espeed/yxy/dao/YxyMarketingWeekDao.java new file mode 100644 index 0000000..134fb1f --- /dev/null +++ a/src/com/espeed/yxy/dao/YxyMarketingWeekDao.java @@ -0,0 +1,16 @@ +package com.espeed.yxy.dao; + +import java.util.List; +import com.espeed.yxy.pojo.YxyMarketingWeek; + + +public interface YxyMarketingWeekDao { + + /**HQL查询*/ + public List<YxyMarketingWeek> findByHql(String hql)throws Exception; + /**指定条记录*/ + public List<YxyMarketingWeek> findByHqlSet(String hql,int num)throws Exception; + /**HQL更新*/ + public void updateByHql(String hql)throws Exception; + +} diff --git b/src/com/espeed/yxy/dao/YxyParamaterDao.java a/src/com/espeed/yxy/dao/YxyParamaterDao.java new file mode 100644 index 0000000..450c482 --- /dev/null +++ a/src/com/espeed/yxy/dao/YxyParamaterDao.java @@ -0,0 +1,38 @@ +package com.espeed.yxy.dao; + +import java.util.List; +import com.espeed.yxy.pojo.YxySysParamaters; + +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 控制参数DAO + * 开始时间: 2013.11.27 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +public interface YxyParamaterDao { + /**查询控制参数*/ + //public List<YxySysParamaters> findParamaterByCode(int level)throws Exception; + /**批量插入*/ + public void addPiPojo(List<YxySysParamaters> o)throws Exception; + + /**实体添加*/ + public int addPojo(YxySysParamaters o)throws Exception; + + /**HQL查询*/ + public List<YxySysParamaters> findByHql(String hql)throws Exception; + + /**SQL查询*/ + public List<Object> findbysql(String sql)throws Exception; + + /**SQL更新*/ + public void updateBySql(String sql)throws Exception; + + /**HQL更新*/ + public void updateByHql(String hql)throws Exception; +} diff --git b/src/com/espeed/yxy/dao/YxyReplyInfoDao.java a/src/com/espeed/yxy/dao/YxyReplyInfoDao.java new file mode 100644 index 0000000..9b4d670 --- /dev/null +++ a/src/com/espeed/yxy/dao/YxyReplyInfoDao.java @@ -0,0 +1,15 @@ +package com.espeed.yxy.dao; + +import java.util.List; +import com.espeed.yxy.pojo.YxyReplyInfo; + +/** + * + * @author 谢勇 + * 回复dao接口 + */ +public interface YxyReplyInfoDao { + + /**HQL查询*/ + public List<YxyReplyInfo> findByHql(String hql)throws Exception; +} diff --git b/src/com/espeed/yxy/dao/YxySendCountDao.java a/src/com/espeed/yxy/dao/YxySendCountDao.java new file mode 100644 index 0000000..c35a14b --- /dev/null +++ a/src/com/espeed/yxy/dao/YxySendCountDao.java @@ -0,0 +1,25 @@ +package com.espeed.yxy.dao; + +import java.util.List; +import com.espeed.yxy.pojo.YxySendCount; + +/** + * 客户发送邮件的统计Dao + * @author 陈南巧 + */ +public interface YxySendCountDao { + /**实体插入*/ + public int addPojo(YxySendCount o)throws Exception; + /**实体编辑*/ + public void updatePojo(YxySendCount o)throws Exception; + /**HQL查询*/ + public List<YxySendCount> findByHql(String hql)throws Exception; + /**HQL数量查询*/ + public int findByHqlCount(String hql)throws Exception; + /**指定条记录*/ + public List<YxySendCount> findByHqlSet(String hql,int num)throws Exception; + /**SQL查询*/ + public List<Object> findBySqlQuery(String sql)throws Exception; + /**HQL更新*/ + public void updateByHql(String hql)throws Exception; +} diff --git b/src/com/espeed/yxy/dao/YxySendFilterAddressDao.java a/src/com/espeed/yxy/dao/YxySendFilterAddressDao.java new file mode 100644 index 0000000..f53fa1f --- /dev/null +++ a/src/com/espeed/yxy/dao/YxySendFilterAddressDao.java @@ -0,0 +1,16 @@ +package com.espeed.yxy.dao; + +import java.util.List; + +import com.espeed.yxy.pojo.YxySendFilterAddress; + +/** + * + * @author 谢勇 + * 用户过滤接口 + */ +public interface YxySendFilterAddressDao { + + /**HQL查询*/ + public List<YxySendFilterAddress> findByHql(String hql)throws Exception; +} diff --git b/src/com/espeed/yxy/dao/YxySendMailDetailDao.java a/src/com/espeed/yxy/dao/YxySendMailDetailDao.java new file mode 100644 index 0000000..72aa060 --- /dev/null +++ a/src/com/espeed/yxy/dao/YxySendMailDetailDao.java @@ -0,0 +1,51 @@ +package com.espeed.yxy.dao; + +import java.util.List; +import com.espeed.yxy.pojo.YxySendMailDetail; + +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 待发邮件地址DAO(营销游) + * 开始时间: 2013.12.09 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +public interface YxySendMailDetailDao { + +// /**根据待发邮件ID查询待发地址*/ +// public List<YxySendMailDetail> findAddressByMailID(int mailID)throws Exception; +// +// /**修改此地址为已发送*/ +// public void updateMailDetailstatus(int addressID)throws Exception; +// +// /**HQL更新*/ +// public void updateByHql(String hql)throws Exception; +// +// /**HQL查询*/ +// public List findbyHql(String hqld)throws Exception; + /**批量插入*/ + public void addPiPojo(List<YxySendMailDetail> o)throws Exception; + + /**实体添加*/ + public int addPojo(YxySendMailDetail o)throws Exception; + + /**HQL查询*/ + public List<YxySendMailDetail> findByHql(String hql)throws Exception; + + /**指定条记录*/ + public List<YxySendMailDetail> findByHqlSet(String hql,int num)throws Exception; + + /**SQL查询*/ + public List<Object> findbysql(String sql)throws Exception; + + /**SQL更新*/ + public void updateBySql(String sql)throws Exception; + + /**HQL更新*/ + public void updateByHql(String hql)throws Exception; +} diff --git b/src/com/espeed/yxy/dao/YxySendMailMasterBaseDao.java a/src/com/espeed/yxy/dao/YxySendMailMasterBaseDao.java new file mode 100644 index 0000000..9ff9a6b --- /dev/null +++ a/src/com/espeed/yxy/dao/YxySendMailMasterBaseDao.java @@ -0,0 +1,33 @@ +package com.espeed.yxy.dao; + +import java.util.List; + +import com.espeed.yxy.pojo.YxySendMailMasterBase; + +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 邮件基本信息DAO(营销游) + * 开始时间: 2013.12.09 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +public interface YxySendMailMasterBaseDao { + + /**实体插入*/ + public int addPojo(YxySendMailMasterBase o)throws Exception; + /**实体编辑*/ + public void updatePojo(YxySendMailMasterBase o)throws Exception; + /**HQL查询*/ + public List<YxySendMailMasterBase> findByHql(String hql)throws Exception; + /**指定条记录*/ + public List<YxySendMailMasterBase> findByHqlSet(String hql,int num)throws Exception; + /**SQL查询*/ + public List<Object> findBySqlQuery(String sql)throws Exception; + /**HQL更新*/ + public void updateByHql(String hql)throws Exception; +} diff --git b/src/com/espeed/yxy/dao/YxySendMailMasterDao.java a/src/com/espeed/yxy/dao/YxySendMailMasterDao.java new file mode 100644 index 0000000..ecd7ffc --- /dev/null +++ a/src/com/espeed/yxy/dao/YxySendMailMasterDao.java @@ -0,0 +1,38 @@ +package com.espeed.yxy.dao; + +import java.util.List; +import com.espeed.yxy.pojo.YxySendMailMaster; + +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 待发邮件DAO(营销游) + * 开始时间: 2013.12.09 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +public interface YxySendMailMasterDao { + + /**批量插入*/ + public void addPiPojo(List<YxySendMailMaster> o)throws Exception; + + /**实体添加*/ + public int addPojo(YxySendMailMaster o)throws Exception; + + /**HQL查询*/ + public List<YxySendMailMaster> findByHql(String hql)throws Exception; + + /**SQL查询*/ + public List<Object> findbysql(String sql)throws Exception; + + /**SQL更新*/ + public void updateBySql(String sql)throws Exception; + + /**HQL更新*/ + public void updateByHql(String hql)throws Exception; + +} diff --git b/src/com/espeed/yxy/dao/YxySendSmtpInfoDao.java a/src/com/espeed/yxy/dao/YxySendSmtpInfoDao.java new file mode 100644 index 0000000..ca7055a --- /dev/null +++ a/src/com/espeed/yxy/dao/YxySendSmtpInfoDao.java @@ -0,0 +1,42 @@ +package com.espeed.yxy.dao; + +import java.util.List; +import com.espeed.yxy.pojo.YxySendSmtpInfo; + +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: SMTP DAO(营销游) + * 开始时间: 2013.12.09 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +public interface YxySendSmtpInfoDao { +// /**查询可用的smtp*/ +// public List<YxySendSmtpInfo> findAllSmtp(int num)throws Exception; +// /**更新smtp状态*/ +// public void updateSmtpStatus(YxySendSmtpInfo o)throws Exception; +// /**HQL查询*/ +// public List<YxySendSmtpInfo> findByHql(String hql)throws Exception; + /**批量插入*/ + public void addPiPojo(List<YxySendSmtpInfo> o)throws Exception; + + /**实体添加*/ + public int addPojo(YxySendSmtpInfo o)throws Exception; + + /**HQL查询*/ + public List<YxySendSmtpInfo> findByHql(String hql)throws Exception; + + /**SQL查询*/ + public List<Object> findbysql(String sql)throws Exception; + + /**SQL更新*/ + public void updateBySql(String sql)throws Exception; + + /**HQL更新*/ + public void updateByHql(String hql)throws Exception; +} diff --git b/src/com/espeed/yxy/dao/YxySenderSetDao.java a/src/com/espeed/yxy/dao/YxySenderSetDao.java new file mode 100644 index 0000000..de36053 --- /dev/null +++ a/src/com/espeed/yxy/dao/YxySenderSetDao.java @@ -0,0 +1,25 @@ +package com.espeed.yxy.dao; + +import java.util.List; + +import com.espeed.yxy.pojo.YxySenderSet; + + +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 发件人配置dao层 + * 开始时间: 2015.4.02 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +public interface YxySenderSetDao { + + /**HQL查询*/ + public List<YxySenderSet> findByHql(String hql)throws Exception; + +} diff --git b/src/com/espeed/yxy/dao/YxySmtpSendSelfOversetDao.java a/src/com/espeed/yxy/dao/YxySmtpSendSelfOversetDao.java new file mode 100644 index 0000000..19dcd73 --- /dev/null +++ a/src/com/espeed/yxy/dao/YxySmtpSendSelfOversetDao.java @@ -0,0 +1,43 @@ +package com.espeed.yxy.dao; + +import java.util.List; +import com.espeed.yxy.pojo.YxySmtpSendSelfOverset; + +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 自配smtp已发送量统计(营销游) + * 开始时间: 2013.12.09 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +public interface YxySmtpSendSelfOversetDao { + +// /**查询该账号的发送量信息*/ +// public List<YxySmtpSendSelfOverset> findBySmtpAccount(String account)throws Exception; +// /**添加该账号的已发量信息*/ +// public void addSendSelfSet(YxySmtpSendSelfOverset o)throws Exception; +// /**更新已发量*/ +// public void updateSendSelfSet(YxySmtpSendSelfOverset o)throws Exception; + /**批量插入*/ + public void addPiPojo(List<YxySmtpSendSelfOverset> o)throws Exception; + + /**实体添加*/ + public int addPojo(YxySmtpSendSelfOverset o)throws Exception; + + /**HQL查询*/ + public List<YxySmtpSendSelfOverset> findByHql(String hql)throws Exception; + + /**SQL查询*/ + public List<Object> findbysql(String sql)throws Exception; + + /**SQL更新*/ + public void updateBySql(String sql)throws Exception; + + /**HQL更新*/ + public void updateByHql(String hql)throws Exception; +} diff --git b/src/com/espeed/yxy/dao/YxySmtpSendSelfSetDao.java a/src/com/espeed/yxy/dao/YxySmtpSendSelfSetDao.java new file mode 100644 index 0000000..fbdb2f2 --- /dev/null +++ a/src/com/espeed/yxy/dao/YxySmtpSendSelfSetDao.java @@ -0,0 +1,39 @@ +package com.espeed.yxy.dao; + +import java.util.List; +import com.espeed.yxy.pojo.YxySmtpSendSelfSet; + +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 自配smtp发送量Dao接口(营销游) + * 开始时间: 2013.12.09 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +public interface YxySmtpSendSelfSetDao{ + +// /**通过smtpID查询此smtp的发送参数*/ +// public List<YxySmtpSendSelfSet> findSendSelfSetByService(String smtpservice)throws Exception; + /**批量插入*/ + public void addPiPojo(List<YxySmtpSendSelfSet> o)throws Exception; + + /**实体添加*/ + public int addPojo(YxySmtpSendSelfSet o)throws Exception; + + /**HQL查询*/ + public List<YxySmtpSendSelfSet> findByHql(String hql)throws Exception; + + /**SQL查询*/ + public List<Object> findbysql(String sql)throws Exception; + + /**SQL更新*/ + public void updateBySql(String sql)throws Exception; + + /**HQL更新*/ + public void updateByHql(String hql)throws Exception; +} diff --git b/src/com/espeed/yxy/dao/YxySmtpSendSetDao.java a/src/com/espeed/yxy/dao/YxySmtpSendSetDao.java new file mode 100644 index 0000000..e4e5b48 --- /dev/null +++ a/src/com/espeed/yxy/dao/YxySmtpSendSetDao.java @@ -0,0 +1,46 @@ +package com.espeed.yxy.dao; + +import java.util.List; +import com.espeed.yxy.pojo.YxySmtpSendSet; +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 后缀发送量接口(营销游) + * 开始时间: 2013.12.09 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +public interface YxySmtpSendSetDao { + +// /**查询该smtp对应后缀在时间段的发送量通过smtp查询(作用于运营smtp)*/ +// public List<YxySmtpSendSet> findAllSmtpSendSet(String smtpservice,String nowDay)throws Exception; +// /**添加后缀发送量信息*/ +// public void addSmtpSendSet(YxySmtpSendSet o)throws Exception; +// /**查询某smtp账号的已发量数据(作用于自配smtp)*/ +// public List<YxySmtpSendSet> findSmtpSetByAccount(String smtpaccount)throws Exception; +// /**更新发送量信息*/ +// public void updateSmtpSet(List<YxySmtpSendSet> o)throws Exception; +// /**hql删除*/ +// public void delByHql(String hql)throws Exception; + /**批量插入*/ + public void addPiPojo(List<YxySmtpSendSet> o)throws Exception; + + /**实体添加*/ + public int addPojo(YxySmtpSendSet o)throws Exception; + + /**HQL查询*/ + public List<YxySmtpSendSet> findByHql(String hql)throws Exception; + + /**SQL查询*/ + public List<Object> findbysql(String sql)throws Exception; + + /**SQL更新*/ + public void updateBySql(String sql)throws Exception; + + /**HQL更新*/ + public void updateByHql(String hql)throws Exception; +} diff --git b/src/com/espeed/yxy/dao/YxySmtpSuffixSetDao.java a/src/com/espeed/yxy/dao/YxySmtpSuffixSetDao.java new file mode 100644 index 0000000..38dd096 --- /dev/null +++ a/src/com/espeed/yxy/dao/YxySmtpSuffixSetDao.java @@ -0,0 +1,39 @@ +package com.espeed.yxy.dao; + +import java.util.List; +import com.espeed.yxy.pojo.YxySmtpSuffixSet; + +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: SMTP 后缀设置信息Dao接口(营销游) + * 开始时间: 2013.12.09 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +public interface YxySmtpSuffixSetDao { + +// /**查询后缀信息*/ +// public List<YxySmtpSuffixSet> findAllSmtpSuffixSet()throws Exception; + /**批量插入*/ + public void addPiPojo(List<YxySmtpSuffixSet> o)throws Exception; + + /**实体添加*/ + public int addPojo(YxySmtpSuffixSet o)throws Exception; + + /**HQL查询*/ + public List<YxySmtpSuffixSet> findByHql(String hql)throws Exception; + + /**SQL查询*/ + public List<Object> findbysql(String sql)throws Exception; + + /**SQL更新*/ + public void updateBySql(String sql)throws Exception; + + /**HQL更新*/ + public void updateByHql(String hql)throws Exception; +} diff --git b/src/com/espeed/yxy/dao/YxySysParamatersValueDao.java a/src/com/espeed/yxy/dao/YxySysParamatersValueDao.java new file mode 100644 index 0000000..cf4f978 --- /dev/null +++ a/src/com/espeed/yxy/dao/YxySysParamatersValueDao.java @@ -0,0 +1,38 @@ +package com.espeed.yxy.dao; + +import java.util.List; +import com.espeed.yxy.pojo.YxySysParamatersValue; +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 控制参数值Dao(营销游) + * 开始时间: 2013.12.09 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +public interface YxySysParamatersValueDao { + +// /**通过paraid查询参数值*/ +// public List<YxySysParamatersValue> findParamatersValueByParaId(String loginid,String domain)throws Exception; + /**批量插入*/ + public void addPiPojo(List<YxySysParamatersValue> o)throws Exception; + + /**实体添加*/ + public int addPojo(YxySysParamatersValue o)throws Exception; + + /**HQL查询*/ + public List<YxySysParamatersValue> findByHql(String hql)throws Exception; + + /**SQL查询*/ + public List<Object> findbysql(String sql)throws Exception; + + /**SQL更新*/ + public void updateBySql(String sql)throws Exception; + + /**HQL更新*/ + public void updateByHql(String hql)throws Exception; +} diff --git b/src/com/espeed/yxy/dao/YxyUserAddressDao.java a/src/com/espeed/yxy/dao/YxyUserAddressDao.java new file mode 100644 index 0000000..ea57a3a --- /dev/null +++ a/src/com/espeed/yxy/dao/YxyUserAddressDao.java @@ -0,0 +1,23 @@ +package com.espeed.yxy.dao; + +import java.util.List; +import com.espeed.yxy.pojo.YxyUserAddress; + +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 用户地址库dao(营销游) + * 开始时间: 2013.12.09 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +public interface YxyUserAddressDao { + + /**HQL查询*/ + public List<YxyUserAddress> findByHql(String hql)throws Exception; + +} diff --git b/src/com/espeed/yxy/dao/impl/CentreHibernateBaseDAOImpl.java a/src/com/espeed/yxy/dao/impl/CentreHibernateBaseDAOImpl.java new file mode 100644 index 0000000..f2ebb2e --- /dev/null +++ a/src/com/espeed/yxy/dao/impl/CentreHibernateBaseDAOImpl.java @@ -0,0 +1,179 @@ +package com.espeed.yxy.dao.impl; + +import java.io.Serializable; +import java.util.List; +import org.hibernate.Query; +import org.hibernate.Session; +import org.springframework.orm.hibernate3.support.HibernateDaoSupport; + +import com.espeed.yxy.dao.HibernateBaseDAO; + +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 通用dao操作接口实现类 + * 开始时间: 2013.09.22 + * 程 序 员: 谢勇 + * 最后修改: 2014-02-26 + * 备 注: 实现通用的增删改查操作,被其他dao所继承使用 + */ + +public abstract class CentreHibernateBaseDAOImpl<T extends Serializable ,Pk extends Serializable> extends HibernateDaoSupport + implements HibernateBaseDAO<T, Pk> { + /** + * ------------------------------常用CRUD操作----------------------------------------- + */ + /**增加记录 (返回新增加记录的主键)*/ + public int add(T o) throws Exception { + return (Integer) super.getHibernateTemplate().save(o); + } + + /**增加记录(无返回值)*/ + public void adddate(T o) throws Exception { + super.getHibernateTemplate().save(o); + } + + /**修改记录*/ + public void update(T o) throws Exception { + super.getHibernateTemplate().update(o); + } + + /**删除记录*/ + public void del(T o) throws Exception { + super.getHibernateTemplate().delete(o); + } + + /**添加或更新*/ + public void saveOrUpdate(T o) throws Exception { + super.getHibernateTemplate().saveOrUpdate(o); + } + + /**根据ID获取一条数据*/ + @SuppressWarnings("unchecked") + public T get(Class<T> t,Pk pk) throws Exception { + return (T) super.getHibernateTemplate().get(t, pk); + } + + /**根据ID获取一条数据*/ + @SuppressWarnings("unchecked") + public T load(Class<T> t,Pk pk) throws Exception { + return (T) super.getHibernateTemplate().load(t, pk); + } + + /**根据hql进行条件查询*/ + @SuppressWarnings("unchecked") + public List<T> getAll(String hql) throws Exception { + return super.getHibernateTemplate().find(hql); + } + + /**条件查询*/ + @SuppressWarnings("unchecked") + public List<T> getAll(String whereHql, Object... params) throws Exception { + return super.getHibernateTemplate().find(whereHql,params); + } + + /* + * -------------------------------查询总记录数----------------------------------------- + */ + /**根据条件查询总记录*/ + public int count(String hql) throws Exception { + List result=super.getHibernateTemplate().find(hql); + if(result.size()>0&&result.get(0)!=null&&!result.get(0).equals("null")){ + return Long.valueOf(result.get(0).toString()).intValue(); + //return Integer.valueOf(result.get(0).toString()); + }else{ + return 0; + } + //return Integer.valueOf(super.getHibernateTemplate().find(hql).get(0).toString()); + } + + /**根据条件和参数查询总记录*/ + public int count(String hql, Object... params) throws Exception { + return Integer.valueOf(super.getHibernateTemplate().find(hql,params).get(0).toString()); + } + + /**HQL语句修改删除记录*/ + public int updateorDelBySql(String hql){ + Query query = null; + int result=0; + Session session =null; + session=super.getHibernateTemplate().getSessionFactory().openSession(); + query = session.createQuery(hql); + result = query.executeUpdate(); + return result; + } + + /**sql语句修改删除记录*/ + public int updateorDelSql(String sql){ + Query query = null; + int result=0; + Session session =null; + try { + session=super.getHibernateTemplate().getSessionFactory().openSession(); + query = session.createSQLQuery(sql); + result = query.executeUpdate(); + } catch (Exception e) { + e.printStackTrace(); + }finally{ + if(session!=null){ + session.clear(); + session.close(); + } + } + + return result; + } + + /**查询设定的记录条数据*/ + public List<T> findBySet(String hql,int num){ + Session session = null; + Query query=null; + try { + session=super.getHibernateTemplate().getSessionFactory().openSession(); + query = session.createQuery(hql); + query.setMaxResults(num); + return query.list(); + } catch (Exception e) { + e.printStackTrace(); + }finally{ + if(session!=null){ + session.clear(); + session.close(); + } + } + return null; + } + + /**批量插入*/ + public void addPi(List<T> o)throws Exception{ + Session session = super.getHibernateTemplate().getSessionFactory().openSession(); + if(o!=null){ + session.beginTransaction(); + for(int i=0;i<o.size();i++){ + session.saveOrUpdate(o.get(i)); + } + session.beginTransaction().commit(); + } + } + + /**sql语句查询 + * @throws Exception */ + public List findBySql(String sql) throws Exception{ + Session session=null; + try { + session =super.getHibernateTemplate().getSessionFactory().openSession(); + return session.createSQLQuery(sql).list(); + } catch (Exception e) { + e.printStackTrace(); + }finally{ + if(session!=null){ + session.clear(); + session.close(); + } + } + return null; + } +} diff --git b/src/com/espeed/yxy/dao/impl/CentreTrackSetDaoImpl.java a/src/com/espeed/yxy/dao/impl/CentreTrackSetDaoImpl.java new file mode 100644 index 0000000..256fbea --- /dev/null +++ a/src/com/espeed/yxy/dao/impl/CentreTrackSetDaoImpl.java @@ -0,0 +1,40 @@ +package com.espeed.yxy.dao.impl; + +import java.util.List; + +import com.espeed.centre.pojo.CentreTrackSet; +import com.espeed.yxy.dao.CentreTrackSetDao; +/** + * 项目名称: 统一验证中心系统 + * 版权所有: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 技术支持: info@21gmail.com + * 单元名称: 营销邮开发客户配置Dao实现类 + * 开始时间: 2018.04.08 + * 开发人员: 陈南巧 + */ +public class CentreTrackSetDaoImpl extends CentreHibernateBaseDAOImpl<CentreTrackSet, Long> implements CentreTrackSetDao { + /**实体插入*/ + public int addPojo(CentreTrackSet o)throws Exception{ + return super.add(o); + } + /**实体编辑*/ + public void updatePojo(CentreTrackSet o)throws Exception{ + super.update(o); + } + /**HQL查询*/ + public List<CentreTrackSet> findByHql(String hql)throws Exception{ + return super.getAll(hql); + } + /**HQL查询数量*/ + public int findByHqlCount(String hql)throws Exception{ + return super.count(hql); + } + /**SQL查询*/ + public List<Object> findBySqlFind(String sql)throws Exception{ + return super.findBySql(sql); + } + /**HQL更新*/ + public void updateByHql(String hql)throws Exception{ + super.updateorDelBySql(hql); + } +} diff --git b/src/com/espeed/yxy/dao/impl/CentreUserDaoImpl.java a/src/com/espeed/yxy/dao/impl/CentreUserDaoImpl.java new file mode 100644 index 0000000..dba8aa9 --- /dev/null +++ a/src/com/espeed/yxy/dao/impl/CentreUserDaoImpl.java @@ -0,0 +1,40 @@ +package com.espeed.yxy.dao.impl; + +import java.util.List; + +import com.espeed.centre.pojo.CentreUser; +import com.espeed.yxy.dao.CentreUserDao; +/** + * 项目名称: 统一验证中心系统 + * 版权所有: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 技术支持: info@21gmail.com + * 单元名称: 营销邮开发客户配置Dao实现类 + * 开始时间: 2018.04.08 + * 开发人员: 陈南巧 + */ +public class CentreUserDaoImpl extends CentreHibernateBaseDAOImpl<CentreUser, Long> implements CentreUserDao { + /**实体插入*/ + public int addPojo(CentreUser o)throws Exception{ + return super.add(o); + } + /**实体编辑*/ + public void updatePojo(CentreUser o)throws Exception{ + super.update(o); + } + /**HQL查询*/ + public List<CentreUser> findByHql(String hql)throws Exception{ + return super.getAll(hql); + } + /**HQL查询数量*/ + public int findByHqlCount(String hql)throws Exception{ + return super.count(hql); + } + /**SQL查询*/ + public List<Object> findBySqlFind(String sql)throws Exception{ + return super.findBySql(sql); + } + /**HQL更新*/ + public void updateByHql(String hql)throws Exception{ + super.updateorDelBySql(hql); + } +} diff --git b/src/com/espeed/yxy/dao/impl/CentreYxyedmNewcustomerDaoImpl.java a/src/com/espeed/yxy/dao/impl/CentreYxyedmNewcustomerDaoImpl.java new file mode 100644 index 0000000..a757fc9 --- /dev/null +++ a/src/com/espeed/yxy/dao/impl/CentreYxyedmNewcustomerDaoImpl.java @@ -0,0 +1,40 @@ +package com.espeed.yxy.dao.impl; + +import java.util.List; + +import com.espeed.centre.pojo.CentreYxyedmNewcustomer; +import com.espeed.yxy.dao.CentreYxyedmNewcustomerDao; +/** + * 项目名称: 统一验证中心系统 + * 版权所有: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 技术支持: info@21gmail.com + * 单元名称: 营销邮开发客户配置Dao实现类 + * 开始时间: 2018.04.08 + * 开发人员: 陈南巧 + */ +public class CentreYxyedmNewcustomerDaoImpl extends CentreHibernateBaseDAOImpl<CentreYxyedmNewcustomer, Long> implements CentreYxyedmNewcustomerDao { + /**实体插入*/ + public int addPojo(CentreYxyedmNewcustomer o)throws Exception{ + return super.add(o); + } + /**实体编辑*/ + public void updatePojo(CentreYxyedmNewcustomer o)throws Exception{ + super.update(o); + } + /**HQL查询*/ + public List<CentreYxyedmNewcustomer> findByHql(String hql)throws Exception{ + return super.getAll(hql); + } + /**HQL查询数量*/ + public int findByHqlCount(String hql)throws Exception{ + return super.count(hql); + } + /**SQL查询*/ + public List<Object> findBySqlFind(String sql)throws Exception{ + return super.findBySql(sql); + } + /**HQL更新*/ + public void updateByHql(String hql)throws Exception{ + super.updateorDelBySql(hql); + } +} diff --git b/src/com/espeed/yxy/dao/impl/CentreYxyedmOldcustomerDaoImpl.java a/src/com/espeed/yxy/dao/impl/CentreYxyedmOldcustomerDaoImpl.java new file mode 100644 index 0000000..c75b11f --- /dev/null +++ a/src/com/espeed/yxy/dao/impl/CentreYxyedmOldcustomerDaoImpl.java @@ -0,0 +1,40 @@ +package com.espeed.yxy.dao.impl; + +import java.util.List; + +import com.espeed.centre.pojo.CentreYxyedmOldcustomer; +import com.espeed.yxy.dao.CentreYxyedmOldcustomerDao; +/** + * 项目名称: 统一验证中心系统 + * 版权所有: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 技术支持: info@21gmail.com + * 单元名称: 营销邮盘活客户配置Dao实现类 + * 开始时间: 2018.04.08 + * 开发人员: 陈南巧 + */ +public class CentreYxyedmOldcustomerDaoImpl extends CentreHibernateBaseDAOImpl<CentreYxyedmOldcustomer, Long> implements CentreYxyedmOldcustomerDao { + /**实体插入*/ + public int addPojo(CentreYxyedmOldcustomer o)throws Exception{ + return super.add(o); + } + /**实体编辑*/ + public void updatePojo(CentreYxyedmOldcustomer o)throws Exception{ + super.update(o); + } + /**HQL查询*/ + public List<CentreYxyedmOldcustomer> findByHql(String hql)throws Exception{ + return super.getAll(hql); + } + /**HQL查询数量*/ + public int findByHqlCount(String hql)throws Exception{ + return super.count(hql); + } + /**SQL查询*/ + public List<Object> findBySqlFind(String sql)throws Exception{ + return super.findBySql(sql); + } + /**HQL更新*/ + public void updateByHql(String hql)throws Exception{ + super.updateorDelBySql(hql); + } +} diff --git b/src/com/espeed/yxy/dao/impl/CrmCustomerInfoDaoImpl.java a/src/com/espeed/yxy/dao/impl/CrmCustomerInfoDaoImpl.java new file mode 100644 index 0000000..4b5ddec --- /dev/null +++ a/src/com/espeed/yxy/dao/impl/CrmCustomerInfoDaoImpl.java @@ -0,0 +1,61 @@ +package com.espeed.yxy.dao.impl; + +import java.util.List; + +import com.espeed.webmail.pojo.CrmCustomerInfo; +import com.espeed.yxy.dao.CrmCustomerInfoDao; + + +/** +* +* @项目名称: 科飞管理后台系统 +* @版权所有: 深圳市科飞时速网络技术有限公司(0755-88843776) +* @技术支持: info@21gmail.com +* @单元名称: 实体类CrmCustomerInfo的DAO接口 +* @开始时间: 2018-09-27 +* @开发人员: 杨志钊 +*/ + +public class CrmCustomerInfoDaoImpl extends WebmailHibernateBaseDAOImpl<CrmCustomerInfo, Long> implements CrmCustomerInfoDao { + + /**实体插入*/ + public int addPojo(CrmCustomerInfo entity) throws Exception { + return super.add(entity); + } + + /**实体编辑*/ + public void updatePojo(CrmCustomerInfo entity) throws Exception { + super.update(entity); + } + + /**HQL查询*/ + public List<CrmCustomerInfo> findByHql(String hql) throws Exception { + return super.getAll(hql); + } + + /**HQL指定条查询*/ + public List<CrmCustomerInfo> findByHqlSet(String hql,int num) throws Exception { + return super.findBySet(hql, num); + } + + /**SQL查询*/ + public List<Object> findBySqlFind(String sql) throws Exception { + return super.findBySql(sql); + } + + /**HQL更新*/ + public void updateByHql(String hql) throws Exception { + super.updateorDelBySql(hql); + } + + /**sql更新*/ + public void updateBySql(String sql) throws Exception { + super.updateorDelSql(sql); + } + + /**HQL查询数量*/ + public int findByHqlCount(String hql) throws Exception { + return super.count(hql); + } + +} diff --git b/src/com/espeed/yxy/dao/impl/HibernateBaseDAOImpl.java a/src/com/espeed/yxy/dao/impl/HibernateBaseDAOImpl.java new file mode 100644 index 0000000..5b43ed8 --- /dev/null +++ a/src/com/espeed/yxy/dao/impl/HibernateBaseDAOImpl.java @@ -0,0 +1,226 @@ +package com.espeed.yxy.dao.impl; + +import java.io.Serializable; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.util.List; +import org.hibernate.Query; +import org.hibernate.Session; +import org.springframework.orm.hibernate3.support.HibernateDaoSupport; + +import com.espeed.yxy.dao.HibernateBaseDAO; +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: hbernate常用方法(营销邮) + * 开始时间: 2013.11.27 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +public abstract class HibernateBaseDAOImpl<T extends Serializable ,Pk extends Serializable> extends HibernateDaoSupport implements HibernateBaseDAO<T, Pk> { + private Connection conn; + private PreparedStatement pst; + private ResultSet rs; + + /**增加记录 (返回新增加记录的主键)*/ + public int add(T o) throws Exception { + return (Integer) super.getHibernateTemplate().save(o); + + } + + + /**修改记录*/ + public void update(T o) throws Exception { + super.getHibernateTemplate().update(o); + } + /**删除记录*/ + public void del(T o) throws Exception { + super.getHibernateTemplate().delete(o); + } + + /**添加或更新*/ + public void saveOrUpdate(T o) throws Exception { + super.getHibernateTemplate().saveOrUpdate(o); + } + /**根据ID获取一条数据*/ + @SuppressWarnings("unchecked") + public T get(Class<T> t,Pk pk) throws Exception { + return (T) super.getHibernateTemplate().get(t, pk); + } + /**根据ID获取一条数据*/ + @SuppressWarnings("unchecked") + public T load(Class<T> t,Pk pk) throws Exception { + return (T) super.getHibernateTemplate().load(t, pk); + } + /**根据hql进行条件查询*/ + @SuppressWarnings("unchecked") + public List<T> getAll(String hql) throws Exception { + return super.getHibernateTemplate().find(hql); + } + /**条件查询*/ + @SuppressWarnings("unchecked") + public List<T> getAll(String whereHql, Object... params) throws Exception { + return super.getHibernateTemplate().find(whereHql,params); + } + /* + * -------------------------------查询总记录数----------------------------------------- + */ + /**根据条件查询总记录*/ + public int count(String hql) throws Exception { + return Integer.valueOf(super.getHibernateTemplate().find(hql).get(0).toString()); + } + /**根据条件和参数查询总记录*/ + public int count(String hql, Object... params) throws Exception { + return Integer.valueOf(super.getHibernateTemplate().find(hql,params).get(0).toString()); + } + + /**hql语句修改删除记录*/ + public int updateorDelByHql(String hql){ + Session session = super.getHibernateTemplate().getSessionFactory().openSession(); + try { + Query query = session.createQuery(hql); + return query.executeUpdate(); + } catch (Exception e) { + e.printStackTrace(); + return 0; + }finally{ + if(session!=null){ + session.clear(); + session.close(); + } + + } + } + + /**sql语句修改删除记录*/ + public int updateorDelBySql(String sql)throws Exception{ + Session session = super.getHibernateTemplate().getSessionFactory().openSession(); + try { + Query query = session.createSQLQuery(sql); + return query.executeUpdate(); + } catch (Exception e) { + e.printStackTrace(); + return 0; + }finally{ + if(session!=null){ + session.clear(); + session.close(); + } + } + + } + + /**查询设定的记录条数据*/ + public List<T> findBySet(String hql,int num)throws Exception{ + Session session = super.getHibernateTemplate().getSessionFactory().openSession(); + try { + Query query = session.createQuery(hql); + query.setMaxResults(num); + return query.list(); + } catch (Exception e) { + e.printStackTrace(); + return null; + }finally{ + if(session!=null){ + session.clear(); + session.close(); + } + } + + + } + + /**批量插入*/ + public void addPi(List<T> o){ + if(o!=null){ + Session session = super.getHibernateTemplate().getSessionFactory().openSession(); + try { + + session.beginTransaction(); + for(int i=0;i<o.size();i++){ + session.saveOrUpdate(o.get(i)); + } + session.beginTransaction().commit(); + } catch (Exception e) { + e.printStackTrace(); + session.beginTransaction().rollback(); + }finally{ + session.flush(); + session.clear(); + session.close(); + } + } + } + + /**批量更新*/ + public void updatePi(List<T> o) throws Exception{ + if(o!=null){ + Session session = super.getHibernateTemplate().getSessionFactory().openSession(); + try { + + session.beginTransaction(); + for(int i=0;i<o.size();i++){ + session.update(o.get(i)); + } + session.beginTransaction().commit(); + + + } catch (Exception e) { + e.printStackTrace(); + session.beginTransaction().rollback(); + }finally{ + session.flush(); + session.clear(); + session.close(); + } + } + } + + + /**批量更新*/ + public void saveandupdatePi(List<T> o) throws Exception{ + if(o!=null){ + Session session = super.getHibernateTemplate().getSessionFactory().openSession(); + try { + + session.beginTransaction(); + for(int i=0;i<o.size();i++){ + session.saveOrUpdate(o.get(i)); + } + session.beginTransaction().commit(); + + + } catch (Exception e) { + e.printStackTrace(); + session.beginTransaction().rollback(); + }finally{ + session.flush(); + session.clear(); + session.close(); + } + } + } + + /**sql语句查询*/ + public List findBySql(String sql){ + Session session=null; + try { + session =super.getHibernateTemplate().getSessionFactory(). + openSession(); + return session.createSQLQuery(sql).list(); + } catch (Exception e) { + e.printStackTrace(); + }finally{ + if(session!=null){ + session.clear(); + session.close(); + } + } + return null; + } +} diff --git b/src/com/espeed/yxy/dao/impl/WebmailHibernateBaseDAOImpl.java a/src/com/espeed/yxy/dao/impl/WebmailHibernateBaseDAOImpl.java new file mode 100644 index 0000000..e68c4f8 --- /dev/null +++ a/src/com/espeed/yxy/dao/impl/WebmailHibernateBaseDAOImpl.java @@ -0,0 +1,179 @@ +package com.espeed.yxy.dao.impl; + +import java.io.Serializable; +import java.util.List; +import org.hibernate.Query; +import org.hibernate.Session; +import org.springframework.orm.hibernate3.support.HibernateDaoSupport; + +import com.espeed.yxy.dao.HibernateBaseDAO; + +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 通用dao操作接口实现类 + * 开始时间: 2013.09.22 + * 程 序 员: 谢勇 + * 最后修改: 2014-02-26 + * 备 注: 实现通用的增删改查操作,被其他dao所继承使用 + */ + +public abstract class WebmailHibernateBaseDAOImpl<T extends Serializable ,Pk extends Serializable> extends HibernateDaoSupport + implements HibernateBaseDAO<T, Pk> { + /** + * ------------------------------常用CRUD操作----------------------------------------- + */ + /**增加记录 (返回新增加记录的主键)*/ + public int add(T o) throws Exception { + return (Integer) super.getHibernateTemplate().save(o); + } + + /**增加记录(无返回值)*/ + public void adddate(T o) throws Exception { + super.getHibernateTemplate().save(o); + } + + /**修改记录*/ + public void update(T o) throws Exception { + super.getHibernateTemplate().update(o); + } + + /**删除记录*/ + public void del(T o) throws Exception { + super.getHibernateTemplate().delete(o); + } + + /**添加或更新*/ + public void saveOrUpdate(T o) throws Exception { + super.getHibernateTemplate().saveOrUpdate(o); + } + + /**根据ID获取一条数据*/ + @SuppressWarnings("unchecked") + public T get(Class<T> t,Pk pk) throws Exception { + return (T) super.getHibernateTemplate().get(t, pk); + } + + /**根据ID获取一条数据*/ + @SuppressWarnings("unchecked") + public T load(Class<T> t,Pk pk) throws Exception { + return (T) super.getHibernateTemplate().load(t, pk); + } + + /**根据hql进行条件查询*/ + @SuppressWarnings("unchecked") + public List<T> getAll(String hql) throws Exception { + return super.getHibernateTemplate().find(hql); + } + + /**条件查询*/ + @SuppressWarnings("unchecked") + public List<T> getAll(String whereHql, Object... params) throws Exception { + return super.getHibernateTemplate().find(whereHql,params); + } + + /* + * -------------------------------查询总记录数----------------------------------------- + */ + /**根据条件查询总记录*/ + public int count(String hql) throws Exception { + List result=super.getHibernateTemplate().find(hql); + if(result.size()>0&&result.get(0)!=null&&!result.get(0).equals("null")){ + return Long.valueOf(result.get(0).toString()).intValue(); + //return Integer.valueOf(result.get(0).toString()); + }else{ + return 0; + } + //return Integer.valueOf(super.getHibernateTemplate().find(hql).get(0).toString()); + } + + /**根据条件和参数查询总记录*/ + public int count(String hql, Object... params) throws Exception { + return Integer.valueOf(super.getHibernateTemplate().find(hql,params).get(0).toString()); + } + + /**HQL语句修改删除记录*/ + public int updateorDelBySql(String hql){ + Query query = null; + int result=0; + Session session =null; + session=super.getHibernateTemplate().getSessionFactory().openSession(); + query = session.createQuery(hql); + result = query.executeUpdate(); + return result; + } + + /**sql语句修改删除记录*/ + public int updateorDelSql(String sql){ + Query query = null; + int result=0; + Session session =null; + try { + session=super.getHibernateTemplate().getSessionFactory().openSession(); + query = session.createSQLQuery(sql); + result = query.executeUpdate(); + } catch (Exception e) { + e.printStackTrace(); + }finally{ + if(session!=null){ + session.clear(); + session.close(); + } + } + + return result; + } + + /**查询设定的记录条数据*/ + public List<T> findBySet(String hql,int num){ + Session session = null; + Query query=null; + try { + session=super.getHibernateTemplate().getSessionFactory().openSession(); + query = session.createQuery(hql); + query.setMaxResults(num); + return query.list(); + } catch (Exception e) { + e.printStackTrace(); + }finally{ + if(session!=null){ + session.clear(); + session.close(); + } + } + return null; + } + + /**批量插入*/ + public void addPi(List<T> o)throws Exception{ + Session session = super.getHibernateTemplate().getSessionFactory().openSession(); + if(o!=null){ + session.beginTransaction(); + for(int i=0;i<o.size();i++){ + session.saveOrUpdate(o.get(i)); + } + session.beginTransaction().commit(); + } + } + + /**sql语句查询 + * @throws Exception */ + public List findBySql(String sql) throws Exception{ + Session session=null; + try { + session =super.getHibernateTemplate().getSessionFactory().openSession(); + return session.createSQLQuery(sql).list(); + } catch (Exception e) { + e.printStackTrace(); + }finally{ + if(session!=null){ + session.clear(); + session.close(); + } + } + return null; + } +} diff --git b/src/com/espeed/yxy/dao/impl/YxyCustomerEmailDaoImpl.java a/src/com/espeed/yxy/dao/impl/YxyCustomerEmailDaoImpl.java new file mode 100644 index 0000000..282e1c6 --- /dev/null +++ a/src/com/espeed/yxy/dao/impl/YxyCustomerEmailDaoImpl.java @@ -0,0 +1,52 @@ +package com.espeed.yxy.dao.impl; + +import java.util.List; + +import com.espeed.webmail.pojo.YxyCustomerEmail; +import com.espeed.yxy.dao.YxyCustomerEmailDao; + +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 分类下的所有dao实现类(营销游) + * 开始时间: 2015.04.08 + * 程 序 员: 陈南巧 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +public class YxyCustomerEmailDaoImpl extends WebmailHibernateBaseDAOImpl<YxyCustomerEmail, Long> implements YxyCustomerEmailDao{ + + /**实体插入*/ + public int addPojo(YxyCustomerEmail o)throws Exception{ + return super.add(o); + } + /**实体编辑*/ + public void updatePojo(YxyCustomerEmail o)throws Exception{ + super.update(o); + } + /**HQL查询*/ + public List<YxyCustomerEmail> findByHql(String hql)throws Exception{ + return super.getAll(hql); + } + /**HQL数量查询*/ + public int findByHqlCount(String hql)throws Exception{ + return super.count(hql); + } + /**指定条记录*/ + public List<YxyCustomerEmail> findByHqlSet(String hql,int num)throws Exception{ + return super.findBySet(hql, num); + } + + /**SQL查询*/ + public List<Object> findBySqlQuery(String sql)throws Exception{ + return super.findBySql(sql); + } + /**HQL更新*/ + public void updateByHql(String hql)throws Exception{ + super.updateorDelBySql(hql); + } + +} diff --git b/src/com/espeed/yxy/dao/impl/YxyMailStencilDaoImpl.java a/src/com/espeed/yxy/dao/impl/YxyMailStencilDaoImpl.java new file mode 100644 index 0000000..92eb101 --- /dev/null +++ a/src/com/espeed/yxy/dao/impl/YxyMailStencilDaoImpl.java @@ -0,0 +1,15 @@ +package com.espeed.yxy.dao.impl; + +import java.util.List; + +import com.espeed.yxy.dao.YxyMailStencilDao; +import com.espeed.yxy.pojo.YxyMailStencil; + +public class YxyMailStencilDaoImpl extends HibernateBaseDAOImpl<YxyMailStencil, Long> implements YxyMailStencilDao { + + /**HQL查询*/ + public List<YxyMailStencil> findByHql(String hql)throws Exception{ + return super.getAll(hql); + } + +} diff --git b/src/com/espeed/yxy/dao/impl/YxyMarketingPlanDaoImpl.java a/src/com/espeed/yxy/dao/impl/YxyMarketingPlanDaoImpl.java new file mode 100644 index 0000000..25fa414 --- /dev/null +++ a/src/com/espeed/yxy/dao/impl/YxyMarketingPlanDaoImpl.java @@ -0,0 +1,21 @@ +package com.espeed.yxy.dao.impl; + +import java.util.List; +import com.espeed.yxy.dao.YxyMarketingPlanDao; +import com.espeed.yxy.pojo.YxyMarketingPlan; + +public class YxyMarketingPlanDaoImpl extends HibernateBaseDAOImpl<YxyMarketingPlan, Long> implements YxyMarketingPlanDao { + + /**HQL查询*/ + public List<YxyMarketingPlan> findByHql(String hql)throws Exception{ + return super.getAll(hql); + } + /**指定条记录*/ + public List<YxyMarketingPlan> findByHqlSet(String hql,int num)throws Exception{ + return super.findBySet(hql, num); + } + /**HQL更新*/ + public void updateByHql(String hql)throws Exception{ + super.updateorDelByHql(hql); + } +} diff --git b/src/com/espeed/yxy/dao/impl/YxyMarketingWeekDaoImpl.java a/src/com/espeed/yxy/dao/impl/YxyMarketingWeekDaoImpl.java new file mode 100644 index 0000000..9042580 --- /dev/null +++ a/src/com/espeed/yxy/dao/impl/YxyMarketingWeekDaoImpl.java @@ -0,0 +1,21 @@ +package com.espeed.yxy.dao.impl; + +import java.util.List; +import com.espeed.yxy.dao.YxyMarketingWeekDao; +import com.espeed.yxy.pojo.YxyMarketingWeek; + +public class YxyMarketingWeekDaoImpl extends HibernateBaseDAOImpl<YxyMarketingWeek, Long> implements YxyMarketingWeekDao { + + /**HQL查询*/ + public List<YxyMarketingWeek> findByHql(String hql)throws Exception{ + return super.getAll(hql); + } + /**指定条记录*/ + public List<YxyMarketingWeek> findByHqlSet(String hql,int num)throws Exception{ + return super.findBySet(hql, num); + } + /**HQL更新*/ + public void updateByHql(String hql) throws Exception { + super.updateorDelByHql(hql); + } +} diff --git b/src/com/espeed/yxy/dao/impl/YxyParamaterDaoImpl.java a/src/com/espeed/yxy/dao/impl/YxyParamaterDaoImpl.java new file mode 100644 index 0000000..60ccadb --- /dev/null +++ a/src/com/espeed/yxy/dao/impl/YxyParamaterDaoImpl.java @@ -0,0 +1,55 @@ +package com.espeed.yxy.dao.impl; +import java.util.List; +import com.espeed.yxy.dao.YxyParamaterDao; +import com.espeed.yxy.pojo.YxySysParamaters; + +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 控制参数DAO实现类 + * 开始时间: 2013.11.27 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +public class YxyParamaterDaoImpl extends HibernateBaseDAOImpl<YxySysParamaters, Long> implements YxyParamaterDao{ + + /**批量插入*/ + public void addPiPojo(List<YxySysParamaters> o)throws Exception{ + super.addPi(o); + } + + /**实体添加*/ + public int addPojo(YxySysParamaters o)throws Exception{ + return super.add(o); + } + + /**HQL查询*/ + public List<YxySysParamaters> findByHql(String hql)throws Exception{ + return super.getAll(hql); + } + + /**SQL查询*/ + public List<Object> findbysql(String sql)throws Exception{ + return super.findBySql(sql); + } + + /**SQL更新*/ + public void updateBySql(String sql)throws Exception{ + super.updateorDelBySql(sql); + } + + /**HQL更新*/ + public void updateByHql(String hql)throws Exception{ + super.updateorDelByHql(hql); + } +// /**通过code查询控制参数*/ +// public List<YxySysParamaters> findParamaterByCode(int level) throws Exception { +// String hql="from YxySysParamaters where owner_type="+level; +// return super.getAll(hql); +// } + +} diff --git b/src/com/espeed/yxy/dao/impl/YxyReplyInfoDaoImpl.java a/src/com/espeed/yxy/dao/impl/YxyReplyInfoDaoImpl.java new file mode 100644 index 0000000..eb7b5da --- /dev/null +++ a/src/com/espeed/yxy/dao/impl/YxyReplyInfoDaoImpl.java @@ -0,0 +1,19 @@ +package com.espeed.yxy.dao.impl; + +import java.util.List; + +import com.espeed.yxy.dao.YxyReplyInfoDao; +import com.espeed.yxy.pojo.YxyReplyInfo; + +/** + * + * @author 谢勇 + * 回复dao接口实现类 + */ +public class YxyReplyInfoDaoImpl extends HibernateBaseDAOImpl<YxyReplyInfo, Long> implements YxyReplyInfoDao{ + + /**HQL查询*/ + public List<YxyReplyInfo> findByHql(String hql)throws Exception{ + return super.getAll(hql); + } +} diff --git b/src/com/espeed/yxy/dao/impl/YxySendCountDaoImpl.java a/src/com/espeed/yxy/dao/impl/YxySendCountDaoImpl.java new file mode 100644 index 0000000..2d5bd8e --- /dev/null +++ a/src/com/espeed/yxy/dao/impl/YxySendCountDaoImpl.java @@ -0,0 +1,40 @@ +package com.espeed.yxy.dao.impl; + +import java.util.List; +import com.espeed.yxy.dao.YxySendCountDao; +import com.espeed.yxy.pojo.YxySendCount; +/** + * 客户发送邮件的统计Dao实现类 + * @author 陈南巧 + */ +public class YxySendCountDaoImpl extends HibernateBaseDAOImpl<YxySendCount, Long> implements YxySendCountDao{ + /**实体插入*/ + public int addPojo(YxySendCount o)throws Exception{ + return super.add(o); + } + /**实体编辑*/ + public void updatePojo(YxySendCount o)throws Exception{ + super.update(o); + } + /**HQL查询*/ + public List<YxySendCount> findByHql(String hql)throws Exception{ + return super.getAll(hql); + } + /**指定条记录*/ + public List<YxySendCount> findByHqlSet(String hql,int num)throws Exception{ + return super.findBySet(hql, num); + } + /**SQL查询*/ + public List<Object> findBySqlQuery(String sql)throws Exception{ + return super.findBySql(sql); + } + /**HQL更新*/ + public void updateByHql(String hql)throws Exception{ + super.updateorDelByHql(hql); + } + + /**HQL数量查询*/ + public int findByHqlCount(String hql)throws Exception{ + return super.count(hql); + } +} diff --git b/src/com/espeed/yxy/dao/impl/YxySendFilterAddressDaoImpl.java a/src/com/espeed/yxy/dao/impl/YxySendFilterAddressDaoImpl.java new file mode 100644 index 0000000..46ae43e --- /dev/null +++ a/src/com/espeed/yxy/dao/impl/YxySendFilterAddressDaoImpl.java @@ -0,0 +1,19 @@ +package com.espeed.yxy.dao.impl; + +import java.util.List; + +import com.espeed.yxy.dao.YxySendFilterAddressDao; +import com.espeed.yxy.pojo.YxySendFilterAddress; + +/** + * + * @author 谢勇 + * 用户过滤接口 + */ +public class YxySendFilterAddressDaoImpl extends HibernateBaseDAOImpl<YxySendFilterAddress, Long> implements YxySendFilterAddressDao{ + + /**HQL查询*/ + public List<YxySendFilterAddress> findByHql(String hql)throws Exception{ + return super.getAll(hql); + } +} diff --git b/src/com/espeed/yxy/dao/impl/YxySendMailDetailDaoImpl.java a/src/com/espeed/yxy/dao/impl/YxySendMailDetailDaoImpl.java new file mode 100644 index 0000000..277fbf9 --- /dev/null +++ a/src/com/espeed/yxy/dao/impl/YxySendMailDetailDaoImpl.java @@ -0,0 +1,77 @@ +package com.espeed.yxy.dao.impl; + +import java.util.List; + +import com.espeed.yxy.dao.YxySendMailDetailDao; +import com.espeed.yxy.pojo.YxySendMailDetail; +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 待发地址DAO实现类 + * 开始时间: 2013.11.27 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +public class YxySendMailDetailDaoImpl extends HibernateBaseDAOImpl<YxySendMailDetail, Long> implements YxySendMailDetailDao{ + +// /**根据待发邮件ID查询待发地址*/ +// public List<YxySendMailDetail> findAddressByMailID(int mailID) throws Exception { +// String hql="from YxySendMailDetail where status=0 and send_mail_id="+mailID; +// return super.getAll(hql); +// } +// /**修改此地址为已发送*/ +// public void updateMailDetailstatus(int addressID) throws Exception { +// String hql="update YxySendMailDetail set status=1 where mail_id="+addressID; +// super.updateorDelBySql(hql); +// } +// +// /**HQL更新*/ +// public void updateByHql(String hql) throws Exception { +// super.updateorDelBySql(hql); +// +// } +// +// /**HQL查询*/ +// public List findbyHql(String hql) throws Exception { +// return super.getAll(hql); +// } + + /**批量插入*/ + public void addPiPojo(List<YxySendMailDetail> o)throws Exception{ + super.addPi(o); + } + + /**实体添加*/ + public int addPojo(YxySendMailDetail o)throws Exception{ + return super.add(o); + } + + /**HQL查询*/ + public List<YxySendMailDetail> findByHql(String hql)throws Exception{ + return super.getAll(hql); + } + + /**指定条记录*/ + public List<YxySendMailDetail> findByHqlSet(String hql,int num)throws Exception{ + return super.findBySet(hql, num); + } + + /**SQL查询*/ + public List<Object> findbysql(String sql)throws Exception{ + return super.findBySql(sql); + } + + /**SQL更新*/ + public void updateBySql(String sql)throws Exception{ + super.updateorDelBySql(sql); + } + + /**HQL更新*/ + public void updateByHql(String hql)throws Exception{ + super.updateorDelByHql(hql); + } +} diff --git b/src/com/espeed/yxy/dao/impl/YxySendMailMasterBaseDaoImpl.java a/src/com/espeed/yxy/dao/impl/YxySendMailMasterBaseDaoImpl.java new file mode 100644 index 0000000..50cd9fd --- /dev/null +++ a/src/com/espeed/yxy/dao/impl/YxySendMailMasterBaseDaoImpl.java @@ -0,0 +1,46 @@ +package com.espeed.yxy.dao.impl; + +import java.util.List; + +import com.espeed.yxy.dao.YxySendMailMasterBaseDao; +import com.espeed.yxy.pojo.YxySendMailMasterBase; +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 邮件基本信息DAO(营销游) + * 开始时间: 2013.12.09 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +public class YxySendMailMasterBaseDaoImpl extends HibernateBaseDAOImpl<YxySendMailMasterBase, Long> implements YxySendMailMasterBaseDao{ + + /**实体插入*/ + public int addPojo(YxySendMailMasterBase o)throws Exception{ + return super.add(o); + } + /**实体编辑*/ + public void updatePojo(YxySendMailMasterBase o)throws Exception{ + super.update(o); + } + /**HQL查询*/ + public List<YxySendMailMasterBase> findByHql(String hql)throws Exception{ + return super.getAll(hql); + } + /**指定条记录*/ + public List<YxySendMailMasterBase> findByHqlSet(String hql,int num)throws Exception{ + return super.findBySet(hql, num); + } + /**SQL查询*/ + public List<Object> findBySqlQuery(String sql)throws Exception{ + return super.findBySql(sql); + } + /**HQL更新*/ + public void updateByHql(String hql)throws Exception{ + super.updateorDelByHql(hql); + } + +} diff --git b/src/com/espeed/yxy/dao/impl/YxySendMailMasterDaoImpl.java a/src/com/espeed/yxy/dao/impl/YxySendMailMasterDaoImpl.java new file mode 100644 index 0000000..b232a5e --- /dev/null +++ a/src/com/espeed/yxy/dao/impl/YxySendMailMasterDaoImpl.java @@ -0,0 +1,75 @@ +package com.espeed.yxy.dao.impl; + +import java.util.List; + +import com.espeed.yxy.dao.YxySendMailMasterDao; +import com.espeed.yxy.pojo.YxySendMailMaster; +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 待发邮件DAO实现类 + * 开始时间: 2013.11.27 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +public class YxySendMailMasterDaoImpl extends HibernateBaseDAOImpl<YxySendMailMaster, Long> implements YxySendMailMasterDao{ + + /**批量插入*/ + public void addPiPojo(List<YxySendMailMaster> o)throws Exception{ + super.addPi(o); + } + + /**实体添加*/ + public int addPojo(YxySendMailMaster o)throws Exception{ + return super.add(o); + } + + /**HQL查询*/ + public List<YxySendMailMaster> findByHql(String hql)throws Exception{ + return super.getAll(hql); + } + + /**SQL查询*/ + public List<Object> findbysql(String sql)throws Exception{ + return super.findBySql(sql); + } + + /**SQL更新*/ + public void updateBySql(String sql)throws Exception{ + super.updateorDelBySql(sql); + } + + /**HQL更新*/ + public void updateByHql(String hql)throws Exception{ + super.updateorDelByHql(hql); + } + +// /**查询所有可用待发邮件*/ +// public List<YxySendMailMaster> findByMailNum() throws Exception { +// String hql="from YxySendMailMaster where (status=0 or status=2) and exptionnum<=3 and isuse=0 order by result_remark"; +// return super.getAll(hql); +// } +// /**添加修改邮件状态*/ +// public void updateMaster(YxySendMailMaster o) throws Exception { +// super.update(o); +// } +// /**更新base表为已发送状态*/ +// public void updateMasterBase(String sql) throws Exception { +// super.updateorDelBysql(sql); +// } +// /**HQL查询*/ +// public List findByHql(String hql) throws Exception { +// return super.getAll(hql); +// } +// +// /**HQL修改*/ +// public int updateByHql(String hql) throws Exception { +// return super.updateorDelBySql(hql); +// } + + +} diff --git b/src/com/espeed/yxy/dao/impl/YxySendSmtpInfoDaoImpl.java a/src/com/espeed/yxy/dao/impl/YxySendSmtpInfoDaoImpl.java new file mode 100644 index 0000000..5e015f1 --- /dev/null +++ a/src/com/espeed/yxy/dao/impl/YxySendSmtpInfoDaoImpl.java @@ -0,0 +1,67 @@ +package com.espeed.yxy.dao.impl; + +import java.util.List; + +import com.espeed.yxy.dao.YxySendSmtpInfoDao; +import com.espeed.yxy.pojo.YxySendMailDetail; +import com.espeed.yxy.pojo.YxySendSmtpInfo; +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: SMTP DAO实现类 + * 开始时间: 2013.11.27 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +public class YxySendSmtpInfoDaoImpl extends HibernateBaseDAOImpl<YxySendSmtpInfo,Long> implements YxySendSmtpInfoDao{ + +// /**查询可用的smtp*/ +// public List<YxySendSmtpInfo> findAllSmtp(int num) throws Exception { +// String hql="from YxySendSmtpInfo where smtp_service_isuse=0 or smtp_service_isuse=1 order by smtp_service_userdate"; +// return super.getAll(hql); +// } +// /**更新smtp状态*/ +// public void updateSmtpStatus(YxySendSmtpInfo o) throws Exception { +// super.update(o); +// +// } +// /**HQL查询*/ +// public List<YxySendSmtpInfo> findByHql(String hql) throws Exception { +// +// return super.getAll(hql); +// } + + /**批量插入*/ + public void addPiPojo(List<YxySendSmtpInfo> o)throws Exception{ + super.addPi(o); + } + + /**实体添加*/ + public int addPojo(YxySendSmtpInfo o)throws Exception{ + return super.add(o); + } + + /**HQL查询*/ + public List<YxySendSmtpInfo> findByHql(String hql)throws Exception{ + return super.getAll(hql); + } + + /**SQL查询*/ + public List<Object> findbysql(String sql)throws Exception{ + return super.findBySql(sql); + } + + /**SQL更新*/ + public void updateBySql(String sql)throws Exception{ + super.updateorDelBySql(sql); + } + + /**HQL更新*/ + public void updateByHql(String hql)throws Exception{ + super.updateorDelByHql(hql); + } +} diff --git b/src/com/espeed/yxy/dao/impl/YxySenderSetDaoImpl.java a/src/com/espeed/yxy/dao/impl/YxySenderSetDaoImpl.java new file mode 100644 index 0000000..31066ef --- /dev/null +++ a/src/com/espeed/yxy/dao/impl/YxySenderSetDaoImpl.java @@ -0,0 +1,28 @@ +package com.espeed.yxy.dao.impl; + +import java.util.List; + +import com.espeed.yxy.dao.YxySenderSetDao; +import com.espeed.yxy.pojo.YxySenderSet; + + +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 发件人配置 + * 开始时间: 2015.4.02 + * 程 序 员: 蒋俭 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ + +public class YxySenderSetDaoImpl extends HibernateBaseDAOImpl<YxySenderSet, Long>implements YxySenderSetDao { + + /**HQL查询*/ + public List<YxySenderSet> findByHql(String hql)throws Exception{ + return super.getAll(hql); + } +} diff --git b/src/com/espeed/yxy/dao/impl/YxySmtpSendSelfOversetDaoImpl.java a/src/com/espeed/yxy/dao/impl/YxySmtpSendSelfOversetDaoImpl.java new file mode 100644 index 0000000..fbb49cb --- /dev/null +++ a/src/com/espeed/yxy/dao/impl/YxySmtpSendSelfOversetDaoImpl.java @@ -0,0 +1,67 @@ +package com.espeed.yxy.dao.impl; + +import java.util.List; + +import com.espeed.yxy.dao.YxySmtpSendSelfOversetDao; +import com.espeed.yxy.pojo.YxySendMailDetail; +import com.espeed.yxy.pojo.YxySmtpSendSelfOverset; +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: SMTP发送量 DAO实现类 + * 开始时间: 2013.11.27 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +public class YxySmtpSendSelfOversetDaoImpl extends HibernateBaseDAOImpl<YxySmtpSendSelfOverset, Long> implements YxySmtpSendSelfOversetDao{ + +// /**查询该账号的发送量信息*/ +// public List<YxySmtpSendSelfOverset> findBySmtpAccount(String account)throws Exception { +// String hql="from YxySmtpSendSelfOverset where smtp_send_self_over_account='"+account+"'"; +// return super.getAll(hql); +// } +// /**添加该账号的已发量信息*/ +// public void addSendSelfSet(YxySmtpSendSelfOverset o) throws Exception { +// super.add(o); +// +// } +// /**更新已发量*/ +// public void updateSendSelfSet(YxySmtpSendSelfOverset o) throws Exception { +// super.update(o); +// +// } + + /**批量插入*/ + public void addPiPojo(List<YxySmtpSendSelfOverset> o)throws Exception{ + super.addPi(o); + } + + /**实体添加*/ + public int addPojo(YxySmtpSendSelfOverset o)throws Exception{ + return super.add(o); + } + + /**HQL查询*/ + public List<YxySmtpSendSelfOverset> findByHql(String hql)throws Exception{ + return super.getAll(hql); + } + + /**SQL查询*/ + public List<Object> findbysql(String sql)throws Exception{ + return super.findBySql(sql); + } + + /**SQL更新*/ + public void updateBySql(String sql)throws Exception{ + super.updateorDelBySql(sql); + } + + /**HQL更新*/ + public void updateByHql(String hql)throws Exception{ + super.updateorDelByHql(hql); + } +} diff --git b/src/com/espeed/yxy/dao/impl/YxySmtpSendSelfSetDaoImpl.java a/src/com/espeed/yxy/dao/impl/YxySmtpSendSelfSetDaoImpl.java new file mode 100644 index 0000000..f19e6df --- /dev/null +++ a/src/com/espeed/yxy/dao/impl/YxySmtpSendSelfSetDaoImpl.java @@ -0,0 +1,56 @@ +package com.espeed.yxy.dao.impl; + +import java.util.List; + +import com.espeed.yxy.dao.YxySmtpSendSelfSetDao; +import com.espeed.yxy.pojo.YxySendMailDetail; +import com.espeed.yxy.pojo.YxySmtpSendSelfSet; +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: smtp的发送参数 DAO实现类 + * 开始时间: 2013.11.27 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +public class YxySmtpSendSelfSetDaoImpl extends HibernateBaseDAOImpl<YxySmtpSendSelfSet, Long> implements YxySmtpSendSelfSetDao{ +// /**通过smtpID查询此smtp的发送参数*/ +// public List<YxySmtpSendSelfSet> findSendSelfSetByService(String smtpservice) throws Exception { +// String hql="from YxySmtpSendSelfSet where smtp_send_self_set_account='"+smtpservice+"' or smtp_send_self_set_account='domain'"; +// return super.getAll(hql); +// } + + /**批量插入*/ + public void addPiPojo(List<YxySmtpSendSelfSet> o)throws Exception{ + super.addPi(o); + } + + /**实体添加*/ + public int addPojo(YxySmtpSendSelfSet o)throws Exception{ + return super.add(o); + } + + /**HQL查询*/ + public List<YxySmtpSendSelfSet> findByHql(String hql)throws Exception{ + return super.getAll(hql); + } + + /**SQL查询*/ + public List<Object> findbysql(String sql)throws Exception{ + return super.findBySql(sql); + } + + /**SQL更新*/ + public void updateBySql(String sql)throws Exception{ + super.updateorDelBySql(sql); + } + + /**HQL更新*/ + public void updateByHql(String hql)throws Exception{ + super.updateorDelByHql(hql); + } +} diff --git b/src/com/espeed/yxy/dao/impl/YxySmtpSendSetDaoImpl.java a/src/com/espeed/yxy/dao/impl/YxySmtpSendSetDaoImpl.java new file mode 100644 index 0000000..834a230 --- /dev/null +++ a/src/com/espeed/yxy/dao/impl/YxySmtpSendSetDaoImpl.java @@ -0,0 +1,77 @@ +package com.espeed.yxy.dao.impl; + +import java.util.List; + +import com.espeed.yxy.dao.YxySmtpSendSetDao; +import com.espeed.yxy.pojo.YxySendMailDetail; +import com.espeed.yxy.pojo.YxySmtpSendSet; +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: smtp后缀 发送设置DAO实现类 + * 开始时间: 2013.11.27 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +public class YxySmtpSendSetDaoImpl extends HibernateBaseDAOImpl<YxySmtpSendSet,Long> implements YxySmtpSendSetDao{ + +// /**查询该smtp对应后缀在时间段的发送量*/ +// public List<YxySmtpSendSet> findAllSmtpSendSet(String smtpservice,String nowDay) throws Exception { +// String hql="from YxySmtpSendSet where smtp_send_set_service='"+smtpservice+"' and smtp_send_set_daydate='"+nowDay+"'"; +// return super.getAll(hql); +// } +// +// /**添加后缀发送量信息*/ +// public void addSmtpSendSet(YxySmtpSendSet o) throws Exception { +// super.add(o); +// } +// +// /**查询某smtp账号的已发量数据(作用于自配smtp)*/ +// public List<YxySmtpSendSet> findSmtpSetByAccount(String smtpaccount) throws Exception { +// String hql="from YxySmtpSendSet where smtp_send_set_accout='"+smtpaccount+"'"; +// return super.getAll(hql); +// } +// /**更新发送量信息*/ +// public void updateSmtpSet(List<YxySmtpSendSet> o)throws Exception{ +// super.saveandupdatePi(o); +// } +// /**hql删除*/ +// public void delByHql(String hql) throws Exception { +// super.updateorDelBySql(hql); +// +// } + + /**批量插入*/ + public void addPiPojo(List<YxySmtpSendSet> o)throws Exception{ + super.addPi(o); + } + + /**实体添加*/ + public int addPojo(YxySmtpSendSet o)throws Exception{ + return super.add(o); + } + + /**HQL查询*/ + public List<YxySmtpSendSet> findByHql(String hql)throws Exception{ + return super.getAll(hql); + } + + /**SQL查询*/ + public List<Object> findbysql(String sql)throws Exception{ + return super.findBySql(sql); + } + + /**SQL更新*/ + public void updateBySql(String sql)throws Exception{ + super.updateorDelBySql(sql); + } + + /**HQL更新*/ + public void updateByHql(String hql)throws Exception{ + super.updateorDelByHql(hql); + } +} diff --git b/src/com/espeed/yxy/dao/impl/YxySmtpSuffixSetDaoImpl.java a/src/com/espeed/yxy/dao/impl/YxySmtpSuffixSetDaoImpl.java new file mode 100644 index 0000000..7e773d3 --- /dev/null +++ a/src/com/espeed/yxy/dao/impl/YxySmtpSuffixSetDaoImpl.java @@ -0,0 +1,51 @@ +package com.espeed.yxy.dao.impl; + +import java.util.List; + +import com.espeed.yxy.dao.YxySmtpSuffixSetDao; +import com.espeed.yxy.pojo.YxySendMailDetail; +import com.espeed.yxy.pojo.YxySmtpSuffixSet; +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: SMTP 后缀设置信息Dao实现类(营销游) + * 开始时间: 2013.12.09 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +public class YxySmtpSuffixSetDaoImpl extends HibernateBaseDAOImpl<YxySmtpSuffixSet,Long> implements YxySmtpSuffixSetDao{ + + /**批量插入*/ + public void addPiPojo(List<YxySmtpSuffixSet> o)throws Exception{ + super.addPi(o); + } + + /**实体添加*/ + public int addPojo(YxySmtpSuffixSet o)throws Exception{ + return super.add(o); + } + + /**HQL查询*/ + public List<YxySmtpSuffixSet> findByHql(String hql)throws Exception{ + return super.getAll(hql); + } + + /**SQL查询*/ + public List<Object> findbysql(String sql)throws Exception{ + return super.findBySql(sql); + } + + /**SQL更新*/ + public void updateBySql(String sql)throws Exception{ + super.updateorDelBySql(sql); + } + + /**HQL更新*/ + public void updateByHql(String hql)throws Exception{ + super.updateorDelByHql(hql); + } +} diff --git b/src/com/espeed/yxy/dao/impl/YxySysParamatersValueDaoImpl.java a/src/com/espeed/yxy/dao/impl/YxySysParamatersValueDaoImpl.java new file mode 100644 index 0000000..c0ba115 --- /dev/null +++ a/src/com/espeed/yxy/dao/impl/YxySysParamatersValueDaoImpl.java @@ -0,0 +1,57 @@ +package com.espeed.yxy.dao.impl; + +import java.util.List; + +import com.espeed.yxy.dao.YxySysParamatersValueDao; +import com.espeed.yxy.pojo.YxySendMailDetail; +import com.espeed.yxy.pojo.YxySysParamatersValue; +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 控制参数值Dao实现类(营销游) + * 开始时间: 2013.12.09 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +public class YxySysParamatersValueDaoImpl extends HibernateBaseDAOImpl<YxySysParamatersValue, Long> implements YxySysParamatersValueDao{ + +// /**查询用户控制参数值*/ +// public List<YxySysParamatersValue> findParamatersValueByParaId(String loginid,String domain) throws Exception { +// String hql="from YxySysParamatersValue where owner_loginid='"+loginid+"' and company_domain='"+domain+"'"; +// return super.getAll(hql); +// } + + /**批量插入*/ + public void addPiPojo(List<YxySysParamatersValue> o)throws Exception{ + super.addPi(o); + } + + /**实体添加*/ + public int addPojo(YxySysParamatersValue o)throws Exception{ + return super.add(o); + } + + /**HQL查询*/ + public List<YxySysParamatersValue> findByHql(String hql)throws Exception{ + return super.getAll(hql); + } + + /**SQL查询*/ + public List<Object> findbysql(String sql)throws Exception{ + return super.findBySql(sql); + } + + /**SQL更新*/ + public void updateBySql(String sql)throws Exception{ + super.updateorDelBySql(sql); + } + + /**HQL更新*/ + public void updateByHql(String hql)throws Exception{ + super.updateorDelByHql(hql); + } +} diff --git b/src/com/espeed/yxy/dao/impl/YxyUserAddressDaoImpl.java a/src/com/espeed/yxy/dao/impl/YxyUserAddressDaoImpl.java new file mode 100644 index 0000000..955c9de --- /dev/null +++ a/src/com/espeed/yxy/dao/impl/YxyUserAddressDaoImpl.java @@ -0,0 +1,29 @@ +package com.espeed.yxy.dao.impl; + +import java.util.List; + +import com.espeed.yxy.dao.YxyUserAddressDao; +import com.espeed.yxy.pojo.YxyUserAddress; + +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 用户地址库dao实现类(营销游) + * 开始时间: 2013.12.09 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +public class YxyUserAddressDaoImpl extends HibernateBaseDAOImpl<YxyUserAddress, Long> implements YxyUserAddressDao{ + + + /**HQL查询*/ + public List<YxyUserAddress> findByHql(String hql)throws Exception{ + return super.getAll(hql); + } + + +} diff --git b/src/com/espeed/yxy/mail/YxySendMail.java a/src/com/espeed/yxy/mail/YxySendMail.java new file mode 100644 index 0000000..479ed47 --- /dev/null +++ a/src/com/espeed/yxy/mail/YxySendMail.java @@ -0,0 +1,811 @@ +package com.espeed.yxy.mail; + +import java.io.File; +import java.io.PrintWriter; +import java.io.StringWriter; +import java.net.URLEncoder; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Date; +import java.util.HashSet; +import java.util.List; +import java.util.Properties; +import java.util.Random; +import java.util.Set; + +import javax.activation.DataHandler; +import javax.activation.FileDataSource; +import javax.mail.Message; +import javax.mail.Transport; +import javax.mail.internet.InternetAddress; +import javax.mail.internet.MimeBodyPart; +import javax.mail.internet.MimeMessage; +import javax.mail.internet.MimeMultipart; +import javax.mail.internet.MimeUtility; + +import org.jsoup.Jsoup; +import org.jsoup.nodes.Document; +import org.jsoup.nodes.Element; +import org.jsoup.select.Elements; + +import com.espeed.centre.pojo.CentreTrackSet; +import com.espeed.centre.pojo.CentreYxyedmNewcustomer; +import com.espeed.centre.pojo.CentreYxyedmOldcustomer; +import com.espeed.yxy.pojo.YxySendMailDetail; +import com.espeed.yxy.pojo.YxySendMailMaster; +import com.espeed.yxy.pojo.YxySendSmtpInfo; +import com.espeed.yxy.service.YxySendMailService; +import com.espeed.yxy.tool.ConfigPath; +import com.espeed.yxy.tool.LogsTool; +import com.espeed.yxy.util.AnalysisMail; +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 邮件发送方法(营销游) + * 开始时间: 2013.12.09 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +public class YxySendMail { + + //个人版营销邮的域名集合 + private static String[] domainArray = new String[]{ + "waimaoyou.cn","tomex.com.cn","mkonegroup.com","cposl.com", + "chinastonefactory.com","bf6-led.com","yexinglonggroup.com","wheelnutcn.com", + "aokwater.com","hesunny-international.com","szkring.com","sumaonetting.com", + "trsolidcontrol.com","ywksmy.com","sschgroup.com","tf_accessories.com", + "moeatsu.com","chipsen.com","aishine.com","cnbigjeans.com" + }; + + /**发送邮件(业务判断)*/ + public void sendMailMethod(List<YxySendMailDetail> addressList,YxySendMailService sendmailservice,YxySendSmtpInfo SmtpInfo,YxySendMailMaster mailinfo,Properties props,Transport transport){ + //变量定义 + int mailid=0;//邮件ID + String mailuid="";//邮件UID + int addressid=0;//地址ID + int expnum=0;//地址异常量 + try { + mailid=mailinfo.getSend_mail_id();//邮件ID + mailuid=mailinfo.getMail_uid();//邮件UID + //变量赋值 + MimeMessage mimeMsg = null; //MIME邮件对象 + String servername=SmtpInfo.getSmtp_service_account();//smtp账号 + javax.mail.Session mailSession = null; + + //是自配还是运营 + //int isyxy=SmtpInfo.getSmtp_service_isyxy(); + + //此邮件所属用户ID + String loginid=mailinfo.getUser_loginid(); + loginid=loginid.replaceAll(" ", ""); + String domain=mailinfo.getUser_domain(); + domain=domain.replaceAll(" ", ""); + //用户eml文件路径 + String useremlpath=sendmailservice.findCompanyParamByCode("yxy_user_data_save_path",loginid,domain); + if(useremlpath==null||useremlpath.equals("")||useremlpath.equals("-1")){ + //系统级 + useremlpath=sendmailservice.findCompanyParamByCode("yxy_domain_save_path",loginid,domain); + } + mailSession = javax.mail.Session.getInstance(props); + //以下判断是个人版营销邮还是易外销营销邮 + String centersys=ConfigPath.getYxyServicePath();//默认是易外销营销邮 + if(Arrays.asList(domainArray).contains(mailinfo.getUser_domain())){//是单独营销邮 + centersys=ConfigPath.getYxyServicePath2(); + } + //3.收件人 + InternetAddress[] sendTo = new InternetAddress[addressList.size()]; + //4.加入点读服务器访问地址 + String nurl = ""; + if(mailinfo.getIsold()==0 || mailinfo.getIsold()==5 || mailinfo.getIsold()==6)//新客户营销 + { + nurl=ConfigPath.getClickService(); + } + else if(mailinfo.getIsold()==1 || mailinfo.getIsold()==4)//老客户跟进或CRM库超标发送 + { + nurl=ConfigPath.getClickService2(); + } + else if(mailinfo.getIsold()==2 || mailinfo.getIsold()==3)//代发模式或自有域名 + { + //获取跟踪配置信息 + String track_hql = "from CentreTrackSet where company_doamin = '"+mailinfo.getUser_domain()+"' and type = 1 and status = 1"; + List<CentreTrackSet> tracks = sendmailservice.getTrackSetByHql(track_hql); + if(tracks.size() > 0){//有跟踪配置信息则使用配置里面的链接 + nurl = "http://"+tracks.get(0).getDomain()+"/"; + }else{//否则使用默认的老客户跟进链接 + nurl=ConfigPath.getClickService2(); + } + } + else{//否则取默认的老客户跟进链接 + nurl=ConfigPath.getClickService2(); + } + //6.解析eml文件获取内容 + AnalysisMail paxlmail=new AnalysisMail(); + String emlpath=mailinfo.getEml_file_path().replace("#####", useremlpath); + List paxlresult=paxlmail.ParseEmlMethod(emlpath, mailinfo.getEml_encode_key()); + + //内容 + String mailcontext=paxlresult.get(0).toString(); + + //是否加入链接地址 + String linkaddress=""; + if(mailinfo.getInclude_link()==1){ + if(mailinfo.getUnsubscribe_language()==1){//英文 + linkaddress= "<p align=\"center\" style=\"color: #999999;font-size: 12px;\">Access to more detailed :" + + "<a href=\""+ mailinfo.getLink_context() + "\">" + "webpage" + + "</a></p>"; + }else{ + linkaddress= "<p align=\"center\" style=\"color: #999999;font-size: 12px;\">如无法正常显示,请点击:<a href=\"" + + mailinfo.getLink_context() + "\">" + "网页链接" + + "</a></p>"; + } + mailcontext=mailcontext+linkaddress; + } + + //设置from、to等信息 + mimeMsg = new javax.mail.internet.MimeMessage(mailSession); + + //之前的新客户营销、之前的老客户跟进、CRM库自有域名、CRM库超标、新客户营销-自有域名 + if(mailinfo.getIsold()==0 || + mailinfo.getIsold()==1 || + mailinfo.getIsold()==3 || + mailinfo.getIsold()==4 || + mailinfo.getIsold()==5){ + //发件人 + String sender = mailinfo.getSender(); + //发件人地址 + String sendEmail = mailinfo.getSend_email().replace("_", ""); + //回复地址 + String replyEmail = mailinfo.getReply_email().replace("_", ""); + //邮件中的sender + InternetAddress senderAddr = new InternetAddress(servername,sender,"UTF-8"); + mimeMsg.setSender(senderAddr); + //邮件中的from + InternetAddress fromAddr = new InternetAddress(sendEmail,sender,"UTF-8"); + mimeMsg.setFrom(fromAddr); + //邮件中的reply + InternetAddress replyAddr = new InternetAddress(replyEmail); + mimeMsg.setReplyTo(new InternetAddress[]{replyAddr}); + }else if(mailinfo.getIsold()==2){//CRM库代发模式 + String hql = "from CentreYxyedmOldcustomer where company_domain = '"+domain+"'"; + List<CentreYxyedmOldcustomer> oldset = sendmailservice.getOldCustomerSet(hql); + if(oldset.size() > 0){//有配置信息 + //发件人 + String sender = oldset.get(0).getSender_name(); + //发件人地址 + String sendEmail = oldset.get(0).getSender_email().replace("_", ""); + //回复地址 + String replyEmail = mailinfo.getReply_email().replace("_", ""); + //邮件中的sender + InternetAddress senderAddr = new InternetAddress(servername,sender,"UTF-8"); + mimeMsg.setSender(senderAddr); + //邮件中的from + InternetAddress fromAddr = new InternetAddress(sendEmail,sender,"UTF-8"); + mimeMsg.setFrom(fromAddr); + //邮件中的reply + InternetAddress replyAddr = new InternetAddress(replyEmail); + mimeMsg.setReplyTo(new InternetAddress[]{replyAddr}); + }else{//无配置信息 + //发件人 + String sender = mailinfo.getSender(); + //发件人地址 + String sendEmail = mailinfo.getSend_email().replace("_", ""); + //回复地址 + String replyEmail = mailinfo.getReply_email().replace("_", ""); + //邮件中的sender + InternetAddress senderAddr = new InternetAddress(servername,sender,"UTF-8"); + mimeMsg.setSender(senderAddr); + //邮件中的from + InternetAddress fromAddr = new InternetAddress(sendEmail,sender,"UTF-8"); + mimeMsg.setFrom(fromAddr); + //邮件中的reply + InternetAddress replyAddr = new InternetAddress(replyEmail); + mimeMsg.setReplyTo(new InternetAddress[]{replyAddr}); + } + }else if(mailinfo.getIsold()==6){//新客户营销-自有域名超标或代发模式没超标 + String hql = "from CentreYxyedmNewcustomer where company_domain = '"+domain+"'"; + List<CentreYxyedmNewcustomer> newset = sendmailservice.getNewCustomerSet(hql); + if(newset.size() > 0){//有配置信息 + if(newset.get(0).getType() == 1){//代发模式没超标 + //发件人 + String sender = newset.get(0).getSender_name(); + //发件人地址 + String sendEmail = newset.get(0).getSender_email().replace("_", ""); + //回复地址 + String replyEmail = mailinfo.getReply_email().replace("_", ""); + //邮件中的sender + InternetAddress senderAddr = new InternetAddress(servername,sender,"UTF-8"); + mimeMsg.setSender(senderAddr); + //邮件中的from + InternetAddress fromAddr = new InternetAddress(sendEmail,sender,"UTF-8"); + mimeMsg.setFrom(fromAddr); + //邮件中的reply + InternetAddress replyAddr = new InternetAddress(replyEmail); + mimeMsg.setReplyTo(new InternetAddress[]{replyAddr}); + }else{//自有域名超标 + //发件人 + String sender = mailinfo.getSender(); + //发件人地址 + String sendEmail = mailinfo.getSend_email().replace("_", ""); + //回复地址 + String replyEmail = mailinfo.getReply_email().replace("_", ""); + //邮件中的sender + InternetAddress senderAddr = new InternetAddress(servername,sender,"UTF-8"); + mimeMsg.setSender(senderAddr); + //邮件中的from + InternetAddress fromAddr = new InternetAddress(sendEmail,sender,"UTF-8"); + mimeMsg.setFrom(fromAddr); + //邮件中的reply + InternetAddress replyAddr = new InternetAddress(replyEmail); + mimeMsg.setReplyTo(new InternetAddress[]{replyAddr}); + } + }else{//无配置信息 + //发件人 + String sender = mailinfo.getSender(); + //发件人地址 + String sendEmail = mailinfo.getSend_email().replace("_", ""); + //回复地址 + String replyEmail = mailinfo.getReply_email().replace("_", ""); + //邮件中的sender + InternetAddress senderAddr = new InternetAddress(servername,sender,"UTF-8"); + mimeMsg.setSender(senderAddr); + //邮件中的from + InternetAddress fromAddr = new InternetAddress(sendEmail,sender,"UTF-8"); + mimeMsg.setFrom(fromAddr); + //邮件中的reply + InternetAddress replyAddr = new InternetAddress(replyEmail); + mimeMsg.setReplyTo(new InternetAddress[]{replyAddr}); + } + } + + //设置信件头的发送日期 + mimeMsg.setSentDate(new Date()); + + //定义附件 + String parstattr=""; + String attrPath[]=null; + String attrName[]=null; + if(mailinfo.getAttarchment_path()!=null&&!mailinfo.getAttarchment_path().equals("")){ + //包含的多个附件拆解 + String[] splitPath=mailinfo.getAttarchment_path().split("##P##"); + if(splitPath.length>=2){ + attrPath=splitPath[1].split(",");//定义附件名 + attrName=new String[attrPath.length]; + for(int a=0;a<attrPath.length;a++){ + String[] splitStr=attrPath[a].split("#####"); + attrPath[a]=centersys+"\\mailtempfile\\"+domain+"\\"+loginid+"\\attachment\\"+splitStr[0];//附件路径 + attrName[a]=splitStr[1]; + //判断是否存在文件 + File f=new File(attrPath[a]); + if(!f.exists()){//如果不存在则重新解析 + parstattr=paxlmail.parsePicOrAttr(emlpath, mailinfo.getEml_encode_key(),1, centersys+"\\mailtempfile\\"+domain+"\\"+loginid+"\\attachment\\"); + String[] attrresult=parstattr.split(",");//多个分割 + parstattr=centersys+"##P##"+parstattr; + attrPath=new String[attrresult.length]; + attrName=new String[attrresult.length]; + for(int s=0;s<attrresult.length;s++){ + String[] attrname=attrresult[s].split("#####"); + attrPath[s]=centersys+"\\"+attrname[0]; + attrName[s]=attrname[1]; + } + break; + } + } + } + } + //定义图片part + String [] picPath=null; + String parstpic=""; + if(mailinfo.getImage_path()!=null&&!mailinfo.getImage_path().equals("")){ + picPath=mailinfo.getImage_path().split("#####"); + for(int i=0;i<picPath.length;i++){ + String picpath=centersys+"\\mailtempfile\\"+domain+"\\"+loginid+"\\pic\\"+picPath[i]; + //判断图片是否存在 + File f=new File(picpath); + if(!f.exists()){//如果不存在则重新解析 + parstpic=paxlmail.parsePicOrAttr(emlpath, mailinfo.getEml_encode_key(), 2, centersys+"\\mailtempfile\\"+domain+"\\"+loginid+"\\pic\\"); + picPath=parstpic.split("#####"); + break; + } + } + } + //更新邮件信息 + sendmailservice.updatepicattrpath(mailid, parstpic, parstattr); + //内容处理 + //1.内容加入点击地址 + mailcontext+="<img alt=\"trackimg\" src=\"" + nurl + "clickesemail.jsp?to=#RcevieEmail#&mailuid="+mailuid+"&loginid="+loginid+"&domain="+domain+"\" width=0 height=0 />"; + //2.判断是否加入退订 + String linkback=""; + //Header中的退订信息 + String listUnsubscribeStr=""; + if(mailinfo.getIs_unsubscribe()==1){ + listUnsubscribeStr=nurl+"Unsubscribe.jsp?loginid="+loginid+"&domain="+domain+"&mailuid="+mailuid+"&address=#RcevieEmail#"; + //显示中文还是英文 + if(mailinfo.getUnsubscribe_language()==2){//英文 + linkback= "<p align=\"center\" style=\"olor: #999999;font-size: 12px;\">If you don't want to receive these emails in the future,<a href=\"" + nurl + + "Unsubscribe.jsp?loginid=" + + loginid + + "&domain=" + domain + + "&mailuid=" + mailuid + + "&address=#RcevieEmail#" + + "\">" + "please.Unsubscribe,Thanks!" + "</a></p>"; + }else if(mailinfo.getUnsubscribe_language()==1){//中文 + linkback= "<p align=\"center\" style=\"color: #999999;font-size: 12px;\">如果您不需要此邮件,请点击:<a href=\"" + nurl + + "Unsubscribe.jsp?loginid=" + + loginid + + "&domain=" + domain + + "&mailuid=" + mailuid + + "&address=#RcevieEmail#" + + "\">" + "退订" + "</a></p>"; + }else if(mailinfo.getUnsubscribe_language()==3){//自定义 + linkback= "<p align=\"center\" style=\"color: #999999;font-size: 12px;\"><a href=\"" + nurl + + "Unsubscribe.jsp?loginid=" + + loginid + + "&domain=" + domain + + "&mailuid=" + mailuid + + "&address=#RcevieEmail#" + + "\">" + mailinfo.getUnstr() + "</a></p>"; + } + mailcontext+=linkback; + } + String subject=mailinfo.getSubject(); + + //设置X-Mailer + mimeMsg.setHeader("X-Mailer", "Yiwaixiao-EDM - SendMailer2.0"); + + //获取用户信息 + int user_id = 0; + int company_id = 0; + try{ + String sql = "select duser.user_id,dcom.company_id from centre_user as duser " + + "LEFT JOIN centre_company as dcom on duser.company_id = dcom.company_id " + + "where duser.login_id = '"+loginid+"' and dcom.domain = '"+domain+"'"; + List<Object> objects = sendmailservice.getUserInfoBySql(sql); + if(objects.size() > 0){ + Object[] obj_arr = (Object[])objects.get(0); + if(null!=obj_arr[0]){ + user_id = Integer.parseInt(obj_arr[0].toString()); + } + if(null!=obj_arr[1]){ + company_id = Integer.parseInt(obj_arr[1].toString()); + } + } + }catch (Exception e) { + + } + + //循环发送邮件 + for(int i=0;i<addressList.size();i++){ + try{ + String newListUnsubscribeStr=listUnsubscribeStr; + + addressid=addressList.get(i).getMail_id();//地址ID + expnum=addressList.get(i).getIsexp();//异常的量 + + String body=""; + String title=""; + //收件人姓名 + String receiveName=addressList.get(i).getReceiver(); + //企业名 + String company_variable=""; + if(addressList.get(i).getCompany_variable()!=null){ + company_variable=addressList.get(i).getCompany_variable(); + } + //变量名 + String variable=""; + if(addressList.get(i).getVariable()!=null){ + variable=addressList.get(i).getVariable(); + } + //加入内容高级变量 + body=mailcontext; + + boolean bodyok=true; + while(bodyok){ + if(body.indexOf("%ReceiverName%")!=-1){ + //过滤特殊字符 + body=body.replace("%ReceiverName%", receiveName); + }else{ + bodyok=false; + } + } + + boolean receok=true; + //替换点读收件人 + while(receok){ + if(body.indexOf("#RcevieEmail#")!=-1){ + newListUnsubscribeStr=listUnsubscribeStr.replace("#RcevieEmail#", addressList.get(i).getEmail());//替换收件人 + body=body.replace("#RcevieEmail#", addressList.get(i).getEmail());//替换收件人 + }else{ + receok=false; + } + } + //内容企业变量 + boolean bodycompanuok=true; + //替换相关信息 + while(bodycompanuok){ + if(body.indexOf("%titlecompany%")!=-1){ + body=body.replace("%titlecompany%",company_variable);//替换收件人 + }else{ + bodycompanuok=false; + } + } + //内容自定义变量 + boolean bodyselfok=true; + //替换相关信息 + while(bodyselfok){ + if(body.indexOf("%customesubject%")!=-1){ + body=body.replace("%customesubject%",variable);//替换收件人 + }else{ + bodyselfok=false; + } + } + + //加入主题,是否选择了多主题 + if(mailinfo.getSubject().indexOf("###_")!=-1){ + String []titlevalue=mailinfo.getSubject().split("###_"); + Random random = new Random(); + int number = random.nextInt(titlevalue.length); + subject=titlevalue[number]; + } + title=subject; + //主题姓名变量 + boolean titleok=true; + while(titleok){ + if(title.indexOf("%ReceiverName%")!=-1){ + title=title.replace("%ReceiverName%", receiveName); + }else{ + titleok=false; + } + } + + //主题企业变量 + boolean titlecomok=true; + while(titlecomok){ + if(title.indexOf("%titlecompany%")!=-1){ + title=title.replace("%titlecompany%", company_variable); + }else{ + titlecomok=false; + } + } + + //主题自定义变量 + boolean titlemyok=true; + while(titlemyok){ + if(title.indexOf("%customesubject%")!=-1){ + title=title.replace("%customesubject%", variable); + }else{ + titlemyok=false; + } + } + + //设置List-Unsubscribe + mimeMsg.removeHeader("List-Unsubscribe"); + mimeMsg.addHeader("List-Unsubscribe", "<"+newListUnsubscribeStr+">"); + + //主题加入邮件实体中 + //替换推广链接信息 + body=body.replace("?edmtitle=", "?edmtitle="+title); + mimeMsg.setSubject(title,"UTF-8"); + + //收件人 + sendTo[i] = new InternetAddress(addressList.get(i).getEmail().replace(" ", "")); + //接收者地址 + mimeMsg.setRecipient(Message.RecipientType.TO,sendTo[i]); + + //将邮件中各个部分组合到一个"mixed"型的 MimeMultipart 对象 + MimeMultipart multipart = null; + + //不同情况定义不同的邮件类型 + if(attrPath!=null&&attrPath.length>0){//有附件 + multipart = new MimeMultipart("mixed"); + if(picPath!=null&&picPath.length>0){//有图片 + //内容|图片MimeBodyPart + MimeBodyPart textAndPicBody = new MimeBodyPart(); + //内容|图片Multipart + MimeMultipart textAndPicMultipart = new MimeMultipart("related"); + //内容MimeBodyPart + MimeBodyPart textBody = new MimeBodyPart(); + //内容Multipart,包含plain和htmnl + MimeMultipart textMultipart = new MimeMultipart("alternative"); + //plain部分 + MimeBodyPart plainBody = new MimeBodyPart(); + String newPlainBody = body; + newPlainBody = newPlainBody.replaceAll("</?[^>]+>", ""); + newPlainBody = newPlainBody.replace(" ", ""); + newPlainBody = newPlainBody.replace(" ", ""); + plainBody.setContent(newPlainBody, "text/plain;charset=UTF-8"); + plainBody.setHeader("Content-Transfer-Encoding", "base64"); + textMultipart.addBodyPart(plainBody); + //html部分 + MimeBodyPart htmlBody = new MimeBodyPart(); + //替换跟踪统计信息 + if(body.indexOf("ywx-mark-track=\"true\"")!=-1){ + String newHtmlBody = body; + newHtmlBody = rebuildOriginalMail(newHtmlBody,addressList.get(i).getEmail(),mailuid,user_id,company_id); + htmlBody.setContent(newHtmlBody, "text/html;charset=UTF-8"); + }else{ + htmlBody.setContent(body, "text/html;charset=UTF-8"); + } + htmlBody.setHeader("Content-Transfer-Encoding", "quoted-printable"); + textMultipart.addBodyPart(htmlBody); + textBody.setContent(textMultipart); + textAndPicMultipart.addBodyPart(textBody); + //添加图片 + String pic=""; + for(int y=0;y<picPath.length;y++){ + if(picPath[y]!=null){ + pic+=centersys+"\\mailtempfile\\"+domain+"\\"+loginid+"\\pic\\"+picPath[y]+","; + } + } + String[] picpath=pic.split(","); + for(int j=0;j<picpath.length;j++){ + if(!picpath[j].equals("")){ + //正文的图片部分 + MimeBodyPart jpgBody = new MimeBodyPart(); + FileDataSource fds = new FileDataSource(picpath[j]); + jpgBody.setDataHandler(new DataHandler(fds)); + jpgBody.setFileName(fds.getName()); + jpgBody.setContentID("<IMG"+j+">"); + jpgBody.setHeader("Content-Type", "image/jpeg;name="+fds.getName()); + jpgBody.removeHeader("Content-Disposition"); + textAndPicMultipart.addBodyPart(jpgBody); + } + } + textAndPicBody.setContent(textAndPicMultipart); + multipart.addBodyPart(textAndPicBody); + }else{//无图片 + //内容部分 + MimeBodyPart textBody = new MimeBodyPart(); + MimeMultipart textMultipart = new MimeMultipart("alternative"); + //plain部分 + MimeBodyPart plainBody = new MimeBodyPart(); + String newPlainBody = body; + newPlainBody = newPlainBody.replaceAll("</?[^>]+>", ""); + newPlainBody = newPlainBody.replace(" ", ""); + newPlainBody = newPlainBody.replace(" ", ""); + plainBody.setContent(newPlainBody, "text/plain;charset=UTF-8"); + plainBody.setHeader("Content-Transfer-Encoding", "base64"); + textMultipart.addBodyPart(plainBody); + //html部分 + //替换跟踪统计信息 + MimeBodyPart htmlBody = new MimeBodyPart(); + if(body.indexOf("ywx-mark-track=\"true\"")!=-1){ + String newHtmlBody = body; + newHtmlBody = rebuildOriginalMail(newHtmlBody,addressList.get(i).getEmail(),mailuid,user_id,company_id); + htmlBody.setContent(newHtmlBody, "text/html;charset=UTF-8"); + }else{ + htmlBody.setContent(body, "text/html;charset=UTF-8"); + } + htmlBody.setHeader("Content-Transfer-Encoding", "quoted-printable"); + textMultipart.addBodyPart(htmlBody); + textBody.setContent(textMultipart); + multipart.addBodyPart(textBody); + } + for(int s=0;s<attrPath.length;s++){ + MimeBodyPart attachment = createAttachment(attrPath[s],attrName[s]); + multipart.addBodyPart(attachment); + } + }else if(picPath!=null&&picPath.length>0){//有图片 + multipart = new MimeMultipart("related"); + //内容部分 + MimeBodyPart textBody = new MimeBodyPart(); + MimeMultipart textMultipart = new MimeMultipart("alternative"); + //plain部分 + MimeBodyPart plainBody = new MimeBodyPart(); + String newPlainBody = body; + newPlainBody = newPlainBody.replaceAll("</?[^>]+>", ""); + newPlainBody = newPlainBody.replace(" ", ""); + newPlainBody = newPlainBody.replace(" ", ""); + plainBody.setContent(newPlainBody, "text/plain;charset=UTF-8"); + plainBody.setHeader("Content-Transfer-Encoding", "base64"); + textMultipart.addBodyPart(plainBody); + //html部分 + //替换跟踪统计信息 + MimeBodyPart htmlBody = new MimeBodyPart(); + if(body.indexOf("ywx-mark-track=\"true\"")!=-1){ + String newHtmlBody = body; + newHtmlBody = rebuildOriginalMail(newHtmlBody,addressList.get(i).getEmail(),mailuid,user_id,company_id); + htmlBody.setContent(newHtmlBody, "text/html;charset=UTF-8"); + }else{ + htmlBody.setContent(body, "text/html;charset=UTF-8"); + } + htmlBody.setHeader("Content-Transfer-Encoding", "quoted-printable"); + textMultipart.addBodyPart(htmlBody); + textBody.setContent(textMultipart); + multipart.addBodyPart(textBody); + //添加图片 + String pic=""; + for(int y=0;y<picPath.length;y++){ + if(picPath[y]!=null){ + pic+=centersys+"\\mailtempfile\\"+domain+"\\"+loginid+"\\pic\\"+picPath[y]+","; + } + } + String[] picpath=pic.split(","); + for(int j=0;j<picpath.length;j++){ + if(!picpath[j].equals("")){ + //正文的图片部分 + MimeBodyPart jpgBody = new MimeBodyPart(); + FileDataSource fds = new FileDataSource(picpath[j]); + jpgBody.setDataHandler(new DataHandler(fds)); + jpgBody.setFileName(fds.getName()); + jpgBody.setContentID("<IMG"+j+">"); + jpgBody.setHeader("Content-Type", "image/jpeg;name="+fds.getName()); + jpgBody.removeHeader("Content-Disposition"); + multipart.addBodyPart(jpgBody); + } + } + }else{//无附件无图片 + multipart = new MimeMultipart("alternative"); + //plain部分 + MimeBodyPart plainBody = new MimeBodyPart(); + String newPlainBody = body; + newPlainBody = newPlainBody.replaceAll("</?[^>]+>", ""); + newPlainBody = newPlainBody.replace(" ", ""); + newPlainBody = newPlainBody.replace(" ", ""); + plainBody.setContent(newPlainBody, "text/plain;charset=UTF-8"); + plainBody.setHeader("Content-Transfer-Encoding", "base64"); + multipart.addBodyPart(plainBody); + //html部分 + //替换跟踪统计信息 + MimeBodyPart htmlBody = new MimeBodyPart(); + if(body.indexOf("ywx-mark-track=\"true\"")!=-1){ + String newHtmlBody = body; + newHtmlBody = rebuildOriginalMail(newHtmlBody,addressList.get(i).getEmail(),mailuid,user_id,company_id); + htmlBody.setContent(newHtmlBody, "text/html;charset=UTF-8"); + }else{ + htmlBody.setContent(body, "text/html;charset=UTF-8"); + } + htmlBody.setHeader("Content-Transfer-Encoding", "quoted-printable"); + multipart.addBodyPart(htmlBody); + } + + //将上面混合型的 MimeMultipart 对象作为邮件内容并保存 + mimeMsg.setContent(multipart); + mimeMsg.saveChanges(); + + //发送邮件 + transport.sendMessage(mimeMsg,mimeMsg.getRecipients(Message.RecipientType.TO)); + //发送成功后修改该地址为已发送 + sendmailservice.updateMailDetailstatus(addressid); + //写入日志 + LogsTool.sendLogs(domain,loginid,"服务器:"+SmtpInfo.getSmtp_service_number()+"邮件ID:"+mailid+" 收件人:"+addressList.get(i).getEmail()+"发送成功"); + //输出到控制台 + System.out.println("邮件ID:"+mailid+"用户名:"+loginid+"@"+domain+"第"+i+"封总共"+addressList.size()+"封,服务器"+SmtpInfo.getSmtp_service_number()+"发送成功!"); + }catch (Exception e) { + //出现异常后更新此地址为异常地址 + expnum=expnum+1; + sendmailservice.updateExp(addressid,expnum); + //写入日志 + StringWriter sw = new StringWriter(); + e.printStackTrace(new PrintWriter(sw, true)); + String str = sw.toString(); + LogsTool.erroLogs("服务器:"+SmtpInfo.getSmtp_service_number()+"邮件ID为:"+mailid+"地址ID为:"+addressid+"地址发送异常!"+str); + continue; + } + } + System.out.println("邮件ID为:"+mailid+"所有的都发完了"); +// if(mailinfo.getIsold()==2)//开启的是独立域名发送 +// { +// int smtpsendnum = ConfigPath.getSmtpSendNum();//获取配置文件中的smtp发送数量 +// +// System.out.println("邮件ID为:"+mailid+"已经发送"+smtpsendnum+"封"); +// } +// else +// { +// System.out.println("邮件ID为:"+mailid+"所有的都发完了"); +// } + } catch (Exception e) { + //写入日志 + StringWriter sw = new StringWriter(); + e.printStackTrace(new PrintWriter(sw, true)); + String str = sw.toString(); + LogsTool.erroLogs("邮件ID为:"+mailid+"邮件发送异常!"+str); + }finally{ + try { + //更新邮件状态 + //循环完成后判断此邮件是否为已发 + boolean ishave=sendmailservice.isHaveAddress(mailid); + if(ishave){//还有 + sendmailservice.updateMailStatus(0,mailid,mailuid); + }else{//没有了 + sendmailservice.updateMailStatus(1,mailid,mailuid); + } + } catch (Exception e2) { + //写入日志 + StringWriter sw = new StringWriter(); + e2.printStackTrace(new PrintWriter(sw, true)); + String str = sw.toString(); + LogsTool.erroLogs("邮件发送方法异常!"+str); + } + } + } + + + /**根据传入的文件路径创建附件并返回*/ + public MimeBodyPart createAttachment(String filepath,String fileName) throws Exception { + MimeBodyPart attachmentPart = new MimeBodyPart(); + FileDataSource fds = new FileDataSource(filepath); + attachmentPart.setDataHandler(new DataHandler(fds)); + attachmentPart.setFileName(MimeUtility.encodeText(fileName,"UTF-8","B")); + return attachmentPart; + } + + /**根据传入的邮件正文body和文件路径创建图文并茂的正文部分 */ + public MimeBodyPart createContent(String body,String fileName) + throws Exception { + // 用于保存最终正文部分 + MimeBodyPart contentBody = new MimeBodyPart(); + // 用于组合文本和图片,"related"型的MimeMultipart对象 + MimeMultipart contentMulti = new MimeMultipart("related"); + //MimeMultipart contentMulti = new MimeMultipart("alternative"); + + + // 正文的文本部分 + MimeBodyPart textBody = new MimeBodyPart(); + textBody.setContent(body, "text/html;charset=UTF-8"); + textBody.setHeader("Content-Transfer-Encoding", "quoted-printable"); + contentMulti.addBodyPart(textBody); + +// // 正文的plain文本部分 +// MimeBodyPart textBody2 = new MimeBodyPart(); +// String newbody = body.replaceAll("</?[^>]+>", ""); +// textBody2.setContent(newbody, "text/plain;charset=UTF-8"); +// textBody2.setHeader("Content-Transfer-Encoding", "base64"); +// contentMulti.addBodyPart(textBody2); + + //图片部分 + if(!fileName.equals("")){ + String[] picpath=fileName.split(","); + for(int i=1;i<picpath.length+1;i++){ + if(!picpath[i-1].equals("")){ + //正文的图片部分 + MimeBodyPart jpgBody = new MimeBodyPart(); + FileDataSource fds = new FileDataSource(picpath[i-1]); + jpgBody.setDataHandler(new DataHandler(fds)); + jpgBody.setContentID("<IMG"+i+">"); + contentMulti.addBodyPart(jpgBody); + } + } + } + // 将上面"related"型的 MimeMultipart 对象作为邮件的正文 + contentBody.setContent(contentMulti); + return contentBody; + } + + //替换跟踪信息 + private String rebuildOriginalMail(String body, String to_mail, + String mail_uid, int user_id, int company_id) throws Exception { + Document doc = Jsoup.parse(body); + Elements elements = doc.select("a[ywx-mark-track=true]"); + if (elements.size() > 0) { + Set<String> set = new HashSet<String>(); + String href = null; + String url = null; + for (Element element : elements) { + href = element.attr("href"); + if (href != null && !href.trim().isEmpty()) { + set.add(href.trim() + "@espeed@" + element.text()); + } + } + if (set.size() > 0) { + String[] hres = null; + for (String hre : set) { + hres = hre.split("@espeed@"); + url = ConfigPath.getTrackUrl() + "/chain.jsp?ywxType=3&ywxUid=" + + user_id + "&ywxCid=" + company_id + "&ywxMid=" + + mail_uid + "&ywxMail=" + to_mail + "&ywxTo=" + + URLEncoder.encode(hres[0], "UTF-8"); + if (hres.length > 1) { + url += "&ywxTitle=" + URLEncoder.encode(hres[1], "UTF-8"); + } + //body = body.replace(hres[0], url); + body = body.replace("<a href=\""+hres[0]+"\"", "<a href=\""+url+"\""); + } + } + } + return body; + } +} diff --git b/src/com/espeed/yxy/mail/YxysendMethod.java a/src/com/espeed/yxy/mail/YxysendMethod.java new file mode 100644 index 0000000..839a3fb --- /dev/null +++ a/src/com/espeed/yxy/mail/YxysendMethod.java @@ -0,0 +1,587 @@ +package com.espeed.yxy.mail; + +import java.io.PrintWriter; +import java.io.StringWriter; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Properties; +import javax.mail.Transport; +import com.espeed.yxy.pojo.YxySendMailDetail; +import com.espeed.yxy.pojo.YxySendMailMaster; +import com.espeed.yxy.pojo.YxySendSmtpInfo; +import com.espeed.yxy.pojo.YxySmtpSendSelfOverset; +import com.espeed.yxy.pojo.YxySmtpSendSelfSet; +import com.espeed.yxy.pojo.YxySmtpSendSet; +import com.espeed.yxy.pojo.YxySmtpSuffixSet; +import com.espeed.yxy.service.YxySendMailService; +import com.espeed.yxy.timer.SendMailTimer; +import com.espeed.yxy.tool.DES_Encrypt; +import com.espeed.yxy.tool.DateFormat; +import com.espeed.yxy.tool.LogsTool; +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 发送邮件之前的判断(营销游) + * 开始时间: 2013.12.09 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +public class YxysendMethod { + //private static Properties props =null; + //private static Transport transport =null; + /**参数说明(1:service层接口,2:smtp服务器,3:邮件信息,4:smtp后缀信息,5:smtp后缀发送量信息)*/ + public static void sendMethodImpl(YxySendMailService YxySendMailService,YxySendSmtpInfo SmtpInfo,YxySendMailMaster mailinfo){ + //public static void sendMethodImpl(YxySendMailService YxySendMailService,YxySendSmtpInfo SmtpInfo,YxySendMailMaster mailinfo,List<YxySmtpSuffixSet> smtpsuffixsetList){ + try{ + //获取当前时间 + SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String nowDate=sdf1.format(new Date()); + //邮件ID + int mailid=mailinfo.getSend_mail_id(); + //SMTPID + int smtpid=SmtpInfo.getSmtp_service_id(); + //int isyxy=SmtpInfo.getSmtp_service_isyxy();//是自配还是运营 + //判断是自配smtp还是运营smtp +// if(isyxy==0){//自配 +// //更新smtp状态 +// YxySendMailService.updateSmtpUseStatus(1,smtpid,""); +// +// //更新待发邮件为已使用中 +// YxySendMailService.updateMailUseStatus(mailid,1,nowDate); +// +// //自配smtp发送方法 +// selfSmtpMethod(YxySendMailService,SmtpInfo,mailinfo); +// +// //发送完后将smtp状态改回可用,且使用时间修改为当前时间 +// YxySendMailService.updateSmtpUseStatus(0,smtpid,nowDate); +// +// //发送完后将待发邮件状态改回未使用 +// YxySendMailService.updateMailUseStatus(mailid,0,nowDate); +// }else{//运营 + try { + synchronized (SendMailTimer.nowtimer) { + //更新smtp状态 + YxySendMailService.updateSmtpUseStatus(1,smtpid,""); + //更新待发邮件为已使用中 + YxySendMailService.updateMailUseStatus(mailid,1,nowDate); + } + //调用方法 + yxySmtpMethod(YxySendMailService,SmtpInfo,mailinfo); + //yxySmtpMethod(YxySendMailService,SmtpInfo,mailinfo,smtpsuffixsetList); + synchronized (SendMailTimer.nowtimer) { + //发送完后将smtp状态改回可用,且使用时间修改为当前时间 + YxySendMailService.updateSmtpUseStatus(0,smtpid,nowDate); + //发送完后将待发邮件状态改回未使用 + YxySendMailService.updateMailUseStatus(mailid,0,nowDate); + } + } catch (Exception e) { + e.printStackTrace(); + //写入日志 + StringWriter sw = new StringWriter(); + e.printStackTrace(new PrintWriter(sw, true)); + String str = sw.toString(); + LogsTool.erroLogs(str); + //更新此邮件异常量 + YxySendMailService.updateMailExpStatus(mailid,mailinfo.getExptionnum()+1); + } + //} + }catch (Exception e) { + e.printStackTrace(); + System.out.println("sendMethodImpl方法加载异常!"); + //写入日志 + StringWriter sw = new StringWriter(); + e.printStackTrace(new PrintWriter(sw, true)); + String str = sw.toString(); + LogsTool.erroLogs(str); + } + } + + + /**自配运行方法*/ + public static void selfSmtpMethod(YxySendMailService YxySendMailService,YxySendSmtpInfo SmtpInfo,YxySendMailMaster mailinfo){ + try { + //邮件ID + int mailid=mailinfo.getSend_mail_id(); + //邮件UID + String mailuid=mailinfo.getMail_uid(); + //验证SMTP + List<Object> isTong=connectionService(SmtpInfo.getSmtp_service_number(),SmtpInfo.getSmtp_service_account(),SmtpInfo.getSmtp_service_password(),SmtpInfo.getSmtp_is_ssl(),SmtpInfo.getSmtp_service_port()); + + //判断是否验证通过 + if(isTong.get(0).toString().equals("1")){ + Properties props =(Properties) isTong.get(1); + Transport transport =(Transport) isTong.get(2); + //通过获取的待发邮件ID来获取该封邮件的待发地址 + int MastermailId=mailinfo.getSend_mail_id();//该封邮件主ID + List<YxySendMailDetail> addressList=YxySendMailService.findAddressByMailID(MastermailId);//待发邮件对应的地址 + + if(addressList.size()<=0){ + System.out.println("没有待发地址了..结束后续工作"); + //将该邮件状态改为已发送 + YxySendMailService.updateMailStatus(1,mailid,mailuid); + }else{ + //-------定义变量------------------ + //获取当前时间 + SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String currDate=sdf1.format(new Date()); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + String nowDay=sdf.format(new Date()); + + String smtpaccount=SmtpInfo.getSmtp_service_account();//smtp账号 + String smtphost=SmtpInfo.getSmtp_service_number();//SMTP服务器 + int selftenNum=0;//十分钟最大发信量 + int selfhourNum=0;//60分钟最大发信量 + int selfdayNum=0;//一天最大发信量 + + int selftenNumOver=0;//十分钟已发信量 + int selfhourNumOver=0;//60分钟已发信量 + int selfdayNumOver=0;//一天已发信量 + + boolean tenisok=false;//10分钟是否通过 + boolean hourisok=false;//60分钟是否通过 + boolean dayisok=false;//一天是否通过 + + int selftenNumSurplus=0;//十分钟剩余发信量 + int selfhourNumSurplus=0;//60分钟剩余发信量 + int selfdayNumSurplus=0;//一天剩余发信量 + //1.获取自配smtp发送量限制 + List<YxySmtpSendSelfSet> smtpselfsendsetList=YxySendMailService.findSendSelfSetByService(smtphost); + + if(smtpselfsendsetList.size()>=2){//说明有控制量限制(包含默认的和自己配的) + if(!smtpselfsendsetList.get(0).getSmtp_send_self_set_account().equals("domain")){//自配量 + selftenNum=smtpselfsendsetList.get(0).getSmtp_send_self_set_tennum();//十分钟最大发信量 + selfhourNum=smtpselfsendsetList.get(0).getSmtp_send_self_set_hournum();//60分钟最大发信量 + selfdayNum=smtpselfsendsetList.get(0).getSmtp_send_self_set_daynum();//一小时最大发信量 + }else{//domain默认设置信息 + selftenNum=smtpselfsendsetList.get(1).getSmtp_send_self_set_tennum();//十分钟最大发信量 + selfhourNum=smtpselfsendsetList.get(1).getSmtp_send_self_set_hournum();//60分钟最大发信量 + selfdayNum=smtpselfsendsetList.get(1).getSmtp_send_self_set_daynum();//一小时最大发信量 + } + }else{//默认的 + selftenNum=smtpselfsendsetList.get(0).getSmtp_send_self_set_tennum();//十分钟最大发信量 + selfhourNum=smtpselfsendsetList.get(0).getSmtp_send_self_set_hournum();//60分钟最大发信量 + selfdayNum=smtpselfsendsetList.get(0).getSmtp_send_self_set_daynum();//一小时最大发信量 + } + //2.获取自配smtp已发送量 + List<YxySmtpSendSelfOverset> smtpsendsetoverList=YxySendMailService.findBySmtpAccount(smtpaccount); + if(smtpsendsetoverList.size()>0){//说明已存在发送量记录 + //判断是不是当天的记录 + String nowsend=smtpsendsetoverList.get(0).getSmtp_send_self_over_daydate(); + if(nowDay.equals(nowsend)){//说明是当天的记录 + //已发量 + selftenNumOver=smtpsendsetoverList.get(0).getSmtp_send_self_over_tennum(); + selfhourNumOver=smtpsendsetoverList.get(0).getSmtp_send_self_over_hournum(); + selfdayNumOver=smtpsendsetoverList.get(0).getSmtp_send_self_over_daynum(); + + //判断是否在某段时间内发送量是否满足 + //1.10分钟内判断*/ + if(DateFormat.minute1s(smtpsendsetoverList.get(0).getSmtp_send_self_over_tendate(),currDate)<10){//在此时间段内 + if(selftenNumOver>=selftenNum){//已发量大于限定量则不能发 + tenisok=false; + }else{ + tenisok=true; + } + }else{//不在此时间段内 + selftenNumOver=0; + tenisok=true; + //更新此smtp十分钟为0 + smtpsendsetoverList.get(0).setSmtp_send_self_over_tennum(0); + } + + //60分钟内判断 + if(DateFormat.minute1s(smtpsendsetoverList.get(0).getSmtp_send_self_over_hourdate(),currDate)<60){//在此时间段内 + if(selfhourNumOver>=selfhourNum){//已发量大于限定量则不能发 + hourisok=false; + }else{ + hourisok=true; + } + }else{//不在此时间段内 + selfhourNumOver=0; + hourisok=true; + //更新此smtp60分钟为0 + smtpsendsetoverList.get(0).setSmtp_send_self_over_hournum(0); + } + + //一天内判断 + if(smtpsendsetoverList.get(0).getSmtp_send_self_over_daydate().equals(nowDay)){//是否在当天 + if(selfdayNumOver>=selfdayNum){//已发量大于限定量则不能发 + dayisok=false; + }else{ + dayisok=true; + } + }else{//不在此时间段内 + selfdayNumOver=0; + dayisok=true; + //更新此smtp一天数为0 + smtpsendsetoverList.get(0).setSmtp_send_self_over_daynum(0); + } + //YxySendMailService.updateSendSelfSet(smtpsendsetoverList.get(0)); + } + }else{//不存在发送记录则添加一条 + YxySmtpSendSelfOverset o=new YxySmtpSendSelfOverset(); + o.setSmtp_send_self_over_account(smtpaccount);//smtp账号 + o.setSmtp_send_self_over_tendate(currDate); + o.setSmtp_send_self_over_hourdate(currDate); + o.setSmtp_send_self_over_daydate(nowDay); + //添加自配设置信息 + YxySendMailService.addSendSelfSet(o); + tenisok=true; + hourisok=true; + dayisok=true; + } + if(tenisok&&hourisok&&dayisok){//如果发送量都已通过检测则调用发送程序 + //获取剩余量 + selftenNumSurplus=selftenNum-selftenNumOver;//十分钟剩余发信量 + selfhourNumSurplus=selfhourNum-selfhourNumOver;//60分钟剩余发信量 + selfdayNumSurplus=selfdayNum-selfdayNumOver;//一天剩余发信量 + int minNum=0;//最小值 + //三个时间内取最小值(此账号最多能发的量) + if(selftenNumSurplus<selfhourNumSurplus&&selftenNumSurplus<selfdayNumSurplus){ + minNum=selftenNumSurplus; + }else if(selfhourNumSurplus<selftenNumSurplus&&selfhourNumSurplus<selfdayNumSurplus){ + minNum=selfhourNumSurplus; + }else if(selfdayNumSurplus<selftenNumSurplus&&selfdayNumSurplus<selfhourNumSurplus){ + minNum=selfdayNumSurplus; + } + //调用发送方法 + YxySendMail send=new YxySendMail(); + //取固定量的地址 + int sendSuccessNum=0; + if(minNum>addressList.size()){ + //调用发邮件方法 + send.sendMailMethod(addressList,YxySendMailService,SmtpInfo,mailinfo,props,transport); + }else{ + List<YxySendMailDetail> minaddressList=new ArrayList<YxySendMailDetail>(); + for(int j=0;j<minNum;j++){ + minaddressList.add(addressList.get(j)); + } + //调用发邮件方法,返回成功量 + send.sendMailMethod(minaddressList,YxySendMailService,SmtpInfo,mailinfo,props,transport); + } + if(sendSuccessNum>0){ + //更新自配smtp发送量 + smtpsendsetoverList.get(0).setSmtp_send_self_over_daydate(nowDay); + smtpsendsetoverList.get(0).setSmtp_send_self_over_daynum(selfdayNumOver+sendSuccessNum); + smtpsendsetoverList.get(0).setSmtp_send_self_over_hourdate(currDate); + smtpsendsetoverList.get(0).setSmtp_send_self_over_hournum(selfhourNumOver+sendSuccessNum); + smtpsendsetoverList.get(0).setSmtp_send_self_over_tendate(currDate); + smtpsendsetoverList.get(0).setSmtp_send_self_over_tennum(selftenNumOver+sendSuccessNum); + //更新已发量 + YxySendMailService.updateSendSelfSet(smtpsendsetoverList.get(0)); + } + + + }else{//未通过检测 + System.out.println("发送量超标了"); + } + } + } + } catch (Exception e) { + e.printStackTrace(); + //写入日志 + StringWriter sw = new StringWriter(); + e.printStackTrace(new PrintWriter(sw, true)); + String str = sw.toString(); + LogsTool.erroLogs(str); + } + + + + } + /**运营运行方法*/ + //public static void yxySmtpMethod(YxySendMailService YxySendMailService,YxySendSmtpInfo SmtpInfo,YxySendMailMaster mailinfo,List<YxySmtpSuffixSet> smtpsuffixsetList){ + public static void yxySmtpMethod(YxySendMailService YxySendMailService,YxySendSmtpInfo SmtpInfo,YxySendMailMaster mailinfo){ + try { + ///定义变量------------------ + //1.此为没有设置的后缀地址集合 +// List<YxySendMailDetail> nohouzhui=new ArrayList<YxySendMailDetail>(); +// //2.保存有设置的后缀 +// List<YxySendMailDetail> havehouzhui=new ArrayList<YxySendMailDetail>(); +// //3.保存能发的后缀地址集合 +// List<YxySendMailDetail> sendAddress=new ArrayList<YxySendMailDetail>(); + //5.获取当前时间 +// SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); +// String currDate=sdf1.format(new Date()); +// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); +// String nowDay=sdf.format(new Date()); + //邮件ID + int mailid=mailinfo.getSend_mail_id(); + //邮件唯一码 + String mailuid=mailinfo.getMail_uid(); + //smtp相关信息 + String smtpService=SmtpInfo.getSmtp_service_number();//smtp服务器 + //通过获取的待发邮件ID来获取该封邮件的待发地址(未包含异常邮件) + int MastermailId=mailinfo.getSend_mail_id();//该封邮件主ID + List<YxySendMailDetail> addressList=YxySendMailService.findAddressByMailID(MastermailId);//待发邮件对应的地址 + if(addressList.size()<=0){ + //将该邮件状态改为已发送 + YxySendMailService.updateMailStatus(1,mailid,mailuid); + System.out.println("邮件:"+MastermailId+"整理后没有待发地址!!!"); + }else{ + //是否SSL加密 + int isssl=SmtpInfo.getSmtp_is_ssl(); + //端口号 + String port=SmtpInfo.getSmtp_service_port(); + //验证SMTP是否通过 + List<Object> isTong=connectionService(smtpService,SmtpInfo.getSmtp_service_account(),SmtpInfo.getSmtp_service_password(),isssl,port); + if(isTong.get(0).toString().equals("1")){ + Properties props =(Properties) isTong.get(1); + Transport transport =(Transport) isTong.get(2); + //调用发邮件方法 + YxySendMail send=new YxySendMail(); + send.sendMailMethod(addressList,YxySendMailService,SmtpInfo,mailinfo,props,transport); +// //获取后缀已发送量信息 +// List<YxySmtpSendSet> smtpsendsetList=YxySendMailService.findAllSmtpSendSet(smtpService,nowDay); +// //如果没有数据则说明是新的一天了(删除以前的信息) +// if(smtpsendsetList.size()==0){ +// YxySendMailService.delmSmtpSet(smtpService); +// } +// //循环判断该地址的后缀属于哪个smtp统计出来 +// for(int i=0;i<addressList.size();i++){ +// int gs=0; +// our:for(int j=0;j<smtpsuffixsetList.size();j++){ +// //每个地址判断是否属于后缀类别中的一个 +// if(addressList.get(i).getEmail_suffix().equals(smtpsuffixsetList.get(j).getSmtp_suffix_name())){ +// havehouzhui.add(addressList.get(i)); +// gs++; +// break our; +// } +// } +// if(gs==0){ +// nohouzhui.add(addressList.get(i)); +// } +// } +// +// int tensendNum=0;//10分钟最大发送数 +// int hoursendNum=0;//60分钟最大发送数 +// int daysendNum=0;//1天最大发送数 +// +// int tensendNumOver=0;//10分钟已发送数 +// int hoursendNumOver=0;//60分钟已发送数 +// int daysendNumOver=0;//1天已发送数 +// +// String addrSuffix="";//地址后缀 +// String smtpsetSuffix="";//smtp设置后缀 +// +// boolean tenisok=false;//10分钟是否通过 +// boolean hourisok=false;//60分钟是否通过 +// boolean dayisok=false;//一天是否通过 +// +// //调用发送方法 +// YxySendMail send=new YxySendMail(); +// for(int i=0;i<2;i++){ +// //当i=0时表示该地址没有在设置值中直接发送 +// if(i==0){ +// if(nohouzhui.size()==0){ +// System.out.println("未后缀设置的没有地址"); +// continue; +// }else{ +// //没后缀的地址使用默认后缀控制参数(domain) +// send.sendMailMethod(nohouzhui,YxySendMailService,SmtpInfo,mailinfo,props,transport);/**调用发邮件方法*/ +// } +// } +// //否则表示有设置值的后缀 +// if(i==1){ +// //判断是否还存在地址 +// if(havehouzhui.size()==0){ +// System.out.println("后缀集合中没有待发地址了!!!"); +// }else{ +// //循环判断该地址后缀是否还能发送 +// address:for(int m=0;m<havehouzhui.size();m++){ +// //1.获取该地址后缀发送最大量 +// suffix:for(int f=0;f<smtpsuffixsetList.size();f++){ +// addrSuffix=smtpsuffixsetList.get(f).getSmtp_suffix_name();//系统设定的后缀名 +// //for(int j=0;j<havehouzhui.size();j++){ +// if(havehouzhui.get(m).getEmail_suffix().equals(addrSuffix)){ +// tensendNum=smtpsuffixsetList.get(f).getSmtp_suffix_ten();//10分钟最大发送量 +// hoursendNum=smtpsuffixsetList.get(f).getSmtp_suffix_hour();//60分钟最大发送量 +// daysendNum=smtpsuffixsetList.get(f).getSmtp_suffix_day();//一天最大发送量 +// break suffix; +// } +// } +// boolean isexist=false; +// addrSuffix=havehouzhui.get(m).getEmail_suffix();//地址后缀赋值 +// //循环后缀发送量 +// smtpset:for(int s=0;s<smtpsendsetList.size();s++){ +// //判断该地址后缀是否在设置中存在 +// smtpsetSuffix=smtpsendsetList.get(s).getSmtp_send_set_suffix();//smtp设置后缀 +// if(addrSuffix.equals(smtpsetSuffix)){//存在 +// //如果存在则查出各个时间段的已发送量 +// tensendNumOver=smtpsendsetList.get(s).getSmtp_send_set_tennum();//10分钟已发送数 +// hoursendNumOver=smtpsendsetList.get(s).getSmtp_send_set_hournum();//60分钟已发送数 +// daysendNumOver=smtpsendsetList.get(s).getSmtp_send_set_daynum();//1天已发送数 +// isexist=true; +// +// //判断该地址的已发量与设定量是否通过 +// //1.当前时间与最后一次发送时间判断是否是在10分钟内 +// if(DateFormat.minute1s(smtpsendsetList.get(s).getSmtp_send_set_tendate(),currDate)<10){ +// //在此10分钟内,判断是否能发 +// if(tensendNumOver>=tensendNum){ +// System.out.println("十分钟之内无法发送了"); +// //此地址无法发送 +// tenisok=false; +// continue address; +// }else{ +// tenisok=true; +// } +// }else{ +// tenisok=true; +// //更新此smtp10分钟为0 +// smtpsendsetList.get(s).setSmtp_send_set_tennum(0); +// smtpsendsetList.get(s).setSmtp_send_set_tendate(currDate); +// } +// //2.当前时间与最后一次发送时间判断是否是在60分钟内 +// if(DateFormat.minute1s(smtpsendsetList.get(s).getSmtp_send_set_hourdate(),currDate)<60){ +// if(hoursendNumOver>hoursendNum){ +// System.out.println("60分钟之内无法发送了"); +// hourisok=false; +// //此地址无法发送 +// continue address; +// }else{ +// hourisok=true; +// } +// }else{ +// hourisok=true; +// //更新此smtp60分钟为0 +// smtpsendsetList.get(s).setSmtp_send_set_hournum(0); +// smtpsendsetList.get(s).setSmtp_send_set_hourdate(currDate); +// } +// //3.当前时间与最后一次发送时间判断是否是在一天内 +// if(DateFormat.minute1s(smtpsendsetList.get(s).getSmtp_send_set_daydate()+" 00:00:00",currDate)<1440){ +// if(daysendNumOver>daysendNum){ +// System.out.println("一天之内无法发送了"); +// dayisok=false; +// //此地址无法发送 +// continue address; +// }else{ +// dayisok=true; +// } +// }else{ +// //更新此一天为0 +// dayisok=true; +// smtpsendsetList.get(s).setSmtp_send_set_daynum(0); +// smtpsendsetList.get(s).setSmtp_send_set_daydate(currDate); +// } +// //是否都符合 +// if(tenisok&&hourisok&&dayisok){ +// sendAddress.add(havehouzhui.get(m));/**都符合将待发地址加入到可发地址集合中*/ +// /**在该后缀信息上累加1*/ +// smtpsendsetList.get(s).setSmtp_send_set_tennum(smtpsendsetList.get(s).getSmtp_send_set_tennum()+1); +// smtpsendsetList.get(s).setSmtp_send_set_hournum(smtpsendsetList.get(s).getSmtp_send_set_hournum()+1); +// smtpsendsetList.get(s).setSmtp_send_set_daynum(smtpsendsetList.get(s).getSmtp_send_set_daynum()+1); +// +// /**更新后缀已发量记录*/ +// smtpsendsetList.set(s,smtpsendsetList.get(s)); +// +// continue address; +// }else{ +// break smtpset; +// } +// } +// } +// /**循环完后未存在的则新建一条*/ +// if(!isexist){ +// /**添加该后缀的配置信息*/ +// YxySmtpSendSet o=new YxySmtpSendSet(); +// o.setSmtp_send_set_service(smtpService); +// o.setSmtp_send_set_suffix(addrSuffix); +// o.setSmtp_send_set_tendate(currDate); +// o.setSmtp_send_set_hourdate(currDate); +// o.setSmtp_send_set_daydate(nowDay); +// o.setSmtp_send_set_daynum(1); +// o.setSmtp_send_set_hournum(1); +// o.setSmtp_send_set_tennum(1); +// /**将新的后缀量加入集合中*/ +// smtpsendsetList.add(o); +// +// +// sendAddress.add(havehouzhui.get(m)); +// +// } +// } +// //更新各个后缀信息的发送量 +// synchronized (SendMailTimer.nowtimer) { +// YxySendMailService.updateSmtpSet(smtpsendsetList); +// } +// if(sendAddress.size()>0){ +// //调用发邮件方法 +// send.sendMailMethod(sendAddress,YxySendMailService,SmtpInfo,mailinfo,props,transport); +// } +// } +// +// } +// } + }else{ + System.out.println("服务器:"+SmtpInfo.getSmtp_service_id()+"验证不通过"); + } + } + + } catch (Exception e) { + e.printStackTrace(); + //写入日志 + StringWriter sw = new StringWriter(); + e.printStackTrace(new PrintWriter(sw, true)); + String str = sw.toString(); + LogsTool.erroLogs(str); + } + } + + + /** 连接邮件服务器,验证用户名,密码*/ + public static List<Object> connectionService(String host,String servername,String serverpaswd,int isssl,String port) { + List<Object> result=new ArrayList<Object>(); + result.add(0); + result.add(0); + result.add(0); + + Properties props =new Properties(); + Transport transport =null; + + props.put("mail.smtp.host", host); + props.put("mail.smtp.auth", "true");/** 设定发送邮件时需要进行身份验证*/ + javax.mail.Session mailSession = javax.mail.Session.getInstance(props); + mailSession.setDebug(false); + //判断是否需要ssl验证 + String ishost=host.split("\\.")[1]; + if(isssl==1){ + if("gmail".equals(ishost)){ + props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory"); + props.put("mail.smtp.socketFactory.fallback", "false"); + props.put("mail.smtp.port", port); + props.put("mail.smtp.socketFactory.port", port); + }else{ + props.put("mail.smtp.starttls.enable","true"); + props.put("mail.smtp.port", port); + } + } + try { + //解密密码 + DES_Encrypt desEncrypt = new DES_Encrypt(); + desEncrypt.setKey("06"); + desEncrypt.setDesString(serverpaswd); + serverpaswd=desEncrypt.getStrM();//smtp密码需要解密 + + transport = mailSession.getTransport("smtp"); + transport.connect(host, servername, serverpaswd); + + result.set(0, 1); + result.set(1, props); + result.set(2, transport); + } catch (Exception e) { + //写入日志 + StringWriter sw = new StringWriter(); + e.printStackTrace(new PrintWriter(sw, true)); + String str = sw.toString(); + LogsTool.erroLogs("服务器:"+host+","+servername+","+str); + //e.printStackTrace(); + System.out.println("验证失败"); + } + return result; + } +} diff --git b/src/com/espeed/yxy/mail/YxythreadWork.java a/src/com/espeed/yxy/mail/YxythreadWork.java new file mode 100644 index 0000000..04be6c5 --- /dev/null +++ a/src/com/espeed/yxy/mail/YxythreadWork.java @@ -0,0 +1,96 @@ +package com.espeed.yxy.mail; + +import java.io.Serializable; +import java.util.List; +import java.util.concurrent.ArrayBlockingQueue; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; + +import com.espeed.yxy.pojo.YxySendMailMaster; +import com.espeed.yxy.pojo.YxySendSmtpInfo; +import com.espeed.yxy.pojo.YxySmtpSendSet; +import com.espeed.yxy.pojo.YxySmtpSuffixSet; +import com.espeed.yxy.service.YxySendMailService; +import com.espeed.yxy.tool.GetRondom; +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 发送邮件线程池创建(营销游) + * 开始时间: 2013.12.09 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +public class YxythreadWork implements Runnable,Serializable{ + private static ThreadPoolExecutor threadPool=null; + private static YxythreadWork yxythreadwork=null; + private YxySendMailService YxySendMailService;//service + private YxySendSmtpInfo SmtpInfo;//smtp服务器 + private YxySendMailMaster mailinfo;//邮件信息 + private List<YxySmtpSuffixSet> smtpsuffixsetList;//后缀信息 + /**无参构造方法*/ + YxythreadWork(){ + + } + /**参数传递*/ + YxythreadWork(YxySendMailService YxySendMailService,YxySendSmtpInfo SmtpInfo,YxySendMailMaster mailinfo,List<YxySmtpSuffixSet> smtpsuffixsetList){ + this.YxySendMailService=YxySendMailService; + this.SmtpInfo=SmtpInfo; + this.mailinfo=mailinfo; + this.smtpsuffixsetList=smtpsuffixsetList; + } + + /**单例方法*/ + public static YxythreadWork getMethodInstance(){ + if(yxythreadwork==null){ + yxythreadwork=new YxythreadWork(); + } + return yxythreadwork; + } + + /**线程池*/ + public static ThreadPoolExecutor getInstance(int bigThread){ + threadPool=new ThreadPoolExecutor(bigThread,bigThread+2,100, + TimeUnit.SECONDS,new ArrayBlockingQueue(4000), + new ThreadPoolExecutor.DiscardOldestPolicy()); + return threadPool; + } + + /**线程池任务*/ + public void getResult(YxySendMailService YxySendMailService,List<YxySendSmtpInfo> SmtpInfoList,List<YxySendMailMaster> mailinfoList,List<YxySmtpSuffixSet> smtpsuffixsetList,int bigThread) { + threadPool=getInstance(bigThread); + for(int i=0;i<mailinfoList.size();i++){ + try { + threadPool.execute(new YxythreadWork(YxySendMailService,SmtpInfoList.get(i),mailinfoList.get(i),smtpsuffixsetList)); + + } catch (Exception e) { + System.out.println("加入新线程失败!"); + } + } + + } + + //获取线程量 + public int getThreadNum(){ + return threadPool.getActiveCount(); + } + + /**线程处理方法*/ + public void run(){ + try { + //调用发邮件方法 + //YxysendMethod.sendMethodImpl(YxySendMailService, SmtpInfo,mailinfo,smtpsuffixsetList); + } catch (Exception e) { + System.out.println("线程调用方法有问题!"); + } + + //此线程任务完成后重新获取线程池的数量 + synchronized (this) { + threadPool.shutdown(); + } + } +} + diff --git b/src/com/espeed/yxy/pojo/YxyMailStencil.java a/src/com/espeed/yxy/pojo/YxyMailStencil.java new file mode 100644 index 0000000..7357e39 --- /dev/null +++ a/src/com/espeed/yxy/pojo/YxyMailStencil.java @@ -0,0 +1,89 @@ +package com.espeed.yxy.pojo; + +import java.io.Serializable; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; + +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 模版 + * 开始时间: 2013.12.09 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ + +@Entity +@Table(name="yxy_mail_stencil") +public class YxyMailStencil implements Serializable{ + + private int stencil_id;//ID + private String stencil_name;//模版名称 + private String stencil_body;//模版内容 + private int stencil_type;//模版类别ID + private int stencil_level;//模版等级(系统级1,企业级2,用户级3) + private String stencil_time;//时间 + private String stencil_loginid;//账号 + private String stencil_domain;//域名 + + @Id + @GeneratedValue(strategy=GenerationType.AUTO) + public int getStencil_id() { + return stencil_id; + } + public void setStencil_id(int stencilId) { + stencil_id = stencilId; + } + public String getStencil_name() { + return stencil_name; + } + public void setStencil_name(String stencilName) { + stencil_name = stencilName; + } + public String getStencil_body() { + return stencil_body; + } + public void setStencil_body(String stencilBody) { + stencil_body = stencilBody; + } + public int getStencil_type() { + return stencil_type; + } + public void setStencil_type(int stencilType) { + stencil_type = stencilType; + } + public int getStencil_level() { + return stencil_level; + } + public void setStencil_level(int stencilLevel) { + stencil_level = stencilLevel; + } + public String getStencil_time() { + return stencil_time; + } + public void setStencil_time(String stencilTime) { + stencil_time = stencilTime; + } + public String getStencil_loginid() { + return stencil_loginid; + } + public void setStencil_loginid(String stencilLoginid) { + stencil_loginid = stencilLoginid; + } + public String getStencil_domain() { + return stencil_domain; + } + public void setStencil_domain(String stencilDomain) { + stencil_domain = stencilDomain; + } + + +} diff --git b/src/com/espeed/yxy/pojo/YxyMarketingPlan.java a/src/com/espeed/yxy/pojo/YxyMarketingPlan.java new file mode 100644 index 0000000..60de058 --- /dev/null +++ a/src/com/espeed/yxy/pojo/YxyMarketingPlan.java @@ -0,0 +1,142 @@ +package com.espeed.yxy.pojo; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +import javax.persistence.CascadeType; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToMany; +import javax.persistence.Table; + +@Entity +@Table(name="yxy_marketing_plan") +public class YxyMarketingPlan implements Serializable{ + private static final long serialVersionUID = 1L; + private int plan_id; + private String plan_title;//计划说明或主题 + private int plan_type;//计划类型 + private int plan_cycle;//计划周期 + private String plan_createtime;//建立时间 + private String plan_executetime;//执行时间 + private String plan_begintime;//开始时间 + private String plan_endtime;//结束时间 + private int plan_groupid;//计划地址分组 + private String loginid;//账号 + private String domain;//域名 + private int plan_status;//计划状态(0:未执行,1:已执行,-1:正在执行) + /**0:本地库, + * 1:客户分类未超标,2:客户分类已超标 + * 3:客户状态未超标,4:客户状态已超标 + * 5:客户来源未超标,6:客户来源已超标 + * 7:意向产品未超标,8:意向产品已超标 + * 9:采购偏好未超标,10:采购偏好已超标 + * 11:个性营销未超标,12:个性营销已超标 + */ + private Integer plan_differen; + private String other_name;//针对于采购偏好或个性营销邮的名称 + + private List<YxyMarketingWeek> weeklist=new ArrayList<YxyMarketingWeek>(); + @Id + @GeneratedValue(strategy=GenerationType.AUTO) + public int getPlan_id() { + return plan_id; + } + public void setPlan_id(int planId) { + plan_id = planId; + } + public int getPlan_type() { + return plan_type; + } + public void setPlan_type(int planType) { + plan_type = planType; + } + public int getPlan_cycle() { + return plan_cycle; + } + public void setPlan_cycle(int planCycle) { + plan_cycle = planCycle; + } + + public String getPlan_createtime() { + return plan_createtime; + } + public void setPlan_createtime(String planCreatetime) { + plan_createtime = planCreatetime; + } + public String getPlan_executetime() { + return plan_executetime; + } + public void setPlan_executetime(String planExecutetime) { + plan_executetime = planExecutetime; + } + public String getPlan_begintime() { + return plan_begintime; + } + public void setPlan_begintime(String planBegintime) { + plan_begintime = planBegintime; + } + public String getPlan_endtime() { + return plan_endtime; + } + public void setPlan_endtime(String planEndtime) { + plan_endtime = planEndtime; + } + public int getPlan_groupid() { + return plan_groupid; + } + public void setPlan_groupid(int planGroupid) { + plan_groupid = planGroupid; + } + public String getLoginid() { + return loginid; + } + public void setLoginid(String loginid) { + this.loginid = loginid; + } + public String getDomain() { + return domain; + } + public void setDomain(String domain) { + this.domain = domain; + } + public String getPlan_title() { + return plan_title; + } + public void setPlan_title(String planTitle) { + plan_title = planTitle; + } + public int getPlan_status() { + return plan_status; + } + public void setPlan_status(int planStatus) { + plan_status = planStatus; + } + + @OneToMany(cascade = CascadeType.REFRESH, fetch = FetchType.EAGER) + @JoinColumn(name="plan_id",updatable = false,insertable=false) + public List<YxyMarketingWeek> getWeeklist() { + return weeklist; + } + public void setWeeklist(List<YxyMarketingWeek> weeklist) { + this.weeklist = weeklist; + } + + public Integer getPlan_differen() { + return plan_differen; + } + public void setPlan_differen(Integer plan_differen) { + this.plan_differen = plan_differen; + } + public String getOther_name() { + return other_name; + } + public void setOther_name(String other_name) { + this.other_name = other_name; + } +} diff --git b/src/com/espeed/yxy/pojo/YxyMarketingWeek.java a/src/com/espeed/yxy/pojo/YxyMarketingWeek.java new file mode 100644 index 0000000..b33aab0 --- /dev/null +++ a/src/com/espeed/yxy/pojo/YxyMarketingWeek.java @@ -0,0 +1,62 @@ +package com.espeed.yxy.pojo; + +import java.io.Serializable; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; + +@Entity +@Table(name="yxy_marketing_week") +public class YxyMarketingWeek implements Serializable{ + + private int week_id; + private int week_value;//周期值 + private int plan_id;//计划ID + private int mode_id;//模版ID + private int isexecution;//是否执行 + private String week_day;//执行具体时间与周对应 + + @Id + @GeneratedValue(strategy=GenerationType.AUTO) + public int getWeek_id() { + return week_id; + } + public void setWeek_id(int weekId) { + week_id = weekId; + } + public int getWeek_value() { + return week_value; + } + public void setWeek_value(int weekValue) { + week_value = weekValue; + } + public int getPlan_id() { + return plan_id; + } + public void setPlan_id(int planId) { + plan_id = planId; + } + public int getMode_id() { + return mode_id; + } + public void setMode_id(int modeId) { + mode_id = modeId; + } + public int getIsexecution() { + return isexecution; + } + public void setIsexecution(int isexecution) { + this.isexecution = isexecution; + } + public String getWeek_day() { + return week_day; + } + public void setWeek_day(String weekDay) { + week_day = weekDay; + } + + +} diff --git b/src/com/espeed/yxy/pojo/YxyReplyInfo.java a/src/com/espeed/yxy/pojo/YxyReplyInfo.java new file mode 100644 index 0000000..b0321e8 --- /dev/null +++ a/src/com/espeed/yxy/pojo/YxyReplyInfo.java @@ -0,0 +1,52 @@ +package com.espeed.yxy.pojo; + +import java.io.Serializable; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; + +/*** + * + * @author xieyong + * 回复实体 + */ +@Entity +@Table(name="yxy_reply_info") +public class YxyReplyInfo implements Serializable{ + private static final long serialVersionUID = 1L; + private int replyid; + private String loginid;//用户 + private String domain;//所属域名 + private String replyemail;//回复地址 + + @Id + @GeneratedValue(strategy=GenerationType.AUTO) + public int getReplyid() { + return replyid; + } + public void setReplyid(int replyid) { + this.replyid = replyid; + } + public String getLoginid() { + return loginid; + } + public void setLoginid(String loginid) { + this.loginid = loginid; + } + public String getDomain() { + return domain; + } + public void setDomain(String domain) { + this.domain = domain; + } + + public String getReplyemail() { + return replyemail; + } + public void setReplyemail(String replyemail) { + this.replyemail = replyemail; + } +} diff --git b/src/com/espeed/yxy/pojo/YxySendCount.java a/src/com/espeed/yxy/pojo/YxySendCount.java new file mode 100644 index 0000000..421f665 --- /dev/null +++ a/src/com/espeed/yxy/pojo/YxySendCount.java @@ -0,0 +1,70 @@ +package com.espeed.yxy.pojo; + +import java.io.Serializable; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; + +/** + * 客户发送邮件的统计实体 + * @author 陈南巧 + */ +@Entity +@Table(name="yxy_send_count") +public class YxySendCount implements Serializable{ + private static final long serialVersionUID = 1L; + private int id;//主键id + private int user_id;//用户id + private int company_id;//企业id + private int customer_id;//客户id + private int send_counts;//发送封数 + private String send_date;//发送日期 + private String send_time;//发送时间 + @Id + @GeneratedValue(strategy=GenerationType.AUTO) + public int getId() { + return id; + } + public void setId(int id) { + this.id = id; + } + public int getUser_id() { + return user_id; + } + public void setUser_id(int user_id) { + this.user_id = user_id; + } + public int getCompany_id() { + return company_id; + } + public void setCompany_id(int company_id) { + this.company_id = company_id; + } + public int getCustomer_id() { + return customer_id; + } + public void setCustomer_id(int customer_id) { + this.customer_id = customer_id; + } + public int getSend_counts() { + return send_counts; + } + public void setSend_counts(int send_counts) { + this.send_counts = send_counts; + } + public String getSend_date() { + return send_date; + } + public void setSend_date(String send_date) { + this.send_date = send_date; + } + public String getSend_time() { + return send_time; + } + public void setSend_time(String send_time) { + this.send_time = send_time; + } +} diff --git b/src/com/espeed/yxy/pojo/YxySendFilterAddress.java a/src/com/espeed/yxy/pojo/YxySendFilterAddress.java new file mode 100644 index 0000000..819159a --- /dev/null +++ a/src/com/espeed/yxy/pojo/YxySendFilterAddress.java @@ -0,0 +1,59 @@ +package com.espeed.yxy.pojo; + +import java.io.Serializable; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; + +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 过滤分组地址(营销游) + * 开始时间: 2013.12.09 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ + +@Entity +@Table(name="yxy_send_filter_address") +public class YxySendFilterAddress implements Serializable{ + private static final long serialVersionUID = 1L; + private int filteraddrid;//ID + private String filteraddress;//地址或域名 + private String filteraddrloginid;//用户账号 + private String filteraddrdomain;//用户域名 + + @Id + @GeneratedValue(strategy=GenerationType.AUTO) + public int getFilteraddrid() { + return filteraddrid; + } + public void setFilteraddrid(int filteraddrid) { + this.filteraddrid = filteraddrid; + } + public String getFilteraddress() { + return filteraddress; + } + public void setFilteraddress(String filteraddress) { + this.filteraddress = filteraddress; + } + public String getFilteraddrloginid() { + return filteraddrloginid; + } + public void setFilteraddrloginid(String filteraddrloginid) { + this.filteraddrloginid = filteraddrloginid; + } + public String getFilteraddrdomain() { + return filteraddrdomain; + } + public void setFilteraddrdomain(String filteraddrdomain) { + this.filteraddrdomain = filteraddrdomain; + } +} diff --git b/src/com/espeed/yxy/pojo/YxySendMailDetail.java a/src/com/espeed/yxy/pojo/YxySendMailDetail.java new file mode 100644 index 0000000..8ff7633 --- /dev/null +++ a/src/com/espeed/yxy/pojo/YxySendMailDetail.java @@ -0,0 +1,134 @@ +package com.espeed.yxy.pojo; + +import java.io.Serializable; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; + +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 待发邮件地址实体(营销游) + * 开始时间: 2013.12.09 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ + +@Entity +@Table(name="yxy_send_mail_detail") +public class YxySendMailDetail implements Serializable{ + private static final long serialVersionUID = 1L; + private int mail_id;//地址ID + private int send_mail_id;//发送邮件ID(待发邮件) + private int base_mail_id;//邮件基本信息ID + private String mail_uid;//邮件唯一标识 + private String receiver;//收件人 + private String email;//收件人邮箱 + private String plans_send_time;//计划发送时间 + private String email_suffix;//地址后缀 + private int status;//发送状态 + private int isexp;//异常 + private String company_variable;//企业名称 + private int planid;//计划id + private String variable;//自定义变量 + private String loginid;//帐号 + private String domain;//域名 + @Id + @GeneratedValue(strategy=GenerationType.AUTO) + public int getMail_id() { + return mail_id; + } + public void setMail_id(int mailId) { + mail_id = mailId; + } + public int getSend_mail_id() { + return send_mail_id; + } + public void setSend_mail_id(int sendMailId) { + send_mail_id = sendMailId; + } + public String getMail_uid() { + return mail_uid; + } + public void setMail_uid(String mailUid) { + mail_uid = mailUid; + } + public String getReceiver() { + return receiver; + } + public void setReceiver(String receiver) { + this.receiver = receiver; + } + public String getEmail() { + return email; + } + public void setEmail(String email) { + this.email = email; + } + public String getPlans_send_time() { + return plans_send_time; + } + public void setPlans_send_time(String plansSendTime) { + plans_send_time = plansSendTime; + } + public String getEmail_suffix() { + return email_suffix; + } + public void setEmail_suffix(String emailSuffix) { + email_suffix = emailSuffix; + } + public int getStatus() { + return status; + } + public void setStatus(int status) { + this.status = status; + } + public int getBase_mail_id() { + return base_mail_id; + } + public void setBase_mail_id(int baseMailId) { + base_mail_id = baseMailId; + } + public int getIsexp() { + return isexp; + } + public void setIsexp(int isexp) { + this.isexp = isexp; + } + public String getCompany_variable() { + return company_variable; + } + public void setCompany_variable(String companyVariable) { + company_variable = companyVariable; + } + public int getPlanid() { + return planid; + } + public void setPlanid(int planid) { + this.planid = planid; + } + public String getVariable() { + return variable; + } + public void setVariable(String variable) { + this.variable = variable; + } + public String getLoginid() { + return loginid; + } + public void setLoginid(String loginid) { + this.loginid = loginid; + } + public String getDomain() { + return domain; + } + public void setDomain(String domain) { + this.domain = domain; + } +} diff --git b/src/com/espeed/yxy/pojo/YxySendMailMaster.java a/src/com/espeed/yxy/pojo/YxySendMailMaster.java new file mode 100644 index 0000000..5efb138 --- /dev/null +++ a/src/com/espeed/yxy/pojo/YxySendMailMaster.java @@ -0,0 +1,541 @@ +package com.espeed.yxy.pojo; + +import java.io.Serializable; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 待发邮件实体(营销游) + * 开始时间: 2013.12.09 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ + +@Entity +@Table(name="yxy_send_mail_master") +public class YxySendMailMaster implements Serializable{ + private static final long serialVersionUID = 1L; + private int send_mail_id;//发送邮件ID + private String user_loginid;//创建用户账号 + private String user_domain;//创建用户域名 + private String create_time;//创建时间 +// private String setYYtime;//截取后的时间(年月日) +// private String setHHtime;//截取后的时间(时分秒) +// private int mass_flag;//是否群发邮件 +// private int yxy_flag;//是否营销邮邮件 +// private int separate_flag;//是否分别发送 + private int isuse;//是否使用中 +// private int allow_proxy;//是否允许代发 + private int is_unsubscribe;//是否退订 + private int unsubscribe_language;//退订选择语言(1.中文2.英文,3自定义) + private String unstr;//退订字符(自定义) +// private int front_send_flag;//是否前台直发 + private int include_link;//是否包含嵌入链接 + private String link_context;//链接地址 + //private int include_variable;//是否包含邮件变量 + //private String variable_file_path;//邮件变量文件路径 +// private int interval_flag;//是否间隔发送 +// private int Interval_minute ;//间隔时间' +// private int per_send_count;//每批发送邮件数' +// private int random_flag; +// private int use_espeed_flag; + private String mail_account;//发送邮箱账号 + private String sender;//发件人 + private String send_email;//发件人邮箱 + private String reply_email;//回复邮箱 + private String subject;//主题 +// private String setsubject;//截取后的主题 + private int auto_change_subject;//是否多主题变换 + private String body;//邮件正文 +// private int attachment_count;//包含附件数量 +// private int attachment_size;//附件大小 + private String attarchment_path ;//附件保存路径 +// private int image_count ;//包含图片数量 +// private int image_size;//图片大小 + private String image_path;//图片保存路径 + private String eml_file_path;//EML文件路径 + private String eml_encode_key;//EML文件KEY + private int mail_size;//邮件大小 + private int plans_send;//是否定时发送 + private String plans_send_time;//定时发送时间 +// private int convert_time_zone;//是否转换时区发送 +// private int important_flag;//是否重要邮件 +// private int urgent_flag;//是否紧急邮件 +// private int delete_flag ;//删除标识 +// private String result_remark;//发送情况摘要 +// private String remark;//邮件备注 +// private String keywords;//关键词 + private int status ;//处理状态 +// private int star_flag;//是否星标邮件 +// private int lock_flag;//锁定标识 +// private int secure_flag ;//保密标识 +// private int need_auditing;//是否需要审核 +// private int auditing_flag;//审核标识 +// private String auditing_operator;//审核人', +// private String auditing_time;//审核时间 +// private int has_folder;//是否已归档 +// private int has_classify;//是否已分类 +// private int has_tips;//是否有标签 +// private int reply_mail_count;//回复邮件总数 + private int sendci;//发送次数 + private int folder_id;//所属文件夹ID + private String mail_uid; //mail唯一性标识 + private int is_high_precision;//是否使用高精准发信 + private int exptionnum;//发送过程中异常的次数 + private int iscrm;//是不是老客户营销 + private int isold;//0新客户跟进,1老客户营销,2代发模式,3自有域名 + @Id + @GeneratedValue(strategy=GenerationType.AUTO) + public int getSend_mail_id() { + return send_mail_id; + } + public void setSend_mail_id(int sendMailId) { + send_mail_id = sendMailId; + } + public String getCreate_time() { + return create_time; + } + public void setCreate_time(String createTime) { + create_time = createTime; + } +// public int getMass_flag() { +// return mass_flag; +// } +// public void setMass_flag(int massFlag) { +// mass_flag = massFlag; +// } +// public int getYxy_flag() { +// return yxy_flag; +// } +// public void setYxy_flag(int yxyFlag) { +// yxy_flag = yxyFlag; +// } +// public int getSeparate_flag() { +// return separate_flag; +// } +// public void setSeparate_flag(int separateFlag) { +// separate_flag = separateFlag; +// } +// public int getAllow_proxy() { +// return allow_proxy; +// } +// public void setAllow_proxy(int allowProxy) { +// allow_proxy = allowProxy; +// } +// public int getFront_send_flag() { +// return front_send_flag; +// } +// public void setFront_send_flag(int frontSendFlag) { +// front_send_flag = frontSendFlag; +// } + public int getInclude_link() { + return include_link; + } + public void setInclude_link(int includeLink) { + include_link = includeLink; + } +// public int getInclude_variable() { +// return include_variable; +// } +// public void setInclude_variable(int includeVariable) { +// include_variable = includeVariable; +// } +// public String getVariable_file_path() { +// return variable_file_path; +// } +// public void setVariable_file_path(String variableFilePath) { +// variable_file_path = variableFilePath; +// } +// public int getInterval_flag() { +// return interval_flag; +// } +// public void setInterval_flag(int intervalFlag) { +// interval_flag = intervalFlag; +// } +// public int getInterval_minute() { +// return Interval_minute; +// } +// public void setInterval_minute(int intervalMinute) { +// Interval_minute = intervalMinute; +// } +// public int getPer_send_count() { +// return per_send_count; +// } +// public void setPer_send_count(int perSendCount) { +// per_send_count = perSendCount; +// } +// public int getRandom_flag() { +// return random_flag; +// } +// public void setRandom_flag(int randomFlag) { +// random_flag = randomFlag; +// } +// public int getUse_espeed_flag() { +// return use_espeed_flag; +// } +// public void setUse_espeed_flag(int useEspeedFlag) { +// use_espeed_flag = useEspeedFlag; +// } + public String getMail_account() { + return mail_account; + } + public void setMail_account(String mailAccount) { + mail_account = mailAccount; + } + public String getSender() { + return sender; + } + public void setSender(String sender) { + this.sender = sender; + } + public String getSend_email() { + return send_email; + } + public void setSend_email(String sendEmail) { + send_email = sendEmail; + } + public String getReply_email() { + return reply_email; + } + public void setReply_email(String replyEmail) { + reply_email = replyEmail; + } + public String getSubject() { + return subject; + } + public void setSubject(String subject) { + this.subject = subject; + } + public int getAuto_change_subject() { + return auto_change_subject; + } + public void setAuto_change_subject(int autoChangeSubject) { + auto_change_subject = autoChangeSubject; + } + +// @Transient +// public String getBody() { +// return body; +// } +// public void setBody(String body) { +// this.body = body; +// } +// public int getAttachment_count() { +// return attachment_count; +// } +// public void setAttachment_count(int attachmentCount) { +// attachment_count = attachmentCount; +// } +// public int getAttachment_size() { +// return attachment_size; +// } +// public void setAttachment_size(int attachmentSize) { +// attachment_size = attachmentSize; +// } + public String getAttarchment_path() { + return attarchment_path; + } + public void setAttarchment_path(String attarchmentPath) { + attarchment_path = attarchmentPath; + } +// public int getImage_count() { +// return image_count; +// } +// public void setImage_count(int imageCount) { +// image_count = imageCount; +// } +// public int getImage_size() { +// return image_size; +// } +// public void setImage_size(int imageSize) { +// image_size = imageSize; +// } + public String getImage_path() { + return image_path; + } + public void setImage_path(String imagePath) { + image_path = imagePath; + } + public String getEml_file_path() { + return eml_file_path; + } + public void setEml_file_path(String emlFilePath) { + eml_file_path = emlFilePath; + } + public String getEml_encode_key() { + return eml_encode_key; + } + public void setEml_encode_key(String emlEncodeKey) { + eml_encode_key = emlEncodeKey; + } +// public int getMail_size() { +// return mail_size; +// } +// public void setMail_size(int mailSize) { +// mail_size = mailSize; +// } + public int getPlans_send() { + return plans_send; + } + public void setPlans_send(int plansSend) { + plans_send = plansSend; + } + public String getPlans_send_time() { + return plans_send_time; + } + public void setPlans_send_time(String plansSendTime) { + plans_send_time = plansSendTime; + } +// public int getConvert_time_zone() { +// return convert_time_zone; +// } +// public void setConvert_time_zone(int convertTimeZone) { +// convert_time_zone = convertTimeZone; +// } +// public int getImportant_flag() { +// return important_flag; +// } +// public void setImportant_flag(int importantFlag) { +// important_flag = importantFlag; +// } +// public int getUrgent_flag() { +// return urgent_flag; +// } +// public void setUrgent_flag(int urgentFlag) { +// urgent_flag = urgentFlag; +// } +// public int getDelete_flag() { +// return delete_flag; +// } +// public void setDelete_flag(int deleteFlag) { +// delete_flag = deleteFlag; +// } +// public String getResult_remark() { +// return result_remark; +// } +// public void setResult_remark(String resultRemark) { +// result_remark = resultRemark; +// } +// public String getRemark() { +// return remark; +// } +// public void setRemark(String remark) { +// this.remark = remark; +// } +// public String getKeywords() { +// return keywords; +// } +// public void setKeywords(String keywords) { +// this.keywords = keywords; +// } +// public int getStatus() { +// return status; +// } +// public void setStatus(int status) { +// this.status = status; +// } +// public int getStar_flag() { +// return star_flag; +// } +// public void setStar_flag(int starFlag) { +// star_flag = starFlag; +// } +// public int getLock_flag() { +// return lock_flag; +// } +// public void setLock_flag(int lockFlag) { +// lock_flag = lockFlag; +// } +// public int getSecure_flag() { +// return secure_flag; +// } +// public void setSecure_flag(int secureFlag) { +// secure_flag = secureFlag; +// } +// public int getNeed_auditing() { +// return need_auditing; +// } +// public void setNeed_auditing(int needAuditing) { +// need_auditing = needAuditing; +// } +// public int getAuditing_flag() { +// return auditing_flag; +// } +// public void setAuditing_flag(int auditingFlag) { +// auditing_flag = auditingFlag; +// } +// public String getAuditing_operator() { +// return auditing_operator; +// } +// public void setAuditing_operator(String auditingOperator) { +// auditing_operator = auditingOperator; +// } +// public String getAuditing_time() { +// return auditing_time; +// } +// public void setAuditing_time(String auditingTime) { +// auditing_time = auditingTime; +// } +// public int getHas_folder() { +// return has_folder; +// } +// public void setHas_folder(int hasFolder) { +// has_folder = hasFolder; +// } +// public int getHas_classify() { +// return has_classify; +// } +// public void setHas_classify(int hasClassify) { +// has_classify = hasClassify; +// } +// public int getHas_tips() { +// return has_tips; +// } +// public void setHas_tips(int hasTips) { +// has_tips = hasTips; +// } +// public int getReply_mail_count() { +// return reply_mail_count; +// } +// public void setReply_mail_count(int replyMailCount) { +// reply_mail_count = replyMailCount; +// } +// public int getFolder_id() { +// return folder_id; +// } +// public void setFolder_id(int folderId) { +// folder_id = folderId; +// } + public int getIsuse() { + return isuse; + } + public void setIsuse(int isuse) { + this.isuse = isuse; + } +// +// @Transient +// public String getSetsubject() { +// return setsubject; +// } +// public void setSetsubject(String setsubject) { +// this.setsubject = setsubject; +// } +// @Transient +// public String getSetYYtime() { +// return setYYtime; +// } +// public void setSetYYtime(String setYYtime) { +// this.setYYtime = setYYtime; +// } +// @Transient +// public String getSetHHtime() { +// return setHHtime; +// } +// public void setSetHHtime(String setHHtime) { +// this.setHHtime = setHHtime; +// } + public String getMail_uid() { + return mail_uid; + } + public void setMail_uid(String mailUid) { + mail_uid = mailUid; + } + public int getIs_high_precision() { + return is_high_precision; + } + public void setIs_high_precision(int isHighPrecision) { + is_high_precision = isHighPrecision; + } + public String getLink_context() { + return link_context; + } + public void setLink_context(String linkContext) { + link_context = linkContext; + } + public int getIs_unsubscribe() { + return is_unsubscribe; + } + public void setIs_unsubscribe(int isUnsubscribe) { + is_unsubscribe = isUnsubscribe; + } + public int getUnsubscribe_language() { + return unsubscribe_language; + } + public void setUnsubscribe_language(int unsubscribeLanguage) { + unsubscribe_language = unsubscribeLanguage; + } + public String getUser_loginid() { + return user_loginid; + } + public void setUser_loginid(String userLoginid) { + user_loginid = userLoginid; + } + public String getUser_domain() { + return user_domain; + } + public void setUser_domain(String userDomain) { + user_domain = userDomain; + } + public int getExptionnum() { + return exptionnum; + } + public void setExptionnum(int exptionnum) { + this.exptionnum = exptionnum; + } + public String getBody() { + return body; + } + public void setBody(String body) { + this.body = body; + } + public int getFolder_id() { + return folder_id; + } + public void setFolder_id(int folderId) { + folder_id = folderId; + } + public int getStatus() { + return status; + } + public void setStatus(int status) { + this.status = status; + } + public int getMail_size() { + return mail_size; + } + public void setMail_size(int mailSize) { + mail_size = mailSize; + } + public int getSendci() { + return sendci; + } + public void setSendci(int sendci) { + this.sendci = sendci; + } + public String getUnstr() { + return unstr; + } + public void setUnstr(String unstr) { + this.unstr = unstr; + } + public int getIscrm() { + return iscrm; + } + public void setIscrm(int iscrm) { + this.iscrm = iscrm; + } + public int getIsold() { + return isold; + } + public void setIsold(int isold) { + this.isold = isold; + } +} diff --git b/src/com/espeed/yxy/pojo/YxySendMailMasterBase.java a/src/com/espeed/yxy/pojo/YxySendMailMasterBase.java new file mode 100644 index 0000000..f1ce22a --- /dev/null +++ a/src/com/espeed/yxy/pojo/YxySendMailMasterBase.java @@ -0,0 +1,260 @@ +package com.espeed.yxy.pojo; + +import java.io.Serializable; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Transient; +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 邮件基本信息实体(营销游) + * 开始时间: 2013.12.09 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +@Entity +@Table(name="yxy_send_mail_master_base") +public class YxySendMailMasterBase implements Serializable{ + private static final long serialVersionUID = 1L; + private int send_mail_id;//发送邮件ID + private String user_loginid;//创建用户账号 + private String user_domain;//创建用户域名 + private String create_time;//创建时间 + private int is_unsubscribe;//是否退订 + private int unsubscribe_language;//退订选择语言(0.中文1.英文) + private int include_link;//是否包含嵌入链接 + private String link_context;//链接地址 + private String mail_account;//发送邮箱账号 + private String sender;//发件人 + private String send_email;//发件人邮箱 + private String reply_email;//回复邮箱 + private String subject;//主题 + private int auto_change_subject;//是否多主题变换 + private String body;//邮件正文 + private String attarchment_path ;//附件保存路径 + private String image_path;//图片保存路径 + private String eml_file_path;//EML文件路径 + private String eml_encode_key;//EML文件KEY + private int mail_size;//邮件大小 + private int plans_send;//是否定时发送 + private String plans_send_time;//定时发送时间 + private int status ;//处理状态 + private int folder_id;//所属文件夹ID + private String mail_uid; //mail唯一性标识 + private int is_high_precision;//是否使用高精准发信 + private int exptionnum;//发送过程中异常的次数 + private String txtaddresspath;//txt地址文件路径 + private int send_num;//发送量 + private int isuse;//是否使用中 + private int sendci;//发送次数 + private int iscrm;//是不是老客户营销 + private int isold; + @Id + @GeneratedValue(strategy=GenerationType.AUTO) + public int getSend_mail_id() { + return send_mail_id; + } + public void setSend_mail_id(int sendMailId) { + send_mail_id = sendMailId; + } + public String getUser_loginid() { + return user_loginid; + } + public void setUser_loginid(String userLoginid) { + user_loginid = userLoginid; + } + public String getUser_domain() { + return user_domain; + } + public void setUser_domain(String userDomain) { + user_domain = userDomain; + } + public String getCreate_time() { + return create_time; + } + public void setCreate_time(String createTime) { + create_time = createTime; + } + public int getIs_unsubscribe() { + return is_unsubscribe; + } + public void setIs_unsubscribe(int isUnsubscribe) { + is_unsubscribe = isUnsubscribe; + } + public int getUnsubscribe_language() { + return unsubscribe_language; + } + public void setUnsubscribe_language(int unsubscribeLanguage) { + unsubscribe_language = unsubscribeLanguage; + } + public int getInclude_link() { + return include_link; + } + public void setInclude_link(int includeLink) { + include_link = includeLink; + } + public String getLink_context() { + return link_context; + } + public void setLink_context(String linkContext) { + link_context = linkContext; + } + public String getMail_account() { + return mail_account; + } + public void setMail_account(String mailAccount) { + mail_account = mailAccount; + } + public String getSender() { + return sender; + } + public void setSender(String sender) { + this.sender = sender; + } + public String getSend_email() { + return send_email; + } + public void setSend_email(String sendEmail) { + send_email = sendEmail; + } + public String getReply_email() { + return reply_email; + } + public void setReply_email(String replyEmail) { + reply_email = replyEmail; + } + public String getSubject() { + return subject; + } + public void setSubject(String subject) { + this.subject = subject; + } + public int getAuto_change_subject() { + return auto_change_subject; + } + public void setAuto_change_subject(int autoChangeSubject) { + auto_change_subject = autoChangeSubject; + } + public String getBody() { + return body; + } + public void setBody(String body) { + this.body = body; + } + public String getAttarchment_path() { + return attarchment_path; + } + public void setAttarchment_path(String attarchmentPath) { + attarchment_path = attarchmentPath; + } + public String getImage_path() { + return image_path; + } + public void setImage_path(String imagePath) { + image_path = imagePath; + } + public String getEml_file_path() { + return eml_file_path; + } + public void setEml_file_path(String emlFilePath) { + eml_file_path = emlFilePath; + } + public String getEml_encode_key() { + return eml_encode_key; + } + public void setEml_encode_key(String emlEncodeKey) { + eml_encode_key = emlEncodeKey; + } + public int getMail_size() { + return mail_size; + } + public void setMail_size(int mailSize) { + mail_size = mailSize; + } + public int getPlans_send() { + return plans_send; + } + public void setPlans_send(int plansSend) { + plans_send = plansSend; + } + public String getPlans_send_time() { + return plans_send_time; + } + public void setPlans_send_time(String plansSendTime) { + plans_send_time = plansSendTime; + } + public int getStatus() { + return status; + } + public void setStatus(int status) { + this.status = status; + } + public int getFolder_id() { + return folder_id; + } + public void setFolder_id(int folderId) { + folder_id = folderId; + } + public String getMail_uid() { + return mail_uid; + } + public void setMail_uid(String mailUid) { + mail_uid = mailUid; + } + public int getIs_high_precision() { + return is_high_precision; + } + public void setIs_high_precision(int isHighPrecision) { + is_high_precision = isHighPrecision; + } + public int getExptionnum() { + return exptionnum; + } + public void setExptionnum(int exptionnum) { + this.exptionnum = exptionnum; + } + public String getTxtaddresspath() { + return txtaddresspath; + } + public void setTxtaddresspath(String txtaddresspath) { + this.txtaddresspath = txtaddresspath; + } + public int getSend_num() { + return send_num; + } + public void setSend_num(int sendNum) { + send_num = sendNum; + } + public int getIsuse() { + return isuse; + } + public void setIsuse(int isuse) { + this.isuse = isuse; + } + public int getSendci() { + return sendci; + } + public void setSendci(int sendci) { + this.sendci = sendci; + } + public int getIscrm() { + return iscrm; + } + public void setIscrm(int iscrm) { + this.iscrm = iscrm; + } + public int getIsold() { + return isold; + } + public void setIsold(int isold) { + this.isold = isold; + } +} diff --git b/src/com/espeed/yxy/pojo/YxySendSmtpInfo.java a/src/com/espeed/yxy/pojo/YxySendSmtpInfo.java new file mode 100644 index 0000000..dd7eef5 --- /dev/null +++ a/src/com/espeed/yxy/pojo/YxySendSmtpInfo.java @@ -0,0 +1,128 @@ +package com.espeed.yxy.pojo; + +import java.io.Serializable; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; + +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: smtp实体(营销游) + * 开始时间: 2013.12.09 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +@Entity +@Table(name="yxy_send_smtp_info") +public class YxySendSmtpInfo implements Serializable{ + private static final long serialVersionUID = 1L; + private int smtp_service_id;//主键ID + private String smtp_service_number;//smtp服务器 + private String smtp_service_account;//smtp账号 + private String smtp_service_password;//smtp密码 + private int smtp_service_isyxy;//是自配还是运营0默认自配1:运营 + private String smtp_service_creatdate;//创建时间 + private String smtp_service_userdate;//发第一封的时间 + private int smtp_service_isuse;//该smtp是否可用...0可用1不可用 + private int smtp_service_sendNum;//smtp发送封数 + private String smtp_user_loginid;//用户账号 + private String smtp_user_domain;//用户所属域名 + private int smtp_is_ssl;//是否使用SSL加密 + private String smtp_service_port;//端口 + private int smtp_service_type;//0:新客户营销,1:老客户跟进,2:自主域名投递 + + @Id + @GeneratedValue(strategy=GenerationType.AUTO) + public int getSmtp_service_id() { + return smtp_service_id; + } + public void setSmtp_service_id(int smtpServiceId) { + smtp_service_id = smtpServiceId; + } + public String getSmtp_service_number() { + return smtp_service_number; + } + public void setSmtp_service_number(String smtpServiceNumber) { + smtp_service_number = smtpServiceNumber; + } + public String getSmtp_service_account() { + return smtp_service_account; + } + public void setSmtp_service_account(String smtpServiceAccount) { + smtp_service_account = smtpServiceAccount; + } + public String getSmtp_service_password() { + return smtp_service_password; + } + public void setSmtp_service_password(String smtpServicePassword) { + smtp_service_password = smtpServicePassword; + } + public String getSmtp_service_creatdate() { + return smtp_service_creatdate; + } + public void setSmtp_service_creatdate(String smtpServiceCreatdate) { + smtp_service_creatdate = smtpServiceCreatdate; + } + public String getSmtp_service_userdate() { + return smtp_service_userdate; + } + public void setSmtp_service_userdate(String smtpServiceUserdate) { + smtp_service_userdate = smtpServiceUserdate; + } + public int getSmtp_service_isuse() { + return smtp_service_isuse; + } + public void setSmtp_service_isuse(int smtpServiceIsuse) { + smtp_service_isuse = smtpServiceIsuse; + } + public int getSmtp_service_sendNum() { + return smtp_service_sendNum; + } + public void setSmtp_service_sendNum(int smtpServiceSendNum) { + smtp_service_sendNum = smtpServiceSendNum; + } + public int getSmtp_service_isyxy() { + return smtp_service_isyxy; + } + public void setSmtp_service_isyxy(int smtpServiceIsyxy) { + smtp_service_isyxy = smtpServiceIsyxy; + } + public String getSmtp_user_loginid() { + return smtp_user_loginid; + } + public void setSmtp_user_loginid(String smtpUserLoginid) { + smtp_user_loginid = smtpUserLoginid; + } + public String getSmtp_user_domain() { + return smtp_user_domain; + } + public void setSmtp_user_domain(String smtpUserDomain) { + smtp_user_domain = smtpUserDomain; + } + public int getSmtp_is_ssl() { + return smtp_is_ssl; + } + public void setSmtp_is_ssl(int smtp_is_ssl) { + this.smtp_is_ssl = smtp_is_ssl; + } + public String getSmtp_service_port() { + return smtp_service_port; + } + public void setSmtp_service_port(String smtp_service_port) { + this.smtp_service_port = smtp_service_port; + } + public int getSmtp_service_type() { + return smtp_service_type; + } + public void setSmtp_service_type(int smtp_service_type) { + this.smtp_service_type = smtp_service_type; + } +} diff --git b/src/com/espeed/yxy/pojo/YxySenderSet.java a/src/com/espeed/yxy/pojo/YxySenderSet.java new file mode 100644 index 0000000..a7d55f1 --- /dev/null +++ a/src/com/espeed/yxy/pojo/YxySenderSet.java @@ -0,0 +1,91 @@ +package com.espeed.yxy.pojo; + +import java.io.Serializable; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; + + +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 发件人配置 + * 开始时间: 2015.4.02 + * 程 序 员: 蒋俭 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ + + +@Entity +@Table(name="yxy_sender_set") +public class YxySenderSet implements Serializable{ + private int id;//发件人配置id + private String user_login;//登陆用户 + private String user_domain;//登陆域名 + private String sender;//发件人 + private String send_email;//发件人地址 + private String reply_name;//回复人名字 + private String reply_email;//回复人邮箱地址 + private int isdefault;//是否默认 + + @Id + @GeneratedValue(strategy=GenerationType.AUTO) + public int getId() { + return id; + } + public void setId(int id) { + this.id = id; + } + public String getUser_login() { + return user_login; + } + public void setUser_login(String userLogin) { + user_login = userLogin; + } + public String getUser_domain() { + return user_domain; + } + public void setUser_domain(String userDomain) { + user_domain = userDomain; + } + public String getSender() { + return sender; + } + public void setSender(String sender) { + this.sender = sender; + } + + public String getSend_email() { + return send_email; + } + public void setSend_email(String sendEmail) { + send_email = sendEmail; + } + public String getReply_name() { + return reply_name; + } + public void setReply_name(String replyName) { + reply_name = replyName; + } + public String getReply_email() { + return reply_email; + } + public void setReply_email(String replyEmail) { + reply_email = replyEmail; + } + public int getIsdefault() { + return isdefault; + } + public void setIsdefault(int isdefault) { + this.isdefault = isdefault; + } + + +} diff --git b/src/com/espeed/yxy/pojo/YxySmtpSendSelfOverset.java a/src/com/espeed/yxy/pojo/YxySmtpSendSelfOverset.java new file mode 100644 index 0000000..adf9277 --- /dev/null +++ a/src/com/espeed/yxy/pojo/YxySmtpSendSelfOverset.java @@ -0,0 +1,89 @@ +package com.espeed.yxy.pojo; + +import java.io.Serializable; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; + +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 自配smtp发送量统计(营销游) + * 开始时间: 2013.12.09 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +@Entity +@Table(name="yxy_smtp_send_self_overset") +public class YxySmtpSendSelfOverset implements Serializable{ + + private int smtp_send_self_over_id;//主键, + private String smtp_send_self_over_account;//smtp账号, + private int smtp_send_self_over_tennum ;//10分钟已发量, + private int smtp_send_self_over_hournum;// 一个小时已发量, + private int smtp_send_self_over_daynum;//一天已发量, + private String smtp_send_self_over_tendate;//最后记录的10分钟, + private String smtp_send_self_over_hourdate;//最后记录的60分钟, + private String smtp_send_self_over_daydate;// 最后记录的一天, + + @Id + @GeneratedValue(strategy=GenerationType.AUTO) + public int getSmtp_send_self_over_id() { + return smtp_send_self_over_id; + } + public void setSmtp_send_self_over_id(int smtpSendSelfOverId) { + smtp_send_self_over_id = smtpSendSelfOverId; + } + public String getSmtp_send_self_over_account() { + return smtp_send_self_over_account; + } + public void setSmtp_send_self_over_account(String smtpSendSelfOverAccount) { + smtp_send_self_over_account = smtpSendSelfOverAccount; + } + public int getSmtp_send_self_over_tennum() { + return smtp_send_self_over_tennum; + } + public void setSmtp_send_self_over_tennum(int smtpSendSelfOverTennum) { + smtp_send_self_over_tennum = smtpSendSelfOverTennum; + } + public int getSmtp_send_self_over_hournum() { + return smtp_send_self_over_hournum; + } + public void setSmtp_send_self_over_hournum(int smtpSendSelfOverHournum) { + smtp_send_self_over_hournum = smtpSendSelfOverHournum; + } + public int getSmtp_send_self_over_daynum() { + return smtp_send_self_over_daynum; + } + public void setSmtp_send_self_over_daynum(int smtpSendSelfOverDaynum) { + smtp_send_self_over_daynum = smtpSendSelfOverDaynum; + } + public String getSmtp_send_self_over_tendate() { + return smtp_send_self_over_tendate; + } + public void setSmtp_send_self_over_tendate(String smtpSendSelfOverTendate) { + smtp_send_self_over_tendate = smtpSendSelfOverTendate; + } + public String getSmtp_send_self_over_hourdate() { + return smtp_send_self_over_hourdate; + } + public void setSmtp_send_self_over_hourdate(String smtpSendSelfOverHourdate) { + smtp_send_self_over_hourdate = smtpSendSelfOverHourdate; + } + public String getSmtp_send_self_over_daydate() { + return smtp_send_self_over_daydate; + } + public void setSmtp_send_self_over_daydate(String smtpSendSelfOverDaydate) { + smtp_send_self_over_daydate = smtpSendSelfOverDaydate; + } + + + +} diff --git b/src/com/espeed/yxy/pojo/YxySmtpSendSelfSet.java a/src/com/espeed/yxy/pojo/YxySmtpSendSelfSet.java new file mode 100644 index 0000000..e1ef5be --- /dev/null +++ a/src/com/espeed/yxy/pojo/YxySmtpSendSelfSet.java @@ -0,0 +1,68 @@ +package com.espeed.yxy.pojo; + +import java.io.Serializable; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: smtp自配最大发送量实体(营销游) + * 开始时间: 2013.12.09 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ + +@Entity +@Table(name="yxy_smtp_send_self_set") +public class YxySmtpSendSelfSet implements Serializable{ + + private int smtp_send_self_set_id;//自配smtp发送量限制id + private String smtp_send_self_set_account;//服务器账号 + private int smtp_send_self_set_tennum;//10分钟最大发送量 + private int smtp_send_self_set_hournum;//60分钟最大发送量 + private int smtp_send_self_set_daynum;//一天最大发送量 + + @Id + @GeneratedValue(strategy=GenerationType.AUTO) + public int getSmtp_send_self_set_id() { + return smtp_send_self_set_id; + } + public void setSmtp_send_self_set_id(int smtpSendSelfSetId) { + smtp_send_self_set_id = smtpSendSelfSetId; + } + public int getSmtp_send_self_set_tennum() { + return smtp_send_self_set_tennum; + } + public void setSmtp_send_self_set_tennum(int smtpSendSelfSetTennum) { + smtp_send_self_set_tennum = smtpSendSelfSetTennum; + } + public int getSmtp_send_self_set_hournum() { + return smtp_send_self_set_hournum; + } + public void setSmtp_send_self_set_hournum(int smtpSendSelfSetHournum) { + smtp_send_self_set_hournum = smtpSendSelfSetHournum; + } + public int getSmtp_send_self_set_daynum() { + return smtp_send_self_set_daynum; + } + public void setSmtp_send_self_set_daynum(int smtpSendSelfSetDaynum) { + smtp_send_self_set_daynum = smtpSendSelfSetDaynum; + } + public String getSmtp_send_self_set_account() { + return smtp_send_self_set_account; + } + public void setSmtp_send_self_set_account(String smtpSendSelfSetAccount) { + smtp_send_self_set_account = smtpSendSelfSetAccount; + } + + + +} diff --git b/src/com/espeed/yxy/pojo/YxySmtpSendSet.java a/src/com/espeed/yxy/pojo/YxySmtpSendSet.java new file mode 100644 index 0000000..5b7bef5 --- /dev/null +++ a/src/com/espeed/yxy/pojo/YxySmtpSendSet.java @@ -0,0 +1,102 @@ +package com.espeed.yxy.pojo; + +import java.io.Serializable; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: smtp后缀发送信息实体(营销游) + * 开始时间: 2013.12.09 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ + +@Entity +@Table(name="yxy_smtp_send_set") +public class YxySmtpSendSet implements Serializable{ + + private int smtp_send_set_id;//smtp对应的后缀发送时间统计ID + private String smtp_send_set_service;//smtp服务器 + private String smtp_send_set_accout;//smtp账号 + private String smtp_send_set_suffix;//后缀 + private int smtp_send_set_tennum;//10分钟发送量 + private int smtp_send_set_hournum;// 一小时发送量 + private int smtp_send_set_daynum;// 一天发送量 + private String smtp_send_set_tendate;//十分钟时间 + private String smtp_send_set_hourdate;//一小时间 + private String smtp_send_set_daydate;//一天时间 + + @Id + @GeneratedValue(strategy=GenerationType.AUTO) + public int getSmtp_send_set_id() { + return smtp_send_set_id; + } + public void setSmtp_send_set_id(int smtpSendSetId) { + smtp_send_set_id = smtpSendSetId; + } + public String getSmtp_send_set_service() { + return smtp_send_set_service; + } + public void setSmtp_send_set_service(String smtpSendSetService) { + smtp_send_set_service = smtpSendSetService; + } + public String getSmtp_send_set_suffix() { + return smtp_send_set_suffix; + } + public void setSmtp_send_set_suffix(String smtpSendSetSuffix) { + smtp_send_set_suffix = smtpSendSetSuffix; + } + public int getSmtp_send_set_tennum() { + return smtp_send_set_tennum; + } + public void setSmtp_send_set_tennum(int smtpSendSetTennum) { + smtp_send_set_tennum = smtpSendSetTennum; + } + public int getSmtp_send_set_hournum() { + return smtp_send_set_hournum; + } + public void setSmtp_send_set_hournum(int smtpSendSetHournum) { + smtp_send_set_hournum = smtpSendSetHournum; + } + public int getSmtp_send_set_daynum() { + return smtp_send_set_daynum; + } + public void setSmtp_send_set_daynum(int smtpSendSetDaynum) { + smtp_send_set_daynum = smtpSendSetDaynum; + } + public String getSmtp_send_set_tendate() { + return smtp_send_set_tendate; + } + public void setSmtp_send_set_tendate(String smtpSendSetTendate) { + smtp_send_set_tendate = smtpSendSetTendate; + } + public String getSmtp_send_set_hourdate() { + return smtp_send_set_hourdate; + } + public void setSmtp_send_set_hourdate(String smtpSendSetHourdate) { + smtp_send_set_hourdate = smtpSendSetHourdate; + } + public String getSmtp_send_set_daydate() { + return smtp_send_set_daydate; + } + public void setSmtp_send_set_daydate(String smtpSendSetDaydate) { + smtp_send_set_daydate = smtpSendSetDaydate; + } + public String getSmtp_send_set_accout() { + return smtp_send_set_accout; + } + public void setSmtp_send_set_accout(String smtpSendSetAccout) { + smtp_send_set_accout = smtpSendSetAccout; + } + + +} diff --git b/src/com/espeed/yxy/pojo/YxySmtpSuffixSet.java a/src/com/espeed/yxy/pojo/YxySmtpSuffixSet.java new file mode 100644 index 0000000..2b96abe --- /dev/null +++ a/src/com/espeed/yxy/pojo/YxySmtpSuffixSet.java @@ -0,0 +1,67 @@ +package com.espeed.yxy.pojo; + +import java.io.Serializable; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: smtp后缀设置信息实体(营销游) + * 开始时间: 2013.12.09 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ + +@Entity +@Table(name="yxy_smtp_suffix_set") +public class YxySmtpSuffixSet implements Serializable{ + + private int smtp_suffix_id ;//主键ID + private String smtp_suffix_name;//smtp后缀名 + private int smtp_suffix_ten;//该后缀十分钟发送量 + private int smtp_suffix_hour;//该后缀一个小时发送量 + private int smtp_suffix_day;//该后缀一天发送量 + + @Id + @GeneratedValue(strategy=GenerationType.AUTO) + public int getSmtp_suffix_id() { + return smtp_suffix_id; + } + public void setSmtp_suffix_id(int smtpSuffixId) { + smtp_suffix_id = smtpSuffixId; + } + public String getSmtp_suffix_name() { + return smtp_suffix_name; + } + public void setSmtp_suffix_name(String smtpSuffixName) { + smtp_suffix_name = smtpSuffixName; + } + public int getSmtp_suffix_ten() { + return smtp_suffix_ten; + } + public void setSmtp_suffix_ten(int smtpSuffixTen) { + smtp_suffix_ten = smtpSuffixTen; + } + public int getSmtp_suffix_hour() { + return smtp_suffix_hour; + } + public void setSmtp_suffix_hour(int smtpSuffixHour) { + smtp_suffix_hour = smtpSuffixHour; + } + public int getSmtp_suffix_day() { + return smtp_suffix_day; + } + public void setSmtp_suffix_day(int smtpSuffixDay) { + smtp_suffix_day = smtpSuffixDay; + } + + +} diff --git b/src/com/espeed/yxy/pojo/YxySysParamaters.java a/src/com/espeed/yxy/pojo/YxySysParamaters.java new file mode 100644 index 0000000..40d7daf --- /dev/null +++ a/src/com/espeed/yxy/pojo/YxySysParamaters.java @@ -0,0 +1,109 @@ +package com.espeed.yxy.pojo; + +import java.io.Serializable; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; + +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 控制参数(营销游) + * 开始时间: 2013.12.09 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +@Entity +@Table(name="yxy_sys_paramaters") +public class YxySysParamaters implements Serializable{ + + private int para_id; + private int owner_type; + private int enable_flag;//启用标识,1:启用,0:未启用 + private int sort_number;//sort_number + private String para_kind;//分类名称 + private String para_code;//参数代码 + private String para_name;//参数名称 + private String para_desc;//参数描述 + private String para_datatype; + private String default_value;//默认值 + private String list_value;//侯选值 + + @Id + @GeneratedValue(strategy=GenerationType.AUTO) + public int getPara_id() { + return para_id; + } + public void setPara_id(int paraId) { + para_id = paraId; + } + public int getOwner_type() { + return owner_type; + } + public void setOwner_type(int ownerType) { + owner_type = ownerType; + } + public int getEnable_flag() { + return enable_flag; + } + public void setEnable_flag(int enableFlag) { + enable_flag = enableFlag; + } + public int getSort_number() { + return sort_number; + } + public void setSort_number(int sortNumber) { + sort_number = sortNumber; + } + public String getPara_kind() { + return para_kind; + } + public void setPara_kind(String paraKind) { + para_kind = paraKind; + } + public String getPara_code() { + return para_code; + } + public void setPara_code(String paraCode) { + para_code = paraCode; + } + public String getPara_name() { + return para_name; + } + public void setPara_name(String paraName) { + para_name = paraName; + } + public String getPara_desc() { + return para_desc; + } + public void setPara_desc(String paraDesc) { + para_desc = paraDesc; + } + public String getPara_datatype() { + return para_datatype; + } + public void setPara_datatype(String paraDatatype) { + para_datatype = paraDatatype; + } + public String getDefault_value() { + return default_value; + } + public void setDefault_value(String defaultValue) { + default_value = defaultValue; + } + public String getList_value() { + return list_value; + } + public void setList_value(String listValue) { + list_value = listValue; + } + + +} diff --git b/src/com/espeed/yxy/pojo/YxySysParamatersValue.java a/src/com/espeed/yxy/pojo/YxySysParamatersValue.java new file mode 100644 index 0000000..70a7733 --- /dev/null +++ a/src/com/espeed/yxy/pojo/YxySysParamatersValue.java @@ -0,0 +1,74 @@ +package com.espeed.yxy.pojo; + +import java.io.Serializable; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; + +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 控制参数值(营销游) + * 开始时间: 2013.12.09 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +@Entity +@Table(name="yxy_sys_paramaters_value") +public class YxySysParamatersValue implements Serializable{ + + private int id; + private int owner_type;//所有者类别 + private String owner_loginid;//用户账号 + private int para_id;//外键 + private String company_domain;//用户所属域名 + private String para_value;//参数值 + + @Id + @GeneratedValue(strategy=GenerationType.AUTO) + public int getId() { + return id; + } + public void setId(int id) { + this.id = id; + } + public int getOwner_type() { + return owner_type; + } + public void setOwner_type(int ownerType) { + owner_type = ownerType; + } + public String getOwner_loginid() { + return owner_loginid; + } + public void setOwner_loginid(String ownerLoginid) { + owner_loginid = ownerLoginid; + } + public int getPara_id() { + return para_id; + } + public void setPara_id(int paraId) { + para_id = paraId; + } + public String getCompany_domain() { + return company_domain; + } + public void setCompany_domain(String companyDomain) { + company_domain = companyDomain; + } + public String getPara_value() { + return para_value; + } + public void setPara_value(String paraValue) { + para_value = paraValue; + } + + +} diff --git b/src/com/espeed/yxy/pojo/YxyUserAddress.java a/src/com/espeed/yxy/pojo/YxyUserAddress.java new file mode 100644 index 0000000..6b7876f --- /dev/null +++ a/src/com/espeed/yxy/pojo/YxyUserAddress.java @@ -0,0 +1,153 @@ +package com.espeed.yxy.pojo; + +import java.io.Serializable; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Transient; +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 用户地址库(营销游) + * 开始时间: 2013.12.09 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ + +@Entity +@Table(name="yxy_user_address") +public class YxyUserAddress implements Serializable{ + private static final long serialVersionUID = 1L; + private int user_addr_id;//ID + private int user_addr_type_id;//所属类别ID + private String user_loginid;//用户账号 + private String user_domain;//用户所属域名 + private String user_addr_name;//姓名 + private String user_addr_email;//地址 + private String user_addr_web;//公司网址 + private String user_addr_add_date;//地址添加日期 + private String user_addr_modify_date;//地址修改日期 + private String user_addr_sex;//所属地址性别 + private int isrepeat;//是否重复/ + private int user_addr_status;//状态 + private String user_send_time;//发送时间 + private int user_send_num;//发送数 + private String variable;//自定义主题变量 + private String company_variable;//企业名称变量 + private String user_addr_variable;//自定义地址变量 + + @Id + @GeneratedValue(strategy=GenerationType.AUTO) + public int getUser_addr_id() { + return user_addr_id; + } + public void setUser_addr_id(int userAddrId) { + user_addr_id = userAddrId; + } + public int getUser_addr_type_id() { + return user_addr_type_id; + } + public void setUser_addr_type_id(int userAddrTypeId) { + user_addr_type_id = userAddrTypeId; + } + public String getUser_addr_name() { + return user_addr_name; + } + public void setUser_addr_name(String userAddrName) { + user_addr_name = userAddrName; + } + public String getUser_addr_email() { + return user_addr_email; + } + public void setUser_addr_email(String userAddrEmail) { + user_addr_email = userAddrEmail; + } + public String getUser_addr_add_date() { + return user_addr_add_date; + } + public void setUser_addr_add_date(String userAddrAddDate) { + user_addr_add_date = userAddrAddDate; + } + public String getUser_addr_modify_date() { + return user_addr_modify_date; + } + public void setUser_addr_modify_date(String userAddrModifyDate) { + user_addr_modify_date = userAddrModifyDate; + } + public String getUser_addr_sex() { + return user_addr_sex; + } + public void setUser_addr_sex(String userAddrSex) { + user_addr_sex = userAddrSex; + } + @Transient + public int getIsrepeat() { + return isrepeat; + } + public void setIsrepeat(int isrepeat) { + this.isrepeat = isrepeat; + } + public String getUser_loginid() { + return user_loginid; + } + public void setUser_loginid(String userLoginid) { + user_loginid = userLoginid; + } + public String getUser_domain() { + return user_domain; + } + public void setUser_domain(String userDomain) { + user_domain = userDomain; + } + public int getUser_addr_status() { + return user_addr_status; + } + public void setUser_addr_status(int userAddrStatus) { + user_addr_status = userAddrStatus; + } + public String getUser_send_time() { + return user_send_time; + } + public void setUser_send_time(String user_send_time) { + this.user_send_time = user_send_time; + } + public int getUser_send_num() { + return user_send_num; + } + public void setUser_send_num(int user_send_num) { + this.user_send_num = user_send_num; + } + @Transient + public String getVariable() { + return variable; + } + public void setVariable(String variable) { + this.variable = variable; + } + public String getCompany_variable() { + return company_variable; + } + public void setCompany_variable(String companyVariable) { + company_variable = companyVariable; + } + public String getUser_addr_variable() { + return user_addr_variable; + } + public void setUser_addr_variable(String userAddrVariable) { + user_addr_variable = userAddrVariable; + } + public String getUser_addr_web() { + return user_addr_web; + } + public void setUser_addr_web(String userAddrWeb) { + user_addr_web = userAddrWeb; + } + +} diff --git b/src/com/espeed/yxy/service/YxyMarketingPlanService.java a/src/com/espeed/yxy/service/YxyMarketingPlanService.java new file mode 100644 index 0000000..1417f36 --- /dev/null +++ a/src/com/espeed/yxy/service/YxyMarketingPlanService.java @@ -0,0 +1,41 @@ +package com.espeed.yxy.service; + +import java.util.List; + +import com.espeed.centre.pojo.CentreYxyedmOldcustomer; +import com.espeed.yxy.pojo.YxyMailStencil; +import com.espeed.yxy.pojo.YxyMarketingPlan; +import com.espeed.yxy.pojo.YxySenderSet; +import com.espeed.yxy.pojo.YxyUserAddress; + +/*** + * + * @author 谢勇 + * 计划service + */ +public interface YxyMarketingPlanService { + + /**是否有可执行的营销计划*/ + public List<YxyMarketingPlan> findHavePlan()throws Exception; + + /**根据地址分组查询地址*/ + public List<YxyUserAddress> findAddressByGroupid(int typeid,int plan_differen,String loginid,String domain,String other_name)throws Exception; + + /**查询模版*/ + public YxyMailStencil findStencilInfo(int stencilid)throws Exception; + + /**查询发件人*/ + public YxySenderSet findSender(String loginid,String domain)throws Exception; + + /**修改计划周期状态*/ + public void updateWeekStatus(int weekid,int status)throws Exception; + + /**修改计划状态*/ + public void updatePlanStatus(int planid,int status)throws Exception; + + /**code查询控制参数(有用户级返回用户级,否则返回默认参数)*/ + public String findCompanyParamByCode(String code,String loginid,String domain)throws Exception; + + /**获取EDM配置-盘活客户配置信息*/ + public CentreYxyedmOldcustomer getOldCusSet(String domain)throws Exception; +} diff --git b/src/com/espeed/yxy/service/YxySendMailService.java a/src/com/espeed/yxy/service/YxySendMailService.java new file mode 100644 index 0000000..7281c59 --- /dev/null +++ a/src/com/espeed/yxy/service/YxySendMailService.java @@ -0,0 +1,104 @@ +package com.espeed.yxy.service; + +import java.util.List; +import java.util.Map; + +import com.espeed.centre.pojo.CentreTrackSet; +import com.espeed.centre.pojo.CentreYxyedmNewcustomer; +import com.espeed.centre.pojo.CentreYxyedmOldcustomer; +import com.espeed.yxy.pojo.YxySendMailDetail; +import com.espeed.yxy.pojo.YxySendMailMaster; +import com.espeed.yxy.pojo.YxySendSmtpInfo; +import com.espeed.yxy.pojo.YxySmtpSendSelfOverset; +import com.espeed.yxy.pojo.YxySmtpSendSelfSet; +import com.espeed.yxy.pojo.YxySmtpSendSet; +import com.espeed.yxy.pojo.YxySmtpSuffixSet; +import com.espeed.yxy.pojo.YxySysParamatersValue; +import com.espeed.yxy.pojo.YxyUserAddress; +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 邮件发送service业务接口(营销游) + * 开始时间: 2013.12.09 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +public interface YxySendMailService { + + //------------------------待发邮件操作模块----------------------------- + /**查询所有待发邮件*/ + public List<YxySendMailMaster> findByMailNum(int mailNum)throws Exception; + /**修改邮件使用状态*/ + public void updateMailUseStatus(int mailid, int isuse,String timer)throws Exception; + /**修改邮件异常量*/ + public void updateMailExpStatus(int mailid,int expnum)throws Exception; + /**同时修改待发邮件状态与基本邮件信息状态*/ + public void updateMailStatus(int status,int mailid,String mailuid)throws Exception; + /**加入待发邮件*/ + public void addMailMaster(YxySendMailMaster master,List<YxyUserAddress> sendaddress,int planid,int plan_differen)throws Exception; + /**更新待发邮件图片与附件路径*/ + public void updatepicattrpath(int masterid,String picpath,String attrpath)throws Exception; + /**根据hql获取待发邮件*/ + public List<YxySendMailMaster> getMailMasterByHql(String hql)throws Exception; + //------------------------待发地址操作模块----------------------------- + /**根据待发邮件ID查询待发地址*/ + public List<YxySendMailDetail> findAddressByMailID(int mailID)throws Exception; + /**修改此地址为已发送*/ + public void updateMailDetailstatus(int addressid)throws Exception; + /**更新地址状态为异常地址*/ + public void updateExp(int addressid,int expnum)throws Exception; + /**根据邮件ID查询是否还存在待发地址*/ + public boolean isHaveAddress(int mailid)throws Exception; + //------------------------SMTP操作模块--------------------------------- + /**查询所有SMTP*/ + public List<YxySendSmtpInfo> findSmtpInfoSetNum()throws Exception; + /**更新smtp使用状态*/ + public void updateSmtpUseStatus(int status,int smtpid,String nowdate)throws Exception; + /**更新smtp状态所有的*/ + public void updatesmtpstatus()throws Exception; + /**根据客户类型查询smtp*/ + public YxySendSmtpInfo findSmtpInfoByCusType(List<YxySendSmtpInfo> smtp_list,int cus_type)throws Exception; + /**查找自主域名投递的smtp*/ + public YxySendSmtpInfo findSmtpInfoByCusType2(List<YxySendSmtpInfo> smtp_list,YxySendMailMaster master)throws Exception; + //------------------------SMTP后缀设置参数模块------------------------- + /**查询后缀信息*/ + public List<YxySmtpSuffixSet> findAllSmtpSuffixSet()throws Exception; + + + //------------------------SMTP后缀发送量模块---------------------------- + /**查询该smtp对应后缀在时间段的发送量*/ + public List<YxySmtpSendSet> findAllSmtpSendSet(String smtpservice,String nowDay)throws Exception; + /**删除后缀已发量信息*/ + public void delmSmtpSet(String smtpService)throws Exception; + /**更新发送量信息*/ + public void updateSmtpSet(List<YxySmtpSendSet> o)throws Exception; + //------------------------控制参数模块--------------------------------- + /**code查询控制参数(有用户级返回用户级,否则返回默认参数)*/ + public String findCompanyParamByCode(String code,String loginid,String domain)throws Exception; + /**paraid查询企业级控制参数*/ + public List<YxySysParamatersValue> findCompanyParamValues(String domian,int para_id)throws Exception; + + //------------------------自配SMTP发送量模块----------------------------- + /**通过smtpID查询此smtp的发送参数*/ + public List<YxySmtpSendSelfSet> findSendSelfSetByService(String smtpservice)throws Exception; + /**查询自配账号的已发送量信息*/ + public List<YxySmtpSendSelfOverset> findBySmtpAccount(String account)throws Exception; + /**添加自配账号的已发量信息*/ + public void addSendSelfSet(YxySmtpSendSelfOverset o)throws Exception; + /**更新自配已发量*/ + public void updateSendSelfSet(YxySmtpSendSelfOverset o)throws Exception; + /**查询SMTP判断是否阻塞*/ + public void updateinitsmtpstatus()throws Exception; + /**获取跟踪配置信息*/ + public List<CentreTrackSet> getTrackSetByHql(String hql)throws Exception; + /**获取开发客户配置信息*/ + public List<CentreYxyedmNewcustomer> getNewCustomerSet(String hql)throws Exception; + /**获取盘活客户配置信息*/ + public List<CentreYxyedmOldcustomer> getOldCustomerSet(String hql)throws Exception; + /**获取用户信息*/ + public List<Object> getUserInfoBySql(String sql)throws Exception; +} diff --git b/src/com/espeed/yxy/service/impl/YxyMarketingPlanServiceImpl.java a/src/com/espeed/yxy/service/impl/YxyMarketingPlanServiceImpl.java new file mode 100644 index 0000000..87e79f7 --- /dev/null +++ a/src/com/espeed/yxy/service/impl/YxyMarketingPlanServiceImpl.java @@ -0,0 +1,459 @@ +package com.espeed.yxy.service.impl; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + + +import com.espeed.centre.pojo.CentreYxyedmOldcustomer; +import com.espeed.webmail.pojo.YxyCustomerEmail; +import com.espeed.yxy.dao.CentreUserDao; +import com.espeed.yxy.dao.CentreYxyedmOldcustomerDao; +import com.espeed.yxy.dao.CrmCustomerInfoDao; +import com.espeed.yxy.dao.YxyCustomerEmailDao; +import com.espeed.yxy.dao.YxyMailStencilDao; +import com.espeed.yxy.dao.YxyMarketingPlanDao; +import com.espeed.yxy.dao.YxyMarketingWeekDao; +import com.espeed.yxy.dao.YxyParamaterDao; +import com.espeed.yxy.dao.YxySendCountDao; +import com.espeed.yxy.dao.YxySenderSetDao; +import com.espeed.yxy.dao.YxySysParamatersValueDao; +import com.espeed.yxy.dao.YxyUserAddressDao; +import com.espeed.yxy.pojo.YxyMailStencil; +import com.espeed.yxy.pojo.YxyMarketingPlan; +import com.espeed.yxy.pojo.YxySendCount; +import com.espeed.yxy.pojo.YxySenderSet; +import com.espeed.yxy.pojo.YxySysParamaters; +import com.espeed.yxy.pojo.YxySysParamatersValue; +import com.espeed.yxy.pojo.YxyUserAddress; +import com.espeed.yxy.service.YxyMarketingPlanService; +import com.espeed.yxy.tool.DateFormat; + +public class YxyMarketingPlanServiceImpl implements YxyMarketingPlanService{ + + /**是否有可执行的营销计划*/ + public List<YxyMarketingPlan> findHavePlan() throws Exception { + SimpleDateFormat df=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String nowdate=df.format(new Date()); + String nowday=nowdate.split(" ")[0]; + String nowtime=nowdate.split(" ")[1]; + + //hql查询 + String hql="from YxyMarketingPlan where (plan_status=0 or plan_status=-1) and plan_type=1 and plan_executetime<='"+nowtime+"' and plan_begintime<='"+nowday+"' and plan_endtime>='"+nowday+"'"; + return marketingplandao.findByHql(hql); + } + + /**根据地址分组查询地址*/ + public List<YxyUserAddress> findAddressByGroupid(int typeid,int plan_differen,String loginid,String domain,String other_name) throws Exception { + //判断是否是本地库发送还是CRM库 + if(plan_differen == 0)//本地库发送 + { + String hql="from YxyUserAddress where user_addr_type_id="+typeid; + return addressdao.findByHql(hql); + } + else//客户管理发送 + { + int company_id = 0; + int user_id = 0; + List<YxyCustomerEmail> customerEmails = new ArrayList<YxyCustomerEmail>(); + if(plan_differen == 1 || plan_differen == 2){//客户分类 + String sql = "select company_id from centre_company where domain = '"+domain+"'"; + List<Object> objects = centreuserdao.findBySqlFind(sql); + if(objects.size() > 0 && objects.get(0) != null){ + company_id = Integer.parseInt(objects.get(0).toString()); + sql = "select user_id from centre_user where company_id = "+company_id+" and login_id = '"+loginid+"'"; + objects = centreuserdao.findBySqlFind(sql); + if(objects.size() > 0 && objects.get(0) != null){ + user_id = Integer.parseInt(objects.get(0).toString()); + String hql = "from YxyCustomerEmail where user_id = "+user_id+" and current_status != 1 " + + "and delete_flag = 0 and classify_id = "+typeid; + customerEmails = yxycustomeremaildao.findByHql(hql); + } + } + }else if(plan_differen == 3 || plan_differen == 4){//客户状态 + String sql = "select company_id from centre_company where domain = '"+domain+"'"; + List<Object> objects = centreuserdao.findBySqlFind(sql); + if(objects.size() > 0 && objects.get(0) != null){ + company_id = Integer.parseInt(objects.get(0).toString()); + sql = "select user_id from centre_user where company_id = "+company_id+" and login_id = '"+loginid+"'"; + objects = centreuserdao.findBySqlFind(sql); + if(objects.size() > 0 && objects.get(0) != null){ + user_id = Integer.parseInt(objects.get(0).toString()); + String hql = "from YxyCustomerEmail where user_id = "+user_id+" and current_status != 1 " + + "and delete_flag = 0 and customer_status = "+typeid; + customerEmails = yxycustomeremaildao.findByHql(hql); + } + } + }else if(plan_differen == 5 || plan_differen == 6){//客户来源 + String sql = "select company_id from centre_company where domain = '"+domain+"'"; + List<Object> objects = centreuserdao.findBySqlFind(sql); + if(objects.size() > 0 && objects.get(0) != null){ + company_id = Integer.parseInt(objects.get(0).toString()); + sql = "select user_id from centre_user where company_id = "+company_id+" and login_id = '"+loginid+"'"; + objects = centreuserdao.findBySqlFind(sql); + if(objects.size() > 0 && objects.get(0) != null){ + user_id = Integer.parseInt(objects.get(0).toString()); + String hql = "from YxyCustomerEmail where user_id = "+user_id+" and current_status != 1 " + + "and delete_flag = 0 and source_from_id = "+typeid; + customerEmails = yxycustomeremaildao.findByHql(hql); + } + } + }else if(plan_differen == 7 || plan_differen == 8){//意向产品 + String sql = "select company_id from centre_company where domain = '"+domain+"'"; + List<Object> objects = centreuserdao.findBySqlFind(sql); + if(objects.size() > 0 && objects.get(0) != null){ + company_id = Integer.parseInt(objects.get(0).toString()); + sql = "select user_id from centre_user where company_id = "+company_id+" and login_id = '"+loginid+"'"; + objects = centreuserdao.findBySqlFind(sql); + if(objects.size() > 0 && objects.get(0) != null){ + user_id = Integer.parseInt(objects.get(0).toString()); + String hql = "from YxyCustomerEmail where user_id = "+user_id+" and current_status != 1 " + + "and delete_flag = 0 and find_in_set("+typeid+",prductid) > 0"; + customerEmails = yxycustomeremaildao.findByHql(hql); + } + } + }else if(plan_differen == 9 || plan_differen == 10){//采购偏好 + if(other_name != null && !"".equals(other_name)){ + String sql = "select company_id from centre_company where domain = '"+domain+"'"; + List<Object> objects = centreuserdao.findBySqlFind(sql); + if(objects.size() > 0 && objects.get(0) != null){ + company_id = Integer.parseInt(objects.get(0).toString()); + sql = "select user_id from centre_user where company_id = "+company_id+" and login_id = '"+loginid+"'"; + objects = centreuserdao.findBySqlFind(sql); + if(objects.size() > 0 && objects.get(0) != null){ + user_id = Integer.parseInt(objects.get(0).toString()); + String customerids = ""; + sql = "select customer_id from crm_customer_info where most_sourcing_industries like '%" + other_name + "%' and user_id = " + user_id; + objects = crmcustomerinfodao.findBySqlFind(sql); + for (int i = 0;i < objects.size();i++) { + customerids += objects.get(i).toString() + ","; + } + if(!customerids.equals("")){ + customerids = customerids.substring(0,customerids.length()-1); + String hql = "from YxyCustomerEmail where delete_flag = 0 and current_status != 1 " + + "and user_id = "+user_id+" and customer_id in("+customerids+")"; + customerEmails = yxycustomeremaildao.findByHql(hql); + } + } + } + } + }else if(plan_differen == 11 || plan_differen == 12){//个性营销 + if(other_name != null && !"".equals(other_name)){ + String sql = "select company_id from centre_company where domain = '"+domain+"'"; + List<Object> objects = centreuserdao.findBySqlFind(sql); + if(objects.size() > 0 && objects.get(0) != null){ + company_id = Integer.parseInt(objects.get(0).toString()); + sql = "select user_id from centre_user where company_id = "+company_id+" and login_id = '"+loginid+"'"; + objects = centreuserdao.findBySqlFind(sql); + if(objects.size() > 0 && objects.get(0) != null){ + user_id = Integer.parseInt(objects.get(0).toString()); + String[] conditionArr = other_name.split("@espeed@"); + if(conditionArr.length == 10){ + String classfiyStr = conditionArr[0];//客户分类信息 + String statusStr = conditionArr[1];//客户状态信息 + String fromStr = conditionArr[2];//客户来源信息 + String starStr = conditionArr[3];//客户星级信息 + String productStr = conditionArr[4];//意向产品信息 + String caigouStr = conditionArr[5];//采购偏好信息 + String entrolStr = conditionArr[6];//入库时间信息 + String contactStr = conditionArr[7];//联系时间信息 + String followStr = conditionArr[8];//未跟进时间信息 + String typeStr = conditionArr[9];//客户类型信息,0私海,1公海 + String hql = "from YxyCustomerEmail where user_id = "+user_id+" and delete_flag = 0 and current_status != 1 and"; + if(typeStr.equals("1")){//公海客户 + hql = "from YxyCustomerEmail where company_id = "+company_id+" and delete_flag = 0 and current_status = 1 and"; + } + if(!classfiyStr.equals("no")){ + hql += " classify_id in("+classfiyStr+") and"; + } + if(!statusStr.equals("no")){ + hql += " customer_status in("+statusStr+") and"; + } + if(!fromStr.equals("no")){ + hql += " source_from_id in("+fromStr+") and"; + } + if(!starStr.equals("no")){ + hql += " important_star in("+starStr+") and"; + } + if(!productStr.equals("no")){ + String[] productArr = productStr.split("@G@"); + String subHql = " ("; + for(String s : productArr){ + subHql += "find_in_set("+s+",prductid) > 0 or "; + } + subHql = subHql.substring(0,subHql.lastIndexOf("or ")-1); + hql += subHql + ") and"; + } + if(!caigouStr.equals("no")){ + String[] caigouArr = caigouStr.split("@G@"); + int jingzhun = Integer.parseInt(caigouArr[0]);//0:不精准,1:精准 + String customerids = ""; + for(int k = 1;k < caigouArr.length; k++){ + sql = ""; + if(jingzhun == 1){ + sql = "select customer_id from crm_customer_info where find_in_set('"+caigouArr[k]+"',most_sourcing_industries) > 0 and user_id = " + user_id; + }else{ + sql = "select customer_id from crm_customer_info where most_sourcing_industries like '%" + caigouArr[k] + "%' and user_id = " + user_id; + } + objects = crmcustomerinfodao.findBySqlFind(sql); + for (int i = 0;i < objects.size();i++) { + customerids += objects.get(i).toString() + ","; + } + } + if(!customerids.equals("")){ + customerids = customerids.substring(0,customerids.length()-1); + hql += " customer_id in("+customerids+") and"; + } + } + if(!entrolStr.equals("no")){ + String[] entrolArr = entrolStr.split("@G@"); + if(entrolArr.length == 1){ + hql += " enrol_time >= '"+entrolArr[0]+" 00:00:00' and"; + }else if(entrolArr.length == 2){ + hql += " enrol_time >= '"+entrolArr[0]+" 00:00:00' and enrol_time <= '"+entrolArr[1]+" 23:59:59' and"; + } + } + if(!contactStr.equals("no")){ + String[] contactArr = contactStr.split("@G@"); + if(contactArr.length == 1){ + hql += " last_contact_date >= '"+contactArr[0]+" 00:00:00' and"; + }else if(contactArr.length == 2){ + hql += " last_contact_date >= '"+contactArr[0]+" 00:00:00' and last_contact_date <= '"+contactArr[1]+" 23:59:59' and"; + } + } + if(!followStr.equals("no")){ + String[] followArr = followStr.split("@G@"); + int day = Integer.parseInt(followArr[0]); + if(day != -1){ + String start_time = DateFormat.lastDays(-day); + hql += " last_contact_date < '"+start_time+" 00:00:00' and"; + }else if(followArr.length == 2){ + String[] timeArr = followArr[1].split(","); + if(timeArr.length == 1){ + hql += " last_contact_date >= '"+timeArr[0]+" 00:00:00' and"; + }else if(timeArr.length == 2){ + hql += " last_contact_date >= '"+timeArr[0]+" 00:00:00' and last_contact_date <= '"+timeArr[1]+" 23:59:59' and"; + } + } + } + if(!hql.equals("from YxyCustomerEmail where user_id = "+user_id+" and delete_flag = 0 and current_status != 1 and") + && !hql.equals("from YxyCustomerEmail where company_id = "+company_id+" and delete_flag = 0 and current_status = 1 and")){//说明以上的条件都不适合 + hql = hql.substring(0,hql.length()-3); + customerEmails = yxycustomeremaildao.findByHql(hql); + } + } + } + } + } + } + SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd"); + SimpleDateFormat df2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String nowtime = df2.format(new Date()); + String nowdate = df.format(new Date()); + List<YxyUserAddress> address_list = new ArrayList<YxyUserAddress>(); + for(YxyCustomerEmail customer : customerEmails){ + //只查询主联系人的信息 + String sql = "select full_name,email from crm_linkman where is_main_linkman = 1 and customer_id = "+customer.getCustomer_id(); + List<Object> objects = yxycustomeremaildao.findBySqlQuery(sql); + if(objects.size() > 0){ + Object[] obj_arr = (Object[])objects.get(0); + YxyUserAddress address = new YxyUserAddress(); + address.setUser_addr_id(customer.getCustomer_id());//客户id赋值给主键id + address.setCompany_variable(customer.getCustomer_name());//客户名称 + address.setUser_addr_email(obj_arr[1].toString());//地址 + address.setUser_addr_name(obj_arr[0].toString());//联系人 + address_list.add(address);//添加到集合 + try{ + String hql = "from YxySendCount where user_id = "+user_id+" and customer_id = "+customer.getCustomer_id()+" and send_date = '"+nowdate+"'"; + List<YxySendCount> counts = yxysendcountdao.findByHql(hql); + if(counts.size() > 0){ + YxySendCount count = counts.get(0); + count.setSend_counts(count.getSend_counts()+1); + count.setSend_time(nowtime); + yxysendcountdao.updatePojo(count); + }else{ + YxySendCount count = new YxySendCount(); + count.setUser_id(user_id); + count.setCompany_id(company_id); + count.setSend_counts(1); + count.setSend_date(nowdate); + count.setSend_time(nowtime); + count.setCustomer_id(customer.getCustomer_id()); + yxysendcountdao.addPojo(count); + } + }catch (Exception e) { + // TODO: handle exception + } + } + } + return address_list; + } + } + + /**查询模版*/ + public YxyMailStencil findStencilInfo(int stencilid) throws Exception { + String hql="from YxyMailStencil where stencil_id="+stencilid; + List<YxyMailStencil> stencillist=stencildao.findByHql(hql); + if(stencillist.size()>0){ + return stencillist.get(0); + }else{ + return null; + } + } + + /**查询发件人*/ + public YxySenderSet findSender(String loginid,String domain)throws Exception{ + String hql="from YxySenderSet where user_login='"+loginid+"' and user_domain='"+domain+"' and isdefault=1"; + List<YxySenderSet> senderlist=senderdao.findByHql(hql); + if(senderlist.size()>0){ + return senderlist.get(0); + }else{ + return null; + } + } + + /**修改计划周期状态*/ + public void updateWeekStatus(int weekid,int status)throws Exception{ + String hql="update YxyMarketingWeek set isexecution="+status+" where week_id="+weekid; + marketingweekdao.updateByHql(hql); + } + + /**修改计划状态*/ + public void updatePlanStatus(int planid,int status)throws Exception{ + String hql="update YxyMarketingPlan set plan_status="+status+" where plan_id="+planid; + marketingplandao.updateByHql(hql); + } + + /**code查询控制参数(有用户级返回用户级,否则返回默认参数)*/ + public String findCompanyParamByCode(String code,String loginid,String domain)throws Exception{ + //查询此code的paramid + String hql="from YxySysParamaters where para_code='"+code+"'"; + List<YxySysParamaters> paraslist=yxysysparamaterdao.findByHql(hql); + if(paraslist.size()>0){ + int paramid=paraslist.get(0).getPara_id(); + int level=paraslist.get(0).getOwner_type();//所属等级 + String defaultvalue=paraslist.get(0).getDefault_value();//默认值 + if(level==4){//用户级 + //查询参数值 + String hql1="from YxySysParamatersValue where para_id="+paramid+" and owner_loginid='"+loginid+"' and company_domain='"+domain+"'"; + List<YxySysParamatersValue> paraValue=yxysysparamatersvaluedao.findByHql(hql1); + if(paraValue.size()>0){ + return paraValue.get(0).getPara_value(); + }else{ + return defaultvalue; + } + }else{//系统级 + //查询参数值 + String hql1="from YxySysParamatersValue where para_id="+paramid+" and company_domain='"+domain+"'"; + List<YxySysParamatersValue> paraValue=yxysysparamatersvaluedao.findByHql(hql1); + if(paraValue.size()>0){ + return paraValue.get(0).getPara_value(); + }else{ + return defaultvalue; + } + } + + }else{ + return "-1"; + } + } + + /**获取EDM配置-盘活客户配置信息*/ + public CentreYxyedmOldcustomer getOldCusSet(String domain)throws Exception{ + String hql= "from CentreYxyedmOldcustomer where company_domain = '"+domain+"'"; + List<CentreYxyedmOldcustomer> list = centreyxyedmoldcustomerdao.findByHql(hql); + if(list.size()>0){ + return list.get(0); + }else{ + return null; + } + } + + private YxyMarketingPlanDao marketingplandao;//营销计划dao + private YxyMarketingWeekDao marketingweekdao;//营销计划周期dao + private YxyUserAddressDao addressdao;//用户地址dao + private YxyMailStencilDao stencildao;//模版dao + private YxySenderSetDao senderdao;//发件人dao + private YxyParamaterDao yxysysparamaterdao;//控制参数dao + private YxySysParamatersValueDao yxysysparamatersvaluedao;//控制参数值dao + private YxyCustomerEmailDao yxycustomeremaildao;//客户邮件dao + private CentreYxyedmOldcustomerDao centreyxyedmoldcustomerdao;//盘活客户配置dao + private CentreUserDao centreuserdao;//用户dao + private CrmCustomerInfoDao crmcustomerinfodao;//阿里巴巴客户dao + private YxySendCountDao yxysendcountdao;//客户发送邮件的统计dao + public YxyCustomerEmailDao getYxycustomeremaildao() { + return yxycustomeremaildao; + } + public void setYxycustomeremaildao(YxyCustomerEmailDao yxycustomeremaildao) { + this.yxycustomeremaildao = yxycustomeremaildao; + } + public YxyUserAddressDao getAddressdao() { + return addressdao; + } + public void setAddressdao(YxyUserAddressDao addressdao) { + this.addressdao = addressdao; + } + public YxyMarketingPlanDao getMarketingplandao() { + return marketingplandao; + } + public void setMarketingplandao(YxyMarketingPlanDao marketingplandao) { + this.marketingplandao = marketingplandao; + } + public YxyMarketingWeekDao getMarketingweekdao() { + return marketingweekdao; + } + public void setMarketingweekdao(YxyMarketingWeekDao marketingweekdao) { + this.marketingweekdao = marketingweekdao; + } + public YxyMailStencilDao getStencildao() { + return stencildao; + } + public void setStencildao(YxyMailStencilDao stencildao) { + this.stencildao = stencildao; + } + public YxySenderSetDao getSenderdao() { + return senderdao; + } + public void setSenderdao(YxySenderSetDao senderdao) { + this.senderdao = senderdao; + } + public YxyParamaterDao getYxysysparamaterdao() { + return yxysysparamaterdao; + } + public void setYxysysparamaterdao(YxyParamaterDao yxysysparamaterdao) { + this.yxysysparamaterdao = yxysysparamaterdao; + } + public YxySysParamatersValueDao getYxysysparamatersvaluedao() { + return yxysysparamatersvaluedao; + } + public void setYxysysparamatersvaluedao( + YxySysParamatersValueDao yxysysparamatersvaluedao) { + this.yxysysparamatersvaluedao = yxysysparamatersvaluedao; + } + public CentreYxyedmOldcustomerDao getCentreyxyedmoldcustomerdao() { + return centreyxyedmoldcustomerdao; + } + public void setCentreyxyedmoldcustomerdao( + CentreYxyedmOldcustomerDao centreyxyedmoldcustomerdao) { + this.centreyxyedmoldcustomerdao = centreyxyedmoldcustomerdao; + } + public CentreUserDao getCentreuserdao() { + return centreuserdao; + } + public void setCentreuserdao(CentreUserDao centreuserdao) { + this.centreuserdao = centreuserdao; + } + public CrmCustomerInfoDao getCrmcustomerinfodao() { + return crmcustomerinfodao; + } + public void setCrmcustomerinfodao(CrmCustomerInfoDao crmcustomerinfodao) { + this.crmcustomerinfodao = crmcustomerinfodao; + } + public YxySendCountDao getYxysendcountdao() { + return yxysendcountdao; + } + public void setYxysendcountdao(YxySendCountDao yxysendcountdao) { + this.yxysendcountdao = yxysendcountdao; + } +} diff --git b/src/com/espeed/yxy/service/impl/YxySendMailServiceImpl.java a/src/com/espeed/yxy/service/impl/YxySendMailServiceImpl.java new file mode 100644 index 0000000..7c0927a --- /dev/null +++ a/src/com/espeed/yxy/service/impl/YxySendMailServiceImpl.java @@ -0,0 +1,696 @@ +package com.espeed.yxy.service.impl; + +import java.io.File; +import java.io.FileWriter; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.Date; +import java.util.List; + +import org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory; +import org.springframework.beans.BeanUtils; + +import com.espeed.centre.pojo.CentreTrackSet; +import com.espeed.centre.pojo.CentreYxyedmNewcustomer; +import com.espeed.centre.pojo.CentreYxyedmOldcustomer; +import com.espeed.yxy.dao.CentreTrackSetDao; +import com.espeed.yxy.dao.CentreUserDao; +import com.espeed.yxy.dao.CentreYxyedmNewcustomerDao; +import com.espeed.yxy.dao.CentreYxyedmOldcustomerDao; +import com.espeed.yxy.dao.YxyParamaterDao; +import com.espeed.yxy.dao.YxyReplyInfoDao; +import com.espeed.yxy.dao.YxySendFilterAddressDao; +import com.espeed.yxy.dao.YxySendMailDetailDao; +import com.espeed.yxy.dao.YxySendMailMasterBaseDao; +import com.espeed.yxy.dao.YxySendMailMasterDao; +import com.espeed.yxy.dao.YxySendSmtpInfoDao; +import com.espeed.yxy.dao.YxySmtpSendSelfOversetDao; +import com.espeed.yxy.dao.YxySmtpSendSelfSetDao; +import com.espeed.yxy.dao.YxySmtpSendSetDao; +import com.espeed.yxy.dao.YxySmtpSuffixSetDao; +import com.espeed.yxy.dao.YxySysParamatersValueDao; +import com.espeed.yxy.pojo.YxyReplyInfo; +import com.espeed.yxy.pojo.YxySendFilterAddress; +import com.espeed.yxy.pojo.YxySendMailDetail; +import com.espeed.yxy.pojo.YxySendMailMaster; +import com.espeed.yxy.pojo.YxySendMailMasterBase; +import com.espeed.yxy.pojo.YxySendSmtpInfo; +import com.espeed.yxy.pojo.YxySmtpSendSelfOverset; +import com.espeed.yxy.pojo.YxySmtpSendSelfSet; +import com.espeed.yxy.pojo.YxySmtpSendSet; +import com.espeed.yxy.pojo.YxySmtpSuffixSet; +import com.espeed.yxy.pojo.YxySysParamaters; +import com.espeed.yxy.pojo.YxySysParamatersValue; +import com.espeed.yxy.pojo.YxyUserAddress; +import com.espeed.yxy.service.YxySendMailService; +import com.espeed.yxy.tool.ConfigPath; +import com.espeed.yxy.tool.DateFormat; +import com.espeed.yxy.tool.createAndDeleteFile; +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 邮件发送service业务接口实现类(营销游) + * 开始时间: 2013.12.09 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +public class YxySendMailServiceImpl implements YxySendMailService{ + + //------------------------待发邮件操作模块----------------------------- + /**查询所有待发邮件*/ + public List<YxySendMailMaster> findByMailNum(int mailNum) throws Exception { + //正常可用的对象集合 + List<YxySendMailMaster> copymail=new ArrayList<YxySendMailMaster>(); + //数据库返回的结果集 + String hql="from YxySendMailMaster where isuse=0 and (status=0 or status=2) order by create_time"; + List<YxySendMailMaster> sendmailList=yxysendmailmasterdao.findByHql(hql); + if(sendmailList.size()>0){ + //当前时间 + SimpleDateFormat df=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String nowdate=df.format(new Date()); + //相隔分数 + long minytelcha=0; + //判断是不是定时邮件 + for(int i=0;i<sendmailList.size();i++){ + //如果等于指定条的相同则不在比较 + if(copymail.size()==mailNum){ + break; + } + if(sendmailList.get(i).getPlans_send()==1){//是定时邮件 + //判断是否定时时间到了当前时间 + minytelcha= DateFormat.minute1s(nowdate,sendmailList.get(i).getPlans_send_time()); + if(minytelcha<0){//如果在此时间内则加入该对象 + copymail.add(sendmailList.get(i)); + } + }else{//不是定时邮件 + copymail.add(sendmailList.get(i)); + } + } + return copymail; + }else{ + return sendmailList; + } + } + + /**修改邮件使用状态*/ + public void updateMailUseStatus(int mailid, int isuse,String timer) throws Exception { + String hql=""; + if(!timer.equals("")){ + hql="update YxySendMailMaster set isuse="+isuse+",result_remark='"+timer+"' where send_mail_id="+mailid; + }else{ + hql="update YxySendMailMaster set isuse="+isuse+" where send_mail_id="+mailid; + } + yxysendmailmasterdao.updateByHql(hql); + } + + /**修改邮件异常量*/ + public void updateMailExpStatus(int mailid, int expnum) throws Exception { + String hql="update YxySendMailMaster set exptionnum="+expnum+",isuse=0 where send_mail_id="+mailid; + yxysendmailmasterdao.updateByHql(hql); + } + /**同时修改待发邮件状态与基本邮件信息状态*/ + public void updateMailStatus(int status,int mailid, String mailuid) throws Exception { + String hql="update YxySendMailMaster set status="+status+" where send_mail_id="+mailid; + String sql="update yxy_send_mail_master_base set status="+status+" where mail_uid='"+mailuid+"'"; + yxysendmailmasterdao.updateByHql(hql); + yxysendmailmasterdao.updateBySql(sql); + } + + /**加入待发邮件*/ + public void addMailMaster(YxySendMailMaster master,List<YxyUserAddress> addresslist,int planid,int plan_differen)throws Exception { + String loginid=master.getUser_loginid(); + String domain=master.getUser_domain(); + + String customerids = "";//客户的id + //定义邮件基本信息实体 + YxySendMailMasterBase masterbase=new YxySendMailMasterBase(); + //复制对象 + BeanUtils.copyProperties(master,masterbase); + //插入待发邮件 + //int mailid=yxysendmailmasterdao.addPojo(master); + //插入基本邮件信息 + //int baseid=mailmasterbasedao.addPojo(masterbase); + //待发地址 + List<YxySendMailDetail> detaillist=new ArrayList<YxySendMailDetail>(); + //查询回复 + String hql="from YxyReplyInfo where loginid='"+loginid+"' and domain='"+domain+"'"; + List<YxyReplyInfo> replylist=replydao.findByHql(hql); + //查询过滤 + String filterhql="from YxySendFilterAddress where filteraddrloginid='"+loginid+"' and filteraddrdomain='"+domain+"'"; + List<YxySendFilterAddress> filterlist=filterdao.findByHql(filterhql); + //待发地址处理(去掉回复的,用户过滤的) + for(int i=0;i<addresslist.size();i++){ + String email=addresslist.get(i).getUser_addr_email();//地址 + for(int j=0;j<replylist.size();j++){ + if(email.equals(replylist.get(j).getReplyemail())){ + break; + } + } + for(int s=0;s<filterlist.size();s++){ + if(email.indexOf(filterlist.get(s).getFilteraddress())!=-1){ + break; + } + } + + customerids += addresslist.get(i).getUser_addr_id()+",";//当有多个地址进行拼接 + + //待发地址对象 + YxySendMailDetail detail=new YxySendMailDetail(); + detail.setCompany_variable(addresslist.get(i).getCompany_variable()); + detail.setEmail(email); + detail.setEmail_suffix(""); + detail.setIsexp(0); + detail.setPlanid(planid); + detail.setPlans_send_time(null); + detail.setReceiver(addresslist.get(i).getUser_addr_name()); + detail.setStatus(0); + detail.setLoginid(loginid); + detail.setDomain(domain); + //加入集合 + detaillist.add(detail); + } + //赋值 + masterbase.setSend_num(detaillist.size()); + + //将地址生成txt文件(存放路径:域名+用户名+当前时间) + StringBuffer writestr=new StringBuffer(); + if(detaillist.size()>0){ + writestr.append(masterbase.getCreate_time()+"发送的邮件地址\r\n"); + for(int i=0;i<detaillist.size();i++){ + writestr.append(detaillist.get(i).getEmail()+"\r\n"); + } + //项目路进(默认是易外销的营销邮) + String pathew = ConfigPath.getYxyServicePath(); + if(plan_differen == 0){//如果是本地库则切换成单独营销邮的路径 + pathew = ConfigPath.getYxyServicePath2(); + } + SimpleDateFormat dfs=new SimpleDateFormat("yyyyMMddHHmmssSSS"); + String nowFilename=dfs.format(new Date()); + String filename=nowFilename+".txt"; + String txtsavepath=pathew+"\\userSaveFile\\"+domain+"\\"+loginid+"\\"+filename; + File f=new File(pathew+"\\userSaveFile\\"+domain+"\\"+loginid); + if(!f.exists()){ + f.mkdirs(); + } + createAndDeleteFile.createFile(txtsavepath); + System.out.println(txtsavepath); + //写入文件 + FileWriter w = new FileWriter(txtsavepath, true); + w.write(writestr.toString()); + w.close(); + + masterbase.setTxtaddresspath(filename); + } + + //插入待发邮件 + int mailid=yxysendmailmasterdao.addPojo(master); + //插入基本邮件信息 + int baseid=mailmasterbasedao.addPojo(masterbase); + + for(YxySendMailDetail detail : detaillist) + { + detail.setBase_mail_id(baseid); + detail.setSend_mail_id(mailid); + } + + //plan_differen > 0 是客户管理的,否则就是本地库的 + if(plan_differen > 0) + { + //判断客户id + if(!"".equals(customerids)){//不能为空,当有多个 + customerids = customerids.substring(0,customerids.length()-1); + } + try{ + //访问webmail接口URL + String url =ConfigPath.getWebmailInterfaceUrl()+"/webmailWebservice/yxyaddfollowupwebservice?wsdl"; + JaxWsDynamicClientFactory dcf = JaxWsDynamicClientFactory.newInstance(); + org.apache.cxf.endpoint.Client client = dcf.createClient(url); + client.invoke("addFollowup",customerids,0,loginid,domain,masterbase.getSubject(),baseid); + }catch (Exception e) { + System.out.println("添加跟进记录异常..."); + e.printStackTrace(); + } + } + + yxysendmaildetaildao.addPiPojo(detaillist); + } + + /**更新待发邮件图片与附件路径*/ + public void updatepicattrpath(int masterid, String picpath, String attrpath)throws Exception { + String hql=""; + if(!"".equals(picpath)&&!"".equals(attrpath)){ + hql="update YxySendMailMaster set image_path='"+picpath+"',attarchment_path='"+attrpath+"' where send_mail_id="+masterid; + yxysendmailmasterdao.updateByHql(hql); + }else if(!"".equals(picpath)){ + hql="update YxySendMailMaster set image_path='"+picpath+"' where send_mail_id="+masterid; + yxysendmailmasterdao.updateByHql(hql); + }else if(!"".equals(attrpath)){ + hql="update YxySendMailMaster set attarchment_path='"+attrpath+"' where send_mail_id="+masterid; + yxysendmailmasterdao.updateByHql(hql); + } + } + + /**根据hql获取待发邮件*/ + public List<YxySendMailMaster> getMailMasterByHql(String hql)throws Exception{ + return yxysendmailmasterdao.findByHql(hql); + } + + //------------------------待发地址操作模块----------------------------- + /**查询指定条待发地址*/ + public List<YxySendMailDetail> findAddressByMailID(int mailid) throws Exception { + String hql="from YxySendMailDetail where status=0 and send_mail_id="+mailid; + return yxysendmaildetaildao.findByHql(hql); + } + /**修改此地址为已发送*/ + public void updateMailDetailstatus(int addressid) throws Exception { + String hql="update YxySendMailDetail set status=1 where mail_id="+addressid; + yxysendmaildetaildao.updateByHql(hql); + } + /**更新地址状态为异常地址*/ + public void updateExp(int addressid,int expnum) throws Exception { + if(expnum>=ConfigPath.getSendExpNum()){//该收件地址异常数量已经大于配置文件中的数量 + String hql="update YxySendMailDetail set status=1,isexp="+expnum+" where mail_id="+addressid; + yxysendmaildetaildao.updateByHql(hql); + }else{//不大于 + String hql="update YxySendMailDetail set isexp="+expnum+" where mail_id="+addressid; + yxysendmaildetaildao.updateByHql(hql); + } + } + /**根据邮件ID查询是否还存在待发地址*/ + public boolean isHaveAddress(int mailid) throws Exception { + String hql="select count(*) from YxySendMailDetail where send_mail_id="+mailid+" and status=0"; + List resultlist=yxysendmaildetaildao.findByHql(hql); + int num=0; + if(resultlist.size()>0){ + Object obj=resultlist.get(0); + num=Integer.parseInt(obj.toString()); + } + if(num>0){ + return true; + }else{ + return false; + } + } + //------------------------SMTP操作模块--------------------------------- + /**查询可用SMTP*/ + public List<YxySendSmtpInfo> findSmtpInfoSetNum() throws Exception { + + //当前时间 +// SimpleDateFormat df=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); +// String nowdate=df.format(new Date()); + + //集合定义 + List<YxySendSmtpInfo> resmtp=new ArrayList<YxySendSmtpInfo>(); + //查询SMTP信息 + //String hql="from YxySendSmtpInfo where smtp_service_isuse=0 or smtp_service_isuse=1 order by smtp_service_userdate"; + String hql="from YxySendSmtpInfo where smtp_service_isuse=0"; + return yxysendsmtpinfodao.findByHql(hql); + +// String useDate=""; +// long timers=0; +// +// //判断SMTP是否可用 +// for(int i=0;i<smtplist.size();i++){ +// //如果是正在使用中的话判断是否是可用了 +// if(smtplist.get(i).getSmtp_service_isuse()==0){//有未使用的直接返回未使用的 +// resmtp.add(smtplist.get(i)); +// }else{//正在使用中的 +// useDate =smtplist.get(i).getSmtp_service_userdate();//SMTP最后使用的时间 +// //判断两时间的相差量 +// timers=DateFormat.minute1s(useDate, nowdate); +// if(timers>120){//如果两个小时都没使用则在次使用 +// //String hql1="update YxySendSmtpInfo set smtp_service_isuse=0 where smtp_service_id="+smtplist.get(i).getSmtp_service_id(); +// //yxysendsmtpinfodao.updateByHql(hql1); +// resmtp.add(smtplist.get(i)); +// }else{ +// continue; +// } +// } +// } +// return resmtp; + } + + + /**更新smtp使用状态*/ + public void updateSmtpUseStatus(int status,int smtpid,String nowdate) throws Exception { + String hql1=""; + if(nowdate.equals("")){ + hql1="update YxySendSmtpInfo set smtp_service_isuse="+status+" where smtp_service_id="+smtpid; + }else{ + hql1="update YxySendSmtpInfo set smtp_service_isuse="+status+",smtp_service_userdate='"+nowdate+"' where smtp_service_id="+smtpid; + } + + yxysendsmtpinfodao.updateByHql(hql1); + } + + /**更新smtp状态所有的*/ + public void updatesmtpstatus()throws Exception{ + String hql="update YxySendSmtpInfo set smtp_service_isuse=1 where smtp_service_isuse=0"; + yxysendsmtpinfodao.updateByHql(hql); + } + + /**根据客户类型查询smtp*/ + public YxySendSmtpInfo findSmtpInfoByCusType(List<YxySendSmtpInfo> smtp_list,int cus_type)throws Exception + { + YxySendSmtpInfo smtpinfo = null; + + for(int i = 0; i < smtp_list.size(); i++) + { + if(cus_type == 0)//新客户营销 + { + //该smtp是新客户营销且是可用的 + if(smtp_list.get(i).getSmtp_service_type() == 0) + { + smtpinfo = smtp_list.get(i); + + break; + } + } + else if(cus_type == 1)//老客户跟进 + { + //该smtp是老客户跟进且是可用的 + if(smtp_list.get(i).getSmtp_service_type() == 1) + { + smtpinfo = smtp_list.get(i); + + break; + } + } + } + + return smtpinfo; + } + + /**查找自主域名投递的smtp*/ + public YxySendSmtpInfo findSmtpInfoByCusType2(List<YxySendSmtpInfo> smtp_list,YxySendMailMaster master)throws Exception + { + YxySendSmtpInfo smtpinfo = null; + + String loginid = master.getUser_loginid();//邮件所属帐号 + + String domain = master.getUser_domain();//邮件所属域名 + + //保存满足的smtp集合 + List<YxySendSmtpInfo> new_smtp_list = new ArrayList<YxySendSmtpInfo>(); + + for(YxySendSmtpInfo info : smtp_list) + { + String smtp_user_loginid = info.getSmtp_user_loginid();//smtp所属帐号 + + String smtp_user_domain = info.getSmtp_user_domain();//smtp所属域名 + + int smtp_service_type = info.getSmtp_service_type();//smtp类型 + + //smtp类型是自主域名投递且smtp是当前邮件所属用户且域名 + if(smtp_service_type == 2 && + loginid.equals(smtp_user_loginid) && domain.equals(smtp_user_domain)) + { + //把发第一封的时间为Null的smtp设置为空字符串否则下面进行排序时会出现空指针异常 + if(info.getSmtp_service_userdate() == null) + { + info.setSmtp_service_userdate(""); + } + + //添加到集合中 + new_smtp_list.add(info); + } + } + + //判断满足集合是否有元素 + if(new_smtp_list.size() > 0) + { + //按时间进行排序,时间后的排最后 + Collections.sort(new_smtp_list, new Comparator<YxySendSmtpInfo>(){ + @Override + public int compare(YxySendSmtpInfo o1, YxySendSmtpInfo o2) { + return o1.getSmtp_service_userdate().compareTo(o2.getSmtp_service_userdate()); + } + }); + + //取第一个smtp即最先使用的smtp + smtpinfo = new_smtp_list.get(0); + } + + return smtpinfo; + } + + //------------------------SMTP后缀设置参数模块------------------------- + /**查询后缀信息*/ + public List<YxySmtpSuffixSet> findAllSmtpSuffixSet() throws Exception { + String hql="from YxySmtpSuffixSet"; + return yxysmtpsuffixsetdao.findByHql(hql); + } + //------------------------SMTP后缀发送量模块---------------------------- + /**查询该smtp对应后缀在时间段的发送量*/ + public List<YxySmtpSendSet> findAllSmtpSendSet(String smtpservice,String nowDay) throws Exception { + String hql="from YxySmtpSendSet where smtp_send_set_service='"+smtpservice+"' and smtp_send_set_daydate='"+nowDay+"'"; + return yxysmtpsendsetdao.findByHql(hql); + } + + /**删除后缀已发量信息*/ + public void delmSmtpSet(String smtpService) throws Exception { + String hql="delete YxySmtpSendSet where smtp_send_set_service='"+smtpService+"'"; + yxysmtpsendsetdao.updateByHql(hql); + } + + /**更新发送量信息*/ + public void updateSmtpSet(List<YxySmtpSendSet> o) throws Exception { + yxysmtpsendsetdao.addPiPojo(o); + + } + //------------------------控制参数模块--------------------------------- + /**查询控制参数通过传的是系统级还是用户级*/ + public String findCompanyParamByCode(String code,String loginid,String domain) throws Exception { + //查询此code的paramid + String hql="from YxySysParamaters where para_code='"+code+"'"; + List<YxySysParamaters> paraslist=yxysysparamaterdao.findByHql(hql); + if(paraslist.size()>0){ + int paramid=paraslist.get(0).getPara_id(); + int level=paraslist.get(0).getOwner_type();//所属等级 + String defaultvalue=paraslist.get(0).getDefault_value();//默认值 + if(level==4){//用户级 + //查询参数值 + String hql1="from YxySysParamatersValue where para_id="+paramid+" and owner_loginid='"+loginid+"' and company_domain='"+domain+"'"; + List<YxySysParamatersValue> paraValue=yxysysparamatersvaluedao.findByHql(hql1); + if(paraValue.size()>0){ + return paraValue.get(0).getPara_value(); + }else{ + return defaultvalue; + } + }else{//系统级 + //查询参数值 + String hql1="from YxySysParamatersValue where para_id="+paramid+" and company_domain='"+domain+"'"; + List<YxySysParamatersValue> paraValue=yxysysparamatersvaluedao.findByHql(hql1); + if(paraValue.size()>0){ + return paraValue.get(0).getPara_value(); + }else{ + return defaultvalue; + } + } + + }else{ + return "-1"; + } + } + + /**paraid查询企业级控制参数*/ + public List<YxySysParamatersValue> findCompanyParamValues(String domian,int para_id)throws Exception + { + String hql = "from YxySysParamatersValue where owner_type = 1 and company_domain = '"+domian+"' and para_id = "+para_id; + + return yxysysparamatersvaluedao.findByHql(hql); + } + + //------------------------自配SMTP发送量模块----------------------------- + /**通过smtpID查询此smtp的发送参数*/ + public List<YxySmtpSendSelfSet> findSendSelfSetByService(String smtpservice)throws Exception { + String hql="from YxySmtpSendSelfSet where smtp_send_self_set_account='"+smtpservice+"' or smtp_send_self_set_account='domain'"; + return yxysmtpsendselfsetdao.findByHql(hql); + } + /**查询自配账号的已发送量信息*/ + public List<YxySmtpSendSelfOverset> findBySmtpAccount(String account) + throws Exception { + String hql="from YxySmtpSendSelfOverset where smtp_send_self_over_account='"+account+"'"; + return yxysmtpsendselfoversetdao.findByHql(hql); + } + /**添加自配的已发量信息*/ + public void addSendSelfSet(YxySmtpSendSelfOverset o) throws Exception { + yxysmtpsendselfoversetdao.addPojo(o); + } + /**更新已发量*/ + public void updateSendSelfSet(YxySmtpSendSelfOverset o) throws Exception { + yxysmtpsendselfoversetdao.addPojo(o); + + } + + /**查询SMTP判断是否阻塞*/ + public void updateinitsmtpstatus()throws Exception{ + //查询smtp + String hql="from YxySendSmtpInfo where smtp_service_isuse=1"; + List<YxySendSmtpInfo> smtplist=yxysendsmtpinfodao.findByHql(hql); + + //当前时间 + SimpleDateFormat df=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String nowdate=df.format(new Date()); + + //循环判断 + String usetime=""; + int smtpid=0; + for(int i=0;i<smtplist.size();i++){ + smtpid=smtplist.get(i).getSmtp_service_id(); + //判断使用时间是否超过一个小时 + usetime=smtplist.get(i).getSmtp_service_userdate(); + if(usetime!=null&&!"".equals(usetime)){ + long cha=DateFormat.minute1s(usetime, nowdate); + //大于一个小时则改状态为0 + if(cha>=60){ + String updatehql="update YxySendSmtpInfo set smtp_service_isuse=0 where smtp_service_id="+smtpid; + yxysendsmtpinfodao.updateByHql(updatehql); + } + } + } + } + + /**获取跟踪配置信息*/ + public List<CentreTrackSet> getTrackSetByHql(String hql)throws Exception{ + return centretracksetdao.findByHql(hql); + } + + /**获取开发客户配置信息*/ + public List<CentreYxyedmNewcustomer> getNewCustomerSet(String hql)throws Exception{ + return centreyxyedmnewcustomerdao.findByHql(hql); + } + + /**获取盘活客户配置信息*/ + public List<CentreYxyedmOldcustomer> getOldCustomerSet(String hql)throws Exception{ + return centreyxyedmoldcustomerdao.findByHql(hql); + } + + /**获取用户信息*/ + public List<Object> getUserInfoBySql(String sql)throws Exception{ + return centreuserdao.findBySqlFind(sql); + } + + private YxySendMailMasterDao yxysendmailmasterdao;//待发邮件dao + private YxySendMailMasterBaseDao mailmasterbasedao;//邮件基本信息dao + private YxySendMailDetailDao yxysendmaildetaildao;//待发地址dao + private YxySendSmtpInfoDao yxysendsmtpinfodao;//smtp dao + private YxySmtpSuffixSetDao yxysmtpsuffixsetdao;//smtp 后缀dao + private YxySmtpSendSetDao yxysmtpsendsetdao;//smtp后缀发送量 + private YxySmtpSendSelfSetDao yxysmtpsendselfsetdao;//自配smtp发送量限制 + private YxySmtpSendSelfOversetDao yxysmtpsendselfoversetdao;//自配smtp已发送量信息. + private YxyParamaterDao yxysysparamaterdao; + private YxySysParamatersValueDao yxysysparamatersvaluedao; + private YxyReplyInfoDao replydao;//回复dao + private YxySendFilterAddressDao filterdao;//过滤dao + private CentreTrackSetDao centretracksetdao;//跟踪配置dao + private CentreYxyedmNewcustomerDao centreyxyedmnewcustomerdao;//营销开发客户配置dao + private CentreYxyedmOldcustomerDao centreyxyedmoldcustomerdao;//营销盘活客户配置dao + private CentreUserDao centreuserdao;//用户dao + public YxySendMailMasterDao getYxysendmailmasterdao() { + return yxysendmailmasterdao; + } + public void setYxysendmailmasterdao(YxySendMailMasterDao yxysendmailmasterdao) { + this.yxysendmailmasterdao = yxysendmailmasterdao; + } + public YxySendMailDetailDao getYxysendmaildetaildao() { + return yxysendmaildetaildao; + } + public void setYxysendmaildetaildao(YxySendMailDetailDao yxysendmaildetaildao) { + this.yxysendmaildetaildao = yxysendmaildetaildao; + } + public YxySendSmtpInfoDao getYxysendsmtpinfodao() { + return yxysendsmtpinfodao; + } + public void setYxysendsmtpinfodao(YxySendSmtpInfoDao yxysendsmtpinfodao) { + this.yxysendsmtpinfodao = yxysendsmtpinfodao; + } + public YxySmtpSuffixSetDao getYxysmtpsuffixsetdao() { + return yxysmtpsuffixsetdao; + } + public void setYxysmtpsuffixsetdao(YxySmtpSuffixSetDao yxysmtpsuffixsetdao) { + this.yxysmtpsuffixsetdao = yxysmtpsuffixsetdao; + } + public YxySmtpSendSetDao getYxysmtpsendsetdao() { + return yxysmtpsendsetdao; + } + public void setYxysmtpsendsetdao(YxySmtpSendSetDao yxysmtpsendsetdao) { + this.yxysmtpsendsetdao = yxysmtpsendsetdao; + } + public YxySmtpSendSelfSetDao getYxysmtpsendselfsetdao() { + return yxysmtpsendselfsetdao; + } + public void setYxysmtpsendselfsetdao(YxySmtpSendSelfSetDao yxysmtpsendselfsetdao) { + this.yxysmtpsendselfsetdao = yxysmtpsendselfsetdao; + } + public YxySmtpSendSelfOversetDao getYxysmtpsendselfoversetdao() { + return yxysmtpsendselfoversetdao; + } + public void setYxysmtpsendselfoversetdao( + YxySmtpSendSelfOversetDao yxysmtpsendselfoversetdao) { + this.yxysmtpsendselfoversetdao = yxysmtpsendselfoversetdao; + } + public YxyParamaterDao getYxysysparamaterdao() { + return yxysysparamaterdao; + } + public void setYxysysparamaterdao(YxyParamaterDao yxysysparamaterdao) { + this.yxysysparamaterdao = yxysysparamaterdao; + } + public YxySysParamatersValueDao getYxysysparamatersvaluedao() { + return yxysysparamatersvaluedao; + } + public void setYxysysparamatersvaluedao( + YxySysParamatersValueDao yxysysparamatersvaluedao) { + this.yxysysparamatersvaluedao = yxysysparamatersvaluedao; + } + public YxySendMailMasterBaseDao getMailmasterbasedao() { + return mailmasterbasedao; + } + public void setMailmasterbasedao(YxySendMailMasterBaseDao mailmasterbasedao) { + this.mailmasterbasedao = mailmasterbasedao; + } + public YxyReplyInfoDao getReplydao() { + return replydao; + } + public void setReplydao(YxyReplyInfoDao replydao) { + this.replydao = replydao; + } + public YxySendFilterAddressDao getFilterdao() { + return filterdao; + } + public void setFilterdao(YxySendFilterAddressDao filterdao) { + this.filterdao = filterdao; + } + public CentreTrackSetDao getCentretracksetdao() { + return centretracksetdao; + } + public void setCentretracksetdao(CentreTrackSetDao centretracksetdao) { + this.centretracksetdao = centretracksetdao; + } + public CentreYxyedmNewcustomerDao getCentreyxyedmnewcustomerdao() { + return centreyxyedmnewcustomerdao; + } + public void setCentreyxyedmnewcustomerdao( + CentreYxyedmNewcustomerDao centreyxyedmnewcustomerdao) { + this.centreyxyedmnewcustomerdao = centreyxyedmnewcustomerdao; + } + public CentreYxyedmOldcustomerDao getCentreyxyedmoldcustomerdao() { + return centreyxyedmoldcustomerdao; + } + public void setCentreyxyedmoldcustomerdao( + CentreYxyedmOldcustomerDao centreyxyedmoldcustomerdao) { + this.centreyxyedmoldcustomerdao = centreyxyedmoldcustomerdao; + } + public CentreUserDao getCentreuserdao() { + return centreuserdao; + } + public void setCentreuserdao(CentreUserDao centreuserdao) { + this.centreuserdao = centreuserdao; + } +} diff --git b/src/com/espeed/yxy/timer/InitDatebase.java a/src/com/espeed/yxy/timer/InitDatebase.java new file mode 100644 index 0000000..57b4ba2 --- /dev/null +++ a/src/com/espeed/yxy/timer/InitDatebase.java @@ -0,0 +1,33 @@ +package com.espeed.yxy.timer; + +import com.espeed.yxy.service.YxySendMailService; + +/*** + * + * @author 谢勇 + * 初始化数据库相关数据 + */ +public class InitDatebase { + + /**初始化SMTP状态*/ + public void initsmtpstatus(){ + try { + //查询SMTP判断是否阻塞 + yxysendmailservice.updateinitsmtpstatus(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + private YxySendMailService yxysendmailservice;//发信service + + public YxySendMailService getYxysendmailservice() { + return yxysendmailservice; + } + + public void setYxysendmailservice(YxySendMailService yxysendmailservice) { + this.yxysendmailservice = yxysendmailservice; + } + + +} diff --git b/src/com/espeed/yxy/timer/InitializingCronTrigger.java a/src/com/espeed/yxy/timer/InitializingCronTrigger.java new file mode 100644 index 0000000..0349913 --- /dev/null +++ a/src/com/espeed/yxy/timer/InitializingCronTrigger.java @@ -0,0 +1,68 @@ +package com.espeed.yxy.timer; + +import org.springframework.scheduling.quartz.CronTriggerBean; +import org.quartz.Scheduler; + + +public class InitializingCronTrigger{ + + + private static Scheduler scheduler; + + public void setScheduler(Scheduler scheduler){ + InitializingCronTrigger.scheduler = scheduler; + } + + public static boolean isrun(){ + boolean is=false; + try { + System.out.println(Scheduler.DEFAULT_GROUP); + //is= scheduler.isStarted("dotime",Scheduler.DEFAULT_GROUP); + } catch (Exception e) { + e.printStackTrace(); + } + return is; + } + //暂停 + public static void pasue(){ + try { + scheduler.pauseTrigger("dotime", Scheduler.DEFAULT_GROUP); + } catch (Exception e) { + e.printStackTrace(); + } + } + //恢复 + public static void resume(){ + try { + scheduler.resumeTrigger("dotime", Scheduler.DEFAULT_GROUP); + } catch (Exception e) { + e.printStackTrace(); + } + } + + //dotime 配置文件里面 - 是配置jobDetail和CronExpression�? + public static void updateTime(String expression){ + try { + /* + * 通过Scheduler.getTrigger("truggerName","GroupName")得到CronTriggerBean + * 通过setCronExpression方法设置时间 + * */ + CronTriggerBean trigger = (CronTriggerBean) scheduler.getTrigger("dotime", Scheduler.DEFAULT_GROUP); + + if(! trigger.getCronExpression().equalsIgnoreCase(expression)){ + + trigger.setCronExpression(expression); + + scheduler.rescheduleJob("dotime", Scheduler.DEFAULT_GROUP, trigger); + + } + + //trigger.setCronExpression(expression); + System.out.println(trigger.getName() + ":"+ trigger.getCronExpression()); + + } catch (Exception e) { + e.printStackTrace(); + } + } + +} diff --git b/src/com/espeed/yxy/timer/MarketingPlanTime.java a/src/com/espeed/yxy/timer/MarketingPlanTime.java new file mode 100644 index 0000000..63bbefe --- /dev/null +++ a/src/com/espeed/yxy/timer/MarketingPlanTime.java @@ -0,0 +1,197 @@ +package com.espeed.yxy.timer; + +import java.io.PrintWriter; +import java.io.StringWriter; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; + +import com.espeed.centre.pojo.CentreYxyedmOldcustomer; +import com.espeed.yxy.pojo.YxyMailStencil; +import com.espeed.yxy.pojo.YxyMarketingPlan; +import com.espeed.yxy.pojo.YxyMarketingWeek; +import com.espeed.yxy.pojo.YxySendMailMaster; +import com.espeed.yxy.pojo.YxySenderSet; +import com.espeed.yxy.pojo.YxyUserAddress; +import com.espeed.yxy.service.YxyMarketingPlanService; +import com.espeed.yxy.service.YxySendMailService; +import com.espeed.yxy.tool.GetRandom; +import com.espeed.yxy.tool.GreateEmlFile; +import com.espeed.yxy.tool.LogsTool; + +/*** + * + * @author 谢勇 + * 营销计划定时器方法 + * + */ + +public class MarketingPlanTime { + public static boolean isrun=false; + /**营销计划执行*/ + public void marketingmethod(){ + if(!isrun){ + try { + isrun=true; + System.out.println("营销计划开始执行..."); + //是否有可执行的营销计划 + List<YxyMarketingPlan> planlist=marketingplanservice.findHavePlan(); + if(planlist.size()>0){ + //当前时间 + SimpleDateFormat df=new SimpleDateFormat("yyyy-MM-dd"); + SimpleDateFormat df2=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String nowtime=df2.format(new Date()); + String nowdate=df.format(new Date()); + //如果有营销计划则生成待发邮件 + for(int i=0;i<planlist.size();i++){ + int planaddressid=planlist.get(i).getPlan_groupid();//计划地址id + int plan_differen = planlist.get(i).getPlan_differen();//区分客户的本地和CRM库 0:本地 1:CRM + //查询营销计划选择的模版 + List<YxyMarketingWeek> weeklist=planlist.get(i).getWeeklist(); + //模版信息 + YxyMailStencil stencil=new YxyMailStencil(); + int weekid=0;//周期时间 + int weekok=0;//周期是否执行完成 + boolean ishaveplan=false; + //选择当日周几的计划 + for(int j=0;j<weeklist.size();j++){ + if(nowdate.equals(weeklist.get(j).getWeek_day())&&weeklist.get(j).getIsexecution()==0){ + ishaveplan=true; + weekid=weeklist.get(j).getWeek_id(); + //获取模版信息 + stencil=marketingplanservice.findStencilInfo(weeklist.get(j).getMode_id()); + break; + }else if(weeklist.get(j).getIsexecution()==1){ + weekok++; + } + } + if(weekok==weeklist.size()){//所有周期执行完毕则改为已执行 + marketingplanservice.updatePlanStatus(planlist.get(i).getPlan_id(), 1); + }else{//未执行完毕则改为正在执行 + marketingplanservice.updatePlanStatus(planlist.get(i).getPlan_id(), -1); + } + //判断是否有执行计划 + if(ishaveplan){ + //是否有模版 + if(stencil.getStencil_id()>0){ + String loginid=planlist.get(i).getLoginid(); + String domain=planlist.get(i).getDomain(); + //查询发件人 + YxySenderSet sender=marketingplanservice.findSender(loginid, domain); + if(sender!=null){ + SimpleDateFormat df1=new SimpleDateFormat("yyyyMMddHHmmssSSS"); + String romdate=df1.format(new Date()); + + //生成待发邮件 + YxySendMailMaster master=new YxySendMailMaster(); + master.setSubject(stencil.getStencil_name());//主题 + master.setSender(sender.getSender());//发件人姓名 + master.setSend_email(sender.getSend_email());//发件人地址 + master.setReply_email(sender.getReply_email());//回复地址 + master.setBody(stencil.getStencil_body());//内容 + master.setUser_loginid(loginid);//用户账号 + master.setSendci(1); + master.setUser_domain(domain);//用户域名 + master.setCreate_time(nowtime);//创建时间 + master.setFolder_id(0);//所属文件类别ID + master.setStatus(0);//邮件所属状态 + master.setPlans_send(0); + master.setPlans_send_time(null); + if(plan_differen==1 || plan_differen==3 + || plan_differen==5 || plan_differen==7 + || plan_differen==9 || plan_differen == 11){//CRM库选择的时候才进行查询盘活客户配置信息 + //查询盘活客户配置信息 + CentreYxyedmOldcustomer old_set = marketingplanservice.getOldCusSet(domain); + if(old_set != null){//有配置信息 + if(old_set.getStatus() == 1){//状态是可用的 + if(old_set.getType() == 0){//自有域名 + master.setIsold(3); + }else{//代发模式 + master.setIsold(2); + } + }else{//状态不可用 + master.setIsold(1);//老客户营销邮 + } + }else{//无配置信息 + master.setIsold(1);//老客户营销邮 + } + }else if(plan_differen==2 || plan_differen==4 + || plan_differen==6 || plan_differen==8 + || plan_differen==10 || plan_differen==12){//CRM库发送但超标了 + master.setIsold(4); + }else{//本地库选择的时候还是老客户营销 + master.setIsold(1);//老客户营销邮 + } + String random=GetRandom.getRandomString(10);//获取随机数据制定邮件唯一码 + String mailUID=loginid+romdate+random;//邮件唯一码由用户域名+时间格式+随机数 + master.setMail_uid(mailUID);//加入唯一码 + //用户eml文件路径 + String useremlpath=marketingplanservice.findCompanyParamByCode("yxy_user_data_save_path",loginid,domain); + if(useremlpath==null||useremlpath.equals("")||useremlpath.equals("-1")){ + //系统级 + useremlpath=marketingplanservice.findCompanyParamByCode("yxy_domain_save_path",loginid,domain); + } + //eml存放路径 + String emlsavepath=domain+"/"+loginid+"/plan"; + //生成eml文件 + List resulteml=GreateEmlFile.GreateMail(master,loginid,domain,"",useremlpath+"/"+emlsavepath); + + int emlsize=Integer.parseInt(resulteml.get(0).toString());//eml文件大小以K存储 + String emlpath=((String)resulteml.get(1));//eml文件存放路径 + emlpath=emlpath.replace(useremlpath, "#####"); + String emlkey=(String)resulteml.get(2);//emlKEY + String picpath=resulteml.get(4).toString();//图片路径 + //加入本地eml文件信息(待发表) + master.setEml_encode_key(emlkey); + master.setEml_file_path(emlpath); + master.setMail_size(emlsize); + master.setImage_path(picpath); + //查询地址 + List<YxyUserAddress> sendaddress=marketingplanservice.findAddressByGroupid(planaddressid,plan_differen,loginid,domain,planlist.get(i).getOther_name()); + //插入到待发表里 + yxysendmailservice.addMailMaster(master,sendaddress,planlist.get(i).getPlan_id(),plan_differen); + } + //更新为已执行 + marketingplanservice.updateWeekStatus(weekid,1); + }else{ + //更新为已执行 + marketingplanservice.updateWeekStatus(weekid,1); + } + System.out.println("营销执行计划id:"+planlist.get(0).getPlan_id()+",周期id:"+weekid+"执行完毕..."); + } + } + }else{ + System.out.println("未检测到待执行的营销计划..."); + } + System.out.println("执行计划顺利完成!"); + } catch (Exception e) { + System.out.println("执行计划异常了..."); + //写入日志 + StringWriter sw = new StringWriter(); + e.printStackTrace(new PrintWriter(sw, true)); + String str = sw.toString(); + LogsTool.marketPlanLogs(str); + } + isrun=false; + }else{ + System.out.println("执行计划还未完!"); + } + } + + private YxyMarketingPlanService marketingplanservice;//计划service + private YxySendMailService yxysendmailservice;//邮件 + + public YxyMarketingPlanService getMarketingplanservice() { + return marketingplanservice; + } + public void setMarketingplanservice(YxyMarketingPlanService marketingplanservice) { + this.marketingplanservice = marketingplanservice; + } + public YxySendMailService getYxysendmailservice() { + return yxysendmailservice; + } + public void setYxysendmailservice(YxySendMailService yxysendmailservice) { + this.yxysendmailservice = yxysendmailservice; + } + +} diff --git b/src/com/espeed/yxy/timer/MonitorQuartz.java a/src/com/espeed/yxy/timer/MonitorQuartz.java new file mode 100644 index 0000000..eedee25 --- /dev/null +++ a/src/com/espeed/yxy/timer/MonitorQuartz.java @@ -0,0 +1,23 @@ +package com.espeed.yxy.timer; + +public class MonitorQuartz { + + public void monitorMethod(){ + try { + //判断定时发送是否运行 + ThreadPoolTask s=ThreadPoolTask.getMethodInstance(); + int threadnum=s.getThreadNum(); + //System.out.println("最后一次执行的时间:"+SendMailTimer.nowtimer); + System.out.println("当前核心线程数量:"+threadnum); +// if(threadnum!=-1&&threadnum<5){ +// Thread.sleep(2000); +// InitializingCronTrigger.resume(); +// }else if(threadnum==-1&&!"".equals(SendMailTimer.nowtimer)){ +// Thread.sleep(2000); +// InitializingCronTrigger.resume(); +// } + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git b/src/com/espeed/yxy/timer/SendMailTimer.java a/src/com/espeed/yxy/timer/SendMailTimer.java new file mode 100644 index 0000000..5c57c31 --- /dev/null +++ a/src/com/espeed/yxy/timer/SendMailTimer.java @@ -0,0 +1,112 @@ +package com.espeed.yxy.timer; + +import java.io.PrintWriter; +import java.io.StringWriter; +import java.util.ArrayList; +import java.util.List; +import java.util.Random; +import com.espeed.yxy.pojo.YxySendMailMaster; +import com.espeed.yxy.pojo.YxySendSmtpInfo; +import com.espeed.yxy.service.YxySendMailService; +import com.espeed.yxy.tool.LogsTool; + +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 定时器主方法(营销游) + * 开始时间: 2013.12.09 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +public class SendMailTimer { + + private YxySendMailService yxysendmailservice; + public static String nowtimer=""; + + /**定时器运行方法*/ + public void timerMethod(){ + + try { + System.out.println("新任务开始进来了!"); + ThreadPoolTask s=ThreadPoolTask.getMethodInstance(); + + //当前线程量 + System.out.println("当前线程量:"+s.getThreadNum()); + + //变量定义区 + //int smtpnum=0; + //int mailnum=0; + + //获取所有smtp + List<YxySendSmtpInfo> smtpinfoList= yxysendmailservice.findSmtpInfoSetNum(); + //yxysendmailservice.updatesmtpstatus();//更改选定smtp状态 + + //将smtp打乱 + List<YxySendSmtpInfo> newsmtpList=getRandom(smtpinfoList); + //smtpnum=newsmtpList.size(); + System.out.println("获取到了"+newsmtpList.size()+"个SMTP"); + //判断是否存在SMTP + if(newsmtpList.size()>0){ +// //判断是否有可待发邮件(指定条) +// List<YxySendMailMaster> mailList=yxysendmailservice.findByMailNum(smtpnum); +// mailnum=mailList.size(); +// System.out.println("新加入"+mailnum+"个邮件!"); +// if(mailnum>0){ +// //获取smtp后缀配置信息 +// //List<YxySmtpSuffixSet> smtpsuffixsetList=yxysendmailservice.findAllSmtpSuffixSet(); +// //调用线程池 +// //s.getResult(yxysendmailservice, newsmtpList, mailList, smtpsuffixsetList); +// s.getResult(yxysendmailservice, newsmtpList, mailList); +// }else{ +// System.out.println("没有待发邮件!"); +// } + //调用线程池 + s.getResult(yxysendmailservice, newsmtpList); + }else{ + System.out.println("没有可用SMTP!"); + } + + } catch (Exception e) { + System.out.println("定时器异常了..."); + e.printStackTrace(); + //写入日志 + StringWriter sw = new StringWriter(); + e.printStackTrace(new PrintWriter(sw, true)); + String str = sw.toString(); + LogsTool.erroLogs(str); + } + } + + + //将集合打乱 + public static List<YxySendSmtpInfo> getRandom(List<YxySendSmtpInfo> value){ + List<YxySendSmtpInfo> newSmtpList=new ArrayList<YxySendSmtpInfo>(); + int n = value.size(); + Random rand = new Random(); + boolean[] bool = new boolean[n]; + int num =0; + for (int i = 0; i<n; i++){ + do{ + //如果产生的数相同继续循环 + num = rand.nextInt(n); + }while(bool[num]); + bool[num] =true; + newSmtpList.add(value.get(num)); + } + return newSmtpList; + } + //------------------get set-------------------- + public YxySendMailService getYxysendmailservice() { + return yxysendmailservice; + } + + public void setYxysendmailservice(YxySendMailService yxysendmailservice) { + this.yxysendmailservice = yxysendmailservice; + } + +} + diff --git b/src/com/espeed/yxy/timer/ThreadPoolTask.java a/src/com/espeed/yxy/timer/ThreadPoolTask.java new file mode 100644 index 0000000..8b221d4 --- /dev/null +++ a/src/com/espeed/yxy/timer/ThreadPoolTask.java @@ -0,0 +1,313 @@ +package com.espeed.yxy.timer; + +import java.io.PrintWriter; +import java.io.Serializable; +import java.io.StringWriter; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; +import java.util.concurrent.LinkedBlockingDeque; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; +import com.espeed.yxy.mail.YxysendMethod; +import com.espeed.yxy.pojo.YxySendMailMaster; +import com.espeed.yxy.pojo.YxySendSmtpInfo; +import com.espeed.yxy.service.YxySendMailService; +import com.espeed.yxy.tool.DateFormat; +import com.espeed.yxy.tool.LogsTool; +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 手动收邮件后台线程池 + * 开始时间: 2013.09.02 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +public class ThreadPoolTask implements Runnable,Serializable{ + + private static final long serialVersionUID = 0; + private static ThreadPoolExecutor threadPool=null; + private static ThreadPoolTask threadpooltask=null; + + private YxySendMailService service; + private YxySendSmtpInfo smtpinfo; + private YxySendMailMaster mailinfo; + //private List<YxySmtpSuffixSet> suffixtList; + + //无参构造方法 + ThreadPoolTask(){ + } + //传递参数 + //ThreadPoolTask(YxySendMailService service,YxySendSmtpInfo smtpinfo,YxySendMailMaster mailinfo,List<YxySmtpSuffixSet> suffixtList){ + ThreadPoolTask(YxySendMailService service,YxySendSmtpInfo smtpinfo,YxySendMailMaster mailinfo){ + this.service=service; + this.smtpinfo=smtpinfo; + this.mailinfo=mailinfo; + //this.suffixtList=suffixtList; + } + + //单例方法 + public static ThreadPoolTask getMethodInstance(){ + if(threadpooltask==null){ + //System.out.println("创建新对像了"); + threadpooltask=new ThreadPoolTask(); + } + return threadpooltask; + } + + //线程池 + public static ThreadPoolExecutor getInstance(int bigThread){ + if(threadPool==null){ + threadPool=new ThreadPoolExecutor(20,23,50, + TimeUnit.SECONDS,new LinkedBlockingDeque<Runnable>(23), + new ThreadPoolExecutor.DiscardOldestPolicy()); + } + return threadPool; + } + //线程池运行方法 + //public synchronized void getResult(YxySendMailService service,List<YxySendSmtpInfo> smtplist,List<YxySendMailMaster> mailList) { + public synchronized void getResult(YxySendMailService service,List<YxySendSmtpInfo> smtplist) { + threadPool=getInstance(20); + int queue=threadPool.getQueue().size(); + System.out.println("队列:"+queue); + List<YxySendSmtpInfo> new_smtplist = smtplist; + try{ + //根据smtp类型获取对应的类型的待发邮件 + String hql = "from YxySendMailMaster where isuse=0 and (status=0 or status=2) order by create_time"; + List<YxySendMailMaster> masters = service.getMailMasterByHql(hql); + if(masters.size()>0){ + //当前时间 + SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String nowdate = df.format(new Date()); + //循环待发邮件 + for(YxySendMailMaster master : masters){ + //看看还有没有smtp + if(new_smtplist.size() == 0){ + System.out.println("SMTP已经匹配完毕!"); + break; + } + if(master.getPlans_send()==1){//定时邮件 + //判断是否定时时间到了当前时间 + long minytelcha= DateFormat.minute1s(nowdate,master.getPlans_send_time()); + if(minytelcha>0){//定时时间还没到 + continue; + } + } + //该封邮件去smtp集合里面匹配对应的smtp + for(YxySendSmtpInfo smtp : new_smtplist){ + //0-0(新客户营销),1-1(本地库跟进) + if((master.getIsold()==smtp.getSmtp_service_type()) + && (smtp.getSmtp_service_type() == 0 || smtp.getSmtp_service_type() == 1)) + { + //从smtp集合中去除该smtp + new_smtplist.remove(smtp); + //修改SMTP状态为正在使用 + service.updateSmtpUseStatus(1, smtp.getSmtp_service_id(), ""); + Thread.sleep(1000); + System.out.println("smtp服务器:"+smtp.getSmtp_service_id()+",类型:"+smtp.getSmtp_service_type()+"->负责发送邮件:"+master.getSend_mail_id()+",类型:"+master.getIsold()); + //调用线程进行发送 + threadPool.execute(new ThreadPoolTask(service,smtp,master)); + //退出smtp匹配循环 + break; + } + //2-2(CRM库代发模式) + if((master.getIsold()==smtp.getSmtp_service_type()) + && smtp.getSmtp_service_type() == 2) + { + //必须用自己企业的SMTP + if(smtp.getSmtp_user_domain()!=null&&smtp.getSmtp_user_domain().equals(master.getUser_domain())){ + //从smtp集合中去除该smtp + new_smtplist.remove(smtp); + //修改SMTP状态为正在使用 + service.updateSmtpUseStatus(1, smtp.getSmtp_service_id(), ""); + Thread.sleep(1000); + System.out.println("smtp服务器:"+smtp.getSmtp_service_id()+",类型:"+smtp.getSmtp_service_type()+"->负责发送邮件:"+master.getSend_mail_id()+",类型:"+master.getIsold()); + //调用线程进行发送 + threadPool.execute(new ThreadPoolTask(service,smtp,master)); + //退出smtp匹配循环 + break; + } + } + //3-3(CRM库自有域名),5-5(新客户营销-自有域名) + if((master.getIsold()==smtp.getSmtp_service_type()) + && (smtp.getSmtp_service_type() == 3 || smtp.getSmtp_service_type() == 5)) + { + //必须用自己的smtp + if(smtp.getSmtp_user_domain()!=null + && smtp.getSmtp_user_domain().equals(master.getUser_domain()) + && smtp.getSmtp_user_loginid()!=null + && smtp.getSmtp_user_loginid().equals(master.getUser_loginid())){ + //从smtp集合中去除该smtp + new_smtplist.remove(smtp); + //修改SMTP状态为正在使用 + service.updateSmtpUseStatus(1, smtp.getSmtp_service_id(), ""); + Thread.sleep(1000); + System.out.println("smtp服务器:"+smtp.getSmtp_service_id()+",类型:"+smtp.getSmtp_service_type()+"->负责发送邮件:"+master.getSend_mail_id()+",类型:"+master.getIsold()); + //调用线程进行发送 + threadPool.execute(new ThreadPoolTask(service,smtp,master)); + //退出smtp匹配循环 + break; + } + } + //盘活客户超标使用之前的老客户跟进发送 + if(master.getIsold()==4&&smtp.getSmtp_service_type()==1){ + //从smtp集合中去除该smtp + new_smtplist.remove(smtp); + //修改SMTP状态为正在使用 + service.updateSmtpUseStatus(1, smtp.getSmtp_service_id(), ""); + Thread.sleep(1000); + System.out.println("smtp服务器:"+smtp.getSmtp_service_id()+",类型:"+smtp.getSmtp_service_type()+"->负责发送邮件:"+master.getSend_mail_id()+",类型:"+master.getIsold()); + //调用线程进行发送 + threadPool.execute(new ThreadPoolTask(service,smtp,master)); + //退出smtp匹配循环 + break; + } + //开发客户超标使用之前的新客户营销发送 + if(master.getIsold()==6&&smtp.getSmtp_service_type()==0){ + //从smtp集合中去除该smtp + new_smtplist.remove(smtp); + //修改SMTP状态为正在使用 + service.updateSmtpUseStatus(1, smtp.getSmtp_service_id(), ""); + Thread.sleep(1000); + System.out.println("smtp服务器:"+smtp.getSmtp_service_id()+",类型:"+smtp.getSmtp_service_type()+"->负责发送邮件:"+master.getSend_mail_id()+",类型:"+master.getIsold()); + //调用线程进行发送 + threadPool.execute(new ThreadPoolTask(service,smtp,master)); + //退出smtp匹配循环 + break; + } + +// //处理新客户营销或本地客户库的发送或超标的CRM库发送 +// if(master.getIsold()==smtp.getSmtp_service_type()&&(master.getIsold()==0||master.getIsold()==1)){ +// //从smtp集合中去除该smtp +// new_smtplist.remove(smtp); +// //修改SMTP状态为正在使用 +// service.updateSmtpUseStatus(1, smtp.getSmtp_service_id(), ""); +// Thread.sleep(1000); +// System.out.println("smtp服务器:"+smtp.getSmtp_service_id()+"负责发送邮件:"+master.getSend_mail_id()); +// //调用线程进行发送 +// threadPool.execute(new ThreadPoolTask(service,smtp,master)); +// //退出smtp匹配循环 +// break; +// } +// //处理代发模式,当前邮件的域名都使用该smtp发送 +// if(master.getIsold()==smtp.getSmtp_service_type()&&master.getIsold()==2){ +// //是同一个域名则可以发送 +// if(smtp.getSmtp_user_domain()!=null&&smtp.getSmtp_user_domain().equals(master.getUser_domain())){ +// //从smtp集合中去除该smtp +// new_smtplist.remove(smtp); +// //修改SMTP状态为正在使用 +// service.updateSmtpUseStatus(1, smtp.getSmtp_service_id(), ""); +// Thread.sleep(1000); +// System.out.println("smtp服务器:"+smtp.getSmtp_service_id()+"负责发送邮件:"+master.getSend_mail_id()); +// //调用线程进行发送 +// threadPool.execute(new ThreadPoolTask(service,smtp,master)); +// //退出smtp匹配循环 +// break; +// } +// } +// //处理自有域名,当前邮件的域名只能使用自己的smtp发送 +// if(master.getIsold()==smtp.getSmtp_service_type()&&master.getIsold()==3){ +// //是同一个域名则可以发送 +// if(smtp.getSmtp_user_domain()!=null&& +// smtp.getSmtp_user_domain().equals(master.getUser_domain())&& +// smtp.getSmtp_user_loginid()!=null&&smtp.getSmtp_user_loginid().equals(master.getUser_loginid())){ +// //从smtp集合中去除该smtp +// new_smtplist.remove(smtp); +// //修改SMTP状态为正在使用 +// service.updateSmtpUseStatus(1, smtp.getSmtp_service_id(), ""); +// Thread.sleep(1000); +// System.out.println("smtp服务器:"+smtp.getSmtp_service_id()+"负责发送邮件:"+master.getSend_mail_id()); +// //调用线程进行发送 +// threadPool.execute(new ThreadPoolTask(service,smtp,master)); +// //退出smtp匹配循环 +// break; +// } +// } + } + } + }else{ + System.out.println("没有待发邮件!"); + } + }catch (Exception e) { + e.printStackTrace(); + } + + + + +// threadPool=getInstance(20); +// int queue=threadPool.getQueue().size(); +// System.out.println("队列:"+queue); +// List<YxySendSmtpInfo> new_smtplist = smtplist; +// //邮件加入线程池 +// for(int j=0;j<mailList.size();j++){ +// try { +// if(queue>=23){ +// System.out.println("队列已满!"); +// break; +// } +// +// YxySendSmtpInfo smtpinfo = null; +// +// if(mailList.get(j).getIsold()==2)//自主域名投递 +// { +// //选择合适的自主域名投递smtp +// smtpinfo = service.findSmtpInfoByCusType2(new_smtplist, mailList.get(j)); +// } +// else//不是自主域名投递则按之前的业务实现 +// { +// //根据客户类型进行选择smtp服务器 +// smtpinfo = service.findSmtpInfoByCusType(new_smtplist,mailList.get(j).getIsold()); +// } +// if(null==smtpinfo)//没对应的smtp则执行下一循环 +// { +// continue; +// } +// //去除满足的smtp服务器 +// new_smtplist.remove(smtpinfo); +// //修改SMTP状态 +// service.updateSmtpUseStatus(1, smtpinfo.getSmtp_service_id(), ""); +// Thread.sleep(1000); +// System.out.println("smtp服务器:"+smtpinfo.getSmtp_service_id()+"负责发送邮件:"+mailList.get(j).getSend_mail_id()); +// threadPool.execute(new ThreadPoolTask(service,smtpinfo,mailList.get(j))); +//// //修改SMTP状态 +//// service.updateSmtpUseStatus(1, smtplist.get(j).getSmtp_service_id(), ""); +//// Thread.sleep(1000); +//// threadPool.execute(new ThreadPoolTask(service,smtplist.get(j),mailList.get(j))); +// } catch (Exception e) { +// e.printStackTrace(); +// } +// } + } + //获取线程量 + public int getThreadNum(){ + if(threadPool==null){ + return -1; + }else{ + return threadPool.getActiveCount(); + } + } + //start + public void run(){ + try { + //调用发邮件方法 + YxysendMethod.sendMethodImpl(service, smtpinfo,mailinfo); + } catch (Exception e) { + e.printStackTrace(); + //写入日志 + StringWriter sw = new StringWriter(); + e.printStackTrace(new PrintWriter(sw, true)); + String str = sw.toString(); + LogsTool.erroLogs(str); + } + //此线程任务完成后重新获取线程池的数量 +// synchronized (this) { +// threadPool.shutdown(); +// } + } + +} diff --git b/src/com/espeed/yxy/tool/ConfigPath.java a/src/com/espeed/yxy/tool/ConfigPath.java new file mode 100644 index 0000000..0e271bc --- /dev/null +++ a/src/com/espeed/yxy/tool/ConfigPath.java @@ -0,0 +1,113 @@ +package com.espeed.yxy.tool; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.net.URISyntaxException; +import java.util.Properties; +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 配置文件读取工具类(营销游) + * 开始时间: 2013.12.09 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +public class ConfigPath { + + static Properties p = loadPropertyFile("config.properties"); + + public static String getFilePth(){ + return p.get("cfgFilePath")+""; + } + + public static String getXmlFilePth(){ + return p.get("xmlFilePath")+""; + } + + /**读取配置的最大线程量*/ + public static int getThreadNum(){ + return Integer.parseInt(p.get("threadNum")+""); + } + /**获取点读服务路径*/ + public static String getClickService(){ + return p.get("clickserviceurl")+""; + } + /**获取点读服务路径(业务修改后)*/ + public static String getClickService2() + { + return p.get("clickserviceurl2")+""; + } + /**获取营销服务器路径(易外销)*/ + public static String getYxyServicePath(){ + return p.get("yxywebmailpath")+""; + } + /**获取营销服务器路径(单独)*/ + public static String getYxyServicePath2(){ + return p.get("yxywebmailpath2")+""; + } + /**获取一个smtp发送邮件数量*/ + public static int getSmtpSendNum(){ + return Integer.parseInt(p.get("smtpsendnum").toString()); + } + /**webmail定时器URL*/ + public static String getWebMailTimeUrl(){ + return p.get("webmailtimeurl")+""; + } + /**webmail接口URL*/ + public static String getWebmailInterfaceUrl(){ + return p.get("webmailinterfaceurl")+""; + } + /**地址发送异常数量*/ + public static int getSendExpNum(){ + return Integer.parseInt(p.get("sendexpnum").toString()); + } + /**获取超链接跟踪url*/ + public static String getTrackUrl(){ + return p.getProperty("trackurl"); + } + + /**加载配置文件*/ + public static Properties loadPropertyFile(String fullFile) { + String webRootPath = null; + if ( fullFile.equals("")) + throw new IllegalArgumentException("Properties file path can not be null : " + fullFile); + try { + webRootPath = ConfigPath.class.getClassLoader().getResource("").toURI().getPath(); + } catch (URISyntaxException e1) { + e1.printStackTrace(); + } + webRootPath = new File(webRootPath).getParent(); + InputStream inputStream = null; + Properties p = null; + try { + inputStream = new FileInputStream(new File(webRootPath+ File.separator + fullFile)); + p = new Properties(); + p.load(inputStream); + + } catch (FileNotFoundException e) { + throw new IllegalArgumentException("Properties file not found: " + + fullFile); + } catch (IOException e) { + throw new IllegalArgumentException( + "Properties file can not be loading: " + fullFile); + } finally { + try { + if (inputStream != null) + inputStream.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + return p; + } + + + +} diff --git b/src/com/espeed/yxy/tool/DBUtil.java a/src/com/espeed/yxy/tool/DBUtil.java new file mode 100644 index 0000000..9396ce1 --- /dev/null +++ a/src/com/espeed/yxy/tool/DBUtil.java @@ -0,0 +1,74 @@ +package com.espeed.yxy.tool; + +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; + +import javax.sql.DataSource; + +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 获取数据库连接的工具类 + * 开始时间: 2013.10.1 + * 程 序 员: 芮瑞 + * 最后修改: 2014-02-25 + * 备 注:用于从连接池中获取数据源,获取数据库连接 + */ +public class DBUtil +{ + private static DataSource dataSource; + + //获得连接 + public static Connection getConnection() throws SQLException + { + dataSource = (DataSource) SpringFactory.getObject("dataSource"); + + return dataSource.getConnection(); + } + + + /* + * 关闭数据库连接 + */ + public static void close(ResultSet rs,Statement st,Connection conn) + { + + if(rs!=null) + { try { + rs.close(); + } catch (SQLException e) { + e.printStackTrace(); + }finally{ + if(st!=null){ + try { + st.close(); + } catch (SQLException e) { + e.printStackTrace(); + }finally{ + if(conn!=null){ + try { + conn.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + } + } + } + } + } + } + public static void main(String[] args) throws SQLException + { + System.out.println(DBUtil.getConnection()); + } + + + + +} + \ No newline at end of file diff --git b/src/com/espeed/yxy/tool/DES_Encrypt.java a/src/com/espeed/yxy/tool/DES_Encrypt.java new file mode 100644 index 0000000..30b0f54 --- /dev/null +++ a/src/com/espeed/yxy/tool/DES_Encrypt.java @@ -0,0 +1,103 @@ +package com.espeed.yxy.tool; +import java.security.*; +import javax.crypto.*; +import sun.misc.*; +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: DES加密解密工具类 + * 开始时间: 2013.09.02 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +public class DES_Encrypt +{ + private Key key; + private byte[] byteMi = null; + private byte[] byteMing = null; + private String strMi= ""; + private String strM= ""; + /**根据参数生成KEY*/ + public void setKey(String strKey)throws Exception{ + KeyGenerator _generator = KeyGenerator.getInstance("DES"); + _generator.init(new SecureRandom(strKey.getBytes())); + this.key = _generator.generateKey(); + _generator=null; + } + + /**加密String明文输入,String密文输出 */ + public void setEncString(String strMing)throws Exception{ + BASE64Encoder base64en = new BASE64Encoder(); + + this.byteMing = strMing.getBytes("UTF8"); + this.byteMi = this.getEncCode(this.byteMing); + this.strMi = base64en.encode(this.byteMi); + this.byteMing = null; + this.byteMi = null; + } + /**加密以byte[]明文输入,byte[]密文输出 */ + private byte[] getEncCode(byte[] byteS)throws Exception{ + byte[] byteFina = null; + Cipher cipher; + + cipher = Cipher.getInstance("DES"); + cipher.init(Cipher.ENCRYPT_MODE,key); + byteFina = cipher.doFinal(byteS); + cipher = null; + + return byteFina; + } + + /** 解密:以String密文输入,String明文输出*/ + public void setDesString(String strMi)throws Exception{ + BASE64Decoder base64De = new BASE64Decoder(); + this.byteMi = base64De.decodeBuffer(strMi); + this.byteMing = this.getDesCode(byteMi); + this.strM = new String(byteMing,"UTF8"); + base64De = null; + byteMing = null; + byteMi = null; + } + + /** 解密以byte[]密文输入,以byte[]明文输出 */ + private byte[] getDesCode(byte[] byteD)throws Exception{ + Cipher cipher; + byte[] byteFina=null; + cipher = Cipher.getInstance("DES"); + cipher.init(Cipher.DECRYPT_MODE,key); + byteFina = cipher.doFinal(byteD); + cipher=null; + return byteFina; + } + /**返回加密后的密文strMi*/ + public String getStrMi() + { + return strMi; + } + /**返回解密后的明文*/ + public String getStrM() + { + return strM; + } + + public static void main (String[] args) throws Exception + { + DES_Encrypt desEncrypt = new DES_Encrypt(); + desEncrypt.setKey("06"); + desEncrypt.setEncString("15113887519BBs"); + System.out.println("加密后: "+desEncrypt.getStrMi()); + + //desEncrypt.setDesString("77K/j0NmDm9ZsWbbiw2f8g=="); + //System.out.println(desEncrypt.getStrM()); + + + } + + + + +} \ No newline at end of file diff --git b/src/com/espeed/yxy/tool/DateFormat.java a/src/com/espeed/yxy/tool/DateFormat.java new file mode 100644 index 0000000..bb35dc1 --- /dev/null +++ a/src/com/espeed/yxy/tool/DateFormat.java @@ -0,0 +1,285 @@ +package com.espeed.yxy.tool; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 日期转换工具类(营销游) + * 开始时间: 2013.12.09 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +public class DateFormat { + private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日"); + private static SimpleDateFormat sdf2 = new SimpleDateFormat( + "yyyy-MM-dd hh:mm:ss"); + + /**将字符串转换日期*/ + public static Date dateToString(String str) { + + Date dateNum = null; + try { + dateNum = sdf.parse(str); + } catch (ParseException e) { + e.printStackTrace(); + } + return dateNum; + } + + /** 将字符串转换日期*/ + public static Date dateToString2(String str) { + Date dateNum = null; + try { + dateNum = sdf2.parse(str); + } catch (ParseException e) { + e.printStackTrace(); + } + return dateNum; + } + + /** 将日期转换为字符串*/ + public static String simpleDataFormat(Date date) {//yy必须小写,MM是月份,mm是分;HH是24小时制,而hh是12小时制*/ + String str = sdf.format(date); + return str; + } + + /**给定一个日期型字符串,返回加减n天后的日期型字符串*/ + public static String nDaysAfterOneDateString(String basicDate, int n) { + Date tmpDate = null; + try { + tmpDate = sdf2.parse(basicDate); + System.out.println(tmpDate); + } catch (Exception e) { + //日期型字符串格式错误 + } + long nDay = (tmpDate.getTime() / (24 * 60 * 60 * 1000) + 1 + n)* (24 * 60 * 60 * 1000); + tmpDate.setTime(nDay); + + return sdf2.format(tmpDate); + } + + /**给定一个日期,返回加减n天后的日期*/ + public static Date nDaysAfterOneDate(Date basicDate, int n) { + long nDay = (basicDate.getTime() / (24 * 60 * 60 * 1000) + 1 + n) + * (24 * 60 * 60 * 1000); + basicDate.setTime(nDay); + + return basicDate; + } + + /**判断日期为星期几,0为星期天,依此类推*/ + public static String dayOfWeek(String strdate) { + SimpleDateFormat df = new SimpleDateFormat("yyyy年MM月dd日"); + Date date = null; + try { + date = df.parse(strdate); + } catch (ParseException e) { + System.out.println("字符型转日期有异常"); + } + //首先定义一个calendar,必须使用getInstance()进行实例化 + Calendar aCalendar = Calendar.getInstance(); + //里面野可以直接插入date类型 + aCalendar.setTime(date); + //计算此日期是一周中的哪一天 + int x = aCalendar.get(Calendar.DAY_OF_WEEK) - 1; + String week = ""; + switch (x) { + case 0: + week = "星期天"; + break; + case 1: + week = "星期一"; + break; + case 2: + week = "星期二"; + break; + case 3: + week = "星期三"; + break; + case 4: + week = "星期四"; + break; + case 5: + week = "星期五"; + break; + case 6: + week = "星期六"; + break; + + } + return week; + } + + /**判断日期为星期几,0为星期天,依此类推*/ + public static int dayOfWeekNum(String strdate) { + SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd"); + Date date = null; + try { + date = df.parse(strdate); + } catch (ParseException e) { + System.out.println("字符型转日期有异常"); + } + //首先定义一个calendar,必须使用getInstance()进行实例化 + Calendar aCalendar = Calendar.getInstance(); + //里面野可以直接插入date类型 + aCalendar.setTime(date); + //计算此日期是一周中的哪一天 + int x = aCalendar.get(Calendar.DAY_OF_WEEK) - 1; + int week = 0; + switch (x) { + case 0: + week = 7; + break; + case 1: + week = 1; + break; + case 2: + week = 2; + break; + case 3: + week = 3; + break; + case 4: + week = 4; + break; + case 5: + week = 5; + break; + case 6: + week = 6; + break; + + } + return week; + } + + + /** 计算两个日期相隔的天数*/ + public static int nDaysBetweenTwoDate(Date firstDate, Date secondDate) { + int nDay = (int) ((secondDate.getTime() - firstDate.getTime()) / (24 * 60 * 60 * 1000)); + return nDay; + } + + /**计算两个日期相隔的天数*/ + public static int nDaysBetweenTwoDate(String firstString, String secondString) { + SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd"); + Date firstDate = null; + Date secondDate = null; + try { + firstDate = df.parse(firstString); + secondDate = df.parse(secondString); + } catch (Exception e) { + //日期型字符串格式错误 + } + + int nDay = (int) ((secondDate.getTime() - firstDate.getTime()) / (24 * 60 * 60 * 1000)); + + System.out.println("相差"+nDay+"天"); + return nDay; + } + + /** 某年某月有多少天*/ + public static int yearMonthDay(int year, int month) { + int day = 0; + if (((month >= 1) && (month <= 12)) && (year >= 0)) { + if (month == 2) { + if ((((year % 4) == 0) && ((year % 100) != 0))|| ((year % 400) == 0)) + day = 29; + else + day = 28; + } else { + if ((month == 1) || (month == 3) || (month == 5) + || (month == 7) || (month == 8) || (month == 10) + || (month == 12)) + + day = 31; + else + day = 30; + } + System.out.println(year + "年" + month + "月的天数为:" + day); + } else { + System.out.println("请输入正确的年月!"); + } + return day; + } + /**判断两时间相差的分钟数*/ + public static long minute1s(String beginDate,String endDate){ + + Date begin = null; + Date end = null; + SimpleDateFormat dfs = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + long minute1=0; + try { + begin = dfs.parse(beginDate); + end = dfs.parse(endDate); + + long between = (end.getTime() - begin.getTime()) / 1000;//除以1000是为了转换成秒 + minute1 = between / 60; + + } catch (Exception e) { + e.printStackTrace(); + } + return minute1; + + } + + + /**判断两时间相差的分钟数*/ + public static boolean isthisTimer(String nowTimer){ + + int hour=Integer.parseInt(nowTimer.split(":")[0]); + int minute=Integer.parseInt(nowTimer.split(":")[1]); + + System.out.println(nowTimer); + System.out.println(hour); + System.out.println(minute); + + if(hour==23||hour==0){ + if(hour==23&&minute>=30||hour==0&&minute<=30){ + return true; + }else{ + return false; + } + + }else{ + return false; + } + + } + + //获取当前时间加减后的日期 + public static String lastDays(int n){ + String resultdate=""; + try { + //获取几天之前的时间 + SimpleDateFormat formatDate = new SimpleDateFormat("yyyy-MM-dd"); //字符串转换 + Calendar c = Calendar.getInstance(); + c.setTimeInMillis(new Date().getTime()); + c.add(Calendar.DATE, n);//多少天后的日期 + Date date= new Date(c.getTimeInMillis()); //将c转换成Date + resultdate=formatDate.format(date); + } catch (Exception e) { + resultdate=""; + e.printStackTrace(); + } + return resultdate; + } + + public static void main(String[] args) { + try { + SimpleDateFormat df=new SimpleDateFormat("yyyy-MM-dd"); + String nowdate=df.format(new Date()); + System.out.println(minute1s("2016-10-10 10:10:00","2016-10-10 10:20:00")); + } catch (Exception e) { + e.printStackTrace(); + } + + } +} diff --git b/src/com/espeed/yxy/tool/Email_Autherticatorbean.java a/src/com/espeed/yxy/tool/Email_Autherticatorbean.java new file mode 100644 index 0000000..b3949c0 --- /dev/null +++ a/src/com/espeed/yxy/tool/Email_Autherticatorbean.java @@ -0,0 +1,29 @@ +package com.espeed.yxy.tool; + +import javax.mail.Authenticator; +import javax.mail.PasswordAuthentication; + +public class Email_Autherticatorbean extends Authenticator { + private String m_username = null; + private String m_userpass = null; + + public void setUsername(String username) { + m_username = username; + } + + public void setUserpass(String userpass) { + m_userpass = userpass; + } + + public Email_Autherticatorbean(String username, String userpass) { + super(); + setUsername(username); + setUserpass(userpass); + + } + + public PasswordAuthentication getPasswordAuthentication() { + + return new PasswordAuthentication(m_username, m_userpass); + } +} diff --git b/src/com/espeed/yxy/tool/Encrypt.java a/src/com/espeed/yxy/tool/Encrypt.java new file mode 100644 index 0000000..1952312 --- /dev/null +++ a/src/com/espeed/yxy/tool/Encrypt.java @@ -0,0 +1,238 @@ +package com.espeed.yxy.tool; +import java.io.BufferedReader; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.io.OutputStream; +import java.security.Key; +import java.security.SecureRandom; +import javax.crypto.Cipher; +import javax.crypto.CipherInputStream; +import javax.crypto.CipherOutputStream; +import javax.crypto.KeyGenerator; +import javax.crypto.SecretKey; +import javax.crypto.SecretKeyFactory; +import javax.crypto.spec.DESKeySpec; + +import sun.misc.BASE64Decoder; +import sun.misc.BASE64Encoder; +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: DES加密工具类(营销游) + * 开始时间: 2013.12.09 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +public class Encrypt { + /** 密钥算法*/ + private static final String KEY_ALGORITHM = "DES"; + private static final String DEFAULT_CIPHER_ALGORITHM = "DES/ECB/PKCS5Padding"; + + static byte[] byteArray=null; + /** 初始化密钥*/ + public static byte[] initSecretKey() throws Exception{ + //返回生成指定算法的秘密密钥的 KeyGenerator 对象 + KeyGenerator kg = KeyGenerator.getInstance("DES"); + //初始化此密钥生成器,使其具有确定的密钥大小 + kg.init(56); + //生成一个密钥 + SecretKey secretKey = kg.generateKey(); + byteArray=secretKey.getEncoded(); + return secretKey.getEncoded(); + } + + /**转换密钥*/ + private static Key toKey() throws Exception{ + //实例化DES密钥规则 + DESKeySpec dks = new DESKeySpec(byteArray); + //实例化密钥工厂 + SecretKeyFactory skf = SecretKeyFactory.getInstance("DES"); + //生成密钥 ,工厂中对密钥进行处理加工 + SecretKey secretKey = skf.generateSecret(dks); + return secretKey; + } + + /**获得密钥*/ + public static Key getKey() throws Exception { + Key kp =toKey(); + return kp; + } + + +/**文件加密需要传入一个流跟一个文件保存的路径*/ + public static Object encrypt(InputStream is, String dest) throws Exception { + Cipher cipher = Cipher.getInstance("DES"); + //初始化密钥 + initSecretKey(); + //获得密钥 + Object key =getKey(); + cipher.init(Cipher.ENCRYPT_MODE,(Key)key); + //写入文件 + OutputStream out = new FileOutputStream(dest); + CipherInputStream cis = new CipherInputStream(is, cipher); + byte[] buffer = new byte[1024]; + int r; + while ((r = cis.read(buffer)) > 0) { + out.write(buffer, 0, r); + } + //数据库保存需要一个字符 + BASE64Encoder enc=new BASE64Encoder(); + String string=enc.encode(byteArray); + cis.close(); + is.close(); + out.close(); + return string; + } + /**文件解密返回一个流*/ + public static InputStream decrypt(String file,Key key) throws IOException { + CipherInputStream cis = null; + InputStream is =null; + try { + Cipher cipher = Cipher.getInstance("DES"); + cipher.init(Cipher.DECRYPT_MODE,key); + is = new FileInputStream(file); + cis = new CipherInputStream(is, cipher); + + } catch (Exception e) { + e.printStackTrace(); + return null; + } + return cis; + + } + + /**通过传过来的流生成文件*/ + public static void decrypt(String outfile,String fileName,CipherInputStream in) throws Exception { + File file=new File(outfile); + if(!file.exists()){ + file.mkdirs(); + } + OutputStream out = new FileOutputStream(outfile+"\\"+fileName); + byte[] buffer = new byte[1024]; + int r; + while ((r = in.read(buffer)) >= 0) { + out.write(buffer, 0, r); + } + out.close(); + in.close(); + } + + /**文件解密返回一个字符串*/ + public static String decryptAndGetString(String file,Key key) throws Exception { + Cipher cipher = Cipher.getInstance("DES"); + cipher.init(Cipher.DECRYPT_MODE,key); + InputStream is = new FileInputStream(file); + CipherInputStream cis = new CipherInputStream(is, cipher); + + return convertStreamToString(cis); + + } + public static String inputStream2String(InputStream is) throws IOException{ + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + int i=-1; + while((i=is.read())!=-1){ + baos.write(i); + } + return baos.toString(); + } + + public static String convertStreamToString(InputStream is) { + + BufferedReader reader = new BufferedReader(new InputStreamReader(is)); + + StringBuilder sb = new StringBuilder(); + + + + String line = null; + + try { + + while ((line = reader.readLine()) != null) { + + sb.append(line + "/n"); + + } + + } catch (IOException e) { + + e.printStackTrace(); + + } finally { + + try { + + is.close(); + + } catch (IOException e) { + + e.printStackTrace(); + + } + + } + + + + return sb.toString(); + + } + + /**转换密钥*/ + public static Key toKey(byte[] key) throws Exception{ + //实例化DES密钥规则 + DESKeySpec dks = new DESKeySpec(key); + //实例化密钥工厂 + SecretKeyFactory skf = SecretKeyFactory.getInstance("DES"); + //生成密钥 ,工厂中对密钥进行处理加工 + SecretKey secretKey = skf.generateSecret(dks); + return secretKey; + } + + + + public static void main(String[] args){ + + /* Encrypt.saveDesKey(); + System.out.println("生成key"); + Encrypt.getKey(); + System.out.println("获取key"); + try { + Encrypt.encrypt("d:\\dd.eml", "d:\\e.eml"); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + System.out.println("加密");*/ + try { + //Encrypt.decrypt("d:\\dddd.eml", "d:\\ccc.eml"); + BASE64Decoder enc=new BASE64Decoder(); + Key a=Encrypt.toKey(enc.decodeBuffer("MQ5RobbCg8s=")); + System.out.println("qqq"+Encrypt.decryptAndGetString("H:\\test.txt",a)); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + System.out.println("解密"); +// System.out.println("加密");*/ +// try { +// Encrypt.decrypt("c:/test.txt", "d:\\ccc.eml"); +// } catch (Exception e) { +// // TODO Auto-generated catch block +// e.printStackTrace(); +// } +// System.out.println("解密"); + } + +} \ No newline at end of file diff --git b/src/com/espeed/yxy/tool/GetRandom.java a/src/com/espeed/yxy/tool/GetRandom.java new file mode 100644 index 0000000..119e0cb --- /dev/null +++ a/src/com/espeed/yxy/tool/GetRandom.java @@ -0,0 +1,23 @@ +package com.espeed.yxy.tool; + +import java.util.Random; + +/*** + * + * @author xieyong + * 获取随即码 + */ +public class GetRandom { + + //生成随机码 + public static String getRandomString(int length) throws Exception{ //length表示生成字符串的长度 + String base = "abcdefghijklmnopqrstuvwxyz0123456789"; //生成字符串从此序列中取 + Random random = new Random(); + StringBuffer sb = new StringBuffer(); + for (int i = 0; i < length; i++) { + int number = random.nextInt(base.length()); + sb.append(base.charAt(number)); + } + return sb.toString(); + } +} diff --git b/src/com/espeed/yxy/tool/GetRondom.java a/src/com/espeed/yxy/tool/GetRondom.java new file mode 100644 index 0000000..989504d --- /dev/null +++ a/src/com/espeed/yxy/tool/GetRondom.java @@ -0,0 +1,46 @@ +package com.espeed.yxy.tool; + +import java.util.ArrayList; +import java.util.List; +import java.util.Random; +/*** + * + * @author xieyong + * 获取随机码 + */ +public class GetRondom { + + //生成随机码 + public static List<String> getRandom(List<String> value){ + + List<String> newSmtpList=new ArrayList(); + int n = value.size(); + Random rand = new Random(); + boolean[] bool = new boolean[n]; + + int num =0; + + for (int i = 0; i<n; i++){ + do{ + //如果产生的数相同继续循环 + num = rand.nextInt(n); + }while(bool[num]); + bool[num] =true; + newSmtpList.add(value.get(num)); + } + return newSmtpList; + + } + + public static void main(String[] args) { + List<String> oldStr=new ArrayList<String>(); + for(int i=0;i<3;i++){ + oldStr.add("name"+i); + } + + List<String> newStr=getRandom(oldStr); + for(int j=0;j<newStr.size();j++){ + System.out.println(newStr.get(j)); + } + } +} diff --git b/src/com/espeed/yxy/tool/GreateAndDeleteFile.java a/src/com/espeed/yxy/tool/GreateAndDeleteFile.java new file mode 100644 index 0000000..0978ccb --- /dev/null +++ a/src/com/espeed/yxy/tool/GreateAndDeleteFile.java @@ -0,0 +1,86 @@ +package com.espeed.yxy.tool; + +import java.io.File; + +/*** + * + * @author xieyong + * 生成删除文件 + */ +public class GreateAndDeleteFile { + + /**用于创建文件夹的方法*/ + public static void mkdir(String mkdirName)throws Exception{ + File dirFile = new File(mkdirName); + boolean bFile = dirFile.exists(); + if( bFile == true ) + { + System.out.println("The folder exists."); + } else { + System.out.println("The folder do not exist,now trying to create a one..."); + bFile = dirFile.mkdirs(); + if( bFile == true ) + { + System.out.println("Create successfully!"); + System.out.println("创建文件夹"); + } + else{ + + System.out.println("Disable to make the folder,please check the disk is full or not."); + System.out.println(" 文件夹创建失败,清确认磁盘没有写保护并且空件足够"); + } + } + + } + /**删除文件夹*/ + public static void deleteFile(File file){ + try { + if(file.exists()){ + if(file.isFile()){ + file.delete(); + }else if(file.isDirectory()){ + File files[] = file.listFiles(); + for(int i=0;i<files.length;i++){ + deleteFile(files[i]); + } + } + file.delete(); + }else{ + System.out.println("所删除的文件不存在!"+'\n'); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + /**用于创建文件的方法*/ + public static void createFile(String mkdirName) throws Exception{ + File dirFile = new File(mkdirName); + boolean bFile = dirFile.exists(); + if( bFile == true ) + { + System.out.println("The folder exists."); + } else { + System.out.println("The folder do not exist,now trying to create a one..."); + bFile = dirFile.createNewFile(); + if( bFile == true ) + { + System.out.println("Create successfully!"); + System.out.println("创建文件夹"); + } + else{ + + System.out.println("Disable to make the folder,please check the disk is full or not."); + System.out.println(" 文件夹创建失败,清确认磁盘没有写保护并且空件足够"); + } + } + + } + + public static void main(String[] agrs){ + GreateAndDeleteFile caf = new GreateAndDeleteFile(); + File file = new File("E:\\javawork\\.metadata\\.me_tcat\\webapps\\espeedYxyService\\mailtempfile\\21xmail.com\\xieyong\\attachment\\0d161f8a-7091-492c-bf1b-a394470a63a8.xls"); + caf.deleteFile(file); + } + +} diff --git b/src/com/espeed/yxy/tool/GreateEmlFile.java a/src/com/espeed/yxy/tool/GreateEmlFile.java new file mode 100644 index 0000000..a478e53 --- /dev/null +++ a/src/com/espeed/yxy/tool/GreateEmlFile.java @@ -0,0 +1,186 @@ +package com.espeed.yxy.tool; + +import java.io.File; +import java.io.FileOutputStream; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.activation.DataHandler; +import javax.activation.FileDataSource; +import javax.mail.internet.InternetAddress; +import javax.mail.internet.MimeBodyPart; +import javax.mail.internet.MimeMessage; +import javax.mail.internet.MimeMultipart; +import javax.mail.internet.MimeUtility; + +import com.espeed.yxy.pojo.YxySendMailMaster; +/* + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 生成本地邮件(营销邮) + * 开始时间: 2013.12.13 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +public class GreateEmlFile { + + private static MimeMessage mimeMsg = null; // MIME邮件对象 + private static javax.mail.Session mailSession = null; + + /**生成eml文件*/ + public static List<Object> GreateMail(YxySendMailMaster yxysendmailmaster,String loginid,String domain,String uploadattrName,String usersetpath)throws Exception{ + List<Object> RemlPath=new ArrayList<Object>(); + RemlPath.add("0"); + RemlPath.add(""); + RemlPath.add(""); + RemlPath.add("0"); + RemlPath.add(""); + + //营销web路径(文件路径) + String pathew=ConfigPath.getYxyServicePath(); + //内容 + String context=yxysendmailmaster.getBody(); + + //获取上传的附件名 + String newUpload=uploadattrName.replaceAll("\"", ""); + String [] newstr=newUpload.split(",");//分割多个附件 + + int isAttr=0;//附件个数 + //1.获取附件 + String fileNames[]=new String[0];//定义附件名 + if(newstr==null||newstr[0].equals("")){//判断是否存在附件 + fileNames=new String[0]; + }else{ + String sysPath=pathew+"/mailtempfile/"+domain+"/"+loginid+"/attachment"; + fileNames=new String[newstr.length]; + for (int i = 0; i < newstr.length; i++) { + fileNames[i]=sysPath+"\\"+newstr[i]; + } + } + isAttr=fileNames.length;//附件个数 + + //变量定义 + String mailName=yxysendmailmaster.getSender();//发件人 + String sendMail=yxysendmailmaster.getSend_email();//发件人邮箱 + String replyEmail=yxysendmailmaster.getReply_email();//回复邮箱 + String title=yxysendmailmaster.getSubject();//主题 + + + //------- 设置from、to等信息---------- + mimeMsg = new javax.mail.internet.MimeMessage(mailSession); + + InternetAddress sentFrom; + //发件人 + sentFrom = new InternetAddress(sendMail ,mailName,"UTF-8"); + mimeMsg.setFrom(sentFrom); + //主题 + mimeMsg.setSubject(title,"UTF-8"); + + // ---设置回复人地址--------------- + InternetAddress addressis; + addressis = new InternetAddress(replyEmail); + InternetAddress[] addrs = new InternetAddress[1]; + addrs[0] = addressis; + mimeMsg.setReplyTo(addrs); + + // ------------------------------------- + MimeBodyPart messageBodyPart1 = new MimeBodyPart(); + messageBodyPart1.setHeader("Content-Transfer-Encoding", "base64"); + + + //--------附件-------------------- + MimeMultipart multipart = new MimeMultipart();// 附件传输格式 + multipart.setSubType("related");//这句很重要 + multipart.addBodyPart(messageBodyPart1); + + for (int j = 0; j < fileNames.length; j++) { + MimeBodyPart messageBodyPart2 = new MimeBodyPart(); + messageBodyPart2.setHeader("Content-Transfer-Encoding", "base64"); + //messageBodyPart2.setContentLanguage("UTF-8"); + // 选择出每一个附件名 + String filename = fileNames[j].split("#####")[0]; + String displayname = fileNames[j].split("#####")[1]; + // 得到数据源 + FileDataSource fds = new FileDataSource(filename); + // 得到附件本身并至入BodyPart + messageBodyPart2.setDataHandler(new DataHandler(fds));// 得到文件名同样至入BodyPart + messageBodyPart2.setHeader("Content-Type", "application/octet-stream;name="+displayname); + messageBodyPart2.setFileName(MimeUtility.encodeText(displayname,"UTF-8","B")); + multipart.addBodyPart(messageBodyPart2); + } + String resultpicpath="";//图片路径 + //11.判断是否有图片 + String[] picpath=context.split("<img"); + for(int i=0;i<picpath.length;i++){ + if(picpath[i].contains("src")){ + int index=picpath[i].indexOf("mailtempfile/"); + if(index==-1){ + continue; + } + //处理字符 + String[] picAarry=picpath[i].split("src=\""); + int end=picAarry[1].indexOf("\""); + String result=picAarry[1].substring(0,end); + + //获取图片路径 + int pathbegin=result.indexOf("mailtempfile"); + String path=result.substring(pathbegin,result.length()); + String picpaths=pathew+"\\"+path;//图片真实路径 + + //获取图片保存名字 + //String[] filenamestr=result.split("/"); + //String picname=filenamestr[filenamestr.length-1]; + resultpicpath+=path+"#####"; + + //替换图片 + context=context.replaceFirst(result,"cid:IMG"+i); + + //加入图片源码 + File pf=new File(picpaths); + if(pf.exists()){ + MimeBodyPart gifBodyPart=new MimeBodyPart(); + FileDataSource fds=new FileDataSource(pf);//图片所在的目录的绝对路径 + gifBodyPart.setDataHandler(new DataHandler(fds)); + gifBodyPart.setHeader("Content-Type", "image/jpeg"); + gifBodyPart.setFileName(MimeUtility.encodeText("espeedpic.jpg","UTF-8","B")); + gifBodyPart.setContentID("<IMG"+i+">"); //cid的值 + multipart.addBodyPart(gifBodyPart); + } + } + } + + messageBodyPart1.setContent(context,"text/html" + ";charset=" + "UTF-8"); + + mimeMsg.setContent(multipart); + + //------------- 设置信件头的发送日期--------------- + mimeMsg.setSentDate(new Date()); + + //文件存放路径 + //以当前用户名+当前日期为文件名 + SimpleDateFormat df=new SimpleDateFormat("yyyyMMddHHssmm"); + String nowDate=df.format(new Date()); + String emlfileName=""; + emlfileName=loginid+nowDate + ".eml"; + //保存邮件 + File dir = new File(usersetpath); + dir.mkdirs();// 创建所有目录,包括子目录 + mimeMsg.writeTo(new FileOutputStream(dir+"\\" + emlfileName)); + File files=new File(dir+"\\" + emlfileName); + //返回值 + RemlPath.set(0,files.length());//文件大小 + RemlPath.set(1,usersetpath + "\\" + emlfileName);//返回eml存放路径 + //RemlPath.set(2,"");//文件key + RemlPath.set(3,isAttr);//是否有附件 + RemlPath.set(4,resultpicpath);//图片路径 + + return RemlPath; + } + +} diff --git b/src/com/espeed/yxy/tool/LogsTool.java a/src/com/espeed/yxy/tool/LogsTool.java new file mode 100644 index 0000000..d7ab1c0 --- /dev/null +++ a/src/com/espeed/yxy/tool/LogsTool.java @@ -0,0 +1,101 @@ +package com.espeed.yxy.tool; + +import java.io.File; +import java.io.FileWriter; +import java.text.SimpleDateFormat; +import java.util.Date; + +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 日志记录工具类 + * 开始时间: 2013.11.18 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +public class LogsTool{ + + /**邮件发送日志*/ + public static void sendLogs(String domain,String username,String value){ + try { + //以当前时间为日志文件名 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + String nowDate=sdf.format(new Date()); + //发生的时间 + SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String nowDates=sdf1.format(new Date()); + //组建路径 + String savePath="D:/yxysendlog/"+domain+"/"+username; + File files = new File(savePath); + if (!files.exists()) { + files.mkdirs(); + } + + //写入文件 + FileWriter w = new FileWriter(savePath+"/"+nowDate+".txt", true); + w.write(nowDates+": "+value+"\r\n"); + w.close(); + } catch (Exception e) { + e.printStackTrace(); + System.out.println("日志记录异常"); + } + } + + /**营销异常日志*/ + public static void erroLogs(String value){ + try { + //以当前时间为日志文件名 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + String nowDate=sdf.format(new Date()); + //发生的时间 + SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String nowDates=sdf1.format(new Date()); + //组建路径 + String savePath="D:/yxysenderro/"; + File files = new File(savePath); + if (!files.exists()) { + files.mkdirs(); + } + //写入文件 + FileWriter w = new FileWriter(savePath+nowDate+".txt", true); + w.write(nowDates+": "+value+"\r\n"); + w.close(); + } catch (Exception e) { + e.printStackTrace(); + System.out.println("日志记录异常"); + } + } + + /**执行计划异常日志*/ + public static void marketPlanLogs(String value){ + try { + //以当前时间为日志文件名 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + String nowDate=sdf.format(new Date()); + //发生的时间 + SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String nowDates=sdf1.format(new Date()); + //组建路径 + String savePath="D:/yxymarketplanerro/"; + File files = new File(savePath); + if (!files.exists()) { + files.mkdirs(); + } + //写入文件 + FileWriter w = new FileWriter(savePath+nowDate+".txt", true); + w.write(nowDates+": "+value+"\r\n"); + w.close(); + } catch (Exception e) { + e.printStackTrace(); + System.out.println("日志记录异常"); + } + } + + public static void main(String[] args) { + LogsTool.erroLogs("测试"); + } +} \ No newline at end of file diff --git b/src/com/espeed/yxy/tool/ServiceInit.java a/src/com/espeed/yxy/tool/ServiceInit.java new file mode 100644 index 0000000..74a7ab0 --- /dev/null +++ a/src/com/espeed/yxy/tool/ServiceInit.java @@ -0,0 +1,33 @@ +package com.espeed.yxy.tool; + +import java.sql.CallableStatement; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; + +import javax.servlet.http.HttpServlet; + +public class ServiceInit extends HttpServlet{ + + private Connection conn; + private ResultSet rs; + private PreparedStatement pst; + + //项目初始化 + public void init(){ + //更新待发邮件状态 + try { + //获取数据库链接 + conn=DBUtil.getConnection(); + String sql="update yxy_send_mail_master set isuse=0"; + pst=conn.prepareStatement(sql); + pst.executeUpdate(); + + System.out.println("服务启动初始化成功!"); + } catch (Exception e) { + System.out.println("服务启动初始化失败!"); + }finally{ + DBUtil.close(rs, pst, conn); + } + } +} diff --git b/src/com/espeed/yxy/tool/SpringFactory.java a/src/com/espeed/yxy/tool/SpringFactory.java new file mode 100644 index 0000000..923029f --- /dev/null +++ a/src/com/espeed/yxy/tool/SpringFactory.java @@ -0,0 +1,39 @@ +package com.espeed.yxy.tool; + +import org.springframework.beans.BeansException; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 获取springApplicationContext中Bean的工具类 + * 开始时间: 2013.10.1 + * 程 序 员: 芮瑞 + * 最后修改: 2014-02-25 + * 备 注:功能主要包括(对企业的增删改查) + */ +public class SpringFactory implements ApplicationContextAware +{ + private static ApplicationContext context; + + public void setApplicationContext(ApplicationContext context) + throws BeansException + { + this.context = context; + } + /** + * + * @param id要获取的springBean的id + * @return + */ + public static Object getObject(String id) { + Object object = null; + object = context.getBean(id); + return object; + } + + +} diff --git b/src/com/espeed/yxy/tool/createAndDeleteFile.java a/src/com/espeed/yxy/tool/createAndDeleteFile.java new file mode 100644 index 0000000..5b6a2a9 --- /dev/null +++ a/src/com/espeed/yxy/tool/createAndDeleteFile.java @@ -0,0 +1,83 @@ +package com.espeed.yxy.tool; + +import java.io.File; + +/** +* 用于创建文件夹的方法 +* @param mkdirName +*/ +public class createAndDeleteFile { + + /**创建文件夹*/ + public static void mkdir(String mkdirName)throws Exception{ + + File dirFile = new File(mkdirName); + boolean bFile = dirFile.exists(); + if( bFile == true ) + { + System.out.println("The folder exists."); + } else { + System.out.println("The folder do not exist,now trying to create a one..."); + bFile = dirFile.mkdirs(); + if( bFile == true ) + { + System.out.println("Create successfully!"); + System.out.println("创建文件夹"); + } + else{ + + System.out.println("Disable to make the folder,please check the disk is full or not."); + System.out.println(" 文件夹创建失败,清确认磁盘没有写保护并且空件足够"); + } + } + + } + /**删除文件夹*/ + public static void deleteFile(File file){ + try { + if(file.exists()){ + if(file.isFile()){ + file.delete(); + }else if(file.isDirectory()){ + File files[] = file.listFiles(); + for(int i=0;i<files.length;i++){ + deleteFile(files[i]); + } + } + file.delete(); + }else{ + System.out.println("所删除的文件不存在!"+'\n'); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + /**用于创建文件的方法 */ + public static void createFile(String mkdirName) throws Exception{ + File dirFile = new File(mkdirName); + boolean bFile = dirFile.exists(); + if( bFile == true ){ + System.out.println("The folder exists."); + }else{ + System.out.println("The folder do not exist,now trying to create a one..."); + bFile = dirFile.createNewFile(); + if( bFile == true ){ + System.out.println("Create successfully!"); + System.out.println("创建文件夹"); + }else{ + System.out.println("Disable to make the folder,please check the disk is full or not."); + System.out.println(" 文件夹创建失败,清确认磁盘没有写保护并且空件足够"); + } + } + + } + + public static void main(String[] agrs){ + createAndDeleteFile caf = new createAndDeleteFile(); + File file = new File("J:mail\\xieyong435298846@qq.comdraft7320131122195807.eml"); + caf.deleteFile(file); + //mkdir("c:/aa/aa/aa"); + } + +} diff --git b/src/com/espeed/yxy/util/AnalysisMail.java a/src/com/espeed/yxy/util/AnalysisMail.java new file mode 100644 index 0000000..2e4aa25 --- /dev/null +++ a/src/com/espeed/yxy/util/AnalysisMail.java @@ -0,0 +1,301 @@ +package com.espeed.yxy.util; + +import java.io.BufferedInputStream; +import java.io.BufferedOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.InputStream; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Random; + +import javax.crypto.CipherInputStream; +import javax.mail.BodyPart; +import javax.mail.Multipart; +import javax.mail.Part; +import javax.mail.Session; +import javax.mail.internet.MimeMessage; +import javax.mail.internet.MimeUtility; + +import com.espeed.yxy.tool.Encrypt; + +import sun.misc.BASE64Decoder; + +/** + * 程序名称: EspeedMail_时速邮箱 + * 程序版本: V1.0 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) + * 版权所有: 深圳市科飞时速网络技术有限公司 + * 技术支持: Tech@21gmail.com + * 单元名称: 解析邮件(营销游) + * 开始时间: 2013.12.09 + * 程 序 员: 谢勇 + * 最后修改: + * 备 注: 如需修改请通知程序员 + */ +public class AnalysisMail { + + private MimeMessage msg; + private StringBuffer bodyText=new StringBuffer(); + public String attrname=""; + /**解析邮件*/ + public List ParseEmlMethod(String path,String key){ + //定义结果集 + List<String> result=new ArrayList<String>(); + try { + //System.setProperty("mail.mime.multipart.ignoreexistingboundaryparameter", "true"); + if(key!=null&&!key.equals("")){ + //解密邮件 + BASE64Decoder enc=new BASE64Decoder(); + //需要一个流 给它解密的流 + CipherInputStream CStream = null; + CStream =(CipherInputStream) Encrypt.decrypt(path,Encrypt.toKey(enc.decodeBuffer(key))); + + Session mailSession = Session.getDefaultInstance(System.getProperties(), null); + msg = new MimeMessage(mailSession, CStream); + }else{ + InputStream is =new FileInputStream(path); + Session mailSession = Session.getDefaultInstance(System.getProperties(), null); + msg = new MimeMessage(mailSession, is); + } + + + //获取内容 + getMailContent((Part) msg); + result.add(bodyText+""); + //saveAttachMent((Part) msg); + //result.add(attrName); + + } catch (Exception e) { + e.printStackTrace(); + } + + return result; + } + + /**解析附件或图片*/ + public String parsePicOrAttr(String emlpath,String key,int check,String savepath){ + try { + attrname=""; + if(key!=null&&!key.equals("")){ + //解密邮件 + BASE64Decoder enc=new BASE64Decoder(); + //需要一个流 给它解密的流 + CipherInputStream CStream = null; + CStream =(CipherInputStream) Encrypt.decrypt(emlpath,Encrypt.toKey(enc.decodeBuffer(key))); + + Session mailSession = Session.getDefaultInstance(System.getProperties(), null); + msg = new MimeMessage(mailSession, CStream); + }else{ + InputStream is =new FileInputStream(emlpath); + Session mailSession = Session.getDefaultInstance(System.getProperties(), null); + msg = new MimeMessage(mailSession, is); + } + //处理图片与附件 + saveAttachMent((Part)msg,check,savepath); + } catch (Exception e) { + e.printStackTrace(); + } + return attrname; + } + + /**获取内容*/ + public void getMailContent(Part part) throws Exception { + String contenttype = part.getContentType(); + int nameindex = contenttype.indexOf("name"); + boolean conname = false; + if (nameindex != -1) + conname = true; + + if (part.isMimeType("text/plain") && !conname) { + bodyText.append(part.getContent()); + + } else if (part.isMimeType("text/html") && !conname) { + bodyText.append(part.getContent()); + + } else if (part.isMimeType("multipart/*")) { + Multipart multipart = (Multipart) part.getContent(); + int counts = multipart.getCount(); + for (int i = 0; i < counts; i++) { + getMailContent(multipart.getBodyPart(i)); + } + + } else if (part.isMimeType("message/rfc822")) { + getMailContent((Part) part.getContent()); + + } else { + + } + } + + /**附件与图片*/ + public void saveAttachMent(Part part,int check,String savepath) { + try { + boolean isPic=false; + String filename=""; + String [] contentid=null;//是否有图片 + if(part.isMimeType("multipart/*")){ + Multipart mp = (Multipart)part.getContent(); + for(int i=0;i<mp.getCount();i++){ + BodyPart mpart = mp.getBodyPart(i); + String disposition=""; + disposition = mpart.getDisposition(); + if((disposition != null) &&((disposition.equals(Part.ATTACHMENT))||(disposition.equals(Part.INLINE)))){ + filename = mpart.getFileName(); + filename = MimeUtility.decodeText(filename); + //是否是图片 + contentid=mpart.getHeader("Content-ID"); + if(contentid!=null){//说明是图片 + isPic=true; + } + //判断是解析图片还是附件 + if(check==1){//附件 + if(!isPic){ + saveFile(filename,mpart.getInputStream(),savepath,check); + } + }else{//图片 + if(isPic){ + saveFile(filename,mpart.getInputStream(),savepath,check); + } + } + }else if(mpart.isMimeType("multipart/*")){ + saveAttachMent(mpart,check,savepath); + }else if(mpart.isMimeType("message/rfc822")){ + filename = mpart.getFileName(); + filename=MimeUtility.decodeText(filename); + //是否是图片 + contentid=mpart.getHeader("Content-ID"); + if(contentid!=null){//说明是图片 + isPic=true; + } + //判断是解析图片还是附件 + if(check==1){//附件 + if(!isPic){ + saveFile(filename,mpart.getInputStream(),savepath,check); + } + }else{//图片 + if(isPic){ + saveFile(filename,mpart.getInputStream(),savepath,check); + } + } + } + } + }else if(part.isMimeType("message/rfc822")){ + saveAttachMent((Part)part.getContent(),check,savepath); + }else if(part.isMimeType("application/octet-stream")){ + filename=part.getFileName(); + contentid=part.getHeader("Content-ID"); + if(contentid!=null){//说明是图片 + isPic=true; + } + //判断是解析图片还是附件 + if(check==1){//附件 + if(!isPic){ + saveFile(filename,part.getInputStream(),savepath,check); + } + }else{//图片 + if(isPic){ + saveFile(filename,part.getInputStream(),savepath,check); + } + } + } + } catch (Exception e) { + e.printStackTrace(); + System.out.println("erro:保存附件异常!"); + } + } + + /**真正的保存附件到指定目录*/ + private void saveFile(String fileName,InputStream in,String savepath,int check){ + try { + //重新取名 + String savaname="";//指定保存的名字 + //时间命名 + SimpleDateFormat df=new SimpleDateFormat("yyyyMMddHHmmssSSS"); + String nowtime=df.format(new Date()); + savaname=nowtime; + + String base = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; //生成字符串从此序列中取 + Random random = new Random(); + StringBuffer sb = new StringBuffer(); + for (int i=0;i<5;i++) { + int number = random.nextInt(base.length()); + sb.append(base.charAt(number)); + } + savaname+=sb.toString(); + + //附件名编码解析 + if(fileName.contains("=?")||fileName.contains("?B")){ + fileName=fileName.replace(" ", ""); + fileName=MimeUtility.decodeText(fileName); + }else{ + String newstr=fileName.replace("?", ""); + newstr=new String(newstr.getBytes("iso-8859-1")); + if(!newstr.contains("?")){ + fileName=new String(fileName.getBytes("iso-8859-1")); + } + } + //取得文件后缀 + String[] typearry=fileName.split("\\."); + String filetype=typearry[typearry.length-1]; + //如果是图片则使用新随即名称 + if(check==1){//附件 + attrname+=savaname+"."+filetype+"#####"+fileName+","; + }else{//图片 + attrname+=savaname+"."+filetype+"#####"; + } + String osName = System.getProperty("os.name"); + String storedir = savepath; + String separator = ""; + if (osName == null) + osName = ""; + if (osName.toLowerCase().indexOf("win") != -1) { + separator = "\\"; + if (storedir == null || storedir.equals("")) + storedir = "c:\\tmp"; + }else { + separator = "/"; + storedir = "/tmp"; + } + File storefile = new File(storedir + separator); + if(!storefile.exists()){ + storefile.mkdirs(); + } + BufferedOutputStream bos = null; + BufferedInputStream bis = null; + try { + bos = new BufferedOutputStream(new FileOutputStream(storefile+"//"+ savaname+"."+filetype)); + bis = new BufferedInputStream(in); + int c; + while ((c = bis.read()) != -1) { + bos.write(c); + bos.flush(); + } + }catch (Exception exception) { + exception.printStackTrace(); + }finally { + bos.close(); + bis.close(); + } + } catch (Exception e) { + e.printStackTrace(); + System.out.println("erro:保存附件到指定目录异常!"); + } + } + + /**获得系统相对路径*/ + public String path(){; + String pathew = this.getClass().getClassLoader().getResource("/").getPath(); + pathew = pathew.substring(1, pathew.length()); + pathew = pathew.replace("/WEB-INF/classes/",""); + return pathew; + } + + public static void main(String[] args) { + AnalysisMail paxlmail=new AnalysisMail(); + List result = paxlmail.ParseEmlMethod("f:\\emily20161221170720.eml",""); + } +} diff --git b/src/springConfig/applicationContext_centre.xml a/src/springConfig/applicationContext_centre.xml new file mode 100644 index 0000000..21b88eb --- /dev/null +++ a/src/springConfig/applicationContext_centre.xml @@ -0,0 +1,93 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + spring数据库、整合其它框架配置文件 +--> +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:aop="http://www.springframework.org/schema/aop" + xmlns:tx="http://www.springframework.org/schema/tx" + xsi:schemaLocation=" + http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd + http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd + http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd"> + + <!-- 配置数据源 --> + <bean id="centreDataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> + <property name="driverClassName"> + <value>com.mysql.jdbc.Driver</value> + </property> + <property name="url"> + <value>jdbc:mysql://localhost:3306/centredb?useUnicode=true&characterEncoding=utf8</value> + </property> + <property name="username"> + <value>root</value> + </property> + <property name="password"> + <value>sz1234567890</value> + </property> + <property name="maxActive"> + <value>100</value> + </property> + <property name="maxIdle"> + <value>50</value> + </property> + <property name="initialSize"> + <value>30</value> + </property> + <property name="maxWait"> + <value>10000</value> + </property> + <property name="defaultAutoCommit"> + <value>true</value> + </property> + <property name="removeAbandoned"> + <value>true</value> + </property> + <property name="removeAbandonedTimeout"> + <value>300</value> + </property> + <property name="logAbandoned"> + <value>false</value> + </property> + <property name="validationQuery"> + <value>select 1</value> + </property> + <property name="testOnBorrow"> + <value>true</value> + </property> + </bean> + + <!-- 配置注解sessionFactory --> + <bean id="centreSessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"> + <property name="dataSource" ref="centreDataSource" /> + <property name="packagesToScan"> + <list> + <value>com.espeed.centre.pojo</value> + </list> + </property> + <property name="hibernateProperties"> + <props> + <prop key="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</prop> + <prop key="hibernate.show_sql">false</prop> + <prop key="hibernate.generate_statistics">true</prop> + <prop key="hibernate.connetion.release_mode">auto</prop> + <prop key="hibernate.cache.use_query_cache">false</prop> + <prop key="hibernate.cache.use_second_level_cache">false</prop> + </props> + </property> + </bean> + + <!--配置公共的hibernate方法注解 --> + <bean id="centreAnnHibernateBaseDAO" class="com.espeed.yxy.dao.impl.CentreHibernateBaseDAOImpl" abstract="true" scope="prototype"> + <property name="sessionFactory" ref="centreSessionFactory"/> + </bean> + + <!-- 用户dao --> + <bean id="centreuserdao" class="com.espeed.yxy.dao.impl.CentreUserDaoImpl" parent="centreAnnHibernateBaseDAO"></bean> + <!-- 跟踪配置dao --> + <bean id="centretracksetdao" class="com.espeed.yxy.dao.impl.CentreTrackSetDaoImpl" parent="centreAnnHibernateBaseDAO"></bean> + <!-- 营销开发客户配置dao --> + <bean id="centreyxyedmnewcustomerdao" class="com.espeed.yxy.dao.impl.CentreYxyedmNewcustomerDaoImpl" parent="centreAnnHibernateBaseDAO"></bean> + <!-- 营销盘活客户配置dao --> + <bean id="centreyxyedmoldcustomerdao" class="com.espeed.yxy.dao.impl.CentreYxyedmOldcustomerDaoImpl" parent="centreAnnHibernateBaseDAO"></bean> +</beans> diff --git b/src/springConfig/applicationContext_common.xml a/src/springConfig/applicationContext_common.xml new file mode 100644 index 0000000..38a8859 --- /dev/null +++ a/src/springConfig/applicationContext_common.xml @@ -0,0 +1,109 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- + 共有方法,负责所有共有配置文件 +--> +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:aop="http://www.springframework.org/schema/aop" + xmlns:tx="http://www.springframework.org/schema/tx" + xsi:schemaLocation=" + http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd + http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd + http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd"> +<!-- hibernate注入 --> + <!-- 1、配置C3P0,数据源 --> + <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"> + <property name="driverClassName"> + <value>com.mysql.jdbc.Driver</value> + </property> + <property name="url"> + <value>jdbc:mysql://localhost:3306/yxybase?useUnicode=true&characterEncoding=utf8&autoReconnect=true</value> + </property> + <property name="username"> + <value>root</value> + </property> + <property name="password"> + <value>sz1234567890</value> + </property> + + <property name="maxActive" value="300"/> + + <property name="maxIdle" value="50"/> + + <property name="initialSize" value="100"/> + + <property name="maxWait" value="1000"/> + + <property name="defaultAutoCommit" value="true"/> + + <property name="removeAbandoned" value="true"/> + + <property name="removeAbandonedTimeout" value="60"/> + + <property name="logAbandoned" value="true"/> + + <property name="minEvictableIdleTimeMillis" value="10000"/> + <property name="validationQuery" value="SELECT NOW() FROM DUAL"/> + + </bean> + + <!-- 2、配置sessionFactory --> + <bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"> + <!-- 数据源注入 --> + <property name="dataSource" ref="dataSource" /> + <property name="packagesToScan"> + <list> + <value>com.espeed.yxy.pojo</value> + </list> + </property> + <property name="hibernateProperties"> + <props> + <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop> + <prop key="hibernate.show_sql">false</prop> + + <!-- 如果开启, Hibernate将收集有助于性能调节的统计数据. 取值 true | false --> + <prop key="hibernate.generate_statistics">true</prop> + <!-- 指定Hibernate在何时释放JDBC连接. --> + <prop key="hibernate.connetion.release_mode">auto</prop> + </props> + </property> + </bean> + + + + <!--3、配置spring事务(AOP) --> + <!-- 事务管理器 --> + <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> + <property name="sessionFactory" ref="sessionFactory" /> + </bean> + + <!-- 事务的传播特性(propagation) --> + <tx:advice id="txAdvice" transaction-manager="transactionManager"> + <tx:attributes> + <tx:method name="del*"/> + <tx:method name="save*" /> + <tx:method name="update*" /> + <tx:method name="add*" /> + <tx:method name="get*" propagation="SUPPORTS" read-only="true"/> + <tx:method name="load*" propagation="SUPPORTS" read-only="true"/> + <tx:method name="list*" propagation="SUPPORTS" read-only="true"/> + <tx:method name="*" propagation="SUPPORTS" read-only="true"/> + </tx:attributes> + </tx:advice> + <!-- 配置哪些类哪些方法具有事务 ,采用AOP--> + <aop:config> + <aop:pointcut expression="execution(* com.espeed.service.*.*(..))" id="allMethod"/> + <aop:advisor pointcut-ref="allMethod" advice-ref="txAdvice"/> + </aop:config> + <!-- 注入SpringFactory类 --> + <bean id="springfactory" class="com.espeed.yxy.tool.SpringFactory"> + </bean> + <!-- POJO配置 --> + <!--待发邮件实体--> + <bean id="yxysendmailmaster" class="com.espeed.yxy.pojo.YxySendMailMaster"></bean> + <!--待发邮件地址实体--> + <bean id="yxysendmaildetail" class="com.espeed.yxy.pojo.YxySendMailDetail"></bean> + <!--smtp实体--> + <bean id="yxysendsmtpinfo" class="com.espeed.yxy.pojo.YxySendSmtpInfo"></bean> +</beans> diff --git b/src/springConfig/applicationContext_dao.xml a/src/springConfig/applicationContext_dao.xml new file mode 100644 index 0000000..cd7c655 --- /dev/null +++ a/src/springConfig/applicationContext_dao.xml @@ -0,0 +1,56 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!--邮件dao配置文件--> +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:aop="http://www.springframework.org/schema/aop" + xmlns:tx="http://www.springframework.org/schema/tx" + xsi:schemaLocation=" + http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd + http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd + http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd"> + + + <!--待发邮件DAO--> + <bean id="yxysendmailmasterdao" class="com.espeed.yxy.dao.impl.YxySendMailMasterDaoImpl" parent="hibernateBaseDAO"></bean> + <!--邮件DAO--> + <bean id="mailmasterbasedao" class="com.espeed.yxy.dao.impl.YxySendMailMasterBaseDaoImpl" parent="hibernateBaseDAO"></bean> + <!--待发地址DAO--> + <bean id="yxysendmaildetaildao" class="com.espeed.yxy.dao.impl.YxySendMailDetailDaoImpl" parent="hibernateBaseDAO"></bean> + <!--SMTP DAO--> + <bean id="yxysendsmtpinfodao" class="com.espeed.yxy.dao.impl.YxySendSmtpInfoDaoImpl" parent="hibernateBaseDAO"></bean> + <!--SMTP后缀设置信息 DAO--> + <bean id="yxysmtpsuffixsetdao" class="com.espeed.yxy.dao.impl.YxySmtpSuffixSetDaoImpl" parent="hibernateBaseDAO"></bean> + <!--SMTP后缀设置信息 DAO--> + <bean id="yxysmtpsendsetdao" class="com.espeed.yxy.dao.impl.YxySmtpSendSetDaoImpl" parent="hibernateBaseDAO"></bean> + <!--自配SMTP发送量信息 DAO--> + <bean id="yxysmtpsendselfoversetdao" class="com.espeed.yxy.dao.impl.YxySmtpSendSelfOversetDaoImpl" parent="hibernateBaseDAO"></bean> + <!--自配SMTP发送量限制 DAO--> + <bean id="yxysmtpsendselfsetdao" class="com.espeed.yxy.dao.impl.YxySmtpSendSelfSetDaoImpl" parent="hibernateBaseDAO"></bean> + <!--控制参数DAO--> + <bean id="yxysysparamaterdao" class="com.espeed.yxy.dao.impl.YxyParamaterDaoImpl" parent="hibernateBaseDAO"></bean> + <!--控制参数值DAO--> + <bean id="yxysysparamatersvaluedao" class="com.espeed.yxy.dao.impl.YxySysParamatersValueDaoImpl" parent="hibernateBaseDAO"></bean> + <!-- 营销计划dao --> + <bean id="marketingplandao" class="com.espeed.yxy.dao.impl.YxyMarketingPlanDaoImpl" parent="hibernateBaseDAO"></bean> + <!-- 用户地址dao --> + <bean id="addressdao" class="com.espeed.yxy.dao.impl.YxyUserAddressDaoImpl" parent="hibernateBaseDAO"></bean> + <!-- 模版dao --> + <bean id="stencildao" class="com.espeed.yxy.dao.impl.YxyMailStencilDaoImpl" parent="hibernateBaseDAO"></bean> + <!-- 计划周期dao --> + <bean id="marketingweekdao" class="com.espeed.yxy.dao.impl.YxyMarketingWeekDaoImpl" parent="hibernateBaseDAO"></bean> + <!-- 发件人dao --> + <bean id="senderdao" class="com.espeed.yxy.dao.impl.YxySenderSetDaoImpl" parent="hibernateBaseDAO"></bean> + <!-- 回复dao --> + <bean id="replydao" class="com.espeed.yxy.dao.impl.YxyReplyInfoDaoImpl" parent="hibernateBaseDAO"></bean> + <!-- 过滤dao --> + <bean id="filterdao" class="com.espeed.yxy.dao.impl.YxySendFilterAddressDaoImpl" parent="hibernateBaseDAO"></bean> + <!-- 分类下的客户DAO --> + <bean id="yxycustomeremaildao" class="com.espeed.yxy.dao.impl.YxyCustomerEmailDaoImpl" parent="hibernateBaseDAO"></bean> + <!-- 客户发送邮件的统计Dao --> + <bean id="yxysendcountdao" class="com.espeed.yxy.dao.impl.YxySendCountDaoImpl" parent="hibernateBaseDAO"></bean> + <!--配置公共的hibernate方法 --> + <bean id="hibernateBaseDAO" class="com.espeed.yxy.dao.impl.HibernateBaseDAOImpl" abstract="true" scope="prototype"> + <property name="sessionFactory" ref="sessionFactory"/> + </bean> +</beans> diff --git b/src/springConfig/applicationContext_service.xml a/src/springConfig/applicationContext_service.xml new file mode 100644 index 0000000..909c93e --- /dev/null +++ a/src/springConfig/applicationContext_service.xml @@ -0,0 +1,119 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + 邮件service配置文件 + --> +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:aop="http://www.springframework.org/schema/aop" + xmlns:tx="http://www.springframework.org/schema/tx" + xsi:schemaLocation=" + http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd + http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd + http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd"> + + <!-- 发邮件service--> + <bean id="yxysendmailservice" class="com.espeed.yxy.service.impl.YxySendMailServiceImpl"> + <!-- 待发邮件DAO --> + <property name="yxysendmailmasterdao"> + <ref bean="yxysendmailmasterdao"/> + </property> + <property name="mailmasterbasedao"> + <ref bean="mailmasterbasedao"/> + </property> + <!-- 待发邮件地址DAO --> + <property name="yxysendmaildetaildao"> + <ref bean="yxysendmaildetaildao"/> + </property> + <!-- SMTP DAO --> + <property name="yxysendsmtpinfodao"> + <ref bean="yxysendsmtpinfodao"/> + </property> + <!-- SMTP 后缀配置DAO --> + <property name="yxysmtpsuffixsetdao"> + <ref bean="yxysmtpsuffixsetdao"/> + </property> + <!-- SMTP 后缀发送量DAO --> + <property name="yxysmtpsendsetdao"> + <ref bean="yxysmtpsendsetdao"/> + </property> + <!-- 自配SMTP已发送量DAO --> + <property name="yxysmtpsendselfoversetdao"> + <ref bean="yxysmtpsendselfoversetdao"/> + </property> + <!--自配SMTP发送量限制 DAO--> + <property name="yxysmtpsendselfsetdao"> + <ref bean="yxysmtpsendselfsetdao"/> + </property> + <!--控制参数 DAO--> + <property name="yxysysparamaterdao"> + <ref bean="yxysysparamaterdao"/> + </property> + <property name="yxysysparamatersvaluedao"> + <ref bean="yxysysparamatersvaluedao"/> + </property> + <!-- 回复dao --> + <property name="replydao"> + <ref bean="replydao"/> + </property> + <!-- 过滤dao --> + <property name="filterdao"> + <ref bean="filterdao"/> + </property> + <!-- 跟踪配置dao --> + <property name="centretracksetdao"> + <ref bean="centretracksetdao"/> + </property> + <!-- 营销开发客户配置dao --> + <property name="centreyxyedmnewcustomerdao"> + <ref bean="centreyxyedmnewcustomerdao"/> + </property> + <!-- 营销盘活客户配置dao --> + <property name="centreyxyedmoldcustomerdao"> + <ref bean="centreyxyedmoldcustomerdao"/> + </property> + <!-- 用户dao --> + <property name="centreuserdao"> + <ref bean="centreuserdao"></ref> + </property> + </bean> + + <!-- 营销计划service --> + <bean id="marketingplanservice" class="com.espeed.yxy.service.impl.YxyMarketingPlanServiceImpl"> + <property name="marketingplandao"> + <ref bean="marketingplandao"/> + </property> + <property name="marketingweekdao"> + <ref bean="marketingweekdao"/> + </property> + <property name="addressdao"> + <ref bean="addressdao"/> + </property> + <property name="stencildao"> + <ref bean="stencildao"/> + </property> + <property name="senderdao"> + <ref bean="senderdao"/> + </property> + <property name="yxysysparamaterdao"> + <ref bean="yxysysparamaterdao"/> + </property> + <property name="yxysysparamatersvaluedao"> + <ref bean="yxysysparamatersvaluedao"/> + </property> + <property name="yxycustomeremaildao"> + <ref bean="yxycustomeremaildao"/> + </property> + <property name="centreyxyedmoldcustomerdao"> + <ref bean="centreyxyedmoldcustomerdao"/> + </property> + <property name="centreuserdao"> + <ref bean="centreuserdao"/> + </property> + <property name="crmcustomerinfodao"> + <ref bean="crmcustomerinfodao"/> + </property> + <property name="yxysendcountdao"> + <ref bean="yxysendcountdao"/> + </property> + </bean> +</beans> diff --git b/src/springConfig/applicationContext_timer.xml a/src/springConfig/applicationContext_timer.xml new file mode 100644 index 0000000..59783b2 --- /dev/null +++ a/src/springConfig/applicationContext_timer.xml @@ -0,0 +1,70 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + 定时器配置文件 +--> +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:aop="http://www.springframework.org/schema/aop" + xmlns:tx="http://www.springframework.org/schema/tx" + xsi:schemaLocation=" + http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd + http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd + http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd"> + <!-- 营销发送定时器开始 --> + <bean id="quartjob" class="com.espeed.yxy.timer.SendMailTimer" > + <property name="yxysendmailservice" ref="yxysendmailservice"/> + </bean> + <bean id="objAndmethod" + class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean"> + <property name="targetObject" ref="quartjob" /> + <property name="targetMethod" value="timerMethod" /> + </bean> + <bean id="dotime" class="org.springframework.scheduling.quartz.CronTriggerBean"> + <property name="jobDetail"> + <ref bean="objAndmethod" /> + </property> + <property name="cronExpression"> + <!-- + <value>0/45 * * * * ?</value> + --> + <value>0 0/1 * * * ?</value> + </property> + </bean> + <!-- 营销发送定时器结束 --> + + <!-- 营销计划定时器开始 --> + <bean id="markplanjob" class="com.espeed.yxy.timer.MarketingPlanTime" > + <property name="marketingplanservice" ref="marketingplanservice"/> + <property name="yxysendmailservice" ref="yxysendmailservice"/> + </bean> + <bean id="planobjmethod" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean"> + <property name="targetObject" ref="markplanjob" /> + <property name="targetMethod" value="marketingmethod" /> + </bean> + <bean id="markplan" class="org.springframework.scheduling.quartz.CronTriggerBean"> + <property name="jobDetail"> + <ref bean="planobjmethod" /> + </property> + <property name="cronExpression"> + <value>0/50 * * * * ?</value> + </property> + </bean> + <!-- 营销计划定时器结束 --> + + <!-- 管理类 如果将lazy-init='false'那么容器启动就会执行调度程序 --> + <bean id="startQuartz" lazy-init="false" autowire="no" + class="org.springframework.scheduling.quartz.SchedulerFactoryBean"> + <property name="triggers" > + <list> + <ref bean="dotime"/> + <ref bean="markplan"/> + </list> + </property> + </bean> + + <!-- 注入scheduler --> + <bean id="updatetime" class="com.espeed.yxy.timer.InitializingCronTrigger"> + <property name="scheduler" ref="startQuartz" /> + </bean> + +</beans> diff --git b/src/springConfig/applicationContext_webmail.xml a/src/springConfig/applicationContext_webmail.xml new file mode 100644 index 0000000..dd8dabb --- /dev/null +++ a/src/springConfig/applicationContext_webmail.xml @@ -0,0 +1,89 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + spring数据库、整合其它框架配置文件 +--> +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:aop="http://www.springframework.org/schema/aop" + xmlns:tx="http://www.springframework.org/schema/tx" + xsi:schemaLocation=" + http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd + http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd + http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd"> + + <!-- 配置数据源 --> + <bean id="webmailDataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> + <property name="driverClassName"> + <value>com.mysql.jdbc.Driver</value> + </property> + <property name="url"> + <value>jdbc:mysql://localhost:3306/webmailbase?useUnicode=true&characterEncoding=utf8</value> + </property> + <property name="username"> + <value>root</value> + </property> + <property name="password"> + <value>sz1234567890</value> + </property> + <property name="maxActive"> + <value>100</value> + </property> + <property name="maxIdle"> + <value>50</value> + </property> + <property name="initialSize"> + <value>30</value> + </property> + <property name="maxWait"> + <value>10000</value> + </property> + <property name="defaultAutoCommit"> + <value>true</value> + </property> + <property name="removeAbandoned"> + <value>true</value> + </property> + <property name="removeAbandonedTimeout"> + <value>300</value> + </property> + <property name="logAbandoned"> + <value>false</value> + </property> + <property name="validationQuery"> + <value>select 1</value> + </property> + <property name="testOnBorrow"> + <value>true</value> + </property> + </bean> + + <!-- 配置注解sessionFactory --> + <bean id="webmailSessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"> + <property name="dataSource" ref="webmailDataSource" /> + <property name="packagesToScan"> + <list> + <value>com.espeed.webmail.pojo</value> + </list> + </property> + <property name="hibernateProperties"> + <props> + <prop key="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</prop> + <prop key="hibernate.show_sql">false</prop> + <prop key="hibernate.generate_statistics">true</prop> + <prop key="hibernate.connetion.release_mode">auto</prop> + <prop key="hibernate.cache.use_query_cache">false</prop> + <prop key="hibernate.cache.use_second_level_cache">false</prop> + </props> + </property> + </bean> + + <!--配置公共的hibernate方法注解 --> + <bean id="webmailAnnHibernateBaseDAO" class="com.espeed.yxy.dao.impl.CentreHibernateBaseDAOImpl" abstract="true" scope="prototype"> + <property name="sessionFactory" ref="webmailSessionFactory"/> + </bean> + + <!-- 客户dao --> + <bean id="yxycustomeremaildao" class="com.espeed.yxy.dao.impl.YxyCustomerEmailDaoImpl" parent="webmailAnnHibernateBaseDAO"></bean> + <!-- 阿里巴巴客户dao --> + <bean id="crmcustomerinfodao" class="com.espeed.yxy.dao.impl.CrmCustomerInfoDaoImpl" parent="webmailAnnHibernateBaseDAO"></bean> +</beans>