作者 徐宝林

营销邮后台发送服务SVN转GIT

正在显示 66 个修改的文件 包含 4218 行增加0 行删除

要显示太多修改。

为保证性能只显示 66 of 66+ 个文件。

  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<classpath>
  3 + <classpathentry kind="src" path="src"/>
  4 + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
  5 + <classpathentry kind="con" path="melibrary.com.genuitec.eclipse.j2eedt.core.MYECLIPSE_JAVAEE_5_CONTAINER"/>
  6 + <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/JoSQL-2.1.jar"/>
  7 + <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/antlr-2.7.6.jar"/>
  8 + <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/asm-3.3.1.jar"/>
  9 + <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/aspectjweaver.jar"/>
  10 + <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/c3p0-0.9.1.2.jar"/>
  11 + <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/cglib-2.2.jar"/>
  12 + <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/commons-collections-3.1.jar"/>
  13 + <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/commons-dbcp.jar"/>
  14 + <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/commons-logging-1.1.1.jar"/>
  15 + <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/commons-pool.jar"/>
  16 + <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/dom4j-1.6.1.jar"/>
  17 + <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/gentlyWEB-utils-1.1.jar"/>
  18 + <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/hibernate-jpa-2.0-api-1.0.1.Final.jar"/>
  19 + <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/hibernate3.jar"/>
  20 + <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/javassist-3.12.0.GA.jar"/>
  21 + <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/jta-1.1.jar"/>
  22 + <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/log4j.jar"/>
  23 + <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/mail.jar"/>
  24 + <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/mysql-connector-java-5.1.6-bin.jar"/>
  25 + <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/quartz.jar"/>
  26 + <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/slf4j-api-1.6.1.jar"/>
  27 + <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/spring-beans.jar"/>
  28 + <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/spring-context.jar"/>
  29 + <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/spring-core-3.2.0.M1-javadoc.jar"/>
  30 + <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/spring-web.jar"/>
  31 + <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/spring.jar"/>
  32 + <classpathentry kind="output" path="WebRoot/WEB-INF/classes"/>
  33 +</classpath>
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<project-module
  3 + type="WEB"
  4 + name="espeedSendYingXiaoYouBase"
  5 + id="myeclipse.1432285515350"
  6 + context-root="/espeedSendYingXiaoYouBase"
  7 + j2ee-spec="5.0"
  8 + archive="espeedSendYingXiaoYouBase.war">
  9 + <attributes>
  10 + <attribute name="webrootdir" value="WebRoot" />
  11 + </attributes>
  12 +</project-module>
  13 +
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<projectDescription>
  3 + <name>espeedSendYingXiaoYouBase</name>
  4 + <comment></comment>
  5 + <projects>
  6 + </projects>
  7 + <buildSpec>
  8 + <buildCommand>
  9 + <name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
  10 + <arguments>
  11 + </arguments>
  12 + </buildCommand>
  13 + <buildCommand>
  14 + <name>com.genuitec.eclipse.j2eedt.core.WebClasspathBuilder</name>
  15 + <arguments>
  16 + </arguments>
  17 + </buildCommand>
  18 + <buildCommand>
  19 + <name>org.eclipse.jdt.core.javabuilder</name>
  20 + <arguments>
  21 + </arguments>
  22 + </buildCommand>
  23 + <buildCommand>
  24 + <name>com.genuitec.eclipse.j2eedt.core.J2EEProjectValidator</name>
  25 + <arguments>
  26 + </arguments>
  27 + </buildCommand>
  28 + <buildCommand>
  29 + <name>com.genuitec.eclipse.j2eedt.core.DeploymentDescriptorValidator</name>
  30 + <arguments>
  31 + </arguments>
  32 + </buildCommand>
  33 + <buildCommand>
  34 + <name>org.eclipse.wst.validation.validationbuilder</name>
  35 + <arguments>
  36 + </arguments>
  37 + </buildCommand>
  38 + <buildCommand>
  39 + <name>com.genuitec.eclipse.ast.deploy.core.DeploymentBuilder</name>
  40 + <arguments>
  41 + </arguments>
  42 + </buildCommand>
  43 + </buildSpec>
  44 + <natures>
  45 + <nature>com.genuitec.eclipse.ast.deploy.core.deploymentnature</nature>
  46 + <nature>com.genuitec.eclipse.j2eedt.core.webnature</nature>
  47 + <nature>org.eclipse.jdt.core.javanature</nature>
  48 + <nature>org.eclipse.wst.jsdt.core.jsNature</nature>
  49 + </natures>
  50 +</projectDescription>
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<classpath>
  3 + <classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>
  4 + <classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.WebProject">
  5 + <attributes>
  6 + <attribute name="hide" value="true"/>
  7 + </attributes>
  8 + </classpathentry>
  9 + <classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/>
  10 + <classpathentry kind="src" path="WebRoot"/>
  11 + <classpathentry kind="output" path=""/>
  12 +</classpath>
  1 +#Fri May 22 17:05:27 CST 2015
  2 +eclipse.preferences.version=1
  3 +encoding/<project>=UTF-8
  1 +#Fri May 22 17:05:27 CST 2015
  2 +eclipse.preferences.version=1
  3 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
  4 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
  5 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
  6 +org.eclipse.jdt.core.compiler.compliance=1.6
  7 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate
  8 +org.eclipse.jdt.core.compiler.debug.localVariable=generate
  9 +org.eclipse.jdt.core.compiler.debug.sourceFile=generate
  10 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
  11 +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
  12 +org.eclipse.jdt.core.compiler.source=1.6
  1 +org.eclipse.wst.jsdt.launching.baseBrowserLibrary
  1 +package com.espeed.yxy.dao.impl;
  2 +
  3 +import java.util.List;
  4 +
  5 +import com.espeed.yxy.dao.YxySendMailMasterBaseDao;
  6 +import com.espeed.yxy.pojo.YxySendMailMasterBase;
  7 +/**
  8 + * 程序名称: EspeedMail_时速邮箱
  9 + * 程序版本: V1.0
  10 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776)
  11 + * 版权所有: 深圳市科飞时速网络技术有限公司
  12 + * 技术支持: Tech@21gmail.com
  13 + * 单元名称: 邮件基本信息DAO(营销游)
  14 + * 开始时间: 2013.12.09
  15 + * 程 序 员: 谢勇
  16 + * 最后修改:
  17 + * 备 注: 如需修改请通知程序员
  18 + */
  19 +public class YxySendMailMasterBaseDaoImpl extends HibernateBaseDAOImpl<YxySendMailMasterBase, Long> implements YxySendMailMasterBaseDao{
  20 +
  21 + /**实体插入*/
  22 + public int addPojo(YxySendMailMasterBase o)throws Exception{
  23 + return super.add(o);
  24 + }
  25 + /**实体编辑*/
  26 + public void updatePojo(YxySendMailMasterBase o)throws Exception{
  27 + super.update(o);
  28 + }
  29 + /**HQL查询*/
  30 + public List<YxySendMailMasterBase> findByHql(String hql)throws Exception{
  31 + return super.getAll(hql);
  32 + }
  33 + /**指定条记录*/
  34 + public List<YxySendMailMasterBase> findByHqlSet(String hql,int num)throws Exception{
  35 + return super.findBySet(hql, num);
  36 + }
  37 + /**SQL查询*/
  38 + public List<Object> findBySqlQuery(String sql)throws Exception{
  39 + return super.findBySql(sql);
  40 + }
  41 + /**HQL更新*/
  42 + public void updateByHql(String hql)throws Exception{
  43 + super.updateorDelByHql(hql);
  44 + }
  45 +
  46 +}
  1 +package com.espeed.yxy.tool;
  2 +
  3 +import java.util.ArrayList;
  4 +import java.util.List;
  5 +import java.util.Random;
  6 +/***
  7 + *
  8 + * @author xieyong
  9 + * 获取随机码
  10 + */
  11 +public class GetRondom {
  12 +
  13 + //生成随机码
  14 + public static List<String> getRandom(List<String> value){
  15 +
  16 + List<String> newSmtpList=new ArrayList();
  17 + int n = value.size();
  18 + Random rand = new Random();
  19 + boolean[] bool = new boolean[n];
  20 +
  21 + int num =0;
  22 +
  23 + for (int i = 0; i<n; i++){
  24 + do{
  25 + //如果产生的数相同继续循环
  26 + num = rand.nextInt(n);
  27 + }while(bool[num]);
  28 + bool[num] =true;
  29 + newSmtpList.add(value.get(num));
  30 + }
  31 + return newSmtpList;
  32 +
  33 + }
  34 +
  35 + public static void main(String[] args) {
  36 + List<String> oldStr=new ArrayList<String>();
  37 + for(int i=0;i<3;i++){
  38 + oldStr.add("name"+i);
  39 + }
  40 +
  41 + List<String> newStr=getRandom(oldStr);
  42 + for(int j=0;j<newStr.size();j++){
  43 + System.out.println(newStr.get(j));
  44 + }
  45 + }
  46 +}
  1 +package com.espeed.yxy.tool;
  2 +
  3 +import java.io.File;
  4 +import java.io.FileOutputStream;
  5 +import java.text.SimpleDateFormat;
  6 +import java.util.ArrayList;
  7 +import java.util.Date;
  8 +import java.util.List;
  9 +
  10 +import javax.activation.DataHandler;
  11 +import javax.activation.FileDataSource;
  12 +import javax.mail.internet.InternetAddress;
  13 +import javax.mail.internet.MimeBodyPart;
  14 +import javax.mail.internet.MimeMessage;
  15 +import javax.mail.internet.MimeMultipart;
  16 +import javax.mail.internet.MimeUtility;
  17 +
  18 +import com.espeed.yxy.pojo.YxySendMailMaster;
  19 +/*
  20 + * 程序名称: EspeedMail_时速邮箱
  21 + * 程序版本: V1.0
  22 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776)
  23 + * 版权所有: 深圳市科飞时速网络技术有限公司
  24 + * 技术支持: Tech@21gmail.com
  25 + * 单元名称: 生成本地邮件(营销邮)
  26 + * 开始时间: 2013.12.13
  27 + * 程 序 员: 谢勇
  28 + * 最后修改:
  29 + * 备 注: 如需修改请通知程序员
  30 + */
  31 +public class GreateEmlFile {
  32 +
  33 + private static MimeMessage mimeMsg = null; // MIME邮件对象
  34 + private static javax.mail.Session mailSession = null;
  35 +
  36 + /**生成eml文件*/
  37 + public static List<Object> GreateMail(YxySendMailMaster yxysendmailmaster,String loginid,String domain,String uploadattrName,String usersetpath)throws Exception{
  38 + List<Object> RemlPath=new ArrayList<Object>();
  39 + RemlPath.add("0");
  40 + RemlPath.add("");
  41 + RemlPath.add("");
  42 + RemlPath.add("0");
  43 + RemlPath.add("");
  44 +
  45 + //营销web路径(文件路径)
  46 + String pathew=ConfigPath.getYxyServicePath();
  47 + //内容
  48 + String context=yxysendmailmaster.getBody();
  49 +
  50 + //获取上传的附件名
  51 + String newUpload=uploadattrName.replaceAll("\"", "");
  52 + String [] newstr=newUpload.split(",");//分割多个附件
  53 +
  54 + int isAttr=0;//附件个数
  55 + //1.获取附件
  56 + String fileNames[]=new String[0];//定义附件名
  57 + if(newstr==null||newstr[0].equals("")){//判断是否存在附件
  58 + fileNames=new String[0];
  59 + }else{
  60 + String sysPath=pathew+"/mailtempfile/"+domain+"/"+loginid+"/attachment";
  61 + fileNames=new String[newstr.length];
  62 + for (int i = 0; i < newstr.length; i++) {
  63 + fileNames[i]=sysPath+"\\"+newstr[i];
  64 + }
  65 + }
  66 + isAttr=fileNames.length;//附件个数
  67 +
  68 + //变量定义
  69 + String mailName=yxysendmailmaster.getSender();//发件人
  70 + String sendMail=yxysendmailmaster.getSend_email();//发件人邮箱
  71 + String replyEmail=yxysendmailmaster.getReply_email();//回复邮箱
  72 + String title=yxysendmailmaster.getSubject();//主题
  73 +
  74 +
  75 + //------- 设置from、to等信息----------
  76 + mimeMsg = new javax.mail.internet.MimeMessage(mailSession);
  77 +
  78 + InternetAddress sentFrom;
  79 + //发件人
  80 + sentFrom = new InternetAddress(sendMail ,mailName,"UTF-8");
  81 + mimeMsg.setFrom(sentFrom);
  82 + //主题
  83 + mimeMsg.setSubject(title,"UTF-8");
  84 +
  85 + // ---设置回复人地址---------------
  86 + InternetAddress addressis;
  87 + addressis = new InternetAddress(replyEmail);
  88 + InternetAddress[] addrs = new InternetAddress[1];
  89 + addrs[0] = addressis;
  90 + mimeMsg.setReplyTo(addrs);
  91 +
  92 + // -------------------------------------
  93 + MimeBodyPart messageBodyPart1 = new MimeBodyPart();
  94 + messageBodyPart1.setHeader("Content-Transfer-Encoding", "base64");
  95 +
  96 +
  97 + //--------附件--------------------
  98 + MimeMultipart multipart = new MimeMultipart();// 附件传输格式
  99 + multipart.setSubType("related");//这句很重要
  100 + multipart.addBodyPart(messageBodyPart1);
  101 +
  102 + for (int j = 0; j < fileNames.length; j++) {
  103 + MimeBodyPart messageBodyPart2 = new MimeBodyPart();
  104 + messageBodyPart2.setHeader("Content-Transfer-Encoding", "base64");
  105 + //messageBodyPart2.setContentLanguage("UTF-8");
  106 + // 选择出每一个附件名
  107 + String filename = fileNames[j].split("#####")[0];
  108 + String displayname = fileNames[j].split("#####")[1];
  109 + // 得到数据源
  110 + FileDataSource fds = new FileDataSource(filename);
  111 + // 得到附件本身并至入BodyPart
  112 + messageBodyPart2.setDataHandler(new DataHandler(fds));// 得到文件名同样至入BodyPart
  113 + messageBodyPart2.setHeader("Content-Type", "application/octet-stream;name="+displayname);
  114 + messageBodyPart2.setFileName(MimeUtility.encodeText(displayname,"UTF-8","B"));
  115 + multipart.addBodyPart(messageBodyPart2);
  116 + }
  117 + String resultpicpath="";//图片路径
  118 + //11.判断是否有图片
  119 + String[] picpath=context.split("<img");
  120 + for(int i=0;i<picpath.length;i++){
  121 + if(picpath[i].contains("src")){
  122 + int index=picpath[i].indexOf("mailtempfile/");
  123 + if(index==-1){
  124 + continue;
  125 + }
  126 + //处理字符
  127 + String[] picAarry=picpath[i].split("src=\"");
  128 + int end=picAarry[1].indexOf("\"");
  129 + String result=picAarry[1].substring(0,end);
  130 +
  131 + //获取图片路径
  132 + int pathbegin=result.indexOf("mailtempfile");
  133 + String path=result.substring(pathbegin,result.length());
  134 + String picpaths=pathew+"\\"+path;//图片真实路径
  135 +
  136 + //获取图片保存名字
  137 + //String[] filenamestr=result.split("/");
  138 + //String picname=filenamestr[filenamestr.length-1];
  139 + resultpicpath+=path+"#####";
  140 +
  141 + //替换图片
  142 + context=context.replaceFirst(result,"cid:IMG"+i);
  143 +
  144 + //加入图片源码
  145 + File pf=new File(picpaths);
  146 + if(pf.exists()){
  147 + MimeBodyPart gifBodyPart=new MimeBodyPart();
  148 + FileDataSource fds=new FileDataSource(pf);//图片所在的目录的绝对路径
  149 + gifBodyPart.setDataHandler(new DataHandler(fds));
  150 + gifBodyPart.setHeader("Content-Type", "image/jpeg");
  151 + gifBodyPart.setFileName(MimeUtility.encodeText("espeedpic.jpg","UTF-8","B"));
  152 + gifBodyPart.setContentID("<IMG"+i+">"); //cid的值
  153 + multipart.addBodyPart(gifBodyPart);
  154 + }
  155 + }
  156 + }
  157 +
  158 + messageBodyPart1.setContent(context,"text/html" + ";charset=" + "UTF-8");
  159 +
  160 + mimeMsg.setContent(multipart);
  161 +
  162 + //------------- 设置信件头的发送日期---------------
  163 + mimeMsg.setSentDate(new Date());
  164 +
  165 + //文件存放路径
  166 + //以当前用户名+当前日期为文件名
  167 + SimpleDateFormat df=new SimpleDateFormat("yyyyMMddHHssmm");
  168 + String nowDate=df.format(new Date());
  169 + String emlfileName="";
  170 + emlfileName=loginid+nowDate + ".eml";
  171 + //保存邮件
  172 + File dir = new File(usersetpath);
  173 + dir.mkdirs();// 创建所有目录,包括子目录
  174 + mimeMsg.writeTo(new FileOutputStream(dir+"\\" + emlfileName));
  175 + File files=new File(dir+"\\" + emlfileName);
  176 + //返回值
  177 + RemlPath.set(0,files.length());//文件大小
  178 + RemlPath.set(1,usersetpath + "\\" + emlfileName);//返回eml存放路径
  179 + //RemlPath.set(2,"");//文件key
  180 + RemlPath.set(3,isAttr);//是否有附件
  181 + RemlPath.set(4,resultpicpath);//图片路径
  182 +
  183 + return RemlPath;
  184 + }
  185 +
  186 +}
  1 +package com.espeed.yxy.pojo;
  2 +
  3 +import java.io.Serializable;
  4 +import java.util.ArrayList;
  5 +import java.util.List;
  6 +
  7 +import javax.persistence.CascadeType;
  8 +import javax.persistence.Entity;
  9 +import javax.persistence.FetchType;
  10 +import javax.persistence.GeneratedValue;
  11 +import javax.persistence.GenerationType;
  12 +import javax.persistence.Id;
  13 +import javax.persistence.JoinColumn;
  14 +import javax.persistence.OneToMany;
  15 +import javax.persistence.Table;
  16 +
  17 +@Entity
  18 +@Table(name="yxy_marketing_plan")
  19 +public class YxyMarketingPlan implements Serializable{
  20 + private static final long serialVersionUID = 1L;
  21 + private int plan_id;
  22 + private String plan_title;//计划说明或主题
  23 + private int plan_type;//计划类型
  24 + private int plan_cycle;//计划周期
  25 + private String plan_createtime;//建立时间
  26 + private String plan_executetime;//执行时间
  27 + private String plan_begintime;//开始时间
  28 + private String plan_endtime;//结束时间
  29 + private int plan_groupid;//计划地址分组
  30 + private String loginid;//账号
  31 + private String domain;//域名
  32 + private int plan_status;//计划状态(0:未执行,1:已执行,-1:正在执行)
  33 + /**0:本地库,
  34 + * 1:客户分类未超标,2:客户分类已超标
  35 + * 3:客户状态未超标,4:客户状态已超标
  36 + * 5:客户来源未超标,6:客户来源已超标
  37 + * 7:意向产品未超标,8:意向产品已超标
  38 + * 9:采购偏好未超标,10:采购偏好已超标
  39 + * 11:个性营销未超标,12:个性营销已超标
  40 + */
  41 + private Integer plan_differen;
  42 + private String other_name;//针对于采购偏好或个性营销邮的名称
  43 +
  44 + private List<YxyMarketingWeek> weeklist=new ArrayList<YxyMarketingWeek>();
  45 + @Id
  46 + @GeneratedValue(strategy=GenerationType.AUTO)
  47 + public int getPlan_id() {
  48 + return plan_id;
  49 + }
  50 + public void setPlan_id(int planId) {
  51 + plan_id = planId;
  52 + }
  53 + public int getPlan_type() {
  54 + return plan_type;
  55 + }
  56 + public void setPlan_type(int planType) {
  57 + plan_type = planType;
  58 + }
  59 + public int getPlan_cycle() {
  60 + return plan_cycle;
  61 + }
  62 + public void setPlan_cycle(int planCycle) {
  63 + plan_cycle = planCycle;
  64 + }
  65 +
  66 + public String getPlan_createtime() {
  67 + return plan_createtime;
  68 + }
  69 + public void setPlan_createtime(String planCreatetime) {
  70 + plan_createtime = planCreatetime;
  71 + }
  72 + public String getPlan_executetime() {
  73 + return plan_executetime;
  74 + }
  75 + public void setPlan_executetime(String planExecutetime) {
  76 + plan_executetime = planExecutetime;
  77 + }
  78 + public String getPlan_begintime() {
  79 + return plan_begintime;
  80 + }
  81 + public void setPlan_begintime(String planBegintime) {
  82 + plan_begintime = planBegintime;
  83 + }
  84 + public String getPlan_endtime() {
  85 + return plan_endtime;
  86 + }
  87 + public void setPlan_endtime(String planEndtime) {
  88 + plan_endtime = planEndtime;
  89 + }
  90 + public int getPlan_groupid() {
  91 + return plan_groupid;
  92 + }
  93 + public void setPlan_groupid(int planGroupid) {
  94 + plan_groupid = planGroupid;
  95 + }
  96 + public String getLoginid() {
  97 + return loginid;
  98 + }
  99 + public void setLoginid(String loginid) {
  100 + this.loginid = loginid;
  101 + }
  102 + public String getDomain() {
  103 + return domain;
  104 + }
  105 + public void setDomain(String domain) {
  106 + this.domain = domain;
  107 + }
  108 + public String getPlan_title() {
  109 + return plan_title;
  110 + }
  111 + public void setPlan_title(String planTitle) {
  112 + plan_title = planTitle;
  113 + }
  114 + public int getPlan_status() {
  115 + return plan_status;
  116 + }
  117 + public void setPlan_status(int planStatus) {
  118 + plan_status = planStatus;
  119 + }
  120 +
  121 + @OneToMany(cascade = CascadeType.REFRESH, fetch = FetchType.EAGER)
  122 + @JoinColumn(name="plan_id",updatable = false,insertable=false)
  123 + public List<YxyMarketingWeek> getWeeklist() {
  124 + return weeklist;
  125 + }
  126 + public void setWeeklist(List<YxyMarketingWeek> weeklist) {
  127 + this.weeklist = weeklist;
  128 + }
  129 +
  130 + public Integer getPlan_differen() {
  131 + return plan_differen;
  132 + }
  133 + public void setPlan_differen(Integer plan_differen) {
  134 + this.plan_differen = plan_differen;
  135 + }
  136 + public String getOther_name() {
  137 + return other_name;
  138 + }
  139 + public void setOther_name(String other_name) {
  140 + this.other_name = other_name;
  141 + }
  142 +}
  1 +Manifest-Version: 1.0
  2 +Class-Path:
  3 +
  1 +package com.espeed.yxy.dao.impl;
  2 +
  3 +import java.util.List;
  4 +
  5 +import com.espeed.centre.pojo.CentreYxyedmNewcustomer;
  6 +import com.espeed.yxy.dao.CentreYxyedmNewcustomerDao;
  7 +/**
  8 + * 项目名称: 统一验证中心系统
  9 + * 版权所有: 深圳市科飞时速网络技术有限公司(0755-88843776)
  10 + * 技术支持: info@21gmail.com
  11 + * 单元名称: 营销邮开发客户配置Dao实现类
  12 + * 开始时间: 2018.04.08
  13 + * 开发人员: 陈南巧
  14 + */
  15 +public class CentreYxyedmNewcustomerDaoImpl extends CentreHibernateBaseDAOImpl<CentreYxyedmNewcustomer, Long> implements CentreYxyedmNewcustomerDao {
  16 + /**实体插入*/
  17 + public int addPojo(CentreYxyedmNewcustomer o)throws Exception{
  18 + return super.add(o);
  19 + }
  20 + /**实体编辑*/
  21 + public void updatePojo(CentreYxyedmNewcustomer o)throws Exception{
  22 + super.update(o);
  23 + }
  24 + /**HQL查询*/
  25 + public List<CentreYxyedmNewcustomer> findByHql(String hql)throws Exception{
  26 + return super.getAll(hql);
  27 + }
  28 + /**HQL查询数量*/
  29 + public int findByHqlCount(String hql)throws Exception{
  30 + return super.count(hql);
  31 + }
  32 + /**SQL查询*/
  33 + public List<Object> findBySqlFind(String sql)throws Exception{
  34 + return super.findBySql(sql);
  35 + }
  36 + /**HQL更新*/
  37 + public void updateByHql(String hql)throws Exception{
  38 + super.updateorDelBySql(hql);
  39 + }
  40 +}
  1 +package com.espeed.plan;
  2 +
  3 +import java.io.Serializable;
  4 +import java.util.List;
  5 +import java.util.concurrent.ArrayBlockingQueue;
  6 +import java.util.concurrent.ThreadPoolExecutor;
  7 +import java.util.concurrent.TimeUnit;
  8 +import com.espeed.yxy.pojo.YxyMarketingPlan;
  9 +import com.espeed.yxy.pojo.YxySendSmtpInfo;
  10 +import com.espeed.yxy.service.YxyMarketingPlanService;
  11 +import com.espeed.yxy.service.YxySendMailService;
  12 +/**
  13 + * 程序名称: EspeedMail_时速邮箱
  14 + * 程序版本: V1.0
  15 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776)
  16 + * 版权所有: 深圳市科飞时速网络技术有限公司
  17 + * 技术支持: Tech@21gmail.com
  18 + * 单元名称: 手动收邮件后台线程池
  19 + * 开始时间: 2013.09.02
  20 + * 程 序 员: 谢勇
  21 + * 最后修改:
  22 + * 备 注: 如需修改请通知程序员
  23 + */
  24 +public class PlanThreadPoolTask implements Runnable,Serializable{
  25 +
  26 + private static final long serialVersionUID = 0;
  27 + private static ThreadPoolExecutor threadPool=null;
  28 + private static PlanThreadPoolTask threadpooltask=null;
  29 +
  30 + private YxyMarketingPlanService planservice;//计划service
  31 + private YxySendMailService mailservice;//邮件service
  32 + private YxySendSmtpInfo smtpinfo;//smtp集合
  33 + private YxyMarketingPlan planinfo;//计划集合
  34 + //无参构造方法
  35 + PlanThreadPoolTask(){
  36 + }
  37 + //传递参数
  38 + PlanThreadPoolTask(YxyMarketingPlanService planservice,YxySendMailService mailservice,YxySendSmtpInfo smtpinfo,YxyMarketingPlan planinfo){
  39 + this.planservice=planservice;
  40 + this.smtpinfo=smtpinfo;
  41 + this.smtpinfo=smtpinfo;
  42 + this.mailservice=mailservice;
  43 + }
  44 +
  45 + //单例方法
  46 + public static PlanThreadPoolTask getMethodInstance(){
  47 + if(threadpooltask==null){
  48 + //System.out.println("创建新对像了");
  49 + threadpooltask=new PlanThreadPoolTask();
  50 + }
  51 + return threadpooltask;
  52 + }
  53 +
  54 + //线程池
  55 + public static ThreadPoolExecutor getInstance(int bigThread){
  56 + if(threadPool==null){
  57 + threadPool=new ThreadPoolExecutor(bigThread,bigThread+2,100,
  58 + TimeUnit.SECONDS,new ArrayBlockingQueue<Runnable>(4000),
  59 + new ThreadPoolExecutor.DiscardOldestPolicy());
  60 + }
  61 + return threadPool;
  62 + }
  63 + //线程池运行方法
  64 + public synchronized void getResult(YxyMarketingPlanService planservice,YxySendMailService mailservice,List<YxySendSmtpInfo> smtplist,List<YxyMarketingPlan> planlist) {
  65 + threadPool=getInstance(10);
  66 + //计划加入线程池
  67 + for(int j=0;j<planlist.size();j++){
  68 + try {
  69 + threadPool.execute(new PlanThreadPoolTask(planservice,mailservice,smtplist.get(j),planlist.get(j)));
  70 + } catch (Exception e) {
  71 + e.printStackTrace();
  72 + }
  73 + }
  74 + }
  75 + //获取线程量
  76 + public int getThreadNum(){
  77 + if(threadPool==null){
  78 + return -1;
  79 + }else{
  80 + return threadPool.getActiveCount();
  81 + }
  82 + }
  83 +
  84 + //执行计划
  85 + public void run(){
  86 + try {
  87 +
  88 +
  89 +
  90 + } catch (Exception e) {
  91 + e.printStackTrace();
  92 + }
  93 + }
  94 +
  95 +}
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<project-module
  3 + type="WEB"
  4 + name="espeedSendYingXiaoYouBase"
  5 + id="myeclipse.1432285515350"
  6 + context-root="/espeedSendYingXiaoYouBase"
  7 + j2ee-spec="5.0"
  8 + archive="espeedSendYingXiaoYouBase.war">
  9 + <attributes>
  10 + <attribute name="webrootdir" value="WebRoot" />
  11 + </attributes>
  12 +</project-module>
  13 +
  1 +package com.espeed.yxy.service.impl;
  2 +
  3 +import java.text.SimpleDateFormat;
  4 +import java.util.ArrayList;
  5 +import java.util.Date;
  6 +import java.util.List;
  7 +
  8 +
  9 +import com.espeed.centre.pojo.CentreYxyedmOldcustomer;
  10 +import com.espeed.webmail.pojo.YxyCustomerEmail;
  11 +import com.espeed.yxy.dao.CentreUserDao;
  12 +import com.espeed.yxy.dao.CentreYxyedmOldcustomerDao;
  13 +import com.espeed.yxy.dao.CrmCustomerInfoDao;
  14 +import com.espeed.yxy.dao.YxyCustomerEmailDao;
  15 +import com.espeed.yxy.dao.YxyMailStencilDao;
  16 +import com.espeed.yxy.dao.YxyMarketingPlanDao;
  17 +import com.espeed.yxy.dao.YxyMarketingWeekDao;
  18 +import com.espeed.yxy.dao.YxyParamaterDao;
  19 +import com.espeed.yxy.dao.YxySendCountDao;
  20 +import com.espeed.yxy.dao.YxySenderSetDao;
  21 +import com.espeed.yxy.dao.YxySysParamatersValueDao;
  22 +import com.espeed.yxy.dao.YxyUserAddressDao;
  23 +import com.espeed.yxy.pojo.YxyMailStencil;
  24 +import com.espeed.yxy.pojo.YxyMarketingPlan;
  25 +import com.espeed.yxy.pojo.YxySendCount;
  26 +import com.espeed.yxy.pojo.YxySenderSet;
  27 +import com.espeed.yxy.pojo.YxySysParamaters;
  28 +import com.espeed.yxy.pojo.YxySysParamatersValue;
  29 +import com.espeed.yxy.pojo.YxyUserAddress;
  30 +import com.espeed.yxy.service.YxyMarketingPlanService;
  31 +import com.espeed.yxy.tool.DateFormat;
  32 +
  33 +public class YxyMarketingPlanServiceImpl implements YxyMarketingPlanService{
  34 +
  35 + /**是否有可执行的营销计划*/
  36 + public List<YxyMarketingPlan> findHavePlan() throws Exception {
  37 + SimpleDateFormat df=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  38 + String nowdate=df.format(new Date());
  39 + String nowday=nowdate.split(" ")[0];
  40 + String nowtime=nowdate.split(" ")[1];
  41 +
  42 + //hql查询
  43 + 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+"'";
  44 + return marketingplandao.findByHql(hql);
  45 + }
  46 +
  47 + /**根据地址分组查询地址*/
  48 + public List<YxyUserAddress> findAddressByGroupid(int typeid,int plan_differen,String loginid,String domain,String other_name) throws Exception {
  49 + //判断是否是本地库发送还是CRM库
  50 + if(plan_differen == 0)//本地库发送
  51 + {
  52 + String hql="from YxyUserAddress where user_addr_type_id="+typeid;
  53 + return addressdao.findByHql(hql);
  54 + }
  55 + else//客户管理发送
  56 + {
  57 + int company_id = 0;
  58 + int user_id = 0;
  59 + List<YxyCustomerEmail> customerEmails = new ArrayList<YxyCustomerEmail>();
  60 + if(plan_differen == 1 || plan_differen == 2){//客户分类
  61 + String sql = "select company_id from centre_company where domain = '"+domain+"'";
  62 + List<Object> objects = centreuserdao.findBySqlFind(sql);
  63 + if(objects.size() > 0 && objects.get(0) != null){
  64 + company_id = Integer.parseInt(objects.get(0).toString());
  65 + sql = "select user_id from centre_user where company_id = "+company_id+" and login_id = '"+loginid+"'";
  66 + objects = centreuserdao.findBySqlFind(sql);
  67 + if(objects.size() > 0 && objects.get(0) != null){
  68 + user_id = Integer.parseInt(objects.get(0).toString());
  69 + String hql = "from YxyCustomerEmail where user_id = "+user_id+" and current_status != 1 " +
  70 + "and delete_flag = 0 and classify_id = "+typeid;
  71 + customerEmails = yxycustomeremaildao.findByHql(hql);
  72 + }
  73 + }
  74 + }else if(plan_differen == 3 || plan_differen == 4){//客户状态
  75 + String sql = "select company_id from centre_company where domain = '"+domain+"'";
  76 + List<Object> objects = centreuserdao.findBySqlFind(sql);
  77 + if(objects.size() > 0 && objects.get(0) != null){
  78 + company_id = Integer.parseInt(objects.get(0).toString());
  79 + sql = "select user_id from centre_user where company_id = "+company_id+" and login_id = '"+loginid+"'";
  80 + objects = centreuserdao.findBySqlFind(sql);
  81 + if(objects.size() > 0 && objects.get(0) != null){
  82 + user_id = Integer.parseInt(objects.get(0).toString());
  83 + String hql = "from YxyCustomerEmail where user_id = "+user_id+" and current_status != 1 " +
  84 + "and delete_flag = 0 and customer_status = "+typeid;
  85 + customerEmails = yxycustomeremaildao.findByHql(hql);
  86 + }
  87 + }
  88 + }else if(plan_differen == 5 || plan_differen == 6){//客户来源
  89 + String sql = "select company_id from centre_company where domain = '"+domain+"'";
  90 + List<Object> objects = centreuserdao.findBySqlFind(sql);
  91 + if(objects.size() > 0 && objects.get(0) != null){
  92 + company_id = Integer.parseInt(objects.get(0).toString());
  93 + sql = "select user_id from centre_user where company_id = "+company_id+" and login_id = '"+loginid+"'";
  94 + objects = centreuserdao.findBySqlFind(sql);
  95 + if(objects.size() > 0 && objects.get(0) != null){
  96 + user_id = Integer.parseInt(objects.get(0).toString());
  97 + String hql = "from YxyCustomerEmail where user_id = "+user_id+" and current_status != 1 " +
  98 + "and delete_flag = 0 and source_from_id = "+typeid;
  99 + customerEmails = yxycustomeremaildao.findByHql(hql);
  100 + }
  101 + }
  102 + }else if(plan_differen == 7 || plan_differen == 8){//意向产品
  103 + String sql = "select company_id from centre_company where domain = '"+domain+"'";
  104 + List<Object> objects = centreuserdao.findBySqlFind(sql);
  105 + if(objects.size() > 0 && objects.get(0) != null){
  106 + company_id = Integer.parseInt(objects.get(0).toString());
  107 + sql = "select user_id from centre_user where company_id = "+company_id+" and login_id = '"+loginid+"'";
  108 + objects = centreuserdao.findBySqlFind(sql);
  109 + if(objects.size() > 0 && objects.get(0) != null){
  110 + user_id = Integer.parseInt(objects.get(0).toString());
  111 + String hql = "from YxyCustomerEmail where user_id = "+user_id+" and current_status != 1 " +
  112 + "and delete_flag = 0 and find_in_set("+typeid+",prductid) > 0";
  113 + customerEmails = yxycustomeremaildao.findByHql(hql);
  114 + }
  115 + }
  116 + }else if(plan_differen == 9 || plan_differen == 10){//采购偏好
  117 + if(other_name != null && !"".equals(other_name)){
  118 + String sql = "select company_id from centre_company where domain = '"+domain+"'";
  119 + List<Object> objects = centreuserdao.findBySqlFind(sql);
  120 + if(objects.size() > 0 && objects.get(0) != null){
  121 + company_id = Integer.parseInt(objects.get(0).toString());
  122 + sql = "select user_id from centre_user where company_id = "+company_id+" and login_id = '"+loginid+"'";
  123 + objects = centreuserdao.findBySqlFind(sql);
  124 + if(objects.size() > 0 && objects.get(0) != null){
  125 + user_id = Integer.parseInt(objects.get(0).toString());
  126 + String customerids = "";
  127 + sql = "select customer_id from crm_customer_info where most_sourcing_industries like '%" + other_name + "%' and user_id = " + user_id;
  128 + objects = crmcustomerinfodao.findBySqlFind(sql);
  129 + for (int i = 0;i < objects.size();i++) {
  130 + customerids += objects.get(i).toString() + ",";
  131 + }
  132 + if(!customerids.equals("")){
  133 + customerids = customerids.substring(0,customerids.length()-1);
  134 + String hql = "from YxyCustomerEmail where delete_flag = 0 and current_status != 1 " +
  135 + "and user_id = "+user_id+" and customer_id in("+customerids+")";
  136 + customerEmails = yxycustomeremaildao.findByHql(hql);
  137 + }
  138 + }
  139 + }
  140 + }
  141 + }else if(plan_differen == 11 || plan_differen == 12){//个性营销
  142 + if(other_name != null && !"".equals(other_name)){
  143 + String sql = "select company_id from centre_company where domain = '"+domain+"'";
  144 + List<Object> objects = centreuserdao.findBySqlFind(sql);
  145 + if(objects.size() > 0 && objects.get(0) != null){
  146 + company_id = Integer.parseInt(objects.get(0).toString());
  147 + sql = "select user_id from centre_user where company_id = "+company_id+" and login_id = '"+loginid+"'";
  148 + objects = centreuserdao.findBySqlFind(sql);
  149 + if(objects.size() > 0 && objects.get(0) != null){
  150 + user_id = Integer.parseInt(objects.get(0).toString());
  151 + String[] conditionArr = other_name.split("@espeed@");
  152 + if(conditionArr.length == 10){
  153 + String classfiyStr = conditionArr[0];//客户分类信息
  154 + String statusStr = conditionArr[1];//客户状态信息
  155 + String fromStr = conditionArr[2];//客户来源信息
  156 + String starStr = conditionArr[3];//客户星级信息
  157 + String productStr = conditionArr[4];//意向产品信息
  158 + String caigouStr = conditionArr[5];//采购偏好信息
  159 + String entrolStr = conditionArr[6];//入库时间信息
  160 + String contactStr = conditionArr[7];//联系时间信息
  161 + String followStr = conditionArr[8];//未跟进时间信息
  162 + String typeStr = conditionArr[9];//客户类型信息,0私海,1公海
  163 + String hql = "from YxyCustomerEmail where user_id = "+user_id+" and delete_flag = 0 and current_status != 1 and";
  164 + if(typeStr.equals("1")){//公海客户
  165 + hql = "from YxyCustomerEmail where company_id = "+company_id+" and delete_flag = 0 and current_status = 1 and";
  166 + }
  167 + if(!classfiyStr.equals("no")){
  168 + hql += " classify_id in("+classfiyStr+") and";
  169 + }
  170 + if(!statusStr.equals("no")){
  171 + hql += " customer_status in("+statusStr+") and";
  172 + }
  173 + if(!fromStr.equals("no")){
  174 + hql += " source_from_id in("+fromStr+") and";
  175 + }
  176 + if(!starStr.equals("no")){
  177 + hql += " important_star in("+starStr+") and";
  178 + }
  179 + if(!productStr.equals("no")){
  180 + String[] productArr = productStr.split("@G@");
  181 + String subHql = " (";
  182 + for(String s : productArr){
  183 + subHql += "find_in_set("+s+",prductid) > 0 or ";
  184 + }
  185 + subHql = subHql.substring(0,subHql.lastIndexOf("or ")-1);
  186 + hql += subHql + ") and";
  187 + }
  188 + if(!caigouStr.equals("no")){
  189 + String[] caigouArr = caigouStr.split("@G@");
  190 + int jingzhun = Integer.parseInt(caigouArr[0]);//0:不精准,1:精准
  191 + String customerids = "";
  192 + for(int k = 1;k < caigouArr.length; k++){
  193 + sql = "";
  194 + if(jingzhun == 1){
  195 + sql = "select customer_id from crm_customer_info where find_in_set('"+caigouArr[k]+"',most_sourcing_industries) > 0 and user_id = " + user_id;
  196 + }else{
  197 + sql = "select customer_id from crm_customer_info where most_sourcing_industries like '%" + caigouArr[k] + "%' and user_id = " + user_id;
  198 + }
  199 + objects = crmcustomerinfodao.findBySqlFind(sql);
  200 + for (int i = 0;i < objects.size();i++) {
  201 + customerids += objects.get(i).toString() + ",";
  202 + }
  203 + }
  204 + if(!customerids.equals("")){
  205 + customerids = customerids.substring(0,customerids.length()-1);
  206 + hql += " customer_id in("+customerids+") and";
  207 + }
  208 + }
  209 + if(!entrolStr.equals("no")){
  210 + String[] entrolArr = entrolStr.split("@G@");
  211 + if(entrolArr.length == 1){
  212 + hql += " enrol_time >= '"+entrolArr[0]+" 00:00:00' and";
  213 + }else if(entrolArr.length == 2){
  214 + hql += " enrol_time >= '"+entrolArr[0]+" 00:00:00' and enrol_time <= '"+entrolArr[1]+" 23:59:59' and";
  215 + }
  216 + }
  217 + if(!contactStr.equals("no")){
  218 + String[] contactArr = contactStr.split("@G@");
  219 + if(contactArr.length == 1){
  220 + hql += " last_contact_date >= '"+contactArr[0]+" 00:00:00' and";
  221 + }else if(contactArr.length == 2){
  222 + hql += " last_contact_date >= '"+contactArr[0]+" 00:00:00' and last_contact_date <= '"+contactArr[1]+" 23:59:59' and";
  223 + }
  224 + }
  225 + if(!followStr.equals("no")){
  226 + String[] followArr = followStr.split("@G@");
  227 + int day = Integer.parseInt(followArr[0]);
  228 + if(day != -1){
  229 + String start_time = DateFormat.lastDays(-day);
  230 + hql += " last_contact_date < '"+start_time+" 00:00:00' and";
  231 + }else if(followArr.length == 2){
  232 + String[] timeArr = followArr[1].split(",");
  233 + if(timeArr.length == 1){
  234 + hql += " last_contact_date >= '"+timeArr[0]+" 00:00:00' and";
  235 + }else if(timeArr.length == 2){
  236 + hql += " last_contact_date >= '"+timeArr[0]+" 00:00:00' and last_contact_date <= '"+timeArr[1]+" 23:59:59' and";
  237 + }
  238 + }
  239 + }
  240 + if(!hql.equals("from YxyCustomerEmail where user_id = "+user_id+" and delete_flag = 0 and current_status != 1 and")
  241 + && !hql.equals("from YxyCustomerEmail where company_id = "+company_id+" and delete_flag = 0 and current_status = 1 and")){//说明以上的条件都不适合
  242 + hql = hql.substring(0,hql.length()-3);
  243 + customerEmails = yxycustomeremaildao.findByHql(hql);
  244 + }
  245 + }
  246 + }
  247 + }
  248 + }
  249 + }
  250 + SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
  251 + SimpleDateFormat df2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  252 + String nowtime = df2.format(new Date());
  253 + String nowdate = df.format(new Date());
  254 + List<YxyUserAddress> address_list = new ArrayList<YxyUserAddress>();
  255 + for(YxyCustomerEmail customer : customerEmails){
  256 + //只查询主联系人的信息
  257 + String sql = "select full_name,email from crm_linkman where is_main_linkman = 1 and customer_id = "+customer.getCustomer_id();
  258 + List<Object> objects = yxycustomeremaildao.findBySqlQuery(sql);
  259 + if(objects.size() > 0){
  260 + Object[] obj_arr = (Object[])objects.get(0);
  261 + YxyUserAddress address = new YxyUserAddress();
  262 + address.setUser_addr_id(customer.getCustomer_id());//客户id赋值给主键id
  263 + address.setCompany_variable(customer.getCustomer_name());//客户名称
  264 + address.setUser_addr_email(obj_arr[1].toString());//地址
  265 + address.setUser_addr_name(obj_arr[0].toString());//联系人
  266 + address_list.add(address);//添加到集合
  267 + try{
  268 + String hql = "from YxySendCount where user_id = "+user_id+" and customer_id = "+customer.getCustomer_id()+" and send_date = '"+nowdate+"'";
  269 + List<YxySendCount> counts = yxysendcountdao.findByHql(hql);
  270 + if(counts.size() > 0){
  271 + YxySendCount count = counts.get(0);
  272 + count.setSend_counts(count.getSend_counts()+1);
  273 + count.setSend_time(nowtime);
  274 + yxysendcountdao.updatePojo(count);
  275 + }else{
  276 + YxySendCount count = new YxySendCount();
  277 + count.setUser_id(user_id);
  278 + count.setCompany_id(company_id);
  279 + count.setSend_counts(1);
  280 + count.setSend_date(nowdate);
  281 + count.setSend_time(nowtime);
  282 + count.setCustomer_id(customer.getCustomer_id());
  283 + yxysendcountdao.addPojo(count);
  284 + }
  285 + }catch (Exception e) {
  286 + // TODO: handle exception
  287 + }
  288 + }
  289 + }
  290 + return address_list;
  291 + }
  292 + }
  293 +
  294 + /**查询模版*/
  295 + public YxyMailStencil findStencilInfo(int stencilid) throws Exception {
  296 + String hql="from YxyMailStencil where stencil_id="+stencilid;
  297 + List<YxyMailStencil> stencillist=stencildao.findByHql(hql);
  298 + if(stencillist.size()>0){
  299 + return stencillist.get(0);
  300 + }else{
  301 + return null;
  302 + }
  303 + }
  304 +
  305 + /**查询发件人*/
  306 + public YxySenderSet findSender(String loginid,String domain)throws Exception{
  307 + String hql="from YxySenderSet where user_login='"+loginid+"' and user_domain='"+domain+"' and isdefault=1";
  308 + List<YxySenderSet> senderlist=senderdao.findByHql(hql);
  309 + if(senderlist.size()>0){
  310 + return senderlist.get(0);
  311 + }else{
  312 + return null;
  313 + }
  314 + }
  315 +
  316 + /**修改计划周期状态*/
  317 + public void updateWeekStatus(int weekid,int status)throws Exception{
  318 + String hql="update YxyMarketingWeek set isexecution="+status+" where week_id="+weekid;
  319 + marketingweekdao.updateByHql(hql);
  320 + }
  321 +
  322 + /**修改计划状态*/
  323 + public void updatePlanStatus(int planid,int status)throws Exception{
  324 + String hql="update YxyMarketingPlan set plan_status="+status+" where plan_id="+planid;
  325 + marketingplandao.updateByHql(hql);
  326 + }
  327 +
  328 + /**code查询控制参数(有用户级返回用户级,否则返回默认参数)*/
  329 + public String findCompanyParamByCode(String code,String loginid,String domain)throws Exception{
  330 + //查询此code的paramid
  331 + String hql="from YxySysParamaters where para_code='"+code+"'";
  332 + List<YxySysParamaters> paraslist=yxysysparamaterdao.findByHql(hql);
  333 + if(paraslist.size()>0){
  334 + int paramid=paraslist.get(0).getPara_id();
  335 + int level=paraslist.get(0).getOwner_type();//所属等级
  336 + String defaultvalue=paraslist.get(0).getDefault_value();//默认值
  337 + if(level==4){//用户级
  338 + //查询参数值
  339 + String hql1="from YxySysParamatersValue where para_id="+paramid+" and owner_loginid='"+loginid+"' and company_domain='"+domain+"'";
  340 + List<YxySysParamatersValue> paraValue=yxysysparamatersvaluedao.findByHql(hql1);
  341 + if(paraValue.size()>0){
  342 + return paraValue.get(0).getPara_value();
  343 + }else{
  344 + return defaultvalue;
  345 + }
  346 + }else{//系统级
  347 + //查询参数值
  348 + String hql1="from YxySysParamatersValue where para_id="+paramid+" and company_domain='"+domain+"'";
  349 + List<YxySysParamatersValue> paraValue=yxysysparamatersvaluedao.findByHql(hql1);
  350 + if(paraValue.size()>0){
  351 + return paraValue.get(0).getPara_value();
  352 + }else{
  353 + return defaultvalue;
  354 + }
  355 + }
  356 +
  357 + }else{
  358 + return "-1";
  359 + }
  360 + }
  361 +
  362 + /**获取EDM配置-盘活客户配置信息*/
  363 + public CentreYxyedmOldcustomer getOldCusSet(String domain)throws Exception{
  364 + String hql= "from CentreYxyedmOldcustomer where company_domain = '"+domain+"'";
  365 + List<CentreYxyedmOldcustomer> list = centreyxyedmoldcustomerdao.findByHql(hql);
  366 + if(list.size()>0){
  367 + return list.get(0);
  368 + }else{
  369 + return null;
  370 + }
  371 + }
  372 +
  373 + private YxyMarketingPlanDao marketingplandao;//营销计划dao
  374 + private YxyMarketingWeekDao marketingweekdao;//营销计划周期dao
  375 + private YxyUserAddressDao addressdao;//用户地址dao
  376 + private YxyMailStencilDao stencildao;//模版dao
  377 + private YxySenderSetDao senderdao;//发件人dao
  378 + private YxyParamaterDao yxysysparamaterdao;//控制参数dao
  379 + private YxySysParamatersValueDao yxysysparamatersvaluedao;//控制参数值dao
  380 + private YxyCustomerEmailDao yxycustomeremaildao;//客户邮件dao
  381 + private CentreYxyedmOldcustomerDao centreyxyedmoldcustomerdao;//盘活客户配置dao
  382 + private CentreUserDao centreuserdao;//用户dao
  383 + private CrmCustomerInfoDao crmcustomerinfodao;//阿里巴巴客户dao
  384 + private YxySendCountDao yxysendcountdao;//客户发送邮件的统计dao
  385 + public YxyCustomerEmailDao getYxycustomeremaildao() {
  386 + return yxycustomeremaildao;
  387 + }
  388 + public void setYxycustomeremaildao(YxyCustomerEmailDao yxycustomeremaildao) {
  389 + this.yxycustomeremaildao = yxycustomeremaildao;
  390 + }
  391 + public YxyUserAddressDao getAddressdao() {
  392 + return addressdao;
  393 + }
  394 + public void setAddressdao(YxyUserAddressDao addressdao) {
  395 + this.addressdao = addressdao;
  396 + }
  397 + public YxyMarketingPlanDao getMarketingplandao() {
  398 + return marketingplandao;
  399 + }
  400 + public void setMarketingplandao(YxyMarketingPlanDao marketingplandao) {
  401 + this.marketingplandao = marketingplandao;
  402 + }
  403 + public YxyMarketingWeekDao getMarketingweekdao() {
  404 + return marketingweekdao;
  405 + }
  406 + public void setMarketingweekdao(YxyMarketingWeekDao marketingweekdao) {
  407 + this.marketingweekdao = marketingweekdao;
  408 + }
  409 + public YxyMailStencilDao getStencildao() {
  410 + return stencildao;
  411 + }
  412 + public void setStencildao(YxyMailStencilDao stencildao) {
  413 + this.stencildao = stencildao;
  414 + }
  415 + public YxySenderSetDao getSenderdao() {
  416 + return senderdao;
  417 + }
  418 + public void setSenderdao(YxySenderSetDao senderdao) {
  419 + this.senderdao = senderdao;
  420 + }
  421 + public YxyParamaterDao getYxysysparamaterdao() {
  422 + return yxysysparamaterdao;
  423 + }
  424 + public void setYxysysparamaterdao(YxyParamaterDao yxysysparamaterdao) {
  425 + this.yxysysparamaterdao = yxysysparamaterdao;
  426 + }
  427 + public YxySysParamatersValueDao getYxysysparamatersvaluedao() {
  428 + return yxysysparamatersvaluedao;
  429 + }
  430 + public void setYxysysparamatersvaluedao(
  431 + YxySysParamatersValueDao yxysysparamatersvaluedao) {
  432 + this.yxysysparamatersvaluedao = yxysysparamatersvaluedao;
  433 + }
  434 + public CentreYxyedmOldcustomerDao getCentreyxyedmoldcustomerdao() {
  435 + return centreyxyedmoldcustomerdao;
  436 + }
  437 + public void setCentreyxyedmoldcustomerdao(
  438 + CentreYxyedmOldcustomerDao centreyxyedmoldcustomerdao) {
  439 + this.centreyxyedmoldcustomerdao = centreyxyedmoldcustomerdao;
  440 + }
  441 + public CentreUserDao getCentreuserdao() {
  442 + return centreuserdao;
  443 + }
  444 + public void setCentreuserdao(CentreUserDao centreuserdao) {
  445 + this.centreuserdao = centreuserdao;
  446 + }
  447 + public CrmCustomerInfoDao getCrmcustomerinfodao() {
  448 + return crmcustomerinfodao;
  449 + }
  450 + public void setCrmcustomerinfodao(CrmCustomerInfoDao crmcustomerinfodao) {
  451 + this.crmcustomerinfodao = crmcustomerinfodao;
  452 + }
  453 + public YxySendCountDao getYxysendcountdao() {
  454 + return yxysendcountdao;
  455 + }
  456 + public void setYxysendcountdao(YxySendCountDao yxysendcountdao) {
  457 + this.yxysendcountdao = yxysendcountdao;
  458 + }
  459 +}
  1 +package com.espeed.yxy.dao.impl;
  2 +
  3 +import java.util.List;
  4 +
  5 +import com.espeed.webmail.pojo.CrmCustomerInfo;
  6 +import com.espeed.yxy.dao.CrmCustomerInfoDao;
  7 +
  8 +
  9 +/**
  10 +*
  11 +* @项目名称: 科飞管理后台系统
  12 +* @版权所有: 深圳市科飞时速网络技术有限公司(0755-88843776)
  13 +* @技术支持: info@21gmail.com
  14 +* @单元名称: 实体类CrmCustomerInfo的DAO接口
  15 +* @开始时间: 2018-09-27
  16 +* @开发人员: 杨志钊
  17 +*/
  18 +
  19 +public class CrmCustomerInfoDaoImpl extends WebmailHibernateBaseDAOImpl<CrmCustomerInfo, Long> implements CrmCustomerInfoDao {
  20 +
  21 + /**实体插入*/
  22 + public int addPojo(CrmCustomerInfo entity) throws Exception {
  23 + return super.add(entity);
  24 + }
  25 +
  26 + /**实体编辑*/
  27 + public void updatePojo(CrmCustomerInfo entity) throws Exception {
  28 + super.update(entity);
  29 + }
  30 +
  31 + /**HQL查询*/
  32 + public List<CrmCustomerInfo> findByHql(String hql) throws Exception {
  33 + return super.getAll(hql);
  34 + }
  35 +
  36 + /**HQL指定条查询*/
  37 + public List<CrmCustomerInfo> findByHqlSet(String hql,int num) throws Exception {
  38 + return super.findBySet(hql, num);
  39 + }
  40 +
  41 + /**SQL查询*/
  42 + public List<Object> findBySqlFind(String sql) throws Exception {
  43 + return super.findBySql(sql);
  44 + }
  45 +
  46 + /**HQL更新*/
  47 + public void updateByHql(String hql) throws Exception {
  48 + super.updateorDelBySql(hql);
  49 + }
  50 +
  51 + /**sql更新*/
  52 + public void updateBySql(String sql) throws Exception {
  53 + super.updateorDelSql(sql);
  54 + }
  55 +
  56 + /**HQL查询数量*/
  57 + public int findByHqlCount(String hql) throws Exception {
  58 + return super.count(hql);
  59 + }
  60 +
  61 +}
  1 +package com.espeed.yxy.mail;
  2 +
  3 +import java.io.PrintWriter;
  4 +import java.io.StringWriter;
  5 +import java.text.SimpleDateFormat;
  6 +import java.util.ArrayList;
  7 +import java.util.Date;
  8 +import java.util.List;
  9 +import java.util.Properties;
  10 +import javax.mail.Transport;
  11 +import com.espeed.yxy.pojo.YxySendMailDetail;
  12 +import com.espeed.yxy.pojo.YxySendMailMaster;
  13 +import com.espeed.yxy.pojo.YxySendSmtpInfo;
  14 +import com.espeed.yxy.pojo.YxySmtpSendSelfOverset;
  15 +import com.espeed.yxy.pojo.YxySmtpSendSelfSet;
  16 +import com.espeed.yxy.pojo.YxySmtpSendSet;
  17 +import com.espeed.yxy.pojo.YxySmtpSuffixSet;
  18 +import com.espeed.yxy.service.YxySendMailService;
  19 +import com.espeed.yxy.timer.SendMailTimer;
  20 +import com.espeed.yxy.tool.DES_Encrypt;
  21 +import com.espeed.yxy.tool.DateFormat;
  22 +import com.espeed.yxy.tool.LogsTool;
  23 +/**
  24 + * 程序名称: EspeedMail_时速邮箱
  25 + * 程序版本: V1.0
  26 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776)
  27 + * 版权所有: 深圳市科飞时速网络技术有限公司
  28 + * 技术支持: Tech@21gmail.com
  29 + * 单元名称: 发送邮件之前的判断(营销游)
  30 + * 开始时间: 2013.12.09
  31 + * 程 序 员: 谢勇
  32 + * 最后修改:
  33 + * 备 注: 如需修改请通知程序员
  34 + */
  35 +public class YxysendMethod {
  36 + //private static Properties props =null;
  37 + //private static Transport transport =null;
  38 + /**参数说明(1:service层接口,2:smtp服务器,3:邮件信息,4:smtp后缀信息,5:smtp后缀发送量信息)*/
  39 + public static void sendMethodImpl(YxySendMailService YxySendMailService,YxySendSmtpInfo SmtpInfo,YxySendMailMaster mailinfo){
  40 + //public static void sendMethodImpl(YxySendMailService YxySendMailService,YxySendSmtpInfo SmtpInfo,YxySendMailMaster mailinfo,List<YxySmtpSuffixSet> smtpsuffixsetList){
  41 + try{
  42 + //获取当前时间
  43 + SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  44 + String nowDate=sdf1.format(new Date());
  45 + //邮件ID
  46 + int mailid=mailinfo.getSend_mail_id();
  47 + //SMTPID
  48 + int smtpid=SmtpInfo.getSmtp_service_id();
  49 + //int isyxy=SmtpInfo.getSmtp_service_isyxy();//是自配还是运营
  50 + //判断是自配smtp还是运营smtp
  51 +// if(isyxy==0){//自配
  52 +// //更新smtp状态
  53 +// YxySendMailService.updateSmtpUseStatus(1,smtpid,"");
  54 +//
  55 +// //更新待发邮件为已使用中
  56 +// YxySendMailService.updateMailUseStatus(mailid,1,nowDate);
  57 +//
  58 +// //自配smtp发送方法
  59 +// selfSmtpMethod(YxySendMailService,SmtpInfo,mailinfo);
  60 +//
  61 +// //发送完后将smtp状态改回可用,且使用时间修改为当前时间
  62 +// YxySendMailService.updateSmtpUseStatus(0,smtpid,nowDate);
  63 +//
  64 +// //发送完后将待发邮件状态改回未使用
  65 +// YxySendMailService.updateMailUseStatus(mailid,0,nowDate);
  66 +// }else{//运营
  67 + try {
  68 + synchronized (SendMailTimer.nowtimer) {
  69 + //更新smtp状态
  70 + YxySendMailService.updateSmtpUseStatus(1,smtpid,"");
  71 + //更新待发邮件为已使用中
  72 + YxySendMailService.updateMailUseStatus(mailid,1,nowDate);
  73 + }
  74 + //调用方法
  75 + yxySmtpMethod(YxySendMailService,SmtpInfo,mailinfo);
  76 + //yxySmtpMethod(YxySendMailService,SmtpInfo,mailinfo,smtpsuffixsetList);
  77 + synchronized (SendMailTimer.nowtimer) {
  78 + //发送完后将smtp状态改回可用,且使用时间修改为当前时间
  79 + YxySendMailService.updateSmtpUseStatus(0,smtpid,nowDate);
  80 + //发送完后将待发邮件状态改回未使用
  81 + YxySendMailService.updateMailUseStatus(mailid,0,nowDate);
  82 + }
  83 + } catch (Exception e) {
  84 + e.printStackTrace();
  85 + //写入日志
  86 + StringWriter sw = new StringWriter();
  87 + e.printStackTrace(new PrintWriter(sw, true));
  88 + String str = sw.toString();
  89 + LogsTool.erroLogs(str);
  90 + //更新此邮件异常量
  91 + YxySendMailService.updateMailExpStatus(mailid,mailinfo.getExptionnum()+1);
  92 + }
  93 + //}
  94 + }catch (Exception e) {
  95 + e.printStackTrace();
  96 + System.out.println("sendMethodImpl方法加载异常!");
  97 + //写入日志
  98 + StringWriter sw = new StringWriter();
  99 + e.printStackTrace(new PrintWriter(sw, true));
  100 + String str = sw.toString();
  101 + LogsTool.erroLogs(str);
  102 + }
  103 + }
  104 +
  105 +
  106 + /**自配运行方法*/
  107 + public static void selfSmtpMethod(YxySendMailService YxySendMailService,YxySendSmtpInfo SmtpInfo,YxySendMailMaster mailinfo){
  108 + try {
  109 + //邮件ID
  110 + int mailid=mailinfo.getSend_mail_id();
  111 + //邮件UID
  112 + String mailuid=mailinfo.getMail_uid();
  113 + //验证SMTP
  114 + List<Object> isTong=connectionService(SmtpInfo.getSmtp_service_number(),SmtpInfo.getSmtp_service_account(),SmtpInfo.getSmtp_service_password(),SmtpInfo.getSmtp_is_ssl(),SmtpInfo.getSmtp_service_port());
  115 +
  116 + //判断是否验证通过
  117 + if(isTong.get(0).toString().equals("1")){
  118 + Properties props =(Properties) isTong.get(1);
  119 + Transport transport =(Transport) isTong.get(2);
  120 + //通过获取的待发邮件ID来获取该封邮件的待发地址
  121 + int MastermailId=mailinfo.getSend_mail_id();//该封邮件主ID
  122 + List<YxySendMailDetail> addressList=YxySendMailService.findAddressByMailID(MastermailId);//待发邮件对应的地址
  123 +
  124 + if(addressList.size()<=0){
  125 + System.out.println("没有待发地址了..结束后续工作");
  126 + //将该邮件状态改为已发送
  127 + YxySendMailService.updateMailStatus(1,mailid,mailuid);
  128 + }else{
  129 + //-------定义变量------------------
  130 + //获取当前时间
  131 + SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  132 + String currDate=sdf1.format(new Date());
  133 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
  134 + String nowDay=sdf.format(new Date());
  135 +
  136 + String smtpaccount=SmtpInfo.getSmtp_service_account();//smtp账号
  137 + String smtphost=SmtpInfo.getSmtp_service_number();//SMTP服务器
  138 + int selftenNum=0;//十分钟最大发信量
  139 + int selfhourNum=0;//60分钟最大发信量
  140 + int selfdayNum=0;//一天最大发信量
  141 +
  142 + int selftenNumOver=0;//十分钟已发信量
  143 + int selfhourNumOver=0;//60分钟已发信量
  144 + int selfdayNumOver=0;//一天已发信量
  145 +
  146 + boolean tenisok=false;//10分钟是否通过
  147 + boolean hourisok=false;//60分钟是否通过
  148 + boolean dayisok=false;//一天是否通过
  149 +
  150 + int selftenNumSurplus=0;//十分钟剩余发信量
  151 + int selfhourNumSurplus=0;//60分钟剩余发信量
  152 + int selfdayNumSurplus=0;//一天剩余发信量
  153 + //1.获取自配smtp发送量限制
  154 + List<YxySmtpSendSelfSet> smtpselfsendsetList=YxySendMailService.findSendSelfSetByService(smtphost);
  155 +
  156 + if(smtpselfsendsetList.size()>=2){//说明有控制量限制(包含默认的和自己配的)
  157 + if(!smtpselfsendsetList.get(0).getSmtp_send_self_set_account().equals("domain")){//自配量
  158 + selftenNum=smtpselfsendsetList.get(0).getSmtp_send_self_set_tennum();//十分钟最大发信量
  159 + selfhourNum=smtpselfsendsetList.get(0).getSmtp_send_self_set_hournum();//60分钟最大发信量
  160 + selfdayNum=smtpselfsendsetList.get(0).getSmtp_send_self_set_daynum();//一小时最大发信量
  161 + }else{//domain默认设置信息
  162 + selftenNum=smtpselfsendsetList.get(1).getSmtp_send_self_set_tennum();//十分钟最大发信量
  163 + selfhourNum=smtpselfsendsetList.get(1).getSmtp_send_self_set_hournum();//60分钟最大发信量
  164 + selfdayNum=smtpselfsendsetList.get(1).getSmtp_send_self_set_daynum();//一小时最大发信量
  165 + }
  166 + }else{//默认的
  167 + selftenNum=smtpselfsendsetList.get(0).getSmtp_send_self_set_tennum();//十分钟最大发信量
  168 + selfhourNum=smtpselfsendsetList.get(0).getSmtp_send_self_set_hournum();//60分钟最大发信量
  169 + selfdayNum=smtpselfsendsetList.get(0).getSmtp_send_self_set_daynum();//一小时最大发信量
  170 + }
  171 + //2.获取自配smtp已发送量
  172 + List<YxySmtpSendSelfOverset> smtpsendsetoverList=YxySendMailService.findBySmtpAccount(smtpaccount);
  173 + if(smtpsendsetoverList.size()>0){//说明已存在发送量记录
  174 + //判断是不是当天的记录
  175 + String nowsend=smtpsendsetoverList.get(0).getSmtp_send_self_over_daydate();
  176 + if(nowDay.equals(nowsend)){//说明是当天的记录
  177 + //已发量
  178 + selftenNumOver=smtpsendsetoverList.get(0).getSmtp_send_self_over_tennum();
  179 + selfhourNumOver=smtpsendsetoverList.get(0).getSmtp_send_self_over_hournum();
  180 + selfdayNumOver=smtpsendsetoverList.get(0).getSmtp_send_self_over_daynum();
  181 +
  182 + //判断是否在某段时间内发送量是否满足
  183 + //1.10分钟内判断*/
  184 + if(DateFormat.minute1s(smtpsendsetoverList.get(0).getSmtp_send_self_over_tendate(),currDate)<10){//在此时间段内
  185 + if(selftenNumOver>=selftenNum){//已发量大于限定量则不能发
  186 + tenisok=false;
  187 + }else{
  188 + tenisok=true;
  189 + }
  190 + }else{//不在此时间段内
  191 + selftenNumOver=0;
  192 + tenisok=true;
  193 + //更新此smtp十分钟为0
  194 + smtpsendsetoverList.get(0).setSmtp_send_self_over_tennum(0);
  195 + }
  196 +
  197 + //60分钟内判断
  198 + if(DateFormat.minute1s(smtpsendsetoverList.get(0).getSmtp_send_self_over_hourdate(),currDate)<60){//在此时间段内
  199 + if(selfhourNumOver>=selfhourNum){//已发量大于限定量则不能发
  200 + hourisok=false;
  201 + }else{
  202 + hourisok=true;
  203 + }
  204 + }else{//不在此时间段内
  205 + selfhourNumOver=0;
  206 + hourisok=true;
  207 + //更新此smtp60分钟为0
  208 + smtpsendsetoverList.get(0).setSmtp_send_self_over_hournum(0);
  209 + }
  210 +
  211 + //一天内判断
  212 + if(smtpsendsetoverList.get(0).getSmtp_send_self_over_daydate().equals(nowDay)){//是否在当天
  213 + if(selfdayNumOver>=selfdayNum){//已发量大于限定量则不能发
  214 + dayisok=false;
  215 + }else{
  216 + dayisok=true;
  217 + }
  218 + }else{//不在此时间段内
  219 + selfdayNumOver=0;
  220 + dayisok=true;
  221 + //更新此smtp一天数为0
  222 + smtpsendsetoverList.get(0).setSmtp_send_self_over_daynum(0);
  223 + }
  224 + //YxySendMailService.updateSendSelfSet(smtpsendsetoverList.get(0));
  225 + }
  226 + }else{//不存在发送记录则添加一条
  227 + YxySmtpSendSelfOverset o=new YxySmtpSendSelfOverset();
  228 + o.setSmtp_send_self_over_account(smtpaccount);//smtp账号
  229 + o.setSmtp_send_self_over_tendate(currDate);
  230 + o.setSmtp_send_self_over_hourdate(currDate);
  231 + o.setSmtp_send_self_over_daydate(nowDay);
  232 + //添加自配设置信息
  233 + YxySendMailService.addSendSelfSet(o);
  234 + tenisok=true;
  235 + hourisok=true;
  236 + dayisok=true;
  237 + }
  238 + if(tenisok&&hourisok&&dayisok){//如果发送量都已通过检测则调用发送程序
  239 + //获取剩余量
  240 + selftenNumSurplus=selftenNum-selftenNumOver;//十分钟剩余发信量
  241 + selfhourNumSurplus=selfhourNum-selfhourNumOver;//60分钟剩余发信量
  242 + selfdayNumSurplus=selfdayNum-selfdayNumOver;//一天剩余发信量
  243 + int minNum=0;//最小值
  244 + //三个时间内取最小值(此账号最多能发的量)
  245 + if(selftenNumSurplus<selfhourNumSurplus&&selftenNumSurplus<selfdayNumSurplus){
  246 + minNum=selftenNumSurplus;
  247 + }else if(selfhourNumSurplus<selftenNumSurplus&&selfhourNumSurplus<selfdayNumSurplus){
  248 + minNum=selfhourNumSurplus;
  249 + }else if(selfdayNumSurplus<selftenNumSurplus&&selfdayNumSurplus<selfhourNumSurplus){
  250 + minNum=selfdayNumSurplus;
  251 + }
  252 + //调用发送方法
  253 + YxySendMail send=new YxySendMail();
  254 + //取固定量的地址
  255 + int sendSuccessNum=0;
  256 + if(minNum>addressList.size()){
  257 + //调用发邮件方法
  258 + send.sendMailMethod(addressList,YxySendMailService,SmtpInfo,mailinfo,props,transport);
  259 + }else{
  260 + List<YxySendMailDetail> minaddressList=new ArrayList<YxySendMailDetail>();
  261 + for(int j=0;j<minNum;j++){
  262 + minaddressList.add(addressList.get(j));
  263 + }
  264 + //调用发邮件方法,返回成功量
  265 + send.sendMailMethod(minaddressList,YxySendMailService,SmtpInfo,mailinfo,props,transport);
  266 + }
  267 + if(sendSuccessNum>0){
  268 + //更新自配smtp发送量
  269 + smtpsendsetoverList.get(0).setSmtp_send_self_over_daydate(nowDay);
  270 + smtpsendsetoverList.get(0).setSmtp_send_self_over_daynum(selfdayNumOver+sendSuccessNum);
  271 + smtpsendsetoverList.get(0).setSmtp_send_self_over_hourdate(currDate);
  272 + smtpsendsetoverList.get(0).setSmtp_send_self_over_hournum(selfhourNumOver+sendSuccessNum);
  273 + smtpsendsetoverList.get(0).setSmtp_send_self_over_tendate(currDate);
  274 + smtpsendsetoverList.get(0).setSmtp_send_self_over_tennum(selftenNumOver+sendSuccessNum);
  275 + //更新已发量
  276 + YxySendMailService.updateSendSelfSet(smtpsendsetoverList.get(0));
  277 + }
  278 +
  279 +
  280 + }else{//未通过检测
  281 + System.out.println("发送量超标了");
  282 + }
  283 + }
  284 + }
  285 + } catch (Exception e) {
  286 + e.printStackTrace();
  287 + //写入日志
  288 + StringWriter sw = new StringWriter();
  289 + e.printStackTrace(new PrintWriter(sw, true));
  290 + String str = sw.toString();
  291 + LogsTool.erroLogs(str);
  292 + }
  293 +
  294 +
  295 +
  296 + }
  297 + /**运营运行方法*/
  298 + //public static void yxySmtpMethod(YxySendMailService YxySendMailService,YxySendSmtpInfo SmtpInfo,YxySendMailMaster mailinfo,List<YxySmtpSuffixSet> smtpsuffixsetList){
  299 + public static void yxySmtpMethod(YxySendMailService YxySendMailService,YxySendSmtpInfo SmtpInfo,YxySendMailMaster mailinfo){
  300 + try {
  301 + ///定义变量------------------
  302 + //1.此为没有设置的后缀地址集合
  303 +// List<YxySendMailDetail> nohouzhui=new ArrayList<YxySendMailDetail>();
  304 +// //2.保存有设置的后缀
  305 +// List<YxySendMailDetail> havehouzhui=new ArrayList<YxySendMailDetail>();
  306 +// //3.保存能发的后缀地址集合
  307 +// List<YxySendMailDetail> sendAddress=new ArrayList<YxySendMailDetail>();
  308 + //5.获取当前时间
  309 +// SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  310 +// String currDate=sdf1.format(new Date());
  311 +// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
  312 +// String nowDay=sdf.format(new Date());
  313 + //邮件ID
  314 + int mailid=mailinfo.getSend_mail_id();
  315 + //邮件唯一码
  316 + String mailuid=mailinfo.getMail_uid();
  317 + //smtp相关信息
  318 + String smtpService=SmtpInfo.getSmtp_service_number();//smtp服务器
  319 + //通过获取的待发邮件ID来获取该封邮件的待发地址(未包含异常邮件)
  320 + int MastermailId=mailinfo.getSend_mail_id();//该封邮件主ID
  321 + List<YxySendMailDetail> addressList=YxySendMailService.findAddressByMailID(MastermailId);//待发邮件对应的地址
  322 + if(addressList.size()<=0){
  323 + //将该邮件状态改为已发送
  324 + YxySendMailService.updateMailStatus(1,mailid,mailuid);
  325 + System.out.println("邮件:"+MastermailId+"整理后没有待发地址!!!");
  326 + }else{
  327 + //是否SSL加密
  328 + int isssl=SmtpInfo.getSmtp_is_ssl();
  329 + //端口号
  330 + String port=SmtpInfo.getSmtp_service_port();
  331 + //验证SMTP是否通过
  332 + List<Object> isTong=connectionService(smtpService,SmtpInfo.getSmtp_service_account(),SmtpInfo.getSmtp_service_password(),isssl,port);
  333 + if(isTong.get(0).toString().equals("1")){
  334 + Properties props =(Properties) isTong.get(1);
  335 + Transport transport =(Transport) isTong.get(2);
  336 + //调用发邮件方法
  337 + YxySendMail send=new YxySendMail();
  338 + send.sendMailMethod(addressList,YxySendMailService,SmtpInfo,mailinfo,props,transport);
  339 +// //获取后缀已发送量信息
  340 +// List<YxySmtpSendSet> smtpsendsetList=YxySendMailService.findAllSmtpSendSet(smtpService,nowDay);
  341 +// //如果没有数据则说明是新的一天了(删除以前的信息)
  342 +// if(smtpsendsetList.size()==0){
  343 +// YxySendMailService.delmSmtpSet(smtpService);
  344 +// }
  345 +// //循环判断该地址的后缀属于哪个smtp统计出来
  346 +// for(int i=0;i<addressList.size();i++){
  347 +// int gs=0;
  348 +// our:for(int j=0;j<smtpsuffixsetList.size();j++){
  349 +// //每个地址判断是否属于后缀类别中的一个
  350 +// if(addressList.get(i).getEmail_suffix().equals(smtpsuffixsetList.get(j).getSmtp_suffix_name())){
  351 +// havehouzhui.add(addressList.get(i));
  352 +// gs++;
  353 +// break our;
  354 +// }
  355 +// }
  356 +// if(gs==0){
  357 +// nohouzhui.add(addressList.get(i));
  358 +// }
  359 +// }
  360 +//
  361 +// int tensendNum=0;//10分钟最大发送数
  362 +// int hoursendNum=0;//60分钟最大发送数
  363 +// int daysendNum=0;//1天最大发送数
  364 +//
  365 +// int tensendNumOver=0;//10分钟已发送数
  366 +// int hoursendNumOver=0;//60分钟已发送数
  367 +// int daysendNumOver=0;//1天已发送数
  368 +//
  369 +// String addrSuffix="";//地址后缀
  370 +// String smtpsetSuffix="";//smtp设置后缀
  371 +//
  372 +// boolean tenisok=false;//10分钟是否通过
  373 +// boolean hourisok=false;//60分钟是否通过
  374 +// boolean dayisok=false;//一天是否通过
  375 +//
  376 +// //调用发送方法
  377 +// YxySendMail send=new YxySendMail();
  378 +// for(int i=0;i<2;i++){
  379 +// //当i=0时表示该地址没有在设置值中直接发送
  380 +// if(i==0){
  381 +// if(nohouzhui.size()==0){
  382 +// System.out.println("未后缀设置的没有地址");
  383 +// continue;
  384 +// }else{
  385 +// //没后缀的地址使用默认后缀控制参数(domain)
  386 +// send.sendMailMethod(nohouzhui,YxySendMailService,SmtpInfo,mailinfo,props,transport);/**调用发邮件方法*/
  387 +// }
  388 +// }
  389 +// //否则表示有设置值的后缀
  390 +// if(i==1){
  391 +// //判断是否还存在地址
  392 +// if(havehouzhui.size()==0){
  393 +// System.out.println("后缀集合中没有待发地址了!!!");
  394 +// }else{
  395 +// //循环判断该地址后缀是否还能发送
  396 +// address:for(int m=0;m<havehouzhui.size();m++){
  397 +// //1.获取该地址后缀发送最大量
  398 +// suffix:for(int f=0;f<smtpsuffixsetList.size();f++){
  399 +// addrSuffix=smtpsuffixsetList.get(f).getSmtp_suffix_name();//系统设定的后缀名
  400 +// //for(int j=0;j<havehouzhui.size();j++){
  401 +// if(havehouzhui.get(m).getEmail_suffix().equals(addrSuffix)){
  402 +// tensendNum=smtpsuffixsetList.get(f).getSmtp_suffix_ten();//10分钟最大发送量
  403 +// hoursendNum=smtpsuffixsetList.get(f).getSmtp_suffix_hour();//60分钟最大发送量
  404 +// daysendNum=smtpsuffixsetList.get(f).getSmtp_suffix_day();//一天最大发送量
  405 +// break suffix;
  406 +// }
  407 +// }
  408 +// boolean isexist=false;
  409 +// addrSuffix=havehouzhui.get(m).getEmail_suffix();//地址后缀赋值
  410 +// //循环后缀发送量
  411 +// smtpset:for(int s=0;s<smtpsendsetList.size();s++){
  412 +// //判断该地址后缀是否在设置中存在
  413 +// smtpsetSuffix=smtpsendsetList.get(s).getSmtp_send_set_suffix();//smtp设置后缀
  414 +// if(addrSuffix.equals(smtpsetSuffix)){//存在
  415 +// //如果存在则查出各个时间段的已发送量
  416 +// tensendNumOver=smtpsendsetList.get(s).getSmtp_send_set_tennum();//10分钟已发送数
  417 +// hoursendNumOver=smtpsendsetList.get(s).getSmtp_send_set_hournum();//60分钟已发送数
  418 +// daysendNumOver=smtpsendsetList.get(s).getSmtp_send_set_daynum();//1天已发送数
  419 +// isexist=true;
  420 +//
  421 +// //判断该地址的已发量与设定量是否通过
  422 +// //1.当前时间与最后一次发送时间判断是否是在10分钟内
  423 +// if(DateFormat.minute1s(smtpsendsetList.get(s).getSmtp_send_set_tendate(),currDate)<10){
  424 +// //在此10分钟内,判断是否能发
  425 +// if(tensendNumOver>=tensendNum){
  426 +// System.out.println("十分钟之内无法发送了");
  427 +// //此地址无法发送
  428 +// tenisok=false;
  429 +// continue address;
  430 +// }else{
  431 +// tenisok=true;
  432 +// }
  433 +// }else{
  434 +// tenisok=true;
  435 +// //更新此smtp10分钟为0
  436 +// smtpsendsetList.get(s).setSmtp_send_set_tennum(0);
  437 +// smtpsendsetList.get(s).setSmtp_send_set_tendate(currDate);
  438 +// }
  439 +// //2.当前时间与最后一次发送时间判断是否是在60分钟内
  440 +// if(DateFormat.minute1s(smtpsendsetList.get(s).getSmtp_send_set_hourdate(),currDate)<60){
  441 +// if(hoursendNumOver>hoursendNum){
  442 +// System.out.println("60分钟之内无法发送了");
  443 +// hourisok=false;
  444 +// //此地址无法发送
  445 +// continue address;
  446 +// }else{
  447 +// hourisok=true;
  448 +// }
  449 +// }else{
  450 +// hourisok=true;
  451 +// //更新此smtp60分钟为0
  452 +// smtpsendsetList.get(s).setSmtp_send_set_hournum(0);
  453 +// smtpsendsetList.get(s).setSmtp_send_set_hourdate(currDate);
  454 +// }
  455 +// //3.当前时间与最后一次发送时间判断是否是在一天内
  456 +// if(DateFormat.minute1s(smtpsendsetList.get(s).getSmtp_send_set_daydate()+" 00:00:00",currDate)<1440){
  457 +// if(daysendNumOver>daysendNum){
  458 +// System.out.println("一天之内无法发送了");
  459 +// dayisok=false;
  460 +// //此地址无法发送
  461 +// continue address;
  462 +// }else{
  463 +// dayisok=true;
  464 +// }
  465 +// }else{
  466 +// //更新此一天为0
  467 +// dayisok=true;
  468 +// smtpsendsetList.get(s).setSmtp_send_set_daynum(0);
  469 +// smtpsendsetList.get(s).setSmtp_send_set_daydate(currDate);
  470 +// }
  471 +// //是否都符合
  472 +// if(tenisok&&hourisok&&dayisok){
  473 +// sendAddress.add(havehouzhui.get(m));/**都符合将待发地址加入到可发地址集合中*/
  474 +// /**在该后缀信息上累加1*/
  475 +// smtpsendsetList.get(s).setSmtp_send_set_tennum(smtpsendsetList.get(s).getSmtp_send_set_tennum()+1);
  476 +// smtpsendsetList.get(s).setSmtp_send_set_hournum(smtpsendsetList.get(s).getSmtp_send_set_hournum()+1);
  477 +// smtpsendsetList.get(s).setSmtp_send_set_daynum(smtpsendsetList.get(s).getSmtp_send_set_daynum()+1);
  478 +//
  479 +// /**更新后缀已发量记录*/
  480 +// smtpsendsetList.set(s,smtpsendsetList.get(s));
  481 +//
  482 +// continue address;
  483 +// }else{
  484 +// break smtpset;
  485 +// }
  486 +// }
  487 +// }
  488 +// /**循环完后未存在的则新建一条*/
  489 +// if(!isexist){
  490 +// /**添加该后缀的配置信息*/
  491 +// YxySmtpSendSet o=new YxySmtpSendSet();
  492 +// o.setSmtp_send_set_service(smtpService);
  493 +// o.setSmtp_send_set_suffix(addrSuffix);
  494 +// o.setSmtp_send_set_tendate(currDate);
  495 +// o.setSmtp_send_set_hourdate(currDate);
  496 +// o.setSmtp_send_set_daydate(nowDay);
  497 +// o.setSmtp_send_set_daynum(1);
  498 +// o.setSmtp_send_set_hournum(1);
  499 +// o.setSmtp_send_set_tennum(1);
  500 +// /**将新的后缀量加入集合中*/
  501 +// smtpsendsetList.add(o);
  502 +//
  503 +//
  504 +// sendAddress.add(havehouzhui.get(m));
  505 +//
  506 +// }
  507 +// }
  508 +// //更新各个后缀信息的发送量
  509 +// synchronized (SendMailTimer.nowtimer) {
  510 +// YxySendMailService.updateSmtpSet(smtpsendsetList);
  511 +// }
  512 +// if(sendAddress.size()>0){
  513 +// //调用发邮件方法
  514 +// send.sendMailMethod(sendAddress,YxySendMailService,SmtpInfo,mailinfo,props,transport);
  515 +// }
  516 +// }
  517 +//
  518 +// }
  519 +// }
  520 + }else{
  521 + System.out.println("服务器:"+SmtpInfo.getSmtp_service_id()+"验证不通过");
  522 + }
  523 + }
  524 +
  525 + } catch (Exception e) {
  526 + e.printStackTrace();
  527 + //写入日志
  528 + StringWriter sw = new StringWriter();
  529 + e.printStackTrace(new PrintWriter(sw, true));
  530 + String str = sw.toString();
  531 + LogsTool.erroLogs(str);
  532 + }
  533 + }
  534 +
  535 +
  536 + /** 连接邮件服务器,验证用户名,密码*/
  537 + public static List<Object> connectionService(String host,String servername,String serverpaswd,int isssl,String port) {
  538 + List<Object> result=new ArrayList<Object>();
  539 + result.add(0);
  540 + result.add(0);
  541 + result.add(0);
  542 +
  543 + Properties props =new Properties();
  544 + Transport transport =null;
  545 +
  546 + props.put("mail.smtp.host", host);
  547 + props.put("mail.smtp.auth", "true");/** 设定发送邮件时需要进行身份验证*/
  548 + javax.mail.Session mailSession = javax.mail.Session.getInstance(props);
  549 + mailSession.setDebug(false);
  550 + //判断是否需要ssl验证
  551 + String ishost=host.split("\\.")[1];
  552 + if(isssl==1){
  553 + if("gmail".equals(ishost)){
  554 + props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
  555 + props.put("mail.smtp.socketFactory.fallback", "false");
  556 + props.put("mail.smtp.port", port);
  557 + props.put("mail.smtp.socketFactory.port", port);
  558 + }else{
  559 + props.put("mail.smtp.starttls.enable","true");
  560 + props.put("mail.smtp.port", port);
  561 + }
  562 + }
  563 + try {
  564 + //解密密码
  565 + DES_Encrypt desEncrypt = new DES_Encrypt();
  566 + desEncrypt.setKey("06");
  567 + desEncrypt.setDesString(serverpaswd);
  568 + serverpaswd=desEncrypt.getStrM();//smtp密码需要解密
  569 +
  570 + transport = mailSession.getTransport("smtp");
  571 + transport.connect(host, servername, serverpaswd);
  572 +
  573 + result.set(0, 1);
  574 + result.set(1, props);
  575 + result.set(2, transport);
  576 + } catch (Exception e) {
  577 + //写入日志
  578 + StringWriter sw = new StringWriter();
  579 + e.printStackTrace(new PrintWriter(sw, true));
  580 + String str = sw.toString();
  581 + LogsTool.erroLogs("服务器:"+host+","+servername+","+str);
  582 + //e.printStackTrace();
  583 + System.out.println("验证失败");
  584 + }
  585 + return result;
  586 + }
  587 +}
  1 +package com.espeed.yxy.dao.impl;
  2 +
  3 +import java.util.List;
  4 +import com.espeed.yxy.dao.YxySendCountDao;
  5 +import com.espeed.yxy.pojo.YxySendCount;
  6 +/**
  7 + * 客户发送邮件的统计Dao实现类
  8 + * @author 陈南巧
  9 + */
  10 +public class YxySendCountDaoImpl extends HibernateBaseDAOImpl<YxySendCount, Long> implements YxySendCountDao{
  11 + /**实体插入*/
  12 + public int addPojo(YxySendCount o)throws Exception{
  13 + return super.add(o);
  14 + }
  15 + /**实体编辑*/
  16 + public void updatePojo(YxySendCount o)throws Exception{
  17 + super.update(o);
  18 + }
  19 + /**HQL查询*/
  20 + public List<YxySendCount> findByHql(String hql)throws Exception{
  21 + return super.getAll(hql);
  22 + }
  23 + /**指定条记录*/
  24 + public List<YxySendCount> findByHqlSet(String hql,int num)throws Exception{
  25 + return super.findBySet(hql, num);
  26 + }
  27 + /**SQL查询*/
  28 + public List<Object> findBySqlQuery(String sql)throws Exception{
  29 + return super.findBySql(sql);
  30 + }
  31 + /**HQL更新*/
  32 + public void updateByHql(String hql)throws Exception{
  33 + super.updateorDelByHql(hql);
  34 + }
  35 +
  36 + /**HQL数量查询*/
  37 + public int findByHqlCount(String hql)throws Exception{
  38 + return super.count(hql);
  39 + }
  40 +}
  1 +package com.espeed.yxy.dao.impl;
  2 +
  3 +import java.util.List;
  4 +
  5 +import com.espeed.yxy.dao.YxySendMailMasterDao;
  6 +import com.espeed.yxy.pojo.YxySendMailMaster;
  7 +/**
  8 + * 程序名称: EspeedMail_时速邮箱
  9 + * 程序版本: V1.0
  10 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776)
  11 + * 版权所有: 深圳市科飞时速网络技术有限公司
  12 + * 技术支持: Tech@21gmail.com
  13 + * 单元名称: 待发邮件DAO实现类
  14 + * 开始时间: 2013.11.27
  15 + * 程 序 员: 谢勇
  16 + * 最后修改:
  17 + * 备 注: 如需修改请通知程序员
  18 + */
  19 +public class YxySendMailMasterDaoImpl extends HibernateBaseDAOImpl<YxySendMailMaster, Long> implements YxySendMailMasterDao{
  20 +
  21 + /**批量插入*/
  22 + public void addPiPojo(List<YxySendMailMaster> o)throws Exception{
  23 + super.addPi(o);
  24 + }
  25 +
  26 + /**实体添加*/
  27 + public int addPojo(YxySendMailMaster o)throws Exception{
  28 + return super.add(o);
  29 + }
  30 +
  31 + /**HQL查询*/
  32 + public List<YxySendMailMaster> findByHql(String hql)throws Exception{
  33 + return super.getAll(hql);
  34 + }
  35 +
  36 + /**SQL查询*/
  37 + public List<Object> findbysql(String sql)throws Exception{
  38 + return super.findBySql(sql);
  39 + }
  40 +
  41 + /**SQL更新*/
  42 + public void updateBySql(String sql)throws Exception{
  43 + super.updateorDelBySql(sql);
  44 + }
  45 +
  46 + /**HQL更新*/
  47 + public void updateByHql(String hql)throws Exception{
  48 + super.updateorDelByHql(hql);
  49 + }
  50 +
  51 +// /**查询所有可用待发邮件*/
  52 +// public List<YxySendMailMaster> findByMailNum() throws Exception {
  53 +// String hql="from YxySendMailMaster where (status=0 or status=2) and exptionnum<=3 and isuse=0 order by result_remark";
  54 +// return super.getAll(hql);
  55 +// }
  56 +// /**添加修改邮件状态*/
  57 +// public void updateMaster(YxySendMailMaster o) throws Exception {
  58 +// super.update(o);
  59 +// }
  60 +// /**更新base表为已发送状态*/
  61 +// public void updateMasterBase(String sql) throws Exception {
  62 +// super.updateorDelBysql(sql);
  63 +// }
  64 +// /**HQL查询*/
  65 +// public List findByHql(String hql) throws Exception {
  66 +// return super.getAll(hql);
  67 +// }
  68 +//
  69 +// /**HQL修改*/
  70 +// public int updateByHql(String hql) throws Exception {
  71 +// return super.updateorDelBySql(hql);
  72 +// }
  73 +
  74 +
  75 +}
  1 +package com.espeed.yxy.tool;
  2 +
  3 +import java.util.Random;
  4 +
  5 +/***
  6 + *
  7 + * @author xieyong
  8 + * 获取随即码
  9 + */
  10 +public class GetRandom {
  11 +
  12 + //生成随机码
  13 + public static String getRandomString(int length) throws Exception{ //length表示生成字符串的长度
  14 + String base = "abcdefghijklmnopqrstuvwxyz0123456789"; //生成字符串从此序列中取
  15 + Random random = new Random();
  16 + StringBuffer sb = new StringBuffer();
  17 + for (int i = 0; i < length; i++) {
  18 + int number = random.nextInt(base.length());
  19 + sb.append(base.charAt(number));
  20 + }
  21 + return sb.toString();
  22 + }
  23 +}
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +
  3 +<!--
  4 + 共有方法,负责所有共有配置文件
  5 +-->
  6 +<beans xmlns="http://www.springframework.org/schema/beans"
  7 + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  8 + xmlns:aop="http://www.springframework.org/schema/aop"
  9 + xmlns:tx="http://www.springframework.org/schema/tx"
  10 + xsi:schemaLocation="
  11 + http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
  12 + http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
  13 + http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
  14 +<!-- hibernate注入 -->
  15 + <!-- 1、配置C3P0,数据源 -->
  16 + <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
  17 + <property name="driverClassName">
  18 + <value>com.mysql.jdbc.Driver</value>
  19 + </property>
  20 + <property name="url">
  21 + <value>jdbc:mysql://localhost:3306/yxybase?useUnicode=true&amp;characterEncoding=utf8&amp;autoReconnect=true</value>
  22 + </property>
  23 + <property name="username">
  24 + <value>root</value>
  25 + </property>
  26 + <property name="password">
  27 + <value>sz1234567890</value>
  28 + </property>
  29 +
  30 + <property name="maxActive" value="300"/>
  31 +
  32 + <property name="maxIdle" value="50"/>
  33 +
  34 + <property name="initialSize" value="100"/>
  35 +
  36 + <property name="maxWait" value="1000"/>
  37 +
  38 + <property name="defaultAutoCommit" value="true"/>
  39 +
  40 + <property name="removeAbandoned" value="true"/>
  41 +
  42 + <property name="removeAbandonedTimeout" value="60"/>
  43 +
  44 + <property name="logAbandoned" value="true"/>
  45 +
  46 + <property name="minEvictableIdleTimeMillis" value="10000"/>
  47 + <property name="validationQuery" value="SELECT NOW() FROM DUAL"/>
  48 +
  49 + </bean>
  50 +
  51 + <!-- 2、配置sessionFactory -->
  52 + <bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
  53 + <!-- 数据源注入 -->
  54 + <property name="dataSource" ref="dataSource" />
  55 + <property name="packagesToScan">
  56 + <list>
  57 + <value>com.espeed.yxy.pojo</value>
  58 + </list>
  59 + </property>
  60 + <property name="hibernateProperties">
  61 + <props>
  62 + <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
  63 + <prop key="hibernate.show_sql">false</prop>
  64 +
  65 + <!-- 如果开启, Hibernate将收集有助于性能调节的统计数据. 取值 true | false -->
  66 + <prop key="hibernate.generate_statistics">true</prop>
  67 + <!-- 指定Hibernate在何时释放JDBC连接. -->
  68 + <prop key="hibernate.connetion.release_mode">auto</prop>
  69 + </props>
  70 + </property>
  71 + </bean>
  72 +
  73 +
  74 +
  75 + <!--3、配置spring事务(AOP) -->
  76 + <!-- 事务管理器 -->
  77 + <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
  78 + <property name="sessionFactory" ref="sessionFactory" />
  79 + </bean>
  80 +
  81 + <!-- 事务的传播特性(propagation) -->
  82 + <tx:advice id="txAdvice" transaction-manager="transactionManager">
  83 + <tx:attributes>
  84 + <tx:method name="del*"/>
  85 + <tx:method name="save*" />
  86 + <tx:method name="update*" />
  87 + <tx:method name="add*" />
  88 + <tx:method name="get*" propagation="SUPPORTS" read-only="true"/>
  89 + <tx:method name="load*" propagation="SUPPORTS" read-only="true"/>
  90 + <tx:method name="list*" propagation="SUPPORTS" read-only="true"/>
  91 + <tx:method name="*" propagation="SUPPORTS" read-only="true"/>
  92 + </tx:attributes>
  93 + </tx:advice>
  94 + <!-- 配置哪些类哪些方法具有事务 ,采用AOP-->
  95 + <aop:config>
  96 + <aop:pointcut expression="execution(* com.espeed.service.*.*(..))" id="allMethod"/>
  97 + <aop:advisor pointcut-ref="allMethod" advice-ref="txAdvice"/>
  98 + </aop:config>
  99 + <!-- 注入SpringFactory类 -->
  100 + <bean id="springfactory" class="com.espeed.yxy.tool.SpringFactory">
  101 + </bean>
  102 + <!-- POJO配置 -->
  103 + <!--待发邮件实体-->
  104 + <bean id="yxysendmailmaster" class="com.espeed.yxy.pojo.YxySendMailMaster"></bean>
  105 + <!--待发邮件地址实体-->
  106 + <bean id="yxysendmaildetail" class="com.espeed.yxy.pojo.YxySendMailDetail"></bean>
  107 + <!--smtp实体-->
  108 + <bean id="yxysendsmtpinfo" class="com.espeed.yxy.pojo.YxySendSmtpInfo"></bean>
  109 +</beans>
  1 +package com.espeed.yxy.dao.impl;
  2 +
  3 +import java.io.Serializable;
  4 +import java.sql.Connection;
  5 +import java.sql.PreparedStatement;
  6 +import java.sql.ResultSet;
  7 +import java.util.List;
  8 +import org.hibernate.Query;
  9 +import org.hibernate.Session;
  10 +import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
  11 +
  12 +import com.espeed.yxy.dao.HibernateBaseDAO;
  13 +/**
  14 + * 程序名称: EspeedMail_时速邮箱
  15 + * 程序版本: V1.0
  16 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776)
  17 + * 版权所有: 深圳市科飞时速网络技术有限公司
  18 + * 技术支持: Tech@21gmail.com
  19 + * 单元名称: hbernate常用方法(营销邮)
  20 + * 开始时间: 2013.11.27
  21 + * 程 序 员: 谢勇
  22 + * 最后修改:
  23 + * 备 注: 如需修改请通知程序员
  24 + */
  25 +public abstract class HibernateBaseDAOImpl<T extends Serializable ,Pk extends Serializable> extends HibernateDaoSupport implements HibernateBaseDAO<T, Pk> {
  26 + private Connection conn;
  27 + private PreparedStatement pst;
  28 + private ResultSet rs;
  29 +
  30 + /**增加记录 (返回新增加记录的主键)*/
  31 + public int add(T o) throws Exception {
  32 + return (Integer) super.getHibernateTemplate().save(o);
  33 +
  34 + }
  35 +
  36 +
  37 + /**修改记录*/
  38 + public void update(T o) throws Exception {
  39 + super.getHibernateTemplate().update(o);
  40 + }
  41 + /**删除记录*/
  42 + public void del(T o) throws Exception {
  43 + super.getHibernateTemplate().delete(o);
  44 + }
  45 +
  46 + /**添加或更新*/
  47 + public void saveOrUpdate(T o) throws Exception {
  48 + super.getHibernateTemplate().saveOrUpdate(o);
  49 + }
  50 + /**根据ID获取一条数据*/
  51 + @SuppressWarnings("unchecked")
  52 + public T get(Class<T> t,Pk pk) throws Exception {
  53 + return (T) super.getHibernateTemplate().get(t, pk);
  54 + }
  55 + /**根据ID获取一条数据*/
  56 + @SuppressWarnings("unchecked")
  57 + public T load(Class<T> t,Pk pk) throws Exception {
  58 + return (T) super.getHibernateTemplate().load(t, pk);
  59 + }
  60 + /**根据hql进行条件查询*/
  61 + @SuppressWarnings("unchecked")
  62 + public List<T> getAll(String hql) throws Exception {
  63 + return super.getHibernateTemplate().find(hql);
  64 + }
  65 + /**条件查询*/
  66 + @SuppressWarnings("unchecked")
  67 + public List<T> getAll(String whereHql, Object... params) throws Exception {
  68 + return super.getHibernateTemplate().find(whereHql,params);
  69 + }
  70 + /*
  71 + * -------------------------------查询总记录数-----------------------------------------
  72 + */
  73 + /**根据条件查询总记录*/
  74 + public int count(String hql) throws Exception {
  75 + return Integer.valueOf(super.getHibernateTemplate().find(hql).get(0).toString());
  76 + }
  77 + /**根据条件和参数查询总记录*/
  78 + public int count(String hql, Object... params) throws Exception {
  79 + return Integer.valueOf(super.getHibernateTemplate().find(hql,params).get(0).toString());
  80 + }
  81 +
  82 + /**hql语句修改删除记录*/
  83 + public int updateorDelByHql(String hql){
  84 + Session session = super.getHibernateTemplate().getSessionFactory().openSession();
  85 + try {
  86 + Query query = session.createQuery(hql);
  87 + return query.executeUpdate();
  88 + } catch (Exception e) {
  89 + e.printStackTrace();
  90 + return 0;
  91 + }finally{
  92 + if(session!=null){
  93 + session.clear();
  94 + session.close();
  95 + }
  96 +
  97 + }
  98 + }
  99 +
  100 + /**sql语句修改删除记录*/
  101 + public int updateorDelBySql(String sql)throws Exception{
  102 + Session session = super.getHibernateTemplate().getSessionFactory().openSession();
  103 + try {
  104 + Query query = session.createSQLQuery(sql);
  105 + return query.executeUpdate();
  106 + } catch (Exception e) {
  107 + e.printStackTrace();
  108 + return 0;
  109 + }finally{
  110 + if(session!=null){
  111 + session.clear();
  112 + session.close();
  113 + }
  114 + }
  115 +
  116 + }
  117 +
  118 + /**查询设定的记录条数据*/
  119 + public List<T> findBySet(String hql,int num)throws Exception{
  120 + Session session = super.getHibernateTemplate().getSessionFactory().openSession();
  121 + try {
  122 + Query query = session.createQuery(hql);
  123 + query.setMaxResults(num);
  124 + return query.list();
  125 + } catch (Exception e) {
  126 + e.printStackTrace();
  127 + return null;
  128 + }finally{
  129 + if(session!=null){
  130 + session.clear();
  131 + session.close();
  132 + }
  133 + }
  134 +
  135 +
  136 + }
  137 +
  138 + /**批量插入*/
  139 + public void addPi(List<T> o){
  140 + if(o!=null){
  141 + Session session = super.getHibernateTemplate().getSessionFactory().openSession();
  142 + try {
  143 +
  144 + session.beginTransaction();
  145 + for(int i=0;i<o.size();i++){
  146 + session.saveOrUpdate(o.get(i));
  147 + }
  148 + session.beginTransaction().commit();
  149 + } catch (Exception e) {
  150 + e.printStackTrace();
  151 + session.beginTransaction().rollback();
  152 + }finally{
  153 + session.flush();
  154 + session.clear();
  155 + session.close();
  156 + }
  157 + }
  158 + }
  159 +
  160 + /**批量更新*/
  161 + public void updatePi(List<T> o) throws Exception{
  162 + if(o!=null){
  163 + Session session = super.getHibernateTemplate().getSessionFactory().openSession();
  164 + try {
  165 +
  166 + session.beginTransaction();
  167 + for(int i=0;i<o.size();i++){
  168 + session.update(o.get(i));
  169 + }
  170 + session.beginTransaction().commit();
  171 +
  172 +
  173 + } catch (Exception e) {
  174 + e.printStackTrace();
  175 + session.beginTransaction().rollback();
  176 + }finally{
  177 + session.flush();
  178 + session.clear();
  179 + session.close();
  180 + }
  181 + }
  182 + }
  183 +
  184 +
  185 + /**批量更新*/
  186 + public void saveandupdatePi(List<T> o) throws Exception{
  187 + if(o!=null){
  188 + Session session = super.getHibernateTemplate().getSessionFactory().openSession();
  189 + try {
  190 +
  191 + session.beginTransaction();
  192 + for(int i=0;i<o.size();i++){
  193 + session.saveOrUpdate(o.get(i));
  194 + }
  195 + session.beginTransaction().commit();
  196 +
  197 +
  198 + } catch (Exception e) {
  199 + e.printStackTrace();
  200 + session.beginTransaction().rollback();
  201 + }finally{
  202 + session.flush();
  203 + session.clear();
  204 + session.close();
  205 + }
  206 + }
  207 + }
  208 +
  209 + /**sql语句查询*/
  210 + public List findBySql(String sql){
  211 + Session session=null;
  212 + try {
  213 + session =super.getHibernateTemplate().getSessionFactory().
  214 + openSession();
  215 + return session.createSQLQuery(sql).list();
  216 + } catch (Exception e) {
  217 + e.printStackTrace();
  218 + }finally{
  219 + if(session!=null){
  220 + session.clear();
  221 + session.close();
  222 + }
  223 + }
  224 + return null;
  225 + }
  226 +}
  1 +package com.espeed.yxy.dao;
  2 +
  3 +import java.util.List;
  4 +
  5 +import com.espeed.centre.pojo.CentreUser;
  6 +/**
  7 + * 项目名称: 统一验证中心系统
  8 + * 版权所有: 深圳市科飞时速网络技术有限公司(0755-88843776)
  9 + * 技术支持: info@21gmail.com
  10 + * 单元名称: 跟踪配置Dao
  11 + * 开始时间: 2018.04.08
  12 + * 开发人员: 陈南巧
  13 + */
  14 +public interface CentreUserDao {
  15 + /**实体插入*/
  16 + public int addPojo(CentreUser o)throws Exception;
  17 + /**实体编辑*/
  18 + public void updatePojo(CentreUser o)throws Exception;
  19 + /**HQL查询*/
  20 + public List<CentreUser> findByHql(String hql)throws Exception;
  21 + /**SQL查询*/
  22 + public List<Object> findBySqlFind(String sql)throws Exception;
  23 + /**HQL更新*/
  24 + public void updateByHql(String hql)throws Exception;
  25 + /**HQL查询数量*/
  26 + public int findByHqlCount(String hql)throws Exception;
  27 +}
  1 +package com.espeed.yxy.dao.impl;
  2 +
  3 +import java.util.List;
  4 +
  5 +import com.espeed.yxy.dao.YxySmtpSendSelfOversetDao;
  6 +import com.espeed.yxy.pojo.YxySendMailDetail;
  7 +import com.espeed.yxy.pojo.YxySmtpSendSelfOverset;
  8 +/**
  9 + * 程序名称: EspeedMail_时速邮箱
  10 + * 程序版本: V1.0
  11 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776)
  12 + * 版权所有: 深圳市科飞时速网络技术有限公司
  13 + * 技术支持: Tech@21gmail.com
  14 + * 单元名称: SMTP发送量 DAO实现类
  15 + * 开始时间: 2013.11.27
  16 + * 程 序 员: 谢勇
  17 + * 最后修改:
  18 + * 备 注: 如需修改请通知程序员
  19 + */
  20 +public class YxySmtpSendSelfOversetDaoImpl extends HibernateBaseDAOImpl<YxySmtpSendSelfOverset, Long> implements YxySmtpSendSelfOversetDao{
  21 +
  22 +// /**查询该账号的发送量信息*/
  23 +// public List<YxySmtpSendSelfOverset> findBySmtpAccount(String account)throws Exception {
  24 +// String hql="from YxySmtpSendSelfOverset where smtp_send_self_over_account='"+account+"'";
  25 +// return super.getAll(hql);
  26 +// }
  27 +// /**添加该账号的已发量信息*/
  28 +// public void addSendSelfSet(YxySmtpSendSelfOverset o) throws Exception {
  29 +// super.add(o);
  30 +//
  31 +// }
  32 +// /**更新已发量*/
  33 +// public void updateSendSelfSet(YxySmtpSendSelfOverset o) throws Exception {
  34 +// super.update(o);
  35 +//
  36 +// }
  37 +
  38 + /**批量插入*/
  39 + public void addPiPojo(List<YxySmtpSendSelfOverset> o)throws Exception{
  40 + super.addPi(o);
  41 + }
  42 +
  43 + /**实体添加*/
  44 + public int addPojo(YxySmtpSendSelfOverset o)throws Exception{
  45 + return super.add(o);
  46 + }
  47 +
  48 + /**HQL查询*/
  49 + public List<YxySmtpSendSelfOverset> findByHql(String hql)throws Exception{
  50 + return super.getAll(hql);
  51 + }
  52 +
  53 + /**SQL查询*/
  54 + public List<Object> findbysql(String sql)throws Exception{
  55 + return super.findBySql(sql);
  56 + }
  57 +
  58 + /**SQL更新*/
  59 + public void updateBySql(String sql)throws Exception{
  60 + super.updateorDelBySql(sql);
  61 + }
  62 +
  63 + /**HQL更新*/
  64 + public void updateByHql(String hql)throws Exception{
  65 + super.updateorDelByHql(hql);
  66 + }
  67 +}
  1 +package com.espeed.yxy.pojo;
  2 +
  3 +import java.io.Serializable;
  4 +
  5 +import javax.persistence.Entity;
  6 +import javax.persistence.GeneratedValue;
  7 +import javax.persistence.GenerationType;
  8 +import javax.persistence.Id;
  9 +import javax.persistence.Table;
  10 +/**
  11 + * 程序名称: EspeedMail_时速邮箱
  12 + * 程序版本: V1.0
  13 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776)
  14 + * 版权所有: 深圳市科飞时速网络技术有限公司
  15 + * 技术支持: Tech@21gmail.com
  16 + * 单元名称: smtp自配最大发送量实体(营销游)
  17 + * 开始时间: 2013.12.09
  18 + * 程 序 员: 谢勇
  19 + * 最后修改:
  20 + * 备 注: 如需修改请通知程序员
  21 + */
  22 +
  23 +@Entity
  24 +@Table(name="yxy_smtp_send_self_set")
  25 +public class YxySmtpSendSelfSet implements Serializable{
  26 +
  27 + private int smtp_send_self_set_id;//自配smtp发送量限制id
  28 + private String smtp_send_self_set_account;//服务器账号
  29 + private int smtp_send_self_set_tennum;//10分钟最大发送量
  30 + private int smtp_send_self_set_hournum;//60分钟最大发送量
  31 + private int smtp_send_self_set_daynum;//一天最大发送量
  32 +
  33 + @Id
  34 + @GeneratedValue(strategy=GenerationType.AUTO)
  35 + public int getSmtp_send_self_set_id() {
  36 + return smtp_send_self_set_id;
  37 + }
  38 + public void setSmtp_send_self_set_id(int smtpSendSelfSetId) {
  39 + smtp_send_self_set_id = smtpSendSelfSetId;
  40 + }
  41 + public int getSmtp_send_self_set_tennum() {
  42 + return smtp_send_self_set_tennum;
  43 + }
  44 + public void setSmtp_send_self_set_tennum(int smtpSendSelfSetTennum) {
  45 + smtp_send_self_set_tennum = smtpSendSelfSetTennum;
  46 + }
  47 + public int getSmtp_send_self_set_hournum() {
  48 + return smtp_send_self_set_hournum;
  49 + }
  50 + public void setSmtp_send_self_set_hournum(int smtpSendSelfSetHournum) {
  51 + smtp_send_self_set_hournum = smtpSendSelfSetHournum;
  52 + }
  53 + public int getSmtp_send_self_set_daynum() {
  54 + return smtp_send_self_set_daynum;
  55 + }
  56 + public void setSmtp_send_self_set_daynum(int smtpSendSelfSetDaynum) {
  57 + smtp_send_self_set_daynum = smtpSendSelfSetDaynum;
  58 + }
  59 + public String getSmtp_send_self_set_account() {
  60 + return smtp_send_self_set_account;
  61 + }
  62 + public void setSmtp_send_self_set_account(String smtpSendSelfSetAccount) {
  63 + smtp_send_self_set_account = smtpSendSelfSetAccount;
  64 + }
  65 +
  66 +
  67 +
  68 +}
  1 +package com.espeed.webmail.pojo;
  2 +
  3 +import java.io.Serializable;
  4 +
  5 +import javax.persistence.Entity;
  6 +import javax.persistence.GeneratedValue;
  7 +import javax.persistence.GenerationType;
  8 +import javax.persistence.Id;
  9 +import javax.persistence.Table;
  10 +import javax.persistence.Transient;
  11 +
  12 +/**
  13 +*
  14 +* @项目名称: 科飞管理后台系统
  15 +* @版权所有: 深圳市科飞时速网络技术有限公司(0755-88843776)
  16 +* @技术支持: info@21gmail.com
  17 +* @单元名称: crm_customer_info表CrmCustomerInfo实体类
  18 +* @开始时间: 2018-09-27
  19 +* @开发人员: 杨志钊
  20 +*/
  21 +
  22 +@Entity
  23 +@Table(name = "crm_customer_info")
  24 +public class CrmCustomerInfo implements Serializable {
  25 +
  26 + private static final long serialVersionUID = 1L;
  27 +
  28 + private int id;//主键id
  29 +
  30 + private int customer_id;//客户id
  31 +
  32 + private String year_established;//公司成立时间
  33 +
  34 + private String business_type;//商业类型
  35 +
  36 + private String platforms_selling;//销售平台
  37 +
  38 + private String main_products;//主营产品
  39 +
  40 + private String operational_address;//经营地址
  41 +
  42 + private String joined_alibaba_time;//加入alibaba.com时间
  43 +
  44 + private String Inquiries_product;//询盘产品
  45 +
  46 + private String annual_purchasing_volume;//年采购额
  47 +
  48 + private String primary_sourcing_purpose;//采购目的
  49 +
  50 + private String average_sourcing_frequency;//平均采购频率
  51 +
  52 + private String preferred_supplier_qualifications;//偏好供应商类型
  53 +
  54 + private String preferred_industries;//偏好行业
  55 +
  56 + private String registered_years;//注册年限
  57 +
  58 + private String days_signed_in;//登录天数
  59 +
  60 + private String product_views;//产品浏览数
  61 +
  62 + private String searches;//搜索次数
  63 +
  64 + private String valid_inquiries_sentTo;//有效询盘数/ 回复询盘数
  65 +
  66 + private String spam_inquiries;//被标为垃圾询盘数
  67 +
  68 + private String valid_rfqs_submitted;//有效RFQ数
  69 +
  70 + private String quotations_receivedRead;//收到报价数/ 查看报价数
  71 +
  72 + private String listed_contact;//被添加联系人数
  73 +
  74 + private String add_blacklist;//被添加黑名单数
  75 +
  76 + private String recent_searches;//最近搜索词
  77 +
  78 + private String most_sourcing_industries;//最常采购行业
  79 +
  80 + private String latest_buying_requests;//最新采购需求,多个用###隔开
  81 +
  82 + private String latest_inquiries;//最近询盘产品,多个用###隔开
  83 +
  84 + private String create_time;//记录创建时间
  85 +
  86 + private String modify_time;//记录最后修改时间
  87 +
  88 + private String about_us;//关于我们
  89 +
  90 + @Id
  91 + @GeneratedValue(strategy=GenerationType.AUTO)
  92 + public int getId() {
  93 + return id;
  94 + }
  95 +
  96 + public void setId(int id) {
  97 + this.id = id;
  98 + }
  99 + public int getCustomer_id() {
  100 + return customer_id;
  101 + }
  102 +
  103 + public void setCustomer_id(int customer_id) {
  104 + this.customer_id = customer_id;
  105 + }
  106 + public String getYear_established() {
  107 + return year_established;
  108 + }
  109 +
  110 + public void setYear_established(String year_established) {
  111 + this.year_established = year_established;
  112 + }
  113 + public String getBusiness_type() {
  114 + return business_type;
  115 + }
  116 +
  117 + public void setBusiness_type(String business_type) {
  118 + this.business_type = business_type;
  119 + }
  120 + public String getPlatforms_selling() {
  121 + return platforms_selling;
  122 + }
  123 +
  124 + public void setPlatforms_selling(String platforms_selling) {
  125 + this.platforms_selling = platforms_selling;
  126 + }
  127 + public String getMain_products() {
  128 + return main_products;
  129 + }
  130 +
  131 + public void setMain_products(String main_products) {
  132 + this.main_products = main_products;
  133 + }
  134 + public String getOperational_address() {
  135 + return operational_address;
  136 + }
  137 +
  138 + public void setOperational_address(String operational_address) {
  139 + this.operational_address = operational_address;
  140 + }
  141 + public String getJoined_alibaba_time() {
  142 + return joined_alibaba_time;
  143 + }
  144 +
  145 + public void setJoined_alibaba_time(String joined_alibaba_time) {
  146 + this.joined_alibaba_time = joined_alibaba_time;
  147 + }
  148 + public String getInquiries_product() {
  149 + return Inquiries_product;
  150 + }
  151 +
  152 + public void setInquiries_product(String Inquiries_product) {
  153 + this.Inquiries_product = Inquiries_product;
  154 + }
  155 + public String getAnnual_purchasing_volume() {
  156 + return annual_purchasing_volume;
  157 + }
  158 +
  159 + public void setAnnual_purchasing_volume(String annual_purchasing_volume) {
  160 + this.annual_purchasing_volume = annual_purchasing_volume;
  161 + }
  162 + public String getPrimary_sourcing_purpose() {
  163 + return primary_sourcing_purpose;
  164 + }
  165 +
  166 + public void setPrimary_sourcing_purpose(String primary_sourcing_purpose) {
  167 + this.primary_sourcing_purpose = primary_sourcing_purpose;
  168 + }
  169 + public String getAverage_sourcing_frequency() {
  170 + return average_sourcing_frequency;
  171 + }
  172 +
  173 + public void setAverage_sourcing_frequency(String average_sourcing_frequency) {
  174 + this.average_sourcing_frequency = average_sourcing_frequency;
  175 + }
  176 + public String getPreferred_supplier_qualifications() {
  177 + return preferred_supplier_qualifications;
  178 + }
  179 +
  180 + public void setPreferred_supplier_qualifications(String preferred_supplier_qualifications) {
  181 + this.preferred_supplier_qualifications = preferred_supplier_qualifications;
  182 + }
  183 + public String getPreferred_industries() {
  184 + return preferred_industries;
  185 + }
  186 +
  187 + public void setPreferred_industries(String preferred_industries) {
  188 + this.preferred_industries = preferred_industries;
  189 + }
  190 + public String getRegistered_years() {
  191 + return registered_years;
  192 + }
  193 +
  194 + public void setRegistered_years(String registered_years) {
  195 + this.registered_years = registered_years;
  196 + }
  197 + public String getDays_signed_in() {
  198 + return days_signed_in;
  199 + }
  200 +
  201 + public void setDays_signed_in(String days_signed_in) {
  202 + this.days_signed_in = days_signed_in;
  203 + }
  204 + public String getProduct_views() {
  205 + return product_views;
  206 + }
  207 +
  208 + public void setProduct_views(String product_views) {
  209 + this.product_views = product_views;
  210 + }
  211 + public String getSearches() {
  212 + return searches;
  213 + }
  214 +
  215 + public void setSearches(String searches) {
  216 + this.searches = searches;
  217 + }
  218 + public String getValid_inquiries_sentTo() {
  219 + return valid_inquiries_sentTo;
  220 + }
  221 +
  222 + public void setValid_inquiries_sentTo(String valid_inquiries_sentTo) {
  223 + this.valid_inquiries_sentTo = valid_inquiries_sentTo;
  224 + }
  225 + public String getSpam_inquiries() {
  226 + return spam_inquiries;
  227 + }
  228 +
  229 + public void setSpam_inquiries(String spam_inquiries) {
  230 + this.spam_inquiries = spam_inquiries;
  231 + }
  232 + public String getValid_rfqs_submitted() {
  233 + return valid_rfqs_submitted;
  234 + }
  235 +
  236 + public void setValid_rfqs_submitted(String valid_rfqs_submitted) {
  237 + this.valid_rfqs_submitted = valid_rfqs_submitted;
  238 + }
  239 + public String getQuotations_receivedRead() {
  240 + return quotations_receivedRead;
  241 + }
  242 +
  243 + public void setQuotations_receivedRead(String quotations_receivedRead) {
  244 + this.quotations_receivedRead = quotations_receivedRead;
  245 + }
  246 + public String getListed_contact() {
  247 + return listed_contact;
  248 + }
  249 +
  250 + public void setListed_contact(String listed_contact) {
  251 + this.listed_contact = listed_contact;
  252 + }
  253 + public String getAdd_blacklist() {
  254 + return add_blacklist;
  255 + }
  256 +
  257 + public void setAdd_blacklist(String add_blacklist) {
  258 + this.add_blacklist = add_blacklist;
  259 + }
  260 + public String getRecent_searches() {
  261 + return recent_searches;
  262 + }
  263 +
  264 + public void setRecent_searches(String recent_searches) {
  265 + this.recent_searches = recent_searches;
  266 + }
  267 + public String getMost_sourcing_industries() {
  268 + return most_sourcing_industries;
  269 + }
  270 +
  271 + public void setMost_sourcing_industries(String most_sourcing_industries) {
  272 + this.most_sourcing_industries = most_sourcing_industries;
  273 + }
  274 + public String getLatest_buying_requests() {
  275 + return latest_buying_requests;
  276 + }
  277 +
  278 + public void setLatest_buying_requests(String latest_buying_requests) {
  279 + this.latest_buying_requests = latest_buying_requests;
  280 + }
  281 + public String getLatest_inquiries() {
  282 + return latest_inquiries;
  283 + }
  284 +
  285 + public void setLatest_inquiries(String latest_inquiries) {
  286 + this.latest_inquiries = latest_inquiries;
  287 + }
  288 + public String getCreate_time() {
  289 + return create_time;
  290 + }
  291 +
  292 + public void setCreate_time(String create_time) {
  293 + this.create_time = create_time;
  294 + }
  295 + public String getModify_time() {
  296 + return modify_time;
  297 + }
  298 +
  299 + public void setModify_time(String modify_time) {
  300 + this.modify_time = modify_time;
  301 + }
  302 +
  303 + @Transient
  304 + public String getAbout_us() {
  305 + return about_us;
  306 + }
  307 +
  308 + public void setAbout_us(String about_us) {
  309 + this.about_us = about_us;
  310 + }
  311 +
  312 + }
  1 +package com.espeed.centre.pojo;
  2 +
  3 +import java.io.Serializable;
  4 +import javax.persistence.Entity;
  5 +import javax.persistence.GeneratedValue;
  6 +import javax.persistence.GenerationType;
  7 +import javax.persistence.Id;
  8 +import javax.persistence.Table;
  9 +/**
  10 + * 项目名称: 统一验证中心系统
  11 + * 版权所有: 深圳市科飞时速网络技术有限公司(0755-88843776)
  12 + * 技术支持: info@21gmail.com
  13 + * 单元名称: 营销邮开发客户配置实体类
  14 + * 开始时间: 2018.04.08
  15 + * 开发人员: 陈南巧
  16 + */
  17 +@Entity
  18 +@Table(name="centre_yxyedm_newcustomer")
  19 +public class CentreYxyedmNewcustomer implements Serializable
  20 +{
  21 + private static final long serialVersionUID = 1L;
  22 + private int id;//主键id
  23 + private String sender_email;//发件人邮箱
  24 + private String reply_email;//回复人邮箱
  25 + private String sender_name;//发件人名称
  26 + private String allow_user;//指定营销人员,多个以逗号分割
  27 + private int company_id;//企业id
  28 + private String company_domain;//企业域名
  29 + private String domain;//域名
  30 + private int spf_status;//spf状态,0不可用,1可以用
  31 + private int mx_status;//mx状态,0不可用,1可以用
  32 + private int status;//状态,0不可用,1可以用
  33 + private int type;//类型,0自有域名,1待发模式
  34 + @Id
  35 + @GeneratedValue(strategy=GenerationType.AUTO)
  36 + public int getId() {
  37 + return id;
  38 + }
  39 + public void setId(int id) {
  40 + this.id = id;
  41 + }
  42 + public String getSender_email() {
  43 + return sender_email;
  44 + }
  45 + public void setSender_email(String sender_email) {
  46 + this.sender_email = sender_email;
  47 + }
  48 + public String getReply_email() {
  49 + return reply_email;
  50 + }
  51 + public void setReply_email(String reply_email) {
  52 + this.reply_email = reply_email;
  53 + }
  54 + public String getSender_name() {
  55 + return sender_name;
  56 + }
  57 + public void setSender_name(String sender_name) {
  58 + this.sender_name = sender_name;
  59 + }
  60 + public String getAllow_user() {
  61 + return allow_user;
  62 + }
  63 + public void setAllow_user(String allow_user) {
  64 + this.allow_user = allow_user;
  65 + }
  66 + public int getCompany_id() {
  67 + return company_id;
  68 + }
  69 + public void setCompany_id(int company_id) {
  70 + this.company_id = company_id;
  71 + }
  72 + public String getCompany_domain() {
  73 + return company_domain;
  74 + }
  75 + public void setCompany_domain(String company_domain) {
  76 + this.company_domain = company_domain;
  77 + }
  78 + public String getDomain() {
  79 + return domain;
  80 + }
  81 + public void setDomain(String domain) {
  82 + this.domain = domain;
  83 + }
  84 + public int getSpf_status() {
  85 + return spf_status;
  86 + }
  87 + public void setSpf_status(int spf_status) {
  88 + this.spf_status = spf_status;
  89 + }
  90 + public int getMx_status() {
  91 + return mx_status;
  92 + }
  93 + public void setMx_status(int mx_status) {
  94 + this.mx_status = mx_status;
  95 + }
  96 + public int getStatus() {
  97 + return status;
  98 + }
  99 + public void setStatus(int status) {
  100 + this.status = status;
  101 + }
  102 + public int getType() {
  103 + return type;
  104 + }
  105 + public void setType(int type) {
  106 + this.type = type;
  107 + }
  108 +}
  1 +package com.espeed.yxy.tool;
  2 +
  3 +import java.sql.Connection;
  4 +import java.sql.ResultSet;
  5 +import java.sql.SQLException;
  6 +import java.sql.Statement;
  7 +
  8 +import javax.sql.DataSource;
  9 +
  10 +/**
  11 + * 程序名称: EspeedMail_时速邮箱
  12 + * 程序版本: V1.0
  13 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776)
  14 + * 版权所有: 深圳市科飞时速网络技术有限公司
  15 + * 技术支持: Tech@21gmail.com
  16 + * 单元名称: 获取数据库连接的工具类
  17 + * 开始时间: 2013.10.1
  18 + * 程 序 员: 芮瑞
  19 + * 最后修改: 2014-02-25
  20 + * 备 注:用于从连接池中获取数据源,获取数据库连接
  21 + */
  22 +public class DBUtil
  23 +{
  24 + private static DataSource dataSource;
  25 +
  26 + //获得连接
  27 + public static Connection getConnection() throws SQLException
  28 + {
  29 + dataSource = (DataSource) SpringFactory.getObject("dataSource");
  30 +
  31 + return dataSource.getConnection();
  32 + }
  33 +
  34 +
  35 + /*
  36 + * 关闭数据库连接
  37 + */
  38 + public static void close(ResultSet rs,Statement st,Connection conn)
  39 + {
  40 +
  41 + if(rs!=null)
  42 + { try {
  43 + rs.close();
  44 + } catch (SQLException e) {
  45 + e.printStackTrace();
  46 + }finally{
  47 + if(st!=null){
  48 + try {
  49 + st.close();
  50 + } catch (SQLException e) {
  51 + e.printStackTrace();
  52 + }finally{
  53 + if(conn!=null){
  54 + try {
  55 + conn.close();
  56 + } catch (SQLException e) {
  57 + e.printStackTrace();
  58 + }
  59 + }
  60 + }
  61 + }
  62 + }
  63 + }
  64 + }
  65 + public static void main(String[] args) throws SQLException
  66 + {
  67 + System.out.println(DBUtil.getConnection());
  68 + }
  69 +
  70 +
  71 +
  72 +
  73 +}
  74 +
  1 +package com.espeed.plan;
  2 +
  3 +import java.util.ArrayList;
  4 +import java.util.List;
  5 +import java.util.Properties;
  6 +
  7 +import javax.mail.Transport;
  8 +
  9 +import com.espeed.yxy.pojo.YxyMarketingPlan;
  10 +import com.espeed.yxy.pojo.YxySendSmtpInfo;
  11 +import com.espeed.yxy.pojo.YxyUserAddress;
  12 +import com.espeed.yxy.service.YxyMarketingPlanService;
  13 +import com.espeed.yxy.service.YxySendMailService;
  14 +import com.espeed.yxy.tool.DES_Encrypt;
  15 +
  16 +/***
  17 + *
  18 + * @author 谢勇
  19 + * 计划执行类
  20 + *
  21 + */
  22 +public class PlanRunClass {
  23 +
  24 + public void planrun(YxyMarketingPlanService planservice,YxySendMailService mailservice,YxySendSmtpInfo smtpinfo,YxyMarketingPlan planinfo){
  25 + try {
  26 + //判断此计划是否有地址
  27 + int addressgroupid=planinfo.getPlan_groupid();
  28 + String loginid = planinfo.getLoginid();//账号
  29 + String domain = planinfo.getDomain();//域名
  30 + int plan_differen = planinfo.getPlan_differen();//区分客户的本地和CRM库 0:本地 1:CRM
  31 +
  32 + //SMTP参数
  33 + String host=smtpinfo.getSmtp_service_number();//服务器
  34 + String account=smtpinfo.getSmtp_service_account();//账号
  35 + String password=smtpinfo.getSmtp_service_password();//密码
  36 + int isssl=smtpinfo.getSmtp_is_ssl();//是否SSL加密
  37 + String port=smtpinfo.getSmtp_service_port();//端口号
  38 +
  39 + //查询地址
  40 + List<YxyUserAddress> addresslist=planservice.findAddressByGroupid(addressgroupid,plan_differen,loginid,domain,planinfo.getOther_name());
  41 + if(addresslist.size()>0){
  42 + List<Object> isTong=connectionService(host,account,password,isssl,port);
  43 + if(isTong.get(0).toString().equals("1")){
  44 +
  45 + }else{
  46 + System.out.println("服务器验证失败!");
  47 + }
  48 + }
  49 +
  50 +
  51 +
  52 + } catch (Exception e) {
  53 + e.printStackTrace();
  54 + }
  55 + }
  56 +
  57 + /** 连接邮件服务器,验证用户名,密码*/
  58 + public static List<Object> connectionService(String host,String servername,String serverpaswd,int isssl,String port) {
  59 + List<Object> result=new ArrayList<Object>();
  60 + result.add(0);
  61 + result.add(0);
  62 + result.add(0);
  63 +
  64 + Properties props =new Properties();
  65 + Transport transport =null;
  66 +
  67 + props.put("mail.smtp.host", host);
  68 + props.put("mail.smtp.auth", "true");/** 设定发送邮件时需要进行身份验证*/
  69 + javax.mail.Session mailSession = javax.mail.Session.getInstance(props);
  70 + mailSession.setDebug(false);
  71 + //判断是否需要ssl验证
  72 + String ishost=host.split("\\.")[1];
  73 + if(isssl==1){
  74 + if("gmail".equals(ishost)){
  75 + props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
  76 + props.put("mail.smtp.socketFactory.fallback", "false");
  77 + props.put("mail.smtp.port", port);
  78 + props.put("mail.smtp.socketFactory.port", port);
  79 + }else{
  80 + props.put("mail.smtp.starttls.enable","true");
  81 + props.put("mail.smtp.port", port);
  82 + }
  83 + }
  84 + try {
  85 + //解密密码
  86 + DES_Encrypt desEncrypt = new DES_Encrypt();
  87 + desEncrypt.setKey("06");
  88 + desEncrypt.setDesString(serverpaswd);
  89 + serverpaswd=desEncrypt.getStrM();//smtp密码需要解密
  90 +
  91 + transport = mailSession.getTransport("smtp");
  92 + transport.connect(host, servername, serverpaswd);
  93 +
  94 + result.set(0, 1);
  95 + result.set(1, props);
  96 + result.set(2, transport);
  97 + } catch (Exception e) {
  98 + e.printStackTrace();
  99 + System.out.println("验证失败");
  100 + }
  101 + return result;
  102 + }
  103 +}
  1 +package com.espeed.yxy.tool;
  2 +
  3 +import java.sql.CallableStatement;
  4 +import java.sql.Connection;
  5 +import java.sql.PreparedStatement;
  6 +import java.sql.ResultSet;
  7 +
  8 +import javax.servlet.http.HttpServlet;
  9 +
  10 +public class ServiceInit extends HttpServlet{
  11 +
  12 + private Connection conn;
  13 + private ResultSet rs;
  14 + private PreparedStatement pst;
  15 +
  16 + //项目初始化
  17 + public void init(){
  18 + //更新待发邮件状态
  19 + try {
  20 + //获取数据库链接
  21 + conn=DBUtil.getConnection();
  22 + String sql="update yxy_send_mail_master set isuse=0";
  23 + pst=conn.prepareStatement(sql);
  24 + pst.executeUpdate();
  25 +
  26 + System.out.println("服务启动初始化成功!");
  27 + } catch (Exception e) {
  28 + System.out.println("服务启动初始化失败!");
  29 + }finally{
  30 + DBUtil.close(rs, pst, conn);
  31 + }
  32 + }
  33 +}
  1 +package com.espeed.yxy.tool;
  2 +import java.io.BufferedReader;
  3 +import java.io.ByteArrayOutputStream;
  4 +import java.io.File;
  5 +import java.io.FileInputStream;
  6 +import java.io.FileOutputStream;
  7 +import java.io.IOException;
  8 +import java.io.InputStream;
  9 +import java.io.InputStreamReader;
  10 +import java.io.ObjectInputStream;
  11 +import java.io.ObjectOutputStream;
  12 +import java.io.OutputStream;
  13 +import java.security.Key;
  14 +import java.security.SecureRandom;
  15 +import javax.crypto.Cipher;
  16 +import javax.crypto.CipherInputStream;
  17 +import javax.crypto.CipherOutputStream;
  18 +import javax.crypto.KeyGenerator;
  19 +import javax.crypto.SecretKey;
  20 +import javax.crypto.SecretKeyFactory;
  21 +import javax.crypto.spec.DESKeySpec;
  22 +
  23 +import sun.misc.BASE64Decoder;
  24 +import sun.misc.BASE64Encoder;
  25 +/**
  26 + * 程序名称: EspeedMail_时速邮箱
  27 + * 程序版本: V1.0
  28 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776)
  29 + * 版权所有: 深圳市科飞时速网络技术有限公司
  30 + * 技术支持: Tech@21gmail.com
  31 + * 单元名称: DES加密工具类(营销游)
  32 + * 开始时间: 2013.12.09
  33 + * 程 序 员: 谢勇
  34 + * 最后修改:
  35 + * 备 注: 如需修改请通知程序员
  36 + */
  37 +public class Encrypt {
  38 + /** 密钥算法*/
  39 + private static final String KEY_ALGORITHM = "DES";
  40 + private static final String DEFAULT_CIPHER_ALGORITHM = "DES/ECB/PKCS5Padding";
  41 +
  42 + static byte[] byteArray=null;
  43 + /** 初始化密钥*/
  44 + public static byte[] initSecretKey() throws Exception{
  45 + //返回生成指定算法的秘密密钥的 KeyGenerator 对象
  46 + KeyGenerator kg = KeyGenerator.getInstance("DES");
  47 + //初始化此密钥生成器,使其具有确定的密钥大小
  48 + kg.init(56);
  49 + //生成一个密钥
  50 + SecretKey secretKey = kg.generateKey();
  51 + byteArray=secretKey.getEncoded();
  52 + return secretKey.getEncoded();
  53 + }
  54 +
  55 + /**转换密钥*/
  56 + private static Key toKey() throws Exception{
  57 + //实例化DES密钥规则
  58 + DESKeySpec dks = new DESKeySpec(byteArray);
  59 + //实例化密钥工厂
  60 + SecretKeyFactory skf = SecretKeyFactory.getInstance("DES");
  61 + //生成密钥 ,工厂中对密钥进行处理加工
  62 + SecretKey secretKey = skf.generateSecret(dks);
  63 + return secretKey;
  64 + }
  65 +
  66 + /**获得密钥*/
  67 + public static Key getKey() throws Exception {
  68 + Key kp =toKey();
  69 + return kp;
  70 + }
  71 +
  72 +
  73 +/**文件加密需要传入一个流跟一个文件保存的路径*/
  74 + public static Object encrypt(InputStream is, String dest) throws Exception {
  75 + Cipher cipher = Cipher.getInstance("DES");
  76 + //初始化密钥
  77 + initSecretKey();
  78 + //获得密钥
  79 + Object key =getKey();
  80 + cipher.init(Cipher.ENCRYPT_MODE,(Key)key);
  81 + //写入文件
  82 + OutputStream out = new FileOutputStream(dest);
  83 + CipherInputStream cis = new CipherInputStream(is, cipher);
  84 + byte[] buffer = new byte[1024];
  85 + int r;
  86 + while ((r = cis.read(buffer)) > 0) {
  87 + out.write(buffer, 0, r);
  88 + }
  89 + //数据库保存需要一个字符
  90 + BASE64Encoder enc=new BASE64Encoder();
  91 + String string=enc.encode(byteArray);
  92 + cis.close();
  93 + is.close();
  94 + out.close();
  95 + return string;
  96 + }
  97 + /**文件解密返回一个流*/
  98 + public static InputStream decrypt(String file,Key key) throws IOException {
  99 + CipherInputStream cis = null;
  100 + InputStream is =null;
  101 + try {
  102 + Cipher cipher = Cipher.getInstance("DES");
  103 + cipher.init(Cipher.DECRYPT_MODE,key);
  104 + is = new FileInputStream(file);
  105 + cis = new CipherInputStream(is, cipher);
  106 +
  107 + } catch (Exception e) {
  108 + e.printStackTrace();
  109 + return null;
  110 + }
  111 + return cis;
  112 +
  113 + }
  114 +
  115 + /**通过传过来的流生成文件*/
  116 + public static void decrypt(String outfile,String fileName,CipherInputStream in) throws Exception {
  117 + File file=new File(outfile);
  118 + if(!file.exists()){
  119 + file.mkdirs();
  120 + }
  121 + OutputStream out = new FileOutputStream(outfile+"\\"+fileName);
  122 + byte[] buffer = new byte[1024];
  123 + int r;
  124 + while ((r = in.read(buffer)) >= 0) {
  125 + out.write(buffer, 0, r);
  126 + }
  127 + out.close();
  128 + in.close();
  129 + }
  130 +
  131 + /**文件解密返回一个字符串*/
  132 + public static String decryptAndGetString(String file,Key key) throws Exception {
  133 + Cipher cipher = Cipher.getInstance("DES");
  134 + cipher.init(Cipher.DECRYPT_MODE,key);
  135 + InputStream is = new FileInputStream(file);
  136 + CipherInputStream cis = new CipherInputStream(is, cipher);
  137 +
  138 + return convertStreamToString(cis);
  139 +
  140 + }
  141 + public static String inputStream2String(InputStream is) throws IOException{
  142 + ByteArrayOutputStream baos = new ByteArrayOutputStream();
  143 + int i=-1;
  144 + while((i=is.read())!=-1){
  145 + baos.write(i);
  146 + }
  147 + return baos.toString();
  148 + }
  149 +
  150 + public static String convertStreamToString(InputStream is) {
  151 +
  152 + BufferedReader reader = new BufferedReader(new InputStreamReader(is));
  153 +
  154 + StringBuilder sb = new StringBuilder();
  155 +
  156 +
  157 +
  158 + String line = null;
  159 +
  160 + try {
  161 +
  162 + while ((line = reader.readLine()) != null) {
  163 +
  164 + sb.append(line + "/n");
  165 +
  166 + }
  167 +
  168 + } catch (IOException e) {
  169 +
  170 + e.printStackTrace();
  171 +
  172 + } finally {
  173 +
  174 + try {
  175 +
  176 + is.close();
  177 +
  178 + } catch (IOException e) {
  179 +
  180 + e.printStackTrace();
  181 +
  182 + }
  183 +
  184 + }
  185 +
  186 +
  187 +
  188 + return sb.toString();
  189 +
  190 + }
  191 +
  192 + /**转换密钥*/
  193 + public static Key toKey(byte[] key) throws Exception{
  194 + //实例化DES密钥规则
  195 + DESKeySpec dks = new DESKeySpec(key);
  196 + //实例化密钥工厂
  197 + SecretKeyFactory skf = SecretKeyFactory.getInstance("DES");
  198 + //生成密钥 ,工厂中对密钥进行处理加工
  199 + SecretKey secretKey = skf.generateSecret(dks);
  200 + return secretKey;
  201 + }
  202 +
  203 +
  204 +
  205 + public static void main(String[] args){
  206 +
  207 + /* Encrypt.saveDesKey();
  208 + System.out.println("生成key");
  209 + Encrypt.getKey();
  210 + System.out.println("获取key");
  211 + try {
  212 + Encrypt.encrypt("d:\\dd.eml", "d:\\e.eml");
  213 + } catch (Exception e) {
  214 + // TODO Auto-generated catch block
  215 + e.printStackTrace();
  216 + }
  217 + System.out.println("加密");*/
  218 + try {
  219 + //Encrypt.decrypt("d:\\dddd.eml", "d:\\ccc.eml");
  220 + BASE64Decoder enc=new BASE64Decoder();
  221 + Key a=Encrypt.toKey(enc.decodeBuffer("MQ5RobbCg8s="));
  222 + System.out.println("qqq"+Encrypt.decryptAndGetString("H:\\test.txt",a));
  223 + } catch (Exception e) {
  224 + // TODO Auto-generated catch block
  225 + e.printStackTrace();
  226 + }
  227 + System.out.println("解密");
  228 +// System.out.println("加密");*/
  229 +// try {
  230 +// Encrypt.decrypt("c:/test.txt", "d:\\ccc.eml");
  231 +// } catch (Exception e) {
  232 +// // TODO Auto-generated catch block
  233 +// e.printStackTrace();
  234 +// }
  235 +// System.out.println("解密");
  236 + }
  237 +
  238 +}
  1 +package com.espeed.yxy.dao.impl;
  2 +
  3 +import java.util.List;
  4 +
  5 +import com.espeed.yxy.dao.YxySendSmtpInfoDao;
  6 +import com.espeed.yxy.pojo.YxySendMailDetail;
  7 +import com.espeed.yxy.pojo.YxySendSmtpInfo;
  8 +/**
  9 + * 程序名称: EspeedMail_时速邮箱
  10 + * 程序版本: V1.0
  11 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776)
  12 + * 版权所有: 深圳市科飞时速网络技术有限公司
  13 + * 技术支持: Tech@21gmail.com
  14 + * 单元名称: SMTP DAO实现类
  15 + * 开始时间: 2013.11.27
  16 + * 程 序 员: 谢勇
  17 + * 最后修改:
  18 + * 备 注: 如需修改请通知程序员
  19 + */
  20 +public class YxySendSmtpInfoDaoImpl extends HibernateBaseDAOImpl<YxySendSmtpInfo,Long> implements YxySendSmtpInfoDao{
  21 +
  22 +// /**查询可用的smtp*/
  23 +// public List<YxySendSmtpInfo> findAllSmtp(int num) throws Exception {
  24 +// String hql="from YxySendSmtpInfo where smtp_service_isuse=0 or smtp_service_isuse=1 order by smtp_service_userdate";
  25 +// return super.getAll(hql);
  26 +// }
  27 +// /**更新smtp状态*/
  28 +// public void updateSmtpStatus(YxySendSmtpInfo o) throws Exception {
  29 +// super.update(o);
  30 +//
  31 +// }
  32 +// /**HQL查询*/
  33 +// public List<YxySendSmtpInfo> findByHql(String hql) throws Exception {
  34 +//
  35 +// return super.getAll(hql);
  36 +// }
  37 +
  38 + /**批量插入*/
  39 + public void addPiPojo(List<YxySendSmtpInfo> o)throws Exception{
  40 + super.addPi(o);
  41 + }
  42 +
  43 + /**实体添加*/
  44 + public int addPojo(YxySendSmtpInfo o)throws Exception{
  45 + return super.add(o);
  46 + }
  47 +
  48 + /**HQL查询*/
  49 + public List<YxySendSmtpInfo> findByHql(String hql)throws Exception{
  50 + return super.getAll(hql);
  51 + }
  52 +
  53 + /**SQL查询*/
  54 + public List<Object> findbysql(String sql)throws Exception{
  55 + return super.findBySql(sql);
  56 + }
  57 +
  58 + /**SQL更新*/
  59 + public void updateBySql(String sql)throws Exception{
  60 + super.updateorDelBySql(sql);
  61 + }
  62 +
  63 + /**HQL更新*/
  64 + public void updateByHql(String hql)throws Exception{
  65 + super.updateorDelByHql(hql);
  66 + }
  67 +}
  1 +package com.espeed.yxy.service;
  2 +
  3 +import java.util.List;
  4 +import java.util.Map;
  5 +
  6 +import com.espeed.centre.pojo.CentreTrackSet;
  7 +import com.espeed.centre.pojo.CentreYxyedmNewcustomer;
  8 +import com.espeed.centre.pojo.CentreYxyedmOldcustomer;
  9 +import com.espeed.yxy.pojo.YxySendMailDetail;
  10 +import com.espeed.yxy.pojo.YxySendMailMaster;
  11 +import com.espeed.yxy.pojo.YxySendSmtpInfo;
  12 +import com.espeed.yxy.pojo.YxySmtpSendSelfOverset;
  13 +import com.espeed.yxy.pojo.YxySmtpSendSelfSet;
  14 +import com.espeed.yxy.pojo.YxySmtpSendSet;
  15 +import com.espeed.yxy.pojo.YxySmtpSuffixSet;
  16 +import com.espeed.yxy.pojo.YxySysParamatersValue;
  17 +import com.espeed.yxy.pojo.YxyUserAddress;
  18 +/**
  19 + * 程序名称: EspeedMail_时速邮箱
  20 + * 程序版本: V1.0
  21 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776)
  22 + * 版权所有: 深圳市科飞时速网络技术有限公司
  23 + * 技术支持: Tech@21gmail.com
  24 + * 单元名称: 邮件发送service业务接口(营销游)
  25 + * 开始时间: 2013.12.09
  26 + * 程 序 员: 谢勇
  27 + * 最后修改:
  28 + * 备 注: 如需修改请通知程序员
  29 + */
  30 +public interface YxySendMailService {
  31 +
  32 + //------------------------待发邮件操作模块-----------------------------
  33 + /**查询所有待发邮件*/
  34 + public List<YxySendMailMaster> findByMailNum(int mailNum)throws Exception;
  35 + /**修改邮件使用状态*/
  36 + public void updateMailUseStatus(int mailid, int isuse,String timer)throws Exception;
  37 + /**修改邮件异常量*/
  38 + public void updateMailExpStatus(int mailid,int expnum)throws Exception;
  39 + /**同时修改待发邮件状态与基本邮件信息状态*/
  40 + public void updateMailStatus(int status,int mailid,String mailuid)throws Exception;
  41 + /**加入待发邮件*/
  42 + public void addMailMaster(YxySendMailMaster master,List<YxyUserAddress> sendaddress,int planid,int plan_differen)throws Exception;
  43 + /**更新待发邮件图片与附件路径*/
  44 + public void updatepicattrpath(int masterid,String picpath,String attrpath)throws Exception;
  45 + /**根据hql获取待发邮件*/
  46 + public List<YxySendMailMaster> getMailMasterByHql(String hql)throws Exception;
  47 + //------------------------待发地址操作模块-----------------------------
  48 + /**根据待发邮件ID查询待发地址*/
  49 + public List<YxySendMailDetail> findAddressByMailID(int mailID)throws Exception;
  50 + /**修改此地址为已发送*/
  51 + public void updateMailDetailstatus(int addressid)throws Exception;
  52 + /**更新地址状态为异常地址*/
  53 + public void updateExp(int addressid,int expnum)throws Exception;
  54 + /**根据邮件ID查询是否还存在待发地址*/
  55 + public boolean isHaveAddress(int mailid)throws Exception;
  56 + //------------------------SMTP操作模块---------------------------------
  57 + /**查询所有SMTP*/
  58 + public List<YxySendSmtpInfo> findSmtpInfoSetNum()throws Exception;
  59 + /**更新smtp使用状态*/
  60 + public void updateSmtpUseStatus(int status,int smtpid,String nowdate)throws Exception;
  61 + /**更新smtp状态所有的*/
  62 + public void updatesmtpstatus()throws Exception;
  63 + /**根据客户类型查询smtp*/
  64 + public YxySendSmtpInfo findSmtpInfoByCusType(List<YxySendSmtpInfo> smtp_list,int cus_type)throws Exception;
  65 + /**查找自主域名投递的smtp*/
  66 + public YxySendSmtpInfo findSmtpInfoByCusType2(List<YxySendSmtpInfo> smtp_list,YxySendMailMaster master)throws Exception;
  67 + //------------------------SMTP后缀设置参数模块-------------------------
  68 + /**查询后缀信息*/
  69 + public List<YxySmtpSuffixSet> findAllSmtpSuffixSet()throws Exception;
  70 +
  71 +
  72 + //------------------------SMTP后缀发送量模块----------------------------
  73 + /**查询该smtp对应后缀在时间段的发送量*/
  74 + public List<YxySmtpSendSet> findAllSmtpSendSet(String smtpservice,String nowDay)throws Exception;
  75 + /**删除后缀已发量信息*/
  76 + public void delmSmtpSet(String smtpService)throws Exception;
  77 + /**更新发送量信息*/
  78 + public void updateSmtpSet(List<YxySmtpSendSet> o)throws Exception;
  79 + //------------------------控制参数模块---------------------------------
  80 + /**code查询控制参数(有用户级返回用户级,否则返回默认参数)*/
  81 + public String findCompanyParamByCode(String code,String loginid,String domain)throws Exception;
  82 + /**paraid查询企业级控制参数*/
  83 + public List<YxySysParamatersValue> findCompanyParamValues(String domian,int para_id)throws Exception;
  84 +
  85 + //------------------------自配SMTP发送量模块-----------------------------
  86 + /**通过smtpID查询此smtp的发送参数*/
  87 + public List<YxySmtpSendSelfSet> findSendSelfSetByService(String smtpservice)throws Exception;
  88 + /**查询自配账号的已发送量信息*/
  89 + public List<YxySmtpSendSelfOverset> findBySmtpAccount(String account)throws Exception;
  90 + /**添加自配账号的已发量信息*/
  91 + public void addSendSelfSet(YxySmtpSendSelfOverset o)throws Exception;
  92 + /**更新自配已发量*/
  93 + public void updateSendSelfSet(YxySmtpSendSelfOverset o)throws Exception;
  94 + /**查询SMTP判断是否阻塞*/
  95 + public void updateinitsmtpstatus()throws Exception;
  96 + /**获取跟踪配置信息*/
  97 + public List<CentreTrackSet> getTrackSetByHql(String hql)throws Exception;
  98 + /**获取开发客户配置信息*/
  99 + public List<CentreYxyedmNewcustomer> getNewCustomerSet(String hql)throws Exception;
  100 + /**获取盘活客户配置信息*/
  101 + public List<CentreYxyedmOldcustomer> getOldCustomerSet(String hql)throws Exception;
  102 + /**获取用户信息*/
  103 + public List<Object> getUserInfoBySql(String sql)throws Exception;
  104 +}
  1 +package com.espeed.yxy.pojo;
  2 +
  3 +import java.io.Serializable;
  4 +
  5 +import javax.persistence.Entity;
  6 +import javax.persistence.GeneratedValue;
  7 +import javax.persistence.GenerationType;
  8 +import javax.persistence.Id;
  9 +import javax.persistence.Table;
  10 +/**
  11 + * 程序名称: EspeedMail_时速邮箱
  12 + * 程序版本: V1.0
  13 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776)
  14 + * 版权所有: 深圳市科飞时速网络技术有限公司
  15 + * 技术支持: Tech@21gmail.com
  16 + * 单元名称: smtp后缀设置信息实体(营销游)
  17 + * 开始时间: 2013.12.09
  18 + * 程 序 员: 谢勇
  19 + * 最后修改:
  20 + * 备 注: 如需修改请通知程序员
  21 + */
  22 +
  23 +@Entity
  24 +@Table(name="yxy_smtp_suffix_set")
  25 +public class YxySmtpSuffixSet implements Serializable{
  26 +
  27 + private int smtp_suffix_id ;//主键ID
  28 + private String smtp_suffix_name;//smtp后缀名
  29 + private int smtp_suffix_ten;//该后缀十分钟发送量
  30 + private int smtp_suffix_hour;//该后缀一个小时发送量
  31 + private int smtp_suffix_day;//该后缀一天发送量
  32 +
  33 + @Id
  34 + @GeneratedValue(strategy=GenerationType.AUTO)
  35 + public int getSmtp_suffix_id() {
  36 + return smtp_suffix_id;
  37 + }
  38 + public void setSmtp_suffix_id(int smtpSuffixId) {
  39 + smtp_suffix_id = smtpSuffixId;
  40 + }
  41 + public String getSmtp_suffix_name() {
  42 + return smtp_suffix_name;
  43 + }
  44 + public void setSmtp_suffix_name(String smtpSuffixName) {
  45 + smtp_suffix_name = smtpSuffixName;
  46 + }
  47 + public int getSmtp_suffix_ten() {
  48 + return smtp_suffix_ten;
  49 + }
  50 + public void setSmtp_suffix_ten(int smtpSuffixTen) {
  51 + smtp_suffix_ten = smtpSuffixTen;
  52 + }
  53 + public int getSmtp_suffix_hour() {
  54 + return smtp_suffix_hour;
  55 + }
  56 + public void setSmtp_suffix_hour(int smtpSuffixHour) {
  57 + smtp_suffix_hour = smtpSuffixHour;
  58 + }
  59 + public int getSmtp_suffix_day() {
  60 + return smtp_suffix_day;
  61 + }
  62 + public void setSmtp_suffix_day(int smtpSuffixDay) {
  63 + smtp_suffix_day = smtpSuffixDay;
  64 + }
  65 +
  66 +
  67 +}
  1 +package com.espeed.yxy.dao.impl;
  2 +
  3 +import java.util.List;
  4 +import com.espeed.yxy.dao.YxyMarketingPlanDao;
  5 +import com.espeed.yxy.pojo.YxyMarketingPlan;
  6 +
  7 +public class YxyMarketingPlanDaoImpl extends HibernateBaseDAOImpl<YxyMarketingPlan, Long> implements YxyMarketingPlanDao {
  8 +
  9 + /**HQL查询*/
  10 + public List<YxyMarketingPlan> findByHql(String hql)throws Exception{
  11 + return super.getAll(hql);
  12 + }
  13 + /**指定条记录*/
  14 + public List<YxyMarketingPlan> findByHqlSet(String hql,int num)throws Exception{
  15 + return super.findBySet(hql, num);
  16 + }
  17 + /**HQL更新*/
  18 + public void updateByHql(String hql)throws Exception{
  19 + super.updateorDelByHql(hql);
  20 + }
  21 +}
  1 +package com.espeed.yxy.dao.impl;
  2 +
  3 +import java.util.List;
  4 +
  5 +import com.espeed.centre.pojo.CentreYxyedmOldcustomer;
  6 +import com.espeed.yxy.dao.CentreYxyedmOldcustomerDao;
  7 +/**
  8 + * 项目名称: 统一验证中心系统
  9 + * 版权所有: 深圳市科飞时速网络技术有限公司(0755-88843776)
  10 + * 技术支持: info@21gmail.com
  11 + * 单元名称: 营销邮盘活客户配置Dao实现类
  12 + * 开始时间: 2018.04.08
  13 + * 开发人员: 陈南巧
  14 + */
  15 +public class CentreYxyedmOldcustomerDaoImpl extends CentreHibernateBaseDAOImpl<CentreYxyedmOldcustomer, Long> implements CentreYxyedmOldcustomerDao {
  16 + /**实体插入*/
  17 + public int addPojo(CentreYxyedmOldcustomer o)throws Exception{
  18 + return super.add(o);
  19 + }
  20 + /**实体编辑*/
  21 + public void updatePojo(CentreYxyedmOldcustomer o)throws Exception{
  22 + super.update(o);
  23 + }
  24 + /**HQL查询*/
  25 + public List<CentreYxyedmOldcustomer> findByHql(String hql)throws Exception{
  26 + return super.getAll(hql);
  27 + }
  28 + /**HQL查询数量*/
  29 + public int findByHqlCount(String hql)throws Exception{
  30 + return super.count(hql);
  31 + }
  32 + /**SQL查询*/
  33 + public List<Object> findBySqlFind(String sql)throws Exception{
  34 + return super.findBySql(sql);
  35 + }
  36 + /**HQL更新*/
  37 + public void updateByHql(String hql)throws Exception{
  38 + super.updateorDelBySql(hql);
  39 + }
  40 +}
  1 +package com.espeed.yxy.dao.impl;
  2 +
  3 +import java.util.List;
  4 +
  5 +import com.espeed.webmail.pojo.YxyCustomerEmail;
  6 +import com.espeed.yxy.dao.YxyCustomerEmailDao;
  7 +
  8 +/**
  9 + * 程序名称: EspeedMail_时速邮箱
  10 + * 程序版本: V1.0
  11 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776)
  12 + * 版权所有: 深圳市科飞时速网络技术有限公司
  13 + * 技术支持: Tech@21gmail.com
  14 + * 单元名称: 分类下的所有dao实现类(营销游)
  15 + * 开始时间: 2015.04.08
  16 + * 程 序 员: 陈南巧
  17 + * 最后修改:
  18 + * 备 注: 如需修改请通知程序员
  19 + */
  20 +public class YxyCustomerEmailDaoImpl extends WebmailHibernateBaseDAOImpl<YxyCustomerEmail, Long> implements YxyCustomerEmailDao{
  21 +
  22 + /**实体插入*/
  23 + public int addPojo(YxyCustomerEmail o)throws Exception{
  24 + return super.add(o);
  25 + }
  26 + /**实体编辑*/
  27 + public void updatePojo(YxyCustomerEmail o)throws Exception{
  28 + super.update(o);
  29 + }
  30 + /**HQL查询*/
  31 + public List<YxyCustomerEmail> findByHql(String hql)throws Exception{
  32 + return super.getAll(hql);
  33 + }
  34 + /**HQL数量查询*/
  35 + public int findByHqlCount(String hql)throws Exception{
  36 + return super.count(hql);
  37 + }
  38 + /**指定条记录*/
  39 + public List<YxyCustomerEmail> findByHqlSet(String hql,int num)throws Exception{
  40 + return super.findBySet(hql, num);
  41 + }
  42 +
  43 + /**SQL查询*/
  44 + public List<Object> findBySqlQuery(String sql)throws Exception{
  45 + return super.findBySql(sql);
  46 + }
  47 + /**HQL更新*/
  48 + public void updateByHql(String hql)throws Exception{
  49 + super.updateorDelBySql(hql);
  50 + }
  51 +
  52 +}
  1 +package com.espeed.yxy.pojo;
  2 +
  3 +import java.io.Serializable;
  4 +
  5 +import javax.persistence.Entity;
  6 +import javax.persistence.GeneratedValue;
  7 +import javax.persistence.GenerationType;
  8 +import javax.persistence.Id;
  9 +import javax.persistence.Table;
  10 +
  11 +/**
  12 + * 程序名称: EspeedMail_时速邮箱
  13 + * 程序版本: V1.0
  14 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776)
  15 + * 版权所有: 深圳市科飞时速网络技术有限公司
  16 + * 技术支持: Tech@21gmail.com
  17 + * 单元名称: smtp实体(营销游)
  18 + * 开始时间: 2013.12.09
  19 + * 程 序 员: 谢勇
  20 + * 最后修改:
  21 + * 备 注: 如需修改请通知程序员
  22 + */
  23 +@Entity
  24 +@Table(name="yxy_send_smtp_info")
  25 +public class YxySendSmtpInfo implements Serializable{
  26 + private static final long serialVersionUID = 1L;
  27 + private int smtp_service_id;//主键ID
  28 + private String smtp_service_number;//smtp服务器
  29 + private String smtp_service_account;//smtp账号
  30 + private String smtp_service_password;//smtp密码
  31 + private int smtp_service_isyxy;//是自配还是运营0默认自配1:运营
  32 + private String smtp_service_creatdate;//创建时间
  33 + private String smtp_service_userdate;//发第一封的时间
  34 + private int smtp_service_isuse;//该smtp是否可用...0可用1不可用
  35 + private int smtp_service_sendNum;//smtp发送封数
  36 + private String smtp_user_loginid;//用户账号
  37 + private String smtp_user_domain;//用户所属域名
  38 + private int smtp_is_ssl;//是否使用SSL加密
  39 + private String smtp_service_port;//端口
  40 + private int smtp_service_type;//0:新客户营销,1:老客户跟进,2:自主域名投递
  41 +
  42 + @Id
  43 + @GeneratedValue(strategy=GenerationType.AUTO)
  44 + public int getSmtp_service_id() {
  45 + return smtp_service_id;
  46 + }
  47 + public void setSmtp_service_id(int smtpServiceId) {
  48 + smtp_service_id = smtpServiceId;
  49 + }
  50 + public String getSmtp_service_number() {
  51 + return smtp_service_number;
  52 + }
  53 + public void setSmtp_service_number(String smtpServiceNumber) {
  54 + smtp_service_number = smtpServiceNumber;
  55 + }
  56 + public String getSmtp_service_account() {
  57 + return smtp_service_account;
  58 + }
  59 + public void setSmtp_service_account(String smtpServiceAccount) {
  60 + smtp_service_account = smtpServiceAccount;
  61 + }
  62 + public String getSmtp_service_password() {
  63 + return smtp_service_password;
  64 + }
  65 + public void setSmtp_service_password(String smtpServicePassword) {
  66 + smtp_service_password = smtpServicePassword;
  67 + }
  68 + public String getSmtp_service_creatdate() {
  69 + return smtp_service_creatdate;
  70 + }
  71 + public void setSmtp_service_creatdate(String smtpServiceCreatdate) {
  72 + smtp_service_creatdate = smtpServiceCreatdate;
  73 + }
  74 + public String getSmtp_service_userdate() {
  75 + return smtp_service_userdate;
  76 + }
  77 + public void setSmtp_service_userdate(String smtpServiceUserdate) {
  78 + smtp_service_userdate = smtpServiceUserdate;
  79 + }
  80 + public int getSmtp_service_isuse() {
  81 + return smtp_service_isuse;
  82 + }
  83 + public void setSmtp_service_isuse(int smtpServiceIsuse) {
  84 + smtp_service_isuse = smtpServiceIsuse;
  85 + }
  86 + public int getSmtp_service_sendNum() {
  87 + return smtp_service_sendNum;
  88 + }
  89 + public void setSmtp_service_sendNum(int smtpServiceSendNum) {
  90 + smtp_service_sendNum = smtpServiceSendNum;
  91 + }
  92 + public int getSmtp_service_isyxy() {
  93 + return smtp_service_isyxy;
  94 + }
  95 + public void setSmtp_service_isyxy(int smtpServiceIsyxy) {
  96 + smtp_service_isyxy = smtpServiceIsyxy;
  97 + }
  98 + public String getSmtp_user_loginid() {
  99 + return smtp_user_loginid;
  100 + }
  101 + public void setSmtp_user_loginid(String smtpUserLoginid) {
  102 + smtp_user_loginid = smtpUserLoginid;
  103 + }
  104 + public String getSmtp_user_domain() {
  105 + return smtp_user_domain;
  106 + }
  107 + public void setSmtp_user_domain(String smtpUserDomain) {
  108 + smtp_user_domain = smtpUserDomain;
  109 + }
  110 + public int getSmtp_is_ssl() {
  111 + return smtp_is_ssl;
  112 + }
  113 + public void setSmtp_is_ssl(int smtp_is_ssl) {
  114 + this.smtp_is_ssl = smtp_is_ssl;
  115 + }
  116 + public String getSmtp_service_port() {
  117 + return smtp_service_port;
  118 + }
  119 + public void setSmtp_service_port(String smtp_service_port) {
  120 + this.smtp_service_port = smtp_service_port;
  121 + }
  122 + public int getSmtp_service_type() {
  123 + return smtp_service_type;
  124 + }
  125 + public void setSmtp_service_type(int smtp_service_type) {
  126 + this.smtp_service_type = smtp_service_type;
  127 + }
  128 +}
  1 +package com.espeed.centre.pojo;
  2 +
  3 +import java.io.Serializable;
  4 +import javax.persistence.Entity;
  5 +import javax.persistence.GeneratedValue;
  6 +import javax.persistence.GenerationType;
  7 +import javax.persistence.Id;
  8 +import javax.persistence.Table;
  9 +/**
  10 + * 项目名称: 统一验证中心系统
  11 + * 版权所有: 深圳市科飞时速网络技术有限公司(0755-88843776)
  12 + * 技术支持: info@21gmail.com
  13 + * 单元名称: 中央数据库用户实体类
  14 + * 开始时间: 2017.09.29
  15 + * 开发人员: 陈南巧
  16 + */
  17 +@Entity
  18 +@Table(name="centre_user")
  19 +public class CentreUser implements Serializable{
  20 + private static final long serialVersionUID = 1L;
  21 + private int user_id;//用户id
  22 + private String user_name;//姓名
  23 + private String login_id;//帐号
  24 + private int company_id;//企业id
  25 + @Id
  26 + @GeneratedValue(strategy=GenerationType.AUTO)
  27 + public int getUser_id() {
  28 + return user_id;
  29 + }
  30 + public void setUser_id(int user_id) {
  31 + this.user_id = user_id;
  32 + }
  33 + public String getLogin_id() {
  34 + return login_id;
  35 + }
  36 + public void setLogin_id(String login_id) {
  37 + this.login_id = login_id;
  38 + }
  39 + public int getCompany_id() {
  40 + return company_id;
  41 + }
  42 + public void setCompany_id(int company_id) {
  43 + this.company_id = company_id;
  44 + }
  45 + public String getUser_name() {
  46 + return user_name;
  47 + }
  48 + public void setUser_name(String user_name) {
  49 + this.user_name = user_name;
  50 + }
  51 +}
  1 +package com.espeed.yxy.dao.impl;
  2 +
  3 +import java.util.List;
  4 +import com.espeed.yxy.dao.YxyMarketingWeekDao;
  5 +import com.espeed.yxy.pojo.YxyMarketingWeek;
  6 +
  7 +public class YxyMarketingWeekDaoImpl extends HibernateBaseDAOImpl<YxyMarketingWeek, Long> implements YxyMarketingWeekDao {
  8 +
  9 + /**HQL查询*/
  10 + public List<YxyMarketingWeek> findByHql(String hql)throws Exception{
  11 + return super.getAll(hql);
  12 + }
  13 + /**指定条记录*/
  14 + public List<YxyMarketingWeek> findByHqlSet(String hql,int num)throws Exception{
  15 + return super.findBySet(hql, num);
  16 + }
  17 + /**HQL更新*/
  18 + public void updateByHql(String hql) throws Exception {
  19 + super.updateorDelByHql(hql);
  20 + }
  21 +}
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<web-app version="2.5"
  3 + xmlns="http://java.sun.com/xml/ns/javaee"
  4 + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  5 + xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
  6 + http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
  7 +
  8 + <filter>
  9 + <filter-name>openSessionInView</filter-name>
  10 + <filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
  11 + </filter>
  12 +
  13 + <filter-mapping>
  14 + <filter-name>openSessionInView</filter-name>
  15 + <url-pattern>/*</url-pattern>
  16 + </filter-mapping>
  17 +
  18 +
  19 +
  20 +
  21 + <!-- 配置spring监听器 -->
  22 + <context-param>
  23 + <param-name>contextConfigLocation</param-name>
  24 + <param-value>classpath:applicationContext.xml</param-value>
  25 + </context-param>
  26 + <listener>
  27 + <listener-class>
  28 + org.springframework.web.context.ContextLoaderListener
  29 + </listener-class>
  30 + </listener>
  31 +
  32 + <!-- Spring乱码处理 -->
  33 + <filter>
  34 + <filter-name>characterEncoding</filter-name>
  35 + <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
  36 + <init-param>
  37 + <param-name>encoding</param-name>
  38 + <param-value>UTF-8</param-value>
  39 + </init-param>
  40 + <init-param>
  41 + <param-name>forceEncoding</param-name>
  42 + <param-value>true</param-value>
  43 + </init-param>
  44 + </filter>
  45 +
  46 + <welcome-file-list>
  47 + <welcome-file>index.jsp</welcome-file>
  48 + </welcome-file-list>
  49 +
  50 + <!-- 开机运行方法 -->
  51 + <servlet>
  52 + <servlet-name>initServlet</servlet-name>
  53 + <servlet-class>com.espeed.yxy.tool.ServiceInit</servlet-class>
  54 + <load-on-startup>1</load-on-startup>
  55 + </servlet>
  56 +</web-app>
  1 +package com.espeed.yxy.dao;
  2 +
  3 +import java.util.List;
  4 +import com.espeed.yxy.pojo.YxySendSmtpInfo;
  5 +
  6 +/**
  7 + * 程序名称: EspeedMail_时速邮箱
  8 + * 程序版本: V1.0
  9 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776)
  10 + * 版权所有: 深圳市科飞时速网络技术有限公司
  11 + * 技术支持: Tech@21gmail.com
  12 + * 单元名称: SMTP DAO(营销游)
  13 + * 开始时间: 2013.12.09
  14 + * 程 序 员: 谢勇
  15 + * 最后修改:
  16 + * 备 注: 如需修改请通知程序员
  17 + */
  18 +public interface YxySendSmtpInfoDao {
  19 +// /**查询可用的smtp*/
  20 +// public List<YxySendSmtpInfo> findAllSmtp(int num)throws Exception;
  21 +// /**更新smtp状态*/
  22 +// public void updateSmtpStatus(YxySendSmtpInfo o)throws Exception;
  23 +// /**HQL查询*/
  24 +// public List<YxySendSmtpInfo> findByHql(String hql)throws Exception;
  25 + /**批量插入*/
  26 + public void addPiPojo(List<YxySendSmtpInfo> o)throws Exception;
  27 +
  28 + /**实体添加*/
  29 + public int addPojo(YxySendSmtpInfo o)throws Exception;
  30 +
  31 + /**HQL查询*/
  32 + public List<YxySendSmtpInfo> findByHql(String hql)throws Exception;
  33 +
  34 + /**SQL查询*/
  35 + public List<Object> findbysql(String sql)throws Exception;
  36 +
  37 + /**SQL更新*/
  38 + public void updateBySql(String sql)throws Exception;
  39 +
  40 + /**HQL更新*/
  41 + public void updateByHql(String hql)throws Exception;
  42 +}
  1 +package com.espeed.yxy.pojo;
  2 +
  3 +import java.io.Serializable;
  4 +
  5 +import javax.persistence.Entity;
  6 +import javax.persistence.GeneratedValue;
  7 +import javax.persistence.GenerationType;
  8 +import javax.persistence.Id;
  9 +import javax.persistence.Table;
  10 +import javax.persistence.Transient;
  11 +/**
  12 + * 程序名称: EspeedMail_时速邮箱
  13 + * 程序版本: V1.0
  14 + * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776)
  15 + * 版权所有: 深圳市科飞时速网络技术有限公司
  16 + * 技术支持: Tech@21gmail.com
  17 + * 单元名称: 邮件基本信息实体(营销游)
  18 + * 开始时间: 2013.12.09
  19 + * 程 序 员: 谢勇
  20 + * 最后修改:
  21 + * 备 注: 如需修改请通知程序员
  22 + */
  23 +@Entity
  24 +@Table(name="yxy_send_mail_master_base")
  25 +public class YxySendMailMasterBase implements Serializable{
  26 + private static final long serialVersionUID = 1L;
  27 + private int send_mail_id;//发送邮件ID
  28 + private String user_loginid;//创建用户账号
  29 + private String user_domain;//创建用户域名
  30 + private String create_time;//创建时间
  31 + private int is_unsubscribe;//是否退订
  32 + private int unsubscribe_language;//退订选择语言(0.中文1.英文)
  33 + private int include_link;//是否包含嵌入链接
  34 + private String link_context;//链接地址
  35 + private String mail_account;//发送邮箱账号
  36 + private String sender;//发件人
  37 + private String send_email;//发件人邮箱
  38 + private String reply_email;//回复邮箱
  39 + private String subject;//主题
  40 + private int auto_change_subject;//是否多主题变换
  41 + private String body;//邮件正文
  42 + private String attarchment_path ;//附件保存路径
  43 + private String image_path;//图片保存路径
  44 + private String eml_file_path;//EML文件路径
  45 + private String eml_encode_key;//EML文件KEY
  46 + private int mail_size;//邮件大小
  47 + private int plans_send;//是否定时发送
  48 + private String plans_send_time;//定时发送时间
  49 + private int status ;//处理状态
  50 + private int folder_id;//所属文件夹ID
  51 + private String mail_uid; //mail唯一性标识
  52 + private int is_high_precision;//是否使用高精准发信
  53 + private int exptionnum;//发送过程中异常的次数
  54 + private String txtaddresspath;//txt地址文件路径
  55 + private int send_num;//发送量
  56 + private int isuse;//是否使用中
  57 + private int sendci;//发送次数
  58 + private int iscrm;//是不是老客户营销
  59 + private int isold;
  60 + @Id
  61 + @GeneratedValue(strategy=GenerationType.AUTO)
  62 + public int getSend_mail_id() {
  63 + return send_mail_id;
  64 + }
  65 + public void setSend_mail_id(int sendMailId) {
  66 + send_mail_id = sendMailId;
  67 + }
  68 + public String getUser_loginid() {
  69 + return user_loginid;
  70 + }
  71 + public void setUser_loginid(String userLoginid) {
  72 + user_loginid = userLoginid;
  73 + }
  74 + public String getUser_domain() {
  75 + return user_domain;
  76 + }
  77 + public void setUser_domain(String userDomain) {
  78 + user_domain = userDomain;
  79 + }
  80 + public String getCreate_time() {
  81 + return create_time;
  82 + }
  83 + public void setCreate_time(String createTime) {
  84 + create_time = createTime;
  85 + }
  86 + public int getIs_unsubscribe() {
  87 + return is_unsubscribe;
  88 + }
  89 + public void setIs_unsubscribe(int isUnsubscribe) {
  90 + is_unsubscribe = isUnsubscribe;
  91 + }
  92 + public int getUnsubscribe_language() {
  93 + return unsubscribe_language;
  94 + }
  95 + public void setUnsubscribe_language(int unsubscribeLanguage) {
  96 + unsubscribe_language = unsubscribeLanguage;
  97 + }
  98 + public int getInclude_link() {
  99 + return include_link;
  100 + }
  101 + public void setInclude_link(int includeLink) {
  102 + include_link = includeLink;
  103 + }
  104 + public String getLink_context() {
  105 + return link_context;
  106 + }
  107 + public void setLink_context(String linkContext) {
  108 + link_context = linkContext;
  109 + }
  110 + public String getMail_account() {
  111 + return mail_account;
  112 + }
  113 + public void setMail_account(String mailAccount) {
  114 + mail_account = mailAccount;
  115 + }
  116 + public String getSender() {
  117 + return sender;
  118 + }
  119 + public void setSender(String sender) {
  120 + this.sender = sender;
  121 + }
  122 + public String getSend_email() {
  123 + return send_email;
  124 + }
  125 + public void setSend_email(String sendEmail) {
  126 + send_email = sendEmail;
  127 + }
  128 + public String getReply_email() {
  129 + return reply_email;
  130 + }
  131 + public void setReply_email(String replyEmail) {
  132 + reply_email = replyEmail;
  133 + }
  134 + public String getSubject() {
  135 + return subject;
  136 + }
  137 + public void setSubject(String subject) {
  138 + this.subject = subject;
  139 + }
  140 + public int getAuto_change_subject() {
  141 + return auto_change_subject;
  142 + }
  143 + public void setAuto_change_subject(int autoChangeSubject) {
  144 + auto_change_subject = autoChangeSubject;
  145 + }
  146 + public String getBody() {
  147 + return body;
  148 + }
  149 + public void setBody(String body) {
  150 + this.body = body;
  151 + }
  152 + public String getAttarchment_path() {
  153 + return attarchment_path;
  154 + }
  155 + public void setAttarchment_path(String attarchmentPath) {
  156 + attarchment_path = attarchmentPath;
  157 + }
  158 + public String getImage_path() {
  159 + return image_path;
  160 + }
  161 + public void setImage_path(String imagePath) {
  162 + image_path = imagePath;
  163 + }
  164 + public String getEml_file_path() {
  165 + return eml_file_path;
  166 + }
  167 + public void setEml_file_path(String emlFilePath) {
  168 + eml_file_path = emlFilePath;
  169 + }
  170 + public String getEml_encode_key() {
  171 + return eml_encode_key;
  172 + }
  173 + public void setEml_encode_key(String emlEncodeKey) {
  174 + eml_encode_key = emlEncodeKey;
  175 + }
  176 + public int getMail_size() {
  177 + return mail_size;
  178 + }
  179 + public void setMail_size(int mailSize) {
  180 + mail_size = mailSize;
  181 + }
  182 + public int getPlans_send() {
  183 + return plans_send;
  184 + }
  185 + public void setPlans_send(int plansSend) {
  186 + plans_send = plansSend;
  187 + }
  188 + public String getPlans_send_time() {
  189 + return plans_send_time;
  190 + }
  191 + public void setPlans_send_time(String plansSendTime) {
  192 + plans_send_time = plansSendTime;
  193 + }
  194 + public int getStatus() {
  195 + return status;
  196 + }
  197 + public void setStatus(int status) {
  198 + this.status = status;
  199 + }
  200 + public int getFolder_id() {
  201 + return folder_id;
  202 + }
  203 + public void setFolder_id(int folderId) {
  204 + folder_id = folderId;
  205 + }
  206 + public String getMail_uid() {
  207 + return mail_uid;
  208 + }
  209 + public void setMail_uid(String mailUid) {
  210 + mail_uid = mailUid;
  211 + }
  212 + public int getIs_high_precision() {
  213 + return is_high_precision;
  214 + }
  215 + public void setIs_high_precision(int isHighPrecision) {
  216 + is_high_precision = isHighPrecision;
  217 + }
  218 + public int getExptionnum() {
  219 + return exptionnum;
  220 + }
  221 + public void setExptionnum(int exptionnum) {
  222 + this.exptionnum = exptionnum;
  223 + }
  224 + public String getTxtaddresspath() {
  225 + return txtaddresspath;
  226 + }
  227 + public void setTxtaddresspath(String txtaddresspath) {
  228 + this.txtaddresspath = txtaddresspath;
  229 + }
  230 + public int getSend_num() {
  231 + return send_num;
  232 + }
  233 + public void setSend_num(int sendNum) {
  234 + send_num = sendNum;
  235 + }
  236 + public int getIsuse() {
  237 + return isuse;
  238 + }
  239 + public void setIsuse(int isuse) {
  240 + this.isuse = isuse;
  241 + }
  242 + public int getSendci() {
  243 + return sendci;
  244 + }
  245 + public void setSendci(int sendci) {
  246 + this.sendci = sendci;
  247 + }
  248 + public int getIscrm() {
  249 + return iscrm;
  250 + }
  251 + public void setIscrm(int iscrm) {
  252 + this.iscrm = iscrm;
  253 + }
  254 + public int getIsold() {
  255 + return isold;
  256 + }
  257 + public void setIsold(int isold) {
  258 + this.isold = isold;
  259 + }
  260 +}