作者 徐宝林

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

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

要显示太多修改。

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

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="melibrary.com.genuitec.eclipse.j2eedt.core.MYECLIPSE_JAVAEE_5_CONTAINER"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/JoSQL-2.1.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/antlr-2.7.6.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/asm-3.3.1.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/aspectjweaver.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/c3p0-0.9.1.2.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/cglib-2.2.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/commons-collections-3.1.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/commons-dbcp.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/commons-logging-1.1.1.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/commons-pool.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/dom4j-1.6.1.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/gentlyWEB-utils-1.1.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/hibernate-jpa-2.0-api-1.0.1.Final.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/hibernate3.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/javassist-3.12.0.GA.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/jta-1.1.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/log4j.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/mail.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/mysql-connector-java-5.1.6-bin.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/quartz.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/slf4j-api-1.6.1.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/spring-beans.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/spring-context.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/spring-core-3.2.0.M1-javadoc.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/spring-web.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/spring.jar"/>
<classpathentry kind="output" path="WebRoot/WEB-INF/classes"/>
</classpath>
... ...
<?xml version="1.0" encoding="UTF-8"?>
<project-module
type="WEB"
name="espeedSendYingXiaoYouBase"
id="myeclipse.1432285515350"
context-root="/espeedSendYingXiaoYouBase"
j2ee-spec="5.0"
archive="espeedSendYingXiaoYouBase.war">
<attributes>
<attribute name="webrootdir" value="WebRoot" />
</attributes>
</project-module>
... ...
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>espeedSendYingXiaoYouBase</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.genuitec.eclipse.j2eedt.core.WebClasspathBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.genuitec.eclipse.j2eedt.core.J2EEProjectValidator</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.genuitec.eclipse.j2eedt.core.DeploymentDescriptorValidator</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.genuitec.eclipse.ast.deploy.core.DeploymentBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>com.genuitec.eclipse.ast.deploy.core.deploymentnature</nature>
<nature>com.genuitec.eclipse.j2eedt.core.webnature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
</natures>
</projectDescription>
... ...
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.WebProject">
<attributes>
<attribute name="hide" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/>
<classpathentry kind="src" path="WebRoot"/>
<classpathentry kind="output" path=""/>
</classpath>
... ...
#Fri May 22 17:05:27 CST 2015
eclipse.preferences.version=1
encoding/<project>=UTF-8
... ...
#Fri May 22 17:05:27 CST 2015
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.6
... ...
org.eclipse.wst.jsdt.launching.baseBrowserLibrary
\ No newline at end of file
... ...
Window
\ No newline at end of file
... ...
12
... ...
12
... ...
package com.espeed.yxy.dao.impl;
import java.util.List;
import com.espeed.yxy.dao.YxySendMailMasterBaseDao;
import com.espeed.yxy.pojo.YxySendMailMasterBase;
/**
* 程序名称: EspeedMail_时速邮箱
* 程序版本: V1.0
* 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776)
* 版权所有: 深圳市科飞时速网络技术有限公司
* 技术支持: Tech@21gmail.com
* 单元名称: 邮件基本信息DAO(营销游)
* 开始时间: 2013.12.09
* 程 序 员: 谢勇
* 最后修改:
* 备 注: 如需修改请通知程序员
*/
public class YxySendMailMasterBaseDaoImpl extends HibernateBaseDAOImpl<YxySendMailMasterBase, Long> implements YxySendMailMasterBaseDao{
/**实体插入*/
public int addPojo(YxySendMailMasterBase o)throws Exception{
return super.add(o);
}
/**实体编辑*/
public void updatePojo(YxySendMailMasterBase o)throws Exception{
super.update(o);
}
/**HQL查询*/
public List<YxySendMailMasterBase> findByHql(String hql)throws Exception{
return super.getAll(hql);
}
/**指定条记录*/
public List<YxySendMailMasterBase> findByHqlSet(String hql,int num)throws Exception{
return super.findBySet(hql, num);
}
/**SQL查询*/
public List<Object> findBySqlQuery(String sql)throws Exception{
return super.findBySql(sql);
}
/**HQL更新*/
public void updateByHql(String hql)throws Exception{
super.updateorDelByHql(hql);
}
}
... ...
package com.espeed.yxy.tool;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
/***
*
* @author xieyong
* 获取随机码
*/
public class GetRondom {
//生成随机码
public static List<String> getRandom(List<String> value){
List<String> newSmtpList=new ArrayList();
int n = value.size();
Random rand = new Random();
boolean[] bool = new boolean[n];
int num =0;
for (int i = 0; i<n; i++){
do{
//如果产生的数相同继续循环
num = rand.nextInt(n);
}while(bool[num]);
bool[num] =true;
newSmtpList.add(value.get(num));
}
return newSmtpList;
}
public static void main(String[] args) {
List<String> oldStr=new ArrayList<String>();
for(int i=0;i<3;i++){
oldStr.add("name"+i);
}
List<String> newStr=getRandom(oldStr);
for(int j=0;j<newStr.size();j++){
System.out.println(newStr.get(j));
}
}
}
... ...
package com.espeed.yxy.tool;
import java.io.File;
import java.io.FileOutputStream;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.activation.DataHandler;
import javax.activation.FileDataSource;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeBodyPart;
import javax.mail.internet.MimeMessage;
import javax.mail.internet.MimeMultipart;
import javax.mail.internet.MimeUtility;
import com.espeed.yxy.pojo.YxySendMailMaster;
/*
* 程序名称: EspeedMail_时速邮箱
* 程序版本: V1.0
* 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776)
* 版权所有: 深圳市科飞时速网络技术有限公司
* 技术支持: Tech@21gmail.com
* 单元名称: 生成本地邮件(营销邮)
* 开始时间: 2013.12.13
* 程 序 员: 谢勇
* 最后修改:
* 备 注: 如需修改请通知程序员
*/
public class GreateEmlFile {
private static MimeMessage mimeMsg = null; // MIME邮件对象
private static javax.mail.Session mailSession = null;
/**生成eml文件*/
public static List<Object> GreateMail(YxySendMailMaster yxysendmailmaster,String loginid,String domain,String uploadattrName,String usersetpath)throws Exception{
List<Object> RemlPath=new ArrayList<Object>();
RemlPath.add("0");
RemlPath.add("");
RemlPath.add("");
RemlPath.add("0");
RemlPath.add("");
//营销web路径(文件路径)
String pathew=ConfigPath.getYxyServicePath();
//内容
String context=yxysendmailmaster.getBody();
//获取上传的附件名
String newUpload=uploadattrName.replaceAll("\"", "");
String [] newstr=newUpload.split(",");//分割多个附件
int isAttr=0;//附件个数
//1.获取附件
String fileNames[]=new String[0];//定义附件名
if(newstr==null||newstr[0].equals("")){//判断是否存在附件
fileNames=new String[0];
}else{
String sysPath=pathew+"/mailtempfile/"+domain+"/"+loginid+"/attachment";
fileNames=new String[newstr.length];
for (int i = 0; i < newstr.length; i++) {
fileNames[i]=sysPath+"\\"+newstr[i];
}
}
isAttr=fileNames.length;//附件个数
//变量定义
String mailName=yxysendmailmaster.getSender();//发件人
String sendMail=yxysendmailmaster.getSend_email();//发件人邮箱
String replyEmail=yxysendmailmaster.getReply_email();//回复邮箱
String title=yxysendmailmaster.getSubject();//主题
//------- 设置from、to等信息----------
mimeMsg = new javax.mail.internet.MimeMessage(mailSession);
InternetAddress sentFrom;
//发件人
sentFrom = new InternetAddress(sendMail ,mailName,"UTF-8");
mimeMsg.setFrom(sentFrom);
//主题
mimeMsg.setSubject(title,"UTF-8");
// ---设置回复人地址---------------
InternetAddress addressis;
addressis = new InternetAddress(replyEmail);
InternetAddress[] addrs = new InternetAddress[1];
addrs[0] = addressis;
mimeMsg.setReplyTo(addrs);
// -------------------------------------
MimeBodyPart messageBodyPart1 = new MimeBodyPart();
messageBodyPart1.setHeader("Content-Transfer-Encoding", "base64");
//--------附件--------------------
MimeMultipart multipart = new MimeMultipart();// 附件传输格式
multipart.setSubType("related");//这句很重要
multipart.addBodyPart(messageBodyPart1);
for (int j = 0; j < fileNames.length; j++) {
MimeBodyPart messageBodyPart2 = new MimeBodyPart();
messageBodyPart2.setHeader("Content-Transfer-Encoding", "base64");
//messageBodyPart2.setContentLanguage("UTF-8");
// 选择出每一个附件名
String filename = fileNames[j].split("#####")[0];
String displayname = fileNames[j].split("#####")[1];
// 得到数据源
FileDataSource fds = new FileDataSource(filename);
// 得到附件本身并至入BodyPart
messageBodyPart2.setDataHandler(new DataHandler(fds));// 得到文件名同样至入BodyPart
messageBodyPart2.setHeader("Content-Type", "application/octet-stream;name="+displayname);
messageBodyPart2.setFileName(MimeUtility.encodeText(displayname,"UTF-8","B"));
multipart.addBodyPart(messageBodyPart2);
}
String resultpicpath="";//图片路径
//11.判断是否有图片
String[] picpath=context.split("<img");
for(int i=0;i<picpath.length;i++){
if(picpath[i].contains("src")){
int index=picpath[i].indexOf("mailtempfile/");
if(index==-1){
continue;
}
//处理字符
String[] picAarry=picpath[i].split("src=\"");
int end=picAarry[1].indexOf("\"");
String result=picAarry[1].substring(0,end);
//获取图片路径
int pathbegin=result.indexOf("mailtempfile");
String path=result.substring(pathbegin,result.length());
String picpaths=pathew+"\\"+path;//图片真实路径
//获取图片保存名字
//String[] filenamestr=result.split("/");
//String picname=filenamestr[filenamestr.length-1];
resultpicpath+=path+"#####";
//替换图片
context=context.replaceFirst(result,"cid:IMG"+i);
//加入图片源码
File pf=new File(picpaths);
if(pf.exists()){
MimeBodyPart gifBodyPart=new MimeBodyPart();
FileDataSource fds=new FileDataSource(pf);//图片所在的目录的绝对路径
gifBodyPart.setDataHandler(new DataHandler(fds));
gifBodyPart.setHeader("Content-Type", "image/jpeg");
gifBodyPart.setFileName(MimeUtility.encodeText("espeedpic.jpg","UTF-8","B"));
gifBodyPart.setContentID("<IMG"+i+">"); //cid的值
multipart.addBodyPart(gifBodyPart);
}
}
}
messageBodyPart1.setContent(context,"text/html" + ";charset=" + "UTF-8");
mimeMsg.setContent(multipart);
//------------- 设置信件头的发送日期---------------
mimeMsg.setSentDate(new Date());
//文件存放路径
//以当前用户名+当前日期为文件名
SimpleDateFormat df=new SimpleDateFormat("yyyyMMddHHssmm");
String nowDate=df.format(new Date());
String emlfileName="";
emlfileName=loginid+nowDate + ".eml";
//保存邮件
File dir = new File(usersetpath);
dir.mkdirs();// 创建所有目录,包括子目录
mimeMsg.writeTo(new FileOutputStream(dir+"\\" + emlfileName));
File files=new File(dir+"\\" + emlfileName);
//返回值
RemlPath.set(0,files.length());//文件大小
RemlPath.set(1,usersetpath + "\\" + emlfileName);//返回eml存放路径
//RemlPath.set(2,"");//文件key
RemlPath.set(3,isAttr);//是否有附件
RemlPath.set(4,resultpicpath);//图片路径
return RemlPath;
}
}
... ...
package com.espeed.yxy.pojo;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.Table;
@Entity
@Table(name="yxy_marketing_plan")
public class YxyMarketingPlan implements Serializable{
private static final long serialVersionUID = 1L;
private int plan_id;
private String plan_title;//计划说明或主题
private int plan_type;//计划类型
private int plan_cycle;//计划周期
private String plan_createtime;//建立时间
private String plan_executetime;//执行时间
private String plan_begintime;//开始时间
private String plan_endtime;//结束时间
private int plan_groupid;//计划地址分组
private String loginid;//账号
private String domain;//域名
private int plan_status;//计划状态(0:未执行,1:已执行,-1:正在执行)
/**0:本地库,
* 1:客户分类未超标,2:客户分类已超标
* 3:客户状态未超标,4:客户状态已超标
* 5:客户来源未超标,6:客户来源已超标
* 7:意向产品未超标,8:意向产品已超标
* 9:采购偏好未超标,10:采购偏好已超标
* 11:个性营销未超标,12:个性营销已超标
*/
private Integer plan_differen;
private String other_name;//针对于采购偏好或个性营销邮的名称
private List<YxyMarketingWeek> weeklist=new ArrayList<YxyMarketingWeek>();
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
public int getPlan_id() {
return plan_id;
}
public void setPlan_id(int planId) {
plan_id = planId;
}
public int getPlan_type() {
return plan_type;
}
public void setPlan_type(int planType) {
plan_type = planType;
}
public int getPlan_cycle() {
return plan_cycle;
}
public void setPlan_cycle(int planCycle) {
plan_cycle = planCycle;
}
public String getPlan_createtime() {
return plan_createtime;
}
public void setPlan_createtime(String planCreatetime) {
plan_createtime = planCreatetime;
}
public String getPlan_executetime() {
return plan_executetime;
}
public void setPlan_executetime(String planExecutetime) {
plan_executetime = planExecutetime;
}
public String getPlan_begintime() {
return plan_begintime;
}
public void setPlan_begintime(String planBegintime) {
plan_begintime = planBegintime;
}
public String getPlan_endtime() {
return plan_endtime;
}
public void setPlan_endtime(String planEndtime) {
plan_endtime = planEndtime;
}
public int getPlan_groupid() {
return plan_groupid;
}
public void setPlan_groupid(int planGroupid) {
plan_groupid = planGroupid;
}
public String getLoginid() {
return loginid;
}
public void setLoginid(String loginid) {
this.loginid = loginid;
}
public String getDomain() {
return domain;
}
public void setDomain(String domain) {
this.domain = domain;
}
public String getPlan_title() {
return plan_title;
}
public void setPlan_title(String planTitle) {
plan_title = planTitle;
}
public int getPlan_status() {
return plan_status;
}
public void setPlan_status(int planStatus) {
plan_status = planStatus;
}
@OneToMany(cascade = CascadeType.REFRESH, fetch = FetchType.EAGER)
@JoinColumn(name="plan_id",updatable = false,insertable=false)
public List<YxyMarketingWeek> getWeeklist() {
return weeklist;
}
public void setWeeklist(List<YxyMarketingWeek> weeklist) {
this.weeklist = weeklist;
}
public Integer getPlan_differen() {
return plan_differen;
}
public void setPlan_differen(Integer plan_differen) {
this.plan_differen = plan_differen;
}
public String getOther_name() {
return other_name;
}
public void setOther_name(String other_name) {
this.other_name = other_name;
}
}
... ...
package com.espeed.yxy.dao.impl;
import java.util.List;
import com.espeed.centre.pojo.CentreYxyedmNewcustomer;
import com.espeed.yxy.dao.CentreYxyedmNewcustomerDao;
/**
* 项目名称: 统一验证中心系统
* 版权所有: 深圳市科飞时速网络技术有限公司(0755-88843776)
* 技术支持: info@21gmail.com
* 单元名称: 营销邮开发客户配置Dao实现类
* 开始时间: 2018.04.08
* 开发人员: 陈南巧
*/
public class CentreYxyedmNewcustomerDaoImpl extends CentreHibernateBaseDAOImpl<CentreYxyedmNewcustomer, Long> implements CentreYxyedmNewcustomerDao {
/**实体插入*/
public int addPojo(CentreYxyedmNewcustomer o)throws Exception{
return super.add(o);
}
/**实体编辑*/
public void updatePojo(CentreYxyedmNewcustomer o)throws Exception{
super.update(o);
}
/**HQL查询*/
public List<CentreYxyedmNewcustomer> findByHql(String hql)throws Exception{
return super.getAll(hql);
}
/**HQL查询数量*/
public int findByHqlCount(String hql)throws Exception{
return super.count(hql);
}
/**SQL查询*/
public List<Object> findBySqlFind(String sql)throws Exception{
return super.findBySql(sql);
}
/**HQL更新*/
public void updateByHql(String hql)throws Exception{
super.updateorDelBySql(hql);
}
}
... ...
package com.espeed.plan;
import java.io.Serializable;
import java.util.List;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import com.espeed.yxy.pojo.YxyMarketingPlan;
import com.espeed.yxy.pojo.YxySendSmtpInfo;
import com.espeed.yxy.service.YxyMarketingPlanService;
import com.espeed.yxy.service.YxySendMailService;
/**
* 程序名称: EspeedMail_时速邮箱
* 程序版本: V1.0
* 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776)
* 版权所有: 深圳市科飞时速网络技术有限公司
* 技术支持: Tech@21gmail.com
* 单元名称: 手动收邮件后台线程池
* 开始时间: 2013.09.02
* 程 序 员: 谢勇
* 最后修改:
* 备 注: 如需修改请通知程序员
*/
public class PlanThreadPoolTask implements Runnable,Serializable{
private static final long serialVersionUID = 0;
private static ThreadPoolExecutor threadPool=null;
private static PlanThreadPoolTask threadpooltask=null;
private YxyMarketingPlanService planservice;//计划service
private YxySendMailService mailservice;//邮件service
private YxySendSmtpInfo smtpinfo;//smtp集合
private YxyMarketingPlan planinfo;//计划集合
//无参构造方法
PlanThreadPoolTask(){
}
//传递参数
PlanThreadPoolTask(YxyMarketingPlanService planservice,YxySendMailService mailservice,YxySendSmtpInfo smtpinfo,YxyMarketingPlan planinfo){
this.planservice=planservice;
this.smtpinfo=smtpinfo;
this.smtpinfo=smtpinfo;
this.mailservice=mailservice;
}
//单例方法
public static PlanThreadPoolTask getMethodInstance(){
if(threadpooltask==null){
//System.out.println("创建新对像了");
threadpooltask=new PlanThreadPoolTask();
}
return threadpooltask;
}
//线程池
public static ThreadPoolExecutor getInstance(int bigThread){
if(threadPool==null){
threadPool=new ThreadPoolExecutor(bigThread,bigThread+2,100,
TimeUnit.SECONDS,new ArrayBlockingQueue<Runnable>(4000),
new ThreadPoolExecutor.DiscardOldestPolicy());
}
return threadPool;
}
//线程池运行方法
public synchronized void getResult(YxyMarketingPlanService planservice,YxySendMailService mailservice,List<YxySendSmtpInfo> smtplist,List<YxyMarketingPlan> planlist) {
threadPool=getInstance(10);
//计划加入线程池
for(int j=0;j<planlist.size();j++){
try {
threadPool.execute(new PlanThreadPoolTask(planservice,mailservice,smtplist.get(j),planlist.get(j)));
} catch (Exception e) {
e.printStackTrace();
}
}
}
//获取线程量
public int getThreadNum(){
if(threadPool==null){
return -1;
}else{
return threadPool.getActiveCount();
}
}
//执行计划
public void run(){
try {
} catch (Exception e) {
e.printStackTrace();
}
}
}
... ...
<?xml version="1.0" encoding="UTF-8"?>
<project-module
type="WEB"
name="espeedSendYingXiaoYouBase"
id="myeclipse.1432285515350"
context-root="/espeedSendYingXiaoYouBase"
j2ee-spec="5.0"
archive="espeedSendYingXiaoYouBase.war">
<attributes>
<attribute name="webrootdir" value="WebRoot" />
</attributes>
</project-module>
... ...
package com.espeed.yxy.service.impl;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import com.espeed.centre.pojo.CentreYxyedmOldcustomer;
import com.espeed.webmail.pojo.YxyCustomerEmail;
import com.espeed.yxy.dao.CentreUserDao;
import com.espeed.yxy.dao.CentreYxyedmOldcustomerDao;
import com.espeed.yxy.dao.CrmCustomerInfoDao;
import com.espeed.yxy.dao.YxyCustomerEmailDao;
import com.espeed.yxy.dao.YxyMailStencilDao;
import com.espeed.yxy.dao.YxyMarketingPlanDao;
import com.espeed.yxy.dao.YxyMarketingWeekDao;
import com.espeed.yxy.dao.YxyParamaterDao;
import com.espeed.yxy.dao.YxySendCountDao;
import com.espeed.yxy.dao.YxySenderSetDao;
import com.espeed.yxy.dao.YxySysParamatersValueDao;
import com.espeed.yxy.dao.YxyUserAddressDao;
import com.espeed.yxy.pojo.YxyMailStencil;
import com.espeed.yxy.pojo.YxyMarketingPlan;
import com.espeed.yxy.pojo.YxySendCount;
import com.espeed.yxy.pojo.YxySenderSet;
import com.espeed.yxy.pojo.YxySysParamaters;
import com.espeed.yxy.pojo.YxySysParamatersValue;
import com.espeed.yxy.pojo.YxyUserAddress;
import com.espeed.yxy.service.YxyMarketingPlanService;
import com.espeed.yxy.tool.DateFormat;
public class YxyMarketingPlanServiceImpl implements YxyMarketingPlanService{
/**是否有可执行的营销计划*/
public List<YxyMarketingPlan> findHavePlan() throws Exception {
SimpleDateFormat df=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String nowdate=df.format(new Date());
String nowday=nowdate.split(" ")[0];
String nowtime=nowdate.split(" ")[1];
//hql查询
String hql="from YxyMarketingPlan where (plan_status=0 or plan_status=-1) and plan_type=1 and plan_executetime<='"+nowtime+"' and plan_begintime<='"+nowday+"' and plan_endtime>='"+nowday+"'";
return marketingplandao.findByHql(hql);
}
/**根据地址分组查询地址*/
public List<YxyUserAddress> findAddressByGroupid(int typeid,int plan_differen,String loginid,String domain,String other_name) throws Exception {
//判断是否是本地库发送还是CRM库
if(plan_differen == 0)//本地库发送
{
String hql="from YxyUserAddress where user_addr_type_id="+typeid;
return addressdao.findByHql(hql);
}
else//客户管理发送
{
int company_id = 0;
int user_id = 0;
List<YxyCustomerEmail> customerEmails = new ArrayList<YxyCustomerEmail>();
if(plan_differen == 1 || plan_differen == 2){//客户分类
String sql = "select company_id from centre_company where domain = '"+domain+"'";
List<Object> objects = centreuserdao.findBySqlFind(sql);
if(objects.size() > 0 && objects.get(0) != null){
company_id = Integer.parseInt(objects.get(0).toString());
sql = "select user_id from centre_user where company_id = "+company_id+" and login_id = '"+loginid+"'";
objects = centreuserdao.findBySqlFind(sql);
if(objects.size() > 0 && objects.get(0) != null){
user_id = Integer.parseInt(objects.get(0).toString());
String hql = "from YxyCustomerEmail where user_id = "+user_id+" and current_status != 1 " +
"and delete_flag = 0 and classify_id = "+typeid;
customerEmails = yxycustomeremaildao.findByHql(hql);
}
}
}else if(plan_differen == 3 || plan_differen == 4){//客户状态
String sql = "select company_id from centre_company where domain = '"+domain+"'";
List<Object> objects = centreuserdao.findBySqlFind(sql);
if(objects.size() > 0 && objects.get(0) != null){
company_id = Integer.parseInt(objects.get(0).toString());
sql = "select user_id from centre_user where company_id = "+company_id+" and login_id = '"+loginid+"'";
objects = centreuserdao.findBySqlFind(sql);
if(objects.size() > 0 && objects.get(0) != null){
user_id = Integer.parseInt(objects.get(0).toString());
String hql = "from YxyCustomerEmail where user_id = "+user_id+" and current_status != 1 " +
"and delete_flag = 0 and customer_status = "+typeid;
customerEmails = yxycustomeremaildao.findByHql(hql);
}
}
}else if(plan_differen == 5 || plan_differen == 6){//客户来源
String sql = "select company_id from centre_company where domain = '"+domain+"'";
List<Object> objects = centreuserdao.findBySqlFind(sql);
if(objects.size() > 0 && objects.get(0) != null){
company_id = Integer.parseInt(objects.get(0).toString());
sql = "select user_id from centre_user where company_id = "+company_id+" and login_id = '"+loginid+"'";
objects = centreuserdao.findBySqlFind(sql);
if(objects.size() > 0 && objects.get(0) != null){
user_id = Integer.parseInt(objects.get(0).toString());
String hql = "from YxyCustomerEmail where user_id = "+user_id+" and current_status != 1 " +
"and delete_flag = 0 and source_from_id = "+typeid;
customerEmails = yxycustomeremaildao.findByHql(hql);
}
}
}else if(plan_differen == 7 || plan_differen == 8){//意向产品
String sql = "select company_id from centre_company where domain = '"+domain+"'";
List<Object> objects = centreuserdao.findBySqlFind(sql);
if(objects.size() > 0 && objects.get(0) != null){
company_id = Integer.parseInt(objects.get(0).toString());
sql = "select user_id from centre_user where company_id = "+company_id+" and login_id = '"+loginid+"'";
objects = centreuserdao.findBySqlFind(sql);
if(objects.size() > 0 && objects.get(0) != null){
user_id = Integer.parseInt(objects.get(0).toString());
String hql = "from YxyCustomerEmail where user_id = "+user_id+" and current_status != 1 " +
"and delete_flag = 0 and find_in_set("+typeid+",prductid) > 0";
customerEmails = yxycustomeremaildao.findByHql(hql);
}
}
}else if(plan_differen == 9 || plan_differen == 10){//采购偏好
if(other_name != null && !"".equals(other_name)){
String sql = "select company_id from centre_company where domain = '"+domain+"'";
List<Object> objects = centreuserdao.findBySqlFind(sql);
if(objects.size() > 0 && objects.get(0) != null){
company_id = Integer.parseInt(objects.get(0).toString());
sql = "select user_id from centre_user where company_id = "+company_id+" and login_id = '"+loginid+"'";
objects = centreuserdao.findBySqlFind(sql);
if(objects.size() > 0 && objects.get(0) != null){
user_id = Integer.parseInt(objects.get(0).toString());
String customerids = "";
sql = "select customer_id from crm_customer_info where most_sourcing_industries like '%" + other_name + "%' and user_id = " + user_id;
objects = crmcustomerinfodao.findBySqlFind(sql);
for (int i = 0;i < objects.size();i++) {
customerids += objects.get(i).toString() + ",";
}
if(!customerids.equals("")){
customerids = customerids.substring(0,customerids.length()-1);
String hql = "from YxyCustomerEmail where delete_flag = 0 and current_status != 1 " +
"and user_id = "+user_id+" and customer_id in("+customerids+")";
customerEmails = yxycustomeremaildao.findByHql(hql);
}
}
}
}
}else if(plan_differen == 11 || plan_differen == 12){//个性营销
if(other_name != null && !"".equals(other_name)){
String sql = "select company_id from centre_company where domain = '"+domain+"'";
List<Object> objects = centreuserdao.findBySqlFind(sql);
if(objects.size() > 0 && objects.get(0) != null){
company_id = Integer.parseInt(objects.get(0).toString());
sql = "select user_id from centre_user where company_id = "+company_id+" and login_id = '"+loginid+"'";
objects = centreuserdao.findBySqlFind(sql);
if(objects.size() > 0 && objects.get(0) != null){
user_id = Integer.parseInt(objects.get(0).toString());
String[] conditionArr = other_name.split("@espeed@");
if(conditionArr.length == 10){
String classfiyStr = conditionArr[0];//客户分类信息
String statusStr = conditionArr[1];//客户状态信息
String fromStr = conditionArr[2];//客户来源信息
String starStr = conditionArr[3];//客户星级信息
String productStr = conditionArr[4];//意向产品信息
String caigouStr = conditionArr[5];//采购偏好信息
String entrolStr = conditionArr[6];//入库时间信息
String contactStr = conditionArr[7];//联系时间信息
String followStr = conditionArr[8];//未跟进时间信息
String typeStr = conditionArr[9];//客户类型信息,0私海,1公海
String hql = "from YxyCustomerEmail where user_id = "+user_id+" and delete_flag = 0 and current_status != 1 and";
if(typeStr.equals("1")){//公海客户
hql = "from YxyCustomerEmail where company_id = "+company_id+" and delete_flag = 0 and current_status = 1 and";
}
if(!classfiyStr.equals("no")){
hql += " classify_id in("+classfiyStr+") and";
}
if(!statusStr.equals("no")){
hql += " customer_status in("+statusStr+") and";
}
if(!fromStr.equals("no")){
hql += " source_from_id in("+fromStr+") and";
}
if(!starStr.equals("no")){
hql += " important_star in("+starStr+") and";
}
if(!productStr.equals("no")){
String[] productArr = productStr.split("@G@");
String subHql = " (";
for(String s : productArr){
subHql += "find_in_set("+s+",prductid) > 0 or ";
}
subHql = subHql.substring(0,subHql.lastIndexOf("or ")-1);
hql += subHql + ") and";
}
if(!caigouStr.equals("no")){
String[] caigouArr = caigouStr.split("@G@");
int jingzhun = Integer.parseInt(caigouArr[0]);//0:不精准,1:精准
String customerids = "";
for(int k = 1;k < caigouArr.length; k++){
sql = "";
if(jingzhun == 1){
sql = "select customer_id from crm_customer_info where find_in_set('"+caigouArr[k]+"',most_sourcing_industries) > 0 and user_id = " + user_id;
}else{
sql = "select customer_id from crm_customer_info where most_sourcing_industries like '%" + caigouArr[k] + "%' and user_id = " + user_id;
}
objects = crmcustomerinfodao.findBySqlFind(sql);
for (int i = 0;i < objects.size();i++) {
customerids += objects.get(i).toString() + ",";
}
}
if(!customerids.equals("")){
customerids = customerids.substring(0,customerids.length()-1);
hql += " customer_id in("+customerids+") and";
}
}
if(!entrolStr.equals("no")){
String[] entrolArr = entrolStr.split("@G@");
if(entrolArr.length == 1){
hql += " enrol_time >= '"+entrolArr[0]+" 00:00:00' and";
}else if(entrolArr.length == 2){
hql += " enrol_time >= '"+entrolArr[0]+" 00:00:00' and enrol_time <= '"+entrolArr[1]+" 23:59:59' and";
}
}
if(!contactStr.equals("no")){
String[] contactArr = contactStr.split("@G@");
if(contactArr.length == 1){
hql += " last_contact_date >= '"+contactArr[0]+" 00:00:00' and";
}else if(contactArr.length == 2){
hql += " last_contact_date >= '"+contactArr[0]+" 00:00:00' and last_contact_date <= '"+contactArr[1]+" 23:59:59' and";
}
}
if(!followStr.equals("no")){
String[] followArr = followStr.split("@G@");
int day = Integer.parseInt(followArr[0]);
if(day != -1){
String start_time = DateFormat.lastDays(-day);
hql += " last_contact_date < '"+start_time+" 00:00:00' and";
}else if(followArr.length == 2){
String[] timeArr = followArr[1].split(",");
if(timeArr.length == 1){
hql += " last_contact_date >= '"+timeArr[0]+" 00:00:00' and";
}else if(timeArr.length == 2){
hql += " last_contact_date >= '"+timeArr[0]+" 00:00:00' and last_contact_date <= '"+timeArr[1]+" 23:59:59' and";
}
}
}
if(!hql.equals("from YxyCustomerEmail where user_id = "+user_id+" and delete_flag = 0 and current_status != 1 and")
&& !hql.equals("from YxyCustomerEmail where company_id = "+company_id+" and delete_flag = 0 and current_status = 1 and")){//说明以上的条件都不适合
hql = hql.substring(0,hql.length()-3);
customerEmails = yxycustomeremaildao.findByHql(hql);
}
}
}
}
}
}
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
SimpleDateFormat df2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String nowtime = df2.format(new Date());
String nowdate = df.format(new Date());
List<YxyUserAddress> address_list = new ArrayList<YxyUserAddress>();
for(YxyCustomerEmail customer : customerEmails){
//只查询主联系人的信息
String sql = "select full_name,email from crm_linkman where is_main_linkman = 1 and customer_id = "+customer.getCustomer_id();
List<Object> objects = yxycustomeremaildao.findBySqlQuery(sql);
if(objects.size() > 0){
Object[] obj_arr = (Object[])objects.get(0);
YxyUserAddress address = new YxyUserAddress();
address.setUser_addr_id(customer.getCustomer_id());//客户id赋值给主键id
address.setCompany_variable(customer.getCustomer_name());//客户名称
address.setUser_addr_email(obj_arr[1].toString());//地址
address.setUser_addr_name(obj_arr[0].toString());//联系人
address_list.add(address);//添加到集合
try{
String hql = "from YxySendCount where user_id = "+user_id+" and customer_id = "+customer.getCustomer_id()+" and send_date = '"+nowdate+"'";
List<YxySendCount> counts = yxysendcountdao.findByHql(hql);
if(counts.size() > 0){
YxySendCount count = counts.get(0);
count.setSend_counts(count.getSend_counts()+1);
count.setSend_time(nowtime);
yxysendcountdao.updatePojo(count);
}else{
YxySendCount count = new YxySendCount();
count.setUser_id(user_id);
count.setCompany_id(company_id);
count.setSend_counts(1);
count.setSend_date(nowdate);
count.setSend_time(nowtime);
count.setCustomer_id(customer.getCustomer_id());
yxysendcountdao.addPojo(count);
}
}catch (Exception e) {
// TODO: handle exception
}
}
}
return address_list;
}
}
/**查询模版*/
public YxyMailStencil findStencilInfo(int stencilid) throws Exception {
String hql="from YxyMailStencil where stencil_id="+stencilid;
List<YxyMailStencil> stencillist=stencildao.findByHql(hql);
if(stencillist.size()>0){
return stencillist.get(0);
}else{
return null;
}
}
/**查询发件人*/
public YxySenderSet findSender(String loginid,String domain)throws Exception{
String hql="from YxySenderSet where user_login='"+loginid+"' and user_domain='"+domain+"' and isdefault=1";
List<YxySenderSet> senderlist=senderdao.findByHql(hql);
if(senderlist.size()>0){
return senderlist.get(0);
}else{
return null;
}
}
/**修改计划周期状态*/
public void updateWeekStatus(int weekid,int status)throws Exception{
String hql="update YxyMarketingWeek set isexecution="+status+" where week_id="+weekid;
marketingweekdao.updateByHql(hql);
}
/**修改计划状态*/
public void updatePlanStatus(int planid,int status)throws Exception{
String hql="update YxyMarketingPlan set plan_status="+status+" where plan_id="+planid;
marketingplandao.updateByHql(hql);
}
/**code查询控制参数(有用户级返回用户级,否则返回默认参数)*/
public String findCompanyParamByCode(String code,String loginid,String domain)throws Exception{
//查询此code的paramid
String hql="from YxySysParamaters where para_code='"+code+"'";
List<YxySysParamaters> paraslist=yxysysparamaterdao.findByHql(hql);
if(paraslist.size()>0){
int paramid=paraslist.get(0).getPara_id();
int level=paraslist.get(0).getOwner_type();//所属等级
String defaultvalue=paraslist.get(0).getDefault_value();//默认值
if(level==4){//用户级
//查询参数值
String hql1="from YxySysParamatersValue where para_id="+paramid+" and owner_loginid='"+loginid+"' and company_domain='"+domain+"'";
List<YxySysParamatersValue> paraValue=yxysysparamatersvaluedao.findByHql(hql1);
if(paraValue.size()>0){
return paraValue.get(0).getPara_value();
}else{
return defaultvalue;
}
}else{//系统级
//查询参数值
String hql1="from YxySysParamatersValue where para_id="+paramid+" and company_domain='"+domain+"'";
List<YxySysParamatersValue> paraValue=yxysysparamatersvaluedao.findByHql(hql1);
if(paraValue.size()>0){
return paraValue.get(0).getPara_value();
}else{
return defaultvalue;
}
}
}else{
return "-1";
}
}
/**获取EDM配置-盘活客户配置信息*/
public CentreYxyedmOldcustomer getOldCusSet(String domain)throws Exception{
String hql= "from CentreYxyedmOldcustomer where company_domain = '"+domain+"'";
List<CentreYxyedmOldcustomer> list = centreyxyedmoldcustomerdao.findByHql(hql);
if(list.size()>0){
return list.get(0);
}else{
return null;
}
}
private YxyMarketingPlanDao marketingplandao;//营销计划dao
private YxyMarketingWeekDao marketingweekdao;//营销计划周期dao
private YxyUserAddressDao addressdao;//用户地址dao
private YxyMailStencilDao stencildao;//模版dao
private YxySenderSetDao senderdao;//发件人dao
private YxyParamaterDao yxysysparamaterdao;//控制参数dao
private YxySysParamatersValueDao yxysysparamatersvaluedao;//控制参数值dao
private YxyCustomerEmailDao yxycustomeremaildao;//客户邮件dao
private CentreYxyedmOldcustomerDao centreyxyedmoldcustomerdao;//盘活客户配置dao
private CentreUserDao centreuserdao;//用户dao
private CrmCustomerInfoDao crmcustomerinfodao;//阿里巴巴客户dao
private YxySendCountDao yxysendcountdao;//客户发送邮件的统计dao
public YxyCustomerEmailDao getYxycustomeremaildao() {
return yxycustomeremaildao;
}
public void setYxycustomeremaildao(YxyCustomerEmailDao yxycustomeremaildao) {
this.yxycustomeremaildao = yxycustomeremaildao;
}
public YxyUserAddressDao getAddressdao() {
return addressdao;
}
public void setAddressdao(YxyUserAddressDao addressdao) {
this.addressdao = addressdao;
}
public YxyMarketingPlanDao getMarketingplandao() {
return marketingplandao;
}
public void setMarketingplandao(YxyMarketingPlanDao marketingplandao) {
this.marketingplandao = marketingplandao;
}
public YxyMarketingWeekDao getMarketingweekdao() {
return marketingweekdao;
}
public void setMarketingweekdao(YxyMarketingWeekDao marketingweekdao) {
this.marketingweekdao = marketingweekdao;
}
public YxyMailStencilDao getStencildao() {
return stencildao;
}
public void setStencildao(YxyMailStencilDao stencildao) {
this.stencildao = stencildao;
}
public YxySenderSetDao getSenderdao() {
return senderdao;
}
public void setSenderdao(YxySenderSetDao senderdao) {
this.senderdao = senderdao;
}
public YxyParamaterDao getYxysysparamaterdao() {
return yxysysparamaterdao;
}
public void setYxysysparamaterdao(YxyParamaterDao yxysysparamaterdao) {
this.yxysysparamaterdao = yxysysparamaterdao;
}
public YxySysParamatersValueDao getYxysysparamatersvaluedao() {
return yxysysparamatersvaluedao;
}
public void setYxysysparamatersvaluedao(
YxySysParamatersValueDao yxysysparamatersvaluedao) {
this.yxysysparamatersvaluedao = yxysysparamatersvaluedao;
}
public CentreYxyedmOldcustomerDao getCentreyxyedmoldcustomerdao() {
return centreyxyedmoldcustomerdao;
}
public void setCentreyxyedmoldcustomerdao(
CentreYxyedmOldcustomerDao centreyxyedmoldcustomerdao) {
this.centreyxyedmoldcustomerdao = centreyxyedmoldcustomerdao;
}
public CentreUserDao getCentreuserdao() {
return centreuserdao;
}
public void setCentreuserdao(CentreUserDao centreuserdao) {
this.centreuserdao = centreuserdao;
}
public CrmCustomerInfoDao getCrmcustomerinfodao() {
return crmcustomerinfodao;
}
public void setCrmcustomerinfodao(CrmCustomerInfoDao crmcustomerinfodao) {
this.crmcustomerinfodao = crmcustomerinfodao;
}
public YxySendCountDao getYxysendcountdao() {
return yxysendcountdao;
}
public void setYxysendcountdao(YxySendCountDao yxysendcountdao) {
this.yxysendcountdao = yxysendcountdao;
}
}
... ...
package com.espeed.yxy.dao.impl;
import java.util.List;
import com.espeed.webmail.pojo.CrmCustomerInfo;
import com.espeed.yxy.dao.CrmCustomerInfoDao;
/**
*
* @项目名称: 科飞管理后台系统
* @版权所有: 深圳市科飞时速网络技术有限公司(0755-88843776)
* @技术支持: info@21gmail.com
* @单元名称: 实体类CrmCustomerInfo的DAO接口
* @开始时间: 2018-09-27
* @开发人员: 杨志钊
*/
public class CrmCustomerInfoDaoImpl extends WebmailHibernateBaseDAOImpl<CrmCustomerInfo, Long> implements CrmCustomerInfoDao {
/**实体插入*/
public int addPojo(CrmCustomerInfo entity) throws Exception {
return super.add(entity);
}
/**实体编辑*/
public void updatePojo(CrmCustomerInfo entity) throws Exception {
super.update(entity);
}
/**HQL查询*/
public List<CrmCustomerInfo> findByHql(String hql) throws Exception {
return super.getAll(hql);
}
/**HQL指定条查询*/
public List<CrmCustomerInfo> findByHqlSet(String hql,int num) throws Exception {
return super.findBySet(hql, num);
}
/**SQL查询*/
public List<Object> findBySqlFind(String sql) throws Exception {
return super.findBySql(sql);
}
/**HQL更新*/
public void updateByHql(String hql) throws Exception {
super.updateorDelBySql(hql);
}
/**sql更新*/
public void updateBySql(String sql) throws Exception {
super.updateorDelSql(sql);
}
/**HQL查询数量*/
public int findByHqlCount(String hql) throws Exception {
return super.count(hql);
}
}
... ...
package com.espeed.yxy.mail;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Properties;
import javax.mail.Transport;
import com.espeed.yxy.pojo.YxySendMailDetail;
import com.espeed.yxy.pojo.YxySendMailMaster;
import com.espeed.yxy.pojo.YxySendSmtpInfo;
import com.espeed.yxy.pojo.YxySmtpSendSelfOverset;
import com.espeed.yxy.pojo.YxySmtpSendSelfSet;
import com.espeed.yxy.pojo.YxySmtpSendSet;
import com.espeed.yxy.pojo.YxySmtpSuffixSet;
import com.espeed.yxy.service.YxySendMailService;
import com.espeed.yxy.timer.SendMailTimer;
import com.espeed.yxy.tool.DES_Encrypt;
import com.espeed.yxy.tool.DateFormat;
import com.espeed.yxy.tool.LogsTool;
/**
* 程序名称: EspeedMail_时速邮箱
* 程序版本: V1.0
* 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776)
* 版权所有: 深圳市科飞时速网络技术有限公司
* 技术支持: Tech@21gmail.com
* 单元名称: 发送邮件之前的判断(营销游)
* 开始时间: 2013.12.09
* 程 序 员: 谢勇
* 最后修改:
* 备 注: 如需修改请通知程序员
*/
public class YxysendMethod {
//private static Properties props =null;
//private static Transport transport =null;
/**参数说明(1:service层接口,2:smtp服务器,3:邮件信息,4:smtp后缀信息,5:smtp后缀发送量信息)*/
public static void sendMethodImpl(YxySendMailService YxySendMailService,YxySendSmtpInfo SmtpInfo,YxySendMailMaster mailinfo){
//public static void sendMethodImpl(YxySendMailService YxySendMailService,YxySendSmtpInfo SmtpInfo,YxySendMailMaster mailinfo,List<YxySmtpSuffixSet> smtpsuffixsetList){
try{
//获取当前时间
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String nowDate=sdf1.format(new Date());
//邮件ID
int mailid=mailinfo.getSend_mail_id();
//SMTPID
int smtpid=SmtpInfo.getSmtp_service_id();
//int isyxy=SmtpInfo.getSmtp_service_isyxy();//是自配还是运营
//判断是自配smtp还是运营smtp
// if(isyxy==0){//自配
// //更新smtp状态
// YxySendMailService.updateSmtpUseStatus(1,smtpid,"");
//
// //更新待发邮件为已使用中
// YxySendMailService.updateMailUseStatus(mailid,1,nowDate);
//
// //自配smtp发送方法
// selfSmtpMethod(YxySendMailService,SmtpInfo,mailinfo);
//
// //发送完后将smtp状态改回可用,且使用时间修改为当前时间
// YxySendMailService.updateSmtpUseStatus(0,smtpid,nowDate);
//
// //发送完后将待发邮件状态改回未使用
// YxySendMailService.updateMailUseStatus(mailid,0,nowDate);
// }else{//运营
try {
synchronized (SendMailTimer.nowtimer) {
//更新smtp状态
YxySendMailService.updateSmtpUseStatus(1,smtpid,"");
//更新待发邮件为已使用中
YxySendMailService.updateMailUseStatus(mailid,1,nowDate);
}
//调用方法
yxySmtpMethod(YxySendMailService,SmtpInfo,mailinfo);
//yxySmtpMethod(YxySendMailService,SmtpInfo,mailinfo,smtpsuffixsetList);
synchronized (SendMailTimer.nowtimer) {
//发送完后将smtp状态改回可用,且使用时间修改为当前时间
YxySendMailService.updateSmtpUseStatus(0,smtpid,nowDate);
//发送完后将待发邮件状态改回未使用
YxySendMailService.updateMailUseStatus(mailid,0,nowDate);
}
} catch (Exception e) {
e.printStackTrace();
//写入日志
StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw, true));
String str = sw.toString();
LogsTool.erroLogs(str);
//更新此邮件异常量
YxySendMailService.updateMailExpStatus(mailid,mailinfo.getExptionnum()+1);
}
//}
}catch (Exception e) {
e.printStackTrace();
System.out.println("sendMethodImpl方法加载异常!");
//写入日志
StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw, true));
String str = sw.toString();
LogsTool.erroLogs(str);
}
}
/**自配运行方法*/
public static void selfSmtpMethod(YxySendMailService YxySendMailService,YxySendSmtpInfo SmtpInfo,YxySendMailMaster mailinfo){
try {
//邮件ID
int mailid=mailinfo.getSend_mail_id();
//邮件UID
String mailuid=mailinfo.getMail_uid();
//验证SMTP
List<Object> isTong=connectionService(SmtpInfo.getSmtp_service_number(),SmtpInfo.getSmtp_service_account(),SmtpInfo.getSmtp_service_password(),SmtpInfo.getSmtp_is_ssl(),SmtpInfo.getSmtp_service_port());
//判断是否验证通过
if(isTong.get(0).toString().equals("1")){
Properties props =(Properties) isTong.get(1);
Transport transport =(Transport) isTong.get(2);
//通过获取的待发邮件ID来获取该封邮件的待发地址
int MastermailId=mailinfo.getSend_mail_id();//该封邮件主ID
List<YxySendMailDetail> addressList=YxySendMailService.findAddressByMailID(MastermailId);//待发邮件对应的地址
if(addressList.size()<=0){
System.out.println("没有待发地址了..结束后续工作");
//将该邮件状态改为已发送
YxySendMailService.updateMailStatus(1,mailid,mailuid);
}else{
//-------定义变量------------------
//获取当前时间
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String currDate=sdf1.format(new Date());
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String nowDay=sdf.format(new Date());
String smtpaccount=SmtpInfo.getSmtp_service_account();//smtp账号
String smtphost=SmtpInfo.getSmtp_service_number();//SMTP服务器
int selftenNum=0;//十分钟最大发信量
int selfhourNum=0;//60分钟最大发信量
int selfdayNum=0;//一天最大发信量
int selftenNumOver=0;//十分钟已发信量
int selfhourNumOver=0;//60分钟已发信量
int selfdayNumOver=0;//一天已发信量
boolean tenisok=false;//10分钟是否通过
boolean hourisok=false;//60分钟是否通过
boolean dayisok=false;//一天是否通过
int selftenNumSurplus=0;//十分钟剩余发信量
int selfhourNumSurplus=0;//60分钟剩余发信量
int selfdayNumSurplus=0;//一天剩余发信量
//1.获取自配smtp发送量限制
List<YxySmtpSendSelfSet> smtpselfsendsetList=YxySendMailService.findSendSelfSetByService(smtphost);
if(smtpselfsendsetList.size()>=2){//说明有控制量限制(包含默认的和自己配的)
if(!smtpselfsendsetList.get(0).getSmtp_send_self_set_account().equals("domain")){//自配量
selftenNum=smtpselfsendsetList.get(0).getSmtp_send_self_set_tennum();//十分钟最大发信量
selfhourNum=smtpselfsendsetList.get(0).getSmtp_send_self_set_hournum();//60分钟最大发信量
selfdayNum=smtpselfsendsetList.get(0).getSmtp_send_self_set_daynum();//一小时最大发信量
}else{//domain默认设置信息
selftenNum=smtpselfsendsetList.get(1).getSmtp_send_self_set_tennum();//十分钟最大发信量
selfhourNum=smtpselfsendsetList.get(1).getSmtp_send_self_set_hournum();//60分钟最大发信量
selfdayNum=smtpselfsendsetList.get(1).getSmtp_send_self_set_daynum();//一小时最大发信量
}
}else{//默认的
selftenNum=smtpselfsendsetList.get(0).getSmtp_send_self_set_tennum();//十分钟最大发信量
selfhourNum=smtpselfsendsetList.get(0).getSmtp_send_self_set_hournum();//60分钟最大发信量
selfdayNum=smtpselfsendsetList.get(0).getSmtp_send_self_set_daynum();//一小时最大发信量
}
//2.获取自配smtp已发送量
List<YxySmtpSendSelfOverset> smtpsendsetoverList=YxySendMailService.findBySmtpAccount(smtpaccount);
if(smtpsendsetoverList.size()>0){//说明已存在发送量记录
//判断是不是当天的记录
String nowsend=smtpsendsetoverList.get(0).getSmtp_send_self_over_daydate();
if(nowDay.equals(nowsend)){//说明是当天的记录
//已发量
selftenNumOver=smtpsendsetoverList.get(0).getSmtp_send_self_over_tennum();
selfhourNumOver=smtpsendsetoverList.get(0).getSmtp_send_self_over_hournum();
selfdayNumOver=smtpsendsetoverList.get(0).getSmtp_send_self_over_daynum();
//判断是否在某段时间内发送量是否满足
//1.10分钟内判断*/
if(DateFormat.minute1s(smtpsendsetoverList.get(0).getSmtp_send_self_over_tendate(),currDate)<10){//在此时间段内
if(selftenNumOver>=selftenNum){//已发量大于限定量则不能发
tenisok=false;
}else{
tenisok=true;
}
}else{//不在此时间段内
selftenNumOver=0;
tenisok=true;
//更新此smtp十分钟为0
smtpsendsetoverList.get(0).setSmtp_send_self_over_tennum(0);
}
//60分钟内判断
if(DateFormat.minute1s(smtpsendsetoverList.get(0).getSmtp_send_self_over_hourdate(),currDate)<60){//在此时间段内
if(selfhourNumOver>=selfhourNum){//已发量大于限定量则不能发
hourisok=false;
}else{
hourisok=true;
}
}else{//不在此时间段内
selfhourNumOver=0;
hourisok=true;
//更新此smtp60分钟为0
smtpsendsetoverList.get(0).setSmtp_send_self_over_hournum(0);
}
//一天内判断
if(smtpsendsetoverList.get(0).getSmtp_send_self_over_daydate().equals(nowDay)){//是否在当天
if(selfdayNumOver>=selfdayNum){//已发量大于限定量则不能发
dayisok=false;
}else{
dayisok=true;
}
}else{//不在此时间段内
selfdayNumOver=0;
dayisok=true;
//更新此smtp一天数为0
smtpsendsetoverList.get(0).setSmtp_send_self_over_daynum(0);
}
//YxySendMailService.updateSendSelfSet(smtpsendsetoverList.get(0));
}
}else{//不存在发送记录则添加一条
YxySmtpSendSelfOverset o=new YxySmtpSendSelfOverset();
o.setSmtp_send_self_over_account(smtpaccount);//smtp账号
o.setSmtp_send_self_over_tendate(currDate);
o.setSmtp_send_self_over_hourdate(currDate);
o.setSmtp_send_self_over_daydate(nowDay);
//添加自配设置信息
YxySendMailService.addSendSelfSet(o);
tenisok=true;
hourisok=true;
dayisok=true;
}
if(tenisok&&hourisok&&dayisok){//如果发送量都已通过检测则调用发送程序
//获取剩余量
selftenNumSurplus=selftenNum-selftenNumOver;//十分钟剩余发信量
selfhourNumSurplus=selfhourNum-selfhourNumOver;//60分钟剩余发信量
selfdayNumSurplus=selfdayNum-selfdayNumOver;//一天剩余发信量
int minNum=0;//最小值
//三个时间内取最小值(此账号最多能发的量)
if(selftenNumSurplus<selfhourNumSurplus&&selftenNumSurplus<selfdayNumSurplus){
minNum=selftenNumSurplus;
}else if(selfhourNumSurplus<selftenNumSurplus&&selfhourNumSurplus<selfdayNumSurplus){
minNum=selfhourNumSurplus;
}else if(selfdayNumSurplus<selftenNumSurplus&&selfdayNumSurplus<selfhourNumSurplus){
minNum=selfdayNumSurplus;
}
//调用发送方法
YxySendMail send=new YxySendMail();
//取固定量的地址
int sendSuccessNum=0;
if(minNum>addressList.size()){
//调用发邮件方法
send.sendMailMethod(addressList,YxySendMailService,SmtpInfo,mailinfo,props,transport);
}else{
List<YxySendMailDetail> minaddressList=new ArrayList<YxySendMailDetail>();
for(int j=0;j<minNum;j++){
minaddressList.add(addressList.get(j));
}
//调用发邮件方法,返回成功量
send.sendMailMethod(minaddressList,YxySendMailService,SmtpInfo,mailinfo,props,transport);
}
if(sendSuccessNum>0){
//更新自配smtp发送量
smtpsendsetoverList.get(0).setSmtp_send_self_over_daydate(nowDay);
smtpsendsetoverList.get(0).setSmtp_send_self_over_daynum(selfdayNumOver+sendSuccessNum);
smtpsendsetoverList.get(0).setSmtp_send_self_over_hourdate(currDate);
smtpsendsetoverList.get(0).setSmtp_send_self_over_hournum(selfhourNumOver+sendSuccessNum);
smtpsendsetoverList.get(0).setSmtp_send_self_over_tendate(currDate);
smtpsendsetoverList.get(0).setSmtp_send_self_over_tennum(selftenNumOver+sendSuccessNum);
//更新已发量
YxySendMailService.updateSendSelfSet(smtpsendsetoverList.get(0));
}
}else{//未通过检测
System.out.println("发送量超标了");
}
}
}
} catch (Exception e) {
e.printStackTrace();
//写入日志
StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw, true));
String str = sw.toString();
LogsTool.erroLogs(str);
}
}
/**运营运行方法*/
//public static void yxySmtpMethod(YxySendMailService YxySendMailService,YxySendSmtpInfo SmtpInfo,YxySendMailMaster mailinfo,List<YxySmtpSuffixSet> smtpsuffixsetList){
public static void yxySmtpMethod(YxySendMailService YxySendMailService,YxySendSmtpInfo SmtpInfo,YxySendMailMaster mailinfo){
try {
///定义变量------------------
//1.此为没有设置的后缀地址集合
// List<YxySendMailDetail> nohouzhui=new ArrayList<YxySendMailDetail>();
// //2.保存有设置的后缀
// List<YxySendMailDetail> havehouzhui=new ArrayList<YxySendMailDetail>();
// //3.保存能发的后缀地址集合
// List<YxySendMailDetail> sendAddress=new ArrayList<YxySendMailDetail>();
//5.获取当前时间
// SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
// String currDate=sdf1.format(new Date());
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
// String nowDay=sdf.format(new Date());
//邮件ID
int mailid=mailinfo.getSend_mail_id();
//邮件唯一码
String mailuid=mailinfo.getMail_uid();
//smtp相关信息
String smtpService=SmtpInfo.getSmtp_service_number();//smtp服务器
//通过获取的待发邮件ID来获取该封邮件的待发地址(未包含异常邮件)
int MastermailId=mailinfo.getSend_mail_id();//该封邮件主ID
List<YxySendMailDetail> addressList=YxySendMailService.findAddressByMailID(MastermailId);//待发邮件对应的地址
if(addressList.size()<=0){
//将该邮件状态改为已发送
YxySendMailService.updateMailStatus(1,mailid,mailuid);
System.out.println("邮件:"+MastermailId+"整理后没有待发地址!!!");
}else{
//是否SSL加密
int isssl=SmtpInfo.getSmtp_is_ssl();
//端口号
String port=SmtpInfo.getSmtp_service_port();
//验证SMTP是否通过
List<Object> isTong=connectionService(smtpService,SmtpInfo.getSmtp_service_account(),SmtpInfo.getSmtp_service_password(),isssl,port);
if(isTong.get(0).toString().equals("1")){
Properties props =(Properties) isTong.get(1);
Transport transport =(Transport) isTong.get(2);
//调用发邮件方法
YxySendMail send=new YxySendMail();
send.sendMailMethod(addressList,YxySendMailService,SmtpInfo,mailinfo,props,transport);
// //获取后缀已发送量信息
// List<YxySmtpSendSet> smtpsendsetList=YxySendMailService.findAllSmtpSendSet(smtpService,nowDay);
// //如果没有数据则说明是新的一天了(删除以前的信息)
// if(smtpsendsetList.size()==0){
// YxySendMailService.delmSmtpSet(smtpService);
// }
// //循环判断该地址的后缀属于哪个smtp统计出来
// for(int i=0;i<addressList.size();i++){
// int gs=0;
// our:for(int j=0;j<smtpsuffixsetList.size();j++){
// //每个地址判断是否属于后缀类别中的一个
// if(addressList.get(i).getEmail_suffix().equals(smtpsuffixsetList.get(j).getSmtp_suffix_name())){
// havehouzhui.add(addressList.get(i));
// gs++;
// break our;
// }
// }
// if(gs==0){
// nohouzhui.add(addressList.get(i));
// }
// }
//
// int tensendNum=0;//10分钟最大发送数
// int hoursendNum=0;//60分钟最大发送数
// int daysendNum=0;//1天最大发送数
//
// int tensendNumOver=0;//10分钟已发送数
// int hoursendNumOver=0;//60分钟已发送数
// int daysendNumOver=0;//1天已发送数
//
// String addrSuffix="";//地址后缀
// String smtpsetSuffix="";//smtp设置后缀
//
// boolean tenisok=false;//10分钟是否通过
// boolean hourisok=false;//60分钟是否通过
// boolean dayisok=false;//一天是否通过
//
// //调用发送方法
// YxySendMail send=new YxySendMail();
// for(int i=0;i<2;i++){
// //当i=0时表示该地址没有在设置值中直接发送
// if(i==0){
// if(nohouzhui.size()==0){
// System.out.println("未后缀设置的没有地址");
// continue;
// }else{
// //没后缀的地址使用默认后缀控制参数(domain)
// send.sendMailMethod(nohouzhui,YxySendMailService,SmtpInfo,mailinfo,props,transport);/**调用发邮件方法*/
// }
// }
// //否则表示有设置值的后缀
// if(i==1){
// //判断是否还存在地址
// if(havehouzhui.size()==0){
// System.out.println("后缀集合中没有待发地址了!!!");
// }else{
// //循环判断该地址后缀是否还能发送
// address:for(int m=0;m<havehouzhui.size();m++){
// //1.获取该地址后缀发送最大量
// suffix:for(int f=0;f<smtpsuffixsetList.size();f++){
// addrSuffix=smtpsuffixsetList.get(f).getSmtp_suffix_name();//系统设定的后缀名
// //for(int j=0;j<havehouzhui.size();j++){
// if(havehouzhui.get(m).getEmail_suffix().equals(addrSuffix)){
// tensendNum=smtpsuffixsetList.get(f).getSmtp_suffix_ten();//10分钟最大发送量
// hoursendNum=smtpsuffixsetList.get(f).getSmtp_suffix_hour();//60分钟最大发送量
// daysendNum=smtpsuffixsetList.get(f).getSmtp_suffix_day();//一天最大发送量
// break suffix;
// }
// }
// boolean isexist=false;
// addrSuffix=havehouzhui.get(m).getEmail_suffix();//地址后缀赋值
// //循环后缀发送量
// smtpset:for(int s=0;s<smtpsendsetList.size();s++){
// //判断该地址后缀是否在设置中存在
// smtpsetSuffix=smtpsendsetList.get(s).getSmtp_send_set_suffix();//smtp设置后缀
// if(addrSuffix.equals(smtpsetSuffix)){//存在
// //如果存在则查出各个时间段的已发送量
// tensendNumOver=smtpsendsetList.get(s).getSmtp_send_set_tennum();//10分钟已发送数
// hoursendNumOver=smtpsendsetList.get(s).getSmtp_send_set_hournum();//60分钟已发送数
// daysendNumOver=smtpsendsetList.get(s).getSmtp_send_set_daynum();//1天已发送数
// isexist=true;
//
// //判断该地址的已发量与设定量是否通过
// //1.当前时间与最后一次发送时间判断是否是在10分钟内
// if(DateFormat.minute1s(smtpsendsetList.get(s).getSmtp_send_set_tendate(),currDate)<10){
// //在此10分钟内,判断是否能发
// if(tensendNumOver>=tensendNum){
// System.out.println("十分钟之内无法发送了");
// //此地址无法发送
// tenisok=false;
// continue address;
// }else{
// tenisok=true;
// }
// }else{
// tenisok=true;
// //更新此smtp10分钟为0
// smtpsendsetList.get(s).setSmtp_send_set_tennum(0);
// smtpsendsetList.get(s).setSmtp_send_set_tendate(currDate);
// }
// //2.当前时间与最后一次发送时间判断是否是在60分钟内
// if(DateFormat.minute1s(smtpsendsetList.get(s).getSmtp_send_set_hourdate(),currDate)<60){
// if(hoursendNumOver>hoursendNum){
// System.out.println("60分钟之内无法发送了");
// hourisok=false;
// //此地址无法发送
// continue address;
// }else{
// hourisok=true;
// }
// }else{
// hourisok=true;
// //更新此smtp60分钟为0
// smtpsendsetList.get(s).setSmtp_send_set_hournum(0);
// smtpsendsetList.get(s).setSmtp_send_set_hourdate(currDate);
// }
// //3.当前时间与最后一次发送时间判断是否是在一天内
// if(DateFormat.minute1s(smtpsendsetList.get(s).getSmtp_send_set_daydate()+" 00:00:00",currDate)<1440){
// if(daysendNumOver>daysendNum){
// System.out.println("一天之内无法发送了");
// dayisok=false;
// //此地址无法发送
// continue address;
// }else{
// dayisok=true;
// }
// }else{
// //更新此一天为0
// dayisok=true;
// smtpsendsetList.get(s).setSmtp_send_set_daynum(0);
// smtpsendsetList.get(s).setSmtp_send_set_daydate(currDate);
// }
// //是否都符合
// if(tenisok&&hourisok&&dayisok){
// sendAddress.add(havehouzhui.get(m));/**都符合将待发地址加入到可发地址集合中*/
// /**在该后缀信息上累加1*/
// smtpsendsetList.get(s).setSmtp_send_set_tennum(smtpsendsetList.get(s).getSmtp_send_set_tennum()+1);
// smtpsendsetList.get(s).setSmtp_send_set_hournum(smtpsendsetList.get(s).getSmtp_send_set_hournum()+1);
// smtpsendsetList.get(s).setSmtp_send_set_daynum(smtpsendsetList.get(s).getSmtp_send_set_daynum()+1);
//
// /**更新后缀已发量记录*/
// smtpsendsetList.set(s,smtpsendsetList.get(s));
//
// continue address;
// }else{
// break smtpset;
// }
// }
// }
// /**循环完后未存在的则新建一条*/
// if(!isexist){
// /**添加该后缀的配置信息*/
// YxySmtpSendSet o=new YxySmtpSendSet();
// o.setSmtp_send_set_service(smtpService);
// o.setSmtp_send_set_suffix(addrSuffix);
// o.setSmtp_send_set_tendate(currDate);
// o.setSmtp_send_set_hourdate(currDate);
// o.setSmtp_send_set_daydate(nowDay);
// o.setSmtp_send_set_daynum(1);
// o.setSmtp_send_set_hournum(1);
// o.setSmtp_send_set_tennum(1);
// /**将新的后缀量加入集合中*/
// smtpsendsetList.add(o);
//
//
// sendAddress.add(havehouzhui.get(m));
//
// }
// }
// //更新各个后缀信息的发送量
// synchronized (SendMailTimer.nowtimer) {
// YxySendMailService.updateSmtpSet(smtpsendsetList);
// }
// if(sendAddress.size()>0){
// //调用发邮件方法
// send.sendMailMethod(sendAddress,YxySendMailService,SmtpInfo,mailinfo,props,transport);
// }
// }
//
// }
// }
}else{
System.out.println("服务器:"+SmtpInfo.getSmtp_service_id()+"验证不通过");
}
}
} catch (Exception e) {
e.printStackTrace();
//写入日志
StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw, true));
String str = sw.toString();
LogsTool.erroLogs(str);
}
}
/** 连接邮件服务器,验证用户名,密码*/
public static List<Object> connectionService(String host,String servername,String serverpaswd,int isssl,String port) {
List<Object> result=new ArrayList<Object>();
result.add(0);
result.add(0);
result.add(0);
Properties props =new Properties();
Transport transport =null;
props.put("mail.smtp.host", host);
props.put("mail.smtp.auth", "true");/** 设定发送邮件时需要进行身份验证*/
javax.mail.Session mailSession = javax.mail.Session.getInstance(props);
mailSession.setDebug(false);
//判断是否需要ssl验证
String ishost=host.split("\\.")[1];
if(isssl==1){
if("gmail".equals(ishost)){
props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
props.put("mail.smtp.socketFactory.fallback", "false");
props.put("mail.smtp.port", port);
props.put("mail.smtp.socketFactory.port", port);
}else{
props.put("mail.smtp.starttls.enable","true");
props.put("mail.smtp.port", port);
}
}
try {
//解密密码
DES_Encrypt desEncrypt = new DES_Encrypt();
desEncrypt.setKey("06");
desEncrypt.setDesString(serverpaswd);
serverpaswd=desEncrypt.getStrM();//smtp密码需要解密
transport = mailSession.getTransport("smtp");
transport.connect(host, servername, serverpaswd);
result.set(0, 1);
result.set(1, props);
result.set(2, transport);
} catch (Exception e) {
//写入日志
StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw, true));
String str = sw.toString();
LogsTool.erroLogs("服务器:"+host+","+servername+","+str);
//e.printStackTrace();
System.out.println("验证失败");
}
return result;
}
}
... ...
package com.espeed.yxy.dao.impl;
import java.util.List;
import com.espeed.yxy.dao.YxySendCountDao;
import com.espeed.yxy.pojo.YxySendCount;
/**
* 客户发送邮件的统计Dao实现类
* @author 陈南巧
*/
public class YxySendCountDaoImpl extends HibernateBaseDAOImpl<YxySendCount, Long> implements YxySendCountDao{
/**实体插入*/
public int addPojo(YxySendCount o)throws Exception{
return super.add(o);
}
/**实体编辑*/
public void updatePojo(YxySendCount o)throws Exception{
super.update(o);
}
/**HQL查询*/
public List<YxySendCount> findByHql(String hql)throws Exception{
return super.getAll(hql);
}
/**指定条记录*/
public List<YxySendCount> findByHqlSet(String hql,int num)throws Exception{
return super.findBySet(hql, num);
}
/**SQL查询*/
public List<Object> findBySqlQuery(String sql)throws Exception{
return super.findBySql(sql);
}
/**HQL更新*/
public void updateByHql(String hql)throws Exception{
super.updateorDelByHql(hql);
}
/**HQL数量查询*/
public int findByHqlCount(String hql)throws Exception{
return super.count(hql);
}
}
... ...
package com.espeed.yxy.dao.impl;
import java.util.List;
import com.espeed.yxy.dao.YxySendMailMasterDao;
import com.espeed.yxy.pojo.YxySendMailMaster;
/**
* 程序名称: EspeedMail_时速邮箱
* 程序版本: V1.0
* 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776)
* 版权所有: 深圳市科飞时速网络技术有限公司
* 技术支持: Tech@21gmail.com
* 单元名称: 待发邮件DAO实现类
* 开始时间: 2013.11.27
* 程 序 员: 谢勇
* 最后修改:
* 备 注: 如需修改请通知程序员
*/
public class YxySendMailMasterDaoImpl extends HibernateBaseDAOImpl<YxySendMailMaster, Long> implements YxySendMailMasterDao{
/**批量插入*/
public void addPiPojo(List<YxySendMailMaster> o)throws Exception{
super.addPi(o);
}
/**实体添加*/
public int addPojo(YxySendMailMaster o)throws Exception{
return super.add(o);
}
/**HQL查询*/
public List<YxySendMailMaster> findByHql(String hql)throws Exception{
return super.getAll(hql);
}
/**SQL查询*/
public List<Object> findbysql(String sql)throws Exception{
return super.findBySql(sql);
}
/**SQL更新*/
public void updateBySql(String sql)throws Exception{
super.updateorDelBySql(sql);
}
/**HQL更新*/
public void updateByHql(String hql)throws Exception{
super.updateorDelByHql(hql);
}
// /**查询所有可用待发邮件*/
// public List<YxySendMailMaster> findByMailNum() throws Exception {
// String hql="from YxySendMailMaster where (status=0 or status=2) and exptionnum<=3 and isuse=0 order by result_remark";
// return super.getAll(hql);
// }
// /**添加修改邮件状态*/
// public void updateMaster(YxySendMailMaster o) throws Exception {
// super.update(o);
// }
// /**更新base表为已发送状态*/
// public void updateMasterBase(String sql) throws Exception {
// super.updateorDelBysql(sql);
// }
// /**HQL查询*/
// public List findByHql(String hql) throws Exception {
// return super.getAll(hql);
// }
//
// /**HQL修改*/
// public int updateByHql(String hql) throws Exception {
// return super.updateorDelBySql(hql);
// }
}
... ...
package com.espeed.yxy.tool;
import java.util.Random;
/***
*
* @author xieyong
* 获取随即码
*/
public class GetRandom {
//生成随机码
public static String getRandomString(int length) throws Exception{ //length表示生成字符串的长度
String base = "abcdefghijklmnopqrstuvwxyz0123456789"; //生成字符串从此序列中取
Random random = new Random();
StringBuffer sb = new StringBuffer();
for (int i = 0; i < length; i++) {
int number = random.nextInt(base.length());
sb.append(base.charAt(number));
}
return sb.toString();
}
}
... ...
<?xml version="1.0" encoding="UTF-8"?>
<!--
共有方法,负责所有共有配置文件
-->
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
<!-- hibernate注入 -->
<!-- 1、配置C3P0,数据源 -->
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName">
<value>com.mysql.jdbc.Driver</value>
</property>
<property name="url">
<value>jdbc:mysql://localhost:3306/yxybase?useUnicode=true&amp;characterEncoding=utf8&amp;autoReconnect=true</value>
</property>
<property name="username">
<value>root</value>
</property>
<property name="password">
<value>sz1234567890</value>
</property>
<property name="maxActive" value="300"/>
<property name="maxIdle" value="50"/>
<property name="initialSize" value="100"/>
<property name="maxWait" value="1000"/>
<property name="defaultAutoCommit" value="true"/>
<property name="removeAbandoned" value="true"/>
<property name="removeAbandonedTimeout" value="60"/>
<property name="logAbandoned" value="true"/>
<property name="minEvictableIdleTimeMillis" value="10000"/>
<property name="validationQuery" value="SELECT NOW() FROM DUAL"/>
</bean>
<!-- 2、配置sessionFactory -->
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<!-- 数据源注入 -->
<property name="dataSource" ref="dataSource" />
<property name="packagesToScan">
<list>
<value>com.espeed.yxy.pojo</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
<prop key="hibernate.show_sql">false</prop>
<!-- 如果开启, Hibernate将收集有助于性能调节的统计数据. 取值 true | false -->
<prop key="hibernate.generate_statistics">true</prop>
<!-- 指定Hibernate在何时释放JDBC连接. -->
<prop key="hibernate.connetion.release_mode">auto</prop>
</props>
</property>
</bean>
<!--3、配置spring事务(AOP) -->
<!-- 事务管理器 -->
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
<!-- 事务的传播特性(propagation) -->
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="del*"/>
<tx:method name="save*" />
<tx:method name="update*" />
<tx:method name="add*" />
<tx:method name="get*" propagation="SUPPORTS" read-only="true"/>
<tx:method name="load*" propagation="SUPPORTS" read-only="true"/>
<tx:method name="list*" propagation="SUPPORTS" read-only="true"/>
<tx:method name="*" propagation="SUPPORTS" read-only="true"/>
</tx:attributes>
</tx:advice>
<!-- 配置哪些类哪些方法具有事务 ,采用AOP-->
<aop:config>
<aop:pointcut expression="execution(* com.espeed.service.*.*(..))" id="allMethod"/>
<aop:advisor pointcut-ref="allMethod" advice-ref="txAdvice"/>
</aop:config>
<!-- 注入SpringFactory类 -->
<bean id="springfactory" class="com.espeed.yxy.tool.SpringFactory">
</bean>
<!-- POJO配置 -->
<!--待发邮件实体-->
<bean id="yxysendmailmaster" class="com.espeed.yxy.pojo.YxySendMailMaster"></bean>
<!--待发邮件地址实体-->
<bean id="yxysendmaildetail" class="com.espeed.yxy.pojo.YxySendMailDetail"></bean>
<!--smtp实体-->
<bean id="yxysendsmtpinfo" class="com.espeed.yxy.pojo.YxySendSmtpInfo"></bean>
</beans>
... ...
package com.espeed.yxy.dao.impl;
import java.io.Serializable;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.List;
import org.hibernate.Query;
import org.hibernate.Session;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import com.espeed.yxy.dao.HibernateBaseDAO;
/**
* 程序名称: EspeedMail_时速邮箱
* 程序版本: V1.0
* 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776)
* 版权所有: 深圳市科飞时速网络技术有限公司
* 技术支持: Tech@21gmail.com
* 单元名称: hbernate常用方法(营销邮)
* 开始时间: 2013.11.27
* 程 序 员: 谢勇
* 最后修改:
* 备 注: 如需修改请通知程序员
*/
public abstract class HibernateBaseDAOImpl<T extends Serializable ,Pk extends Serializable> extends HibernateDaoSupport implements HibernateBaseDAO<T, Pk> {
private Connection conn;
private PreparedStatement pst;
private ResultSet rs;
/**增加记录 (返回新增加记录的主键)*/
public int add(T o) throws Exception {
return (Integer) super.getHibernateTemplate().save(o);
}
/**修改记录*/
public void update(T o) throws Exception {
super.getHibernateTemplate().update(o);
}
/**删除记录*/
public void del(T o) throws Exception {
super.getHibernateTemplate().delete(o);
}
/**添加或更新*/
public void saveOrUpdate(T o) throws Exception {
super.getHibernateTemplate().saveOrUpdate(o);
}
/**根据ID获取一条数据*/
@SuppressWarnings("unchecked")
public T get(Class<T> t,Pk pk) throws Exception {
return (T) super.getHibernateTemplate().get(t, pk);
}
/**根据ID获取一条数据*/
@SuppressWarnings("unchecked")
public T load(Class<T> t,Pk pk) throws Exception {
return (T) super.getHibernateTemplate().load(t, pk);
}
/**根据hql进行条件查询*/
@SuppressWarnings("unchecked")
public List<T> getAll(String hql) throws Exception {
return super.getHibernateTemplate().find(hql);
}
/**条件查询*/
@SuppressWarnings("unchecked")
public List<T> getAll(String whereHql, Object... params) throws Exception {
return super.getHibernateTemplate().find(whereHql,params);
}
/*
* -------------------------------查询总记录数-----------------------------------------
*/
/**根据条件查询总记录*/
public int count(String hql) throws Exception {
return Integer.valueOf(super.getHibernateTemplate().find(hql).get(0).toString());
}
/**根据条件和参数查询总记录*/
public int count(String hql, Object... params) throws Exception {
return Integer.valueOf(super.getHibernateTemplate().find(hql,params).get(0).toString());
}
/**hql语句修改删除记录*/
public int updateorDelByHql(String hql){
Session session = super.getHibernateTemplate().getSessionFactory().openSession();
try {
Query query = session.createQuery(hql);
return query.executeUpdate();
} catch (Exception e) {
e.printStackTrace();
return 0;
}finally{
if(session!=null){
session.clear();
session.close();
}
}
}
/**sql语句修改删除记录*/
public int updateorDelBySql(String sql)throws Exception{
Session session = super.getHibernateTemplate().getSessionFactory().openSession();
try {
Query query = session.createSQLQuery(sql);
return query.executeUpdate();
} catch (Exception e) {
e.printStackTrace();
return 0;
}finally{
if(session!=null){
session.clear();
session.close();
}
}
}
/**查询设定的记录条数据*/
public List<T> findBySet(String hql,int num)throws Exception{
Session session = super.getHibernateTemplate().getSessionFactory().openSession();
try {
Query query = session.createQuery(hql);
query.setMaxResults(num);
return query.list();
} catch (Exception e) {
e.printStackTrace();
return null;
}finally{
if(session!=null){
session.clear();
session.close();
}
}
}
/**批量插入*/
public void addPi(List<T> o){
if(o!=null){
Session session = super.getHibernateTemplate().getSessionFactory().openSession();
try {
session.beginTransaction();
for(int i=0;i<o.size();i++){
session.saveOrUpdate(o.get(i));
}
session.beginTransaction().commit();
} catch (Exception e) {
e.printStackTrace();
session.beginTransaction().rollback();
}finally{
session.flush();
session.clear();
session.close();
}
}
}
/**批量更新*/
public void updatePi(List<T> o) throws Exception{
if(o!=null){
Session session = super.getHibernateTemplate().getSessionFactory().openSession();
try {
session.beginTransaction();
for(int i=0;i<o.size();i++){
session.update(o.get(i));
}
session.beginTransaction().commit();
} catch (Exception e) {
e.printStackTrace();
session.beginTransaction().rollback();
}finally{
session.flush();
session.clear();
session.close();
}
}
}
/**批量更新*/
public void saveandupdatePi(List<T> o) throws Exception{
if(o!=null){
Session session = super.getHibernateTemplate().getSessionFactory().openSession();
try {
session.beginTransaction();
for(int i=0;i<o.size();i++){
session.saveOrUpdate(o.get(i));
}
session.beginTransaction().commit();
} catch (Exception e) {
e.printStackTrace();
session.beginTransaction().rollback();
}finally{
session.flush();
session.clear();
session.close();
}
}
}
/**sql语句查询*/
public List findBySql(String sql){
Session session=null;
try {
session =super.getHibernateTemplate().getSessionFactory().
openSession();
return session.createSQLQuery(sql).list();
} catch (Exception e) {
e.printStackTrace();
}finally{
if(session!=null){
session.clear();
session.close();
}
}
return null;
}
}
... ...
package com.espeed.yxy.dao;
import java.util.List;
import com.espeed.centre.pojo.CentreUser;
/**
* 项目名称: 统一验证中心系统
* 版权所有: 深圳市科飞时速网络技术有限公司(0755-88843776)
* 技术支持: info@21gmail.com
* 单元名称: 跟踪配置Dao
* 开始时间: 2018.04.08
* 开发人员: 陈南巧
*/
public interface CentreUserDao {
/**实体插入*/
public int addPojo(CentreUser o)throws Exception;
/**实体编辑*/
public void updatePojo(CentreUser o)throws Exception;
/**HQL查询*/
public List<CentreUser> findByHql(String hql)throws Exception;
/**SQL查询*/
public List<Object> findBySqlFind(String sql)throws Exception;
/**HQL更新*/
public void updateByHql(String hql)throws Exception;
/**HQL查询数量*/
public int findByHqlCount(String hql)throws Exception;
}
... ...
package com.espeed.yxy.dao.impl;
import java.util.List;
import com.espeed.yxy.dao.YxySmtpSendSelfOversetDao;
import com.espeed.yxy.pojo.YxySendMailDetail;
import com.espeed.yxy.pojo.YxySmtpSendSelfOverset;
/**
* 程序名称: EspeedMail_时速邮箱
* 程序版本: V1.0
* 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776)
* 版权所有: 深圳市科飞时速网络技术有限公司
* 技术支持: Tech@21gmail.com
* 单元名称: SMTP发送量 DAO实现类
* 开始时间: 2013.11.27
* 程 序 员: 谢勇
* 最后修改:
* 备 注: 如需修改请通知程序员
*/
public class YxySmtpSendSelfOversetDaoImpl extends HibernateBaseDAOImpl<YxySmtpSendSelfOverset, Long> implements YxySmtpSendSelfOversetDao{
// /**查询该账号的发送量信息*/
// public List<YxySmtpSendSelfOverset> findBySmtpAccount(String account)throws Exception {
// String hql="from YxySmtpSendSelfOverset where smtp_send_self_over_account='"+account+"'";
// return super.getAll(hql);
// }
// /**添加该账号的已发量信息*/
// public void addSendSelfSet(YxySmtpSendSelfOverset o) throws Exception {
// super.add(o);
//
// }
// /**更新已发量*/
// public void updateSendSelfSet(YxySmtpSendSelfOverset o) throws Exception {
// super.update(o);
//
// }
/**批量插入*/
public void addPiPojo(List<YxySmtpSendSelfOverset> o)throws Exception{
super.addPi(o);
}
/**实体添加*/
public int addPojo(YxySmtpSendSelfOverset o)throws Exception{
return super.add(o);
}
/**HQL查询*/
public List<YxySmtpSendSelfOverset> findByHql(String hql)throws Exception{
return super.getAll(hql);
}
/**SQL查询*/
public List<Object> findbysql(String sql)throws Exception{
return super.findBySql(sql);
}
/**SQL更新*/
public void updateBySql(String sql)throws Exception{
super.updateorDelBySql(sql);
}
/**HQL更新*/
public void updateByHql(String hql)throws Exception{
super.updateorDelByHql(hql);
}
}
... ...
package com.espeed.yxy.pojo;
import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
/**
* 程序名称: EspeedMail_时速邮箱
* 程序版本: V1.0
* 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776)
* 版权所有: 深圳市科飞时速网络技术有限公司
* 技术支持: Tech@21gmail.com
* 单元名称: smtp自配最大发送量实体(营销游)
* 开始时间: 2013.12.09
* 程 序 员: 谢勇
* 最后修改:
* 备 注: 如需修改请通知程序员
*/
@Entity
@Table(name="yxy_smtp_send_self_set")
public class YxySmtpSendSelfSet implements Serializable{
private int smtp_send_self_set_id;//自配smtp发送量限制id
private String smtp_send_self_set_account;//服务器账号
private int smtp_send_self_set_tennum;//10分钟最大发送量
private int smtp_send_self_set_hournum;//60分钟最大发送量
private int smtp_send_self_set_daynum;//一天最大发送量
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
public int getSmtp_send_self_set_id() {
return smtp_send_self_set_id;
}
public void setSmtp_send_self_set_id(int smtpSendSelfSetId) {
smtp_send_self_set_id = smtpSendSelfSetId;
}
public int getSmtp_send_self_set_tennum() {
return smtp_send_self_set_tennum;
}
public void setSmtp_send_self_set_tennum(int smtpSendSelfSetTennum) {
smtp_send_self_set_tennum = smtpSendSelfSetTennum;
}
public int getSmtp_send_self_set_hournum() {
return smtp_send_self_set_hournum;
}
public void setSmtp_send_self_set_hournum(int smtpSendSelfSetHournum) {
smtp_send_self_set_hournum = smtpSendSelfSetHournum;
}
public int getSmtp_send_self_set_daynum() {
return smtp_send_self_set_daynum;
}
public void setSmtp_send_self_set_daynum(int smtpSendSelfSetDaynum) {
smtp_send_self_set_daynum = smtpSendSelfSetDaynum;
}
public String getSmtp_send_self_set_account() {
return smtp_send_self_set_account;
}
public void setSmtp_send_self_set_account(String smtpSendSelfSetAccount) {
smtp_send_self_set_account = smtpSendSelfSetAccount;
}
}
... ...
package com.espeed.webmail.pojo;
import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
/**
*
* @项目名称: 科飞管理后台系统
* @版权所有: 深圳市科飞时速网络技术有限公司(0755-88843776)
* @技术支持: info@21gmail.com
* @单元名称: crm_customer_info表CrmCustomerInfo实体类
* @开始时间: 2018-09-27
* @开发人员: 杨志钊
*/
@Entity
@Table(name = "crm_customer_info")
public class CrmCustomerInfo implements Serializable {
private static final long serialVersionUID = 1L;
private int id;//主键id
private int customer_id;//客户id
private String year_established;//公司成立时间
private String business_type;//商业类型
private String platforms_selling;//销售平台
private String main_products;//主营产品
private String operational_address;//经营地址
private String joined_alibaba_time;//加入alibaba.com时间
private String Inquiries_product;//询盘产品
private String annual_purchasing_volume;//年采购额
private String primary_sourcing_purpose;//采购目的
private String average_sourcing_frequency;//平均采购频率
private String preferred_supplier_qualifications;//偏好供应商类型
private String preferred_industries;//偏好行业
private String registered_years;//注册年限
private String days_signed_in;//登录天数
private String product_views;//产品浏览数
private String searches;//搜索次数
private String valid_inquiries_sentTo;//有效询盘数/ 回复询盘数
private String spam_inquiries;//被标为垃圾询盘数
private String valid_rfqs_submitted;//有效RFQ数
private String quotations_receivedRead;//收到报价数/ 查看报价数
private String listed_contact;//被添加联系人数
private String add_blacklist;//被添加黑名单数
private String recent_searches;//最近搜索词
private String most_sourcing_industries;//最常采购行业
private String latest_buying_requests;//最新采购需求,多个用###隔开
private String latest_inquiries;//最近询盘产品,多个用###隔开
private String create_time;//记录创建时间
private String modify_time;//记录最后修改时间
private String about_us;//关于我们
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getCustomer_id() {
return customer_id;
}
public void setCustomer_id(int customer_id) {
this.customer_id = customer_id;
}
public String getYear_established() {
return year_established;
}
public void setYear_established(String year_established) {
this.year_established = year_established;
}
public String getBusiness_type() {
return business_type;
}
public void setBusiness_type(String business_type) {
this.business_type = business_type;
}
public String getPlatforms_selling() {
return platforms_selling;
}
public void setPlatforms_selling(String platforms_selling) {
this.platforms_selling = platforms_selling;
}
public String getMain_products() {
return main_products;
}
public void setMain_products(String main_products) {
this.main_products = main_products;
}
public String getOperational_address() {
return operational_address;
}
public void setOperational_address(String operational_address) {
this.operational_address = operational_address;
}
public String getJoined_alibaba_time() {
return joined_alibaba_time;
}
public void setJoined_alibaba_time(String joined_alibaba_time) {
this.joined_alibaba_time = joined_alibaba_time;
}
public String getInquiries_product() {
return Inquiries_product;
}
public void setInquiries_product(String Inquiries_product) {
this.Inquiries_product = Inquiries_product;
}
public String getAnnual_purchasing_volume() {
return annual_purchasing_volume;
}
public void setAnnual_purchasing_volume(String annual_purchasing_volume) {
this.annual_purchasing_volume = annual_purchasing_volume;
}
public String getPrimary_sourcing_purpose() {
return primary_sourcing_purpose;
}
public void setPrimary_sourcing_purpose(String primary_sourcing_purpose) {
this.primary_sourcing_purpose = primary_sourcing_purpose;
}
public String getAverage_sourcing_frequency() {
return average_sourcing_frequency;
}
public void setAverage_sourcing_frequency(String average_sourcing_frequency) {
this.average_sourcing_frequency = average_sourcing_frequency;
}
public String getPreferred_supplier_qualifications() {
return preferred_supplier_qualifications;
}
public void setPreferred_supplier_qualifications(String preferred_supplier_qualifications) {
this.preferred_supplier_qualifications = preferred_supplier_qualifications;
}
public String getPreferred_industries() {
return preferred_industries;
}
public void setPreferred_industries(String preferred_industries) {
this.preferred_industries = preferred_industries;
}
public String getRegistered_years() {
return registered_years;
}
public void setRegistered_years(String registered_years) {
this.registered_years = registered_years;
}
public String getDays_signed_in() {
return days_signed_in;
}
public void setDays_signed_in(String days_signed_in) {
this.days_signed_in = days_signed_in;
}
public String getProduct_views() {
return product_views;
}
public void setProduct_views(String product_views) {
this.product_views = product_views;
}
public String getSearches() {
return searches;
}
public void setSearches(String searches) {
this.searches = searches;
}
public String getValid_inquiries_sentTo() {
return valid_inquiries_sentTo;
}
public void setValid_inquiries_sentTo(String valid_inquiries_sentTo) {
this.valid_inquiries_sentTo = valid_inquiries_sentTo;
}
public String getSpam_inquiries() {
return spam_inquiries;
}
public void setSpam_inquiries(String spam_inquiries) {
this.spam_inquiries = spam_inquiries;
}
public String getValid_rfqs_submitted() {
return valid_rfqs_submitted;
}
public void setValid_rfqs_submitted(String valid_rfqs_submitted) {
this.valid_rfqs_submitted = valid_rfqs_submitted;
}
public String getQuotations_receivedRead() {
return quotations_receivedRead;
}
public void setQuotations_receivedRead(String quotations_receivedRead) {
this.quotations_receivedRead = quotations_receivedRead;
}
public String getListed_contact() {
return listed_contact;
}
public void setListed_contact(String listed_contact) {
this.listed_contact = listed_contact;
}
public String getAdd_blacklist() {
return add_blacklist;
}
public void setAdd_blacklist(String add_blacklist) {
this.add_blacklist = add_blacklist;
}
public String getRecent_searches() {
return recent_searches;
}
public void setRecent_searches(String recent_searches) {
this.recent_searches = recent_searches;
}
public String getMost_sourcing_industries() {
return most_sourcing_industries;
}
public void setMost_sourcing_industries(String most_sourcing_industries) {
this.most_sourcing_industries = most_sourcing_industries;
}
public String getLatest_buying_requests() {
return latest_buying_requests;
}
public void setLatest_buying_requests(String latest_buying_requests) {
this.latest_buying_requests = latest_buying_requests;
}
public String getLatest_inquiries() {
return latest_inquiries;
}
public void setLatest_inquiries(String latest_inquiries) {
this.latest_inquiries = latest_inquiries;
}
public String getCreate_time() {
return create_time;
}
public void setCreate_time(String create_time) {
this.create_time = create_time;
}
public String getModify_time() {
return modify_time;
}
public void setModify_time(String modify_time) {
this.modify_time = modify_time;
}
@Transient
public String getAbout_us() {
return about_us;
}
public void setAbout_us(String about_us) {
this.about_us = about_us;
}
}
... ...
package com.espeed.centre.pojo;
import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
/**
* 项目名称: 统一验证中心系统
* 版权所有: 深圳市科飞时速网络技术有限公司(0755-88843776)
* 技术支持: info@21gmail.com
* 单元名称: 营销邮开发客户配置实体类
* 开始时间: 2018.04.08
* 开发人员: 陈南巧
*/
@Entity
@Table(name="centre_yxyedm_newcustomer")
public class CentreYxyedmNewcustomer implements Serializable
{
private static final long serialVersionUID = 1L;
private int id;//主键id
private String sender_email;//发件人邮箱
private String reply_email;//回复人邮箱
private String sender_name;//发件人名称
private String allow_user;//指定营销人员,多个以逗号分割
private int company_id;//企业id
private String company_domain;//企业域名
private String domain;//域名
private int spf_status;//spf状态,0不可用,1可以用
private int mx_status;//mx状态,0不可用,1可以用
private int status;//状态,0不可用,1可以用
private int type;//类型,0自有域名,1待发模式
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getSender_email() {
return sender_email;
}
public void setSender_email(String sender_email) {
this.sender_email = sender_email;
}
public String getReply_email() {
return reply_email;
}
public void setReply_email(String reply_email) {
this.reply_email = reply_email;
}
public String getSender_name() {
return sender_name;
}
public void setSender_name(String sender_name) {
this.sender_name = sender_name;
}
public String getAllow_user() {
return allow_user;
}
public void setAllow_user(String allow_user) {
this.allow_user = allow_user;
}
public int getCompany_id() {
return company_id;
}
public void setCompany_id(int company_id) {
this.company_id = company_id;
}
public String getCompany_domain() {
return company_domain;
}
public void setCompany_domain(String company_domain) {
this.company_domain = company_domain;
}
public String getDomain() {
return domain;
}
public void setDomain(String domain) {
this.domain = domain;
}
public int getSpf_status() {
return spf_status;
}
public void setSpf_status(int spf_status) {
this.spf_status = spf_status;
}
public int getMx_status() {
return mx_status;
}
public void setMx_status(int mx_status) {
this.mx_status = mx_status;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
}
... ...
package com.espeed.yxy.tool;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import javax.sql.DataSource;
/**
* 程序名称: EspeedMail_时速邮箱
* 程序版本: V1.0
* 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776)
* 版权所有: 深圳市科飞时速网络技术有限公司
* 技术支持: Tech@21gmail.com
* 单元名称: 获取数据库连接的工具类
* 开始时间: 2013.10.1
* 程 序 员: 芮瑞
* 最后修改: 2014-02-25
* 备 注:用于从连接池中获取数据源,获取数据库连接
*/
public class DBUtil
{
private static DataSource dataSource;
//获得连接
public static Connection getConnection() throws SQLException
{
dataSource = (DataSource) SpringFactory.getObject("dataSource");
return dataSource.getConnection();
}
/*
* 关闭数据库连接
*/
public static void close(ResultSet rs,Statement st,Connection conn)
{
if(rs!=null)
{ try {
rs.close();
} catch (SQLException e) {
e.printStackTrace();
}finally{
if(st!=null){
try {
st.close();
} catch (SQLException e) {
e.printStackTrace();
}finally{
if(conn!=null){
try {
conn.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
}
}
}
}
}
public static void main(String[] args) throws SQLException
{
System.out.println(DBUtil.getConnection());
}
}
\ No newline at end of file
... ...
package com.espeed.plan;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
import javax.mail.Transport;
import com.espeed.yxy.pojo.YxyMarketingPlan;
import com.espeed.yxy.pojo.YxySendSmtpInfo;
import com.espeed.yxy.pojo.YxyUserAddress;
import com.espeed.yxy.service.YxyMarketingPlanService;
import com.espeed.yxy.service.YxySendMailService;
import com.espeed.yxy.tool.DES_Encrypt;
/***
*
* @author 谢勇
* 计划执行类
*
*/
public class PlanRunClass {
public void planrun(YxyMarketingPlanService planservice,YxySendMailService mailservice,YxySendSmtpInfo smtpinfo,YxyMarketingPlan planinfo){
try {
//判断此计划是否有地址
int addressgroupid=planinfo.getPlan_groupid();
String loginid = planinfo.getLoginid();//账号
String domain = planinfo.getDomain();//域名
int plan_differen = planinfo.getPlan_differen();//区分客户的本地和CRM库 0:本地 1:CRM
//SMTP参数
String host=smtpinfo.getSmtp_service_number();//服务器
String account=smtpinfo.getSmtp_service_account();//账号
String password=smtpinfo.getSmtp_service_password();//密码
int isssl=smtpinfo.getSmtp_is_ssl();//是否SSL加密
String port=smtpinfo.getSmtp_service_port();//端口号
//查询地址
List<YxyUserAddress> addresslist=planservice.findAddressByGroupid(addressgroupid,plan_differen,loginid,domain,planinfo.getOther_name());
if(addresslist.size()>0){
List<Object> isTong=connectionService(host,account,password,isssl,port);
if(isTong.get(0).toString().equals("1")){
}else{
System.out.println("服务器验证失败!");
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
/** 连接邮件服务器,验证用户名,密码*/
public static List<Object> connectionService(String host,String servername,String serverpaswd,int isssl,String port) {
List<Object> result=new ArrayList<Object>();
result.add(0);
result.add(0);
result.add(0);
Properties props =new Properties();
Transport transport =null;
props.put("mail.smtp.host", host);
props.put("mail.smtp.auth", "true");/** 设定发送邮件时需要进行身份验证*/
javax.mail.Session mailSession = javax.mail.Session.getInstance(props);
mailSession.setDebug(false);
//判断是否需要ssl验证
String ishost=host.split("\\.")[1];
if(isssl==1){
if("gmail".equals(ishost)){
props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
props.put("mail.smtp.socketFactory.fallback", "false");
props.put("mail.smtp.port", port);
props.put("mail.smtp.socketFactory.port", port);
}else{
props.put("mail.smtp.starttls.enable","true");
props.put("mail.smtp.port", port);
}
}
try {
//解密密码
DES_Encrypt desEncrypt = new DES_Encrypt();
desEncrypt.setKey("06");
desEncrypt.setDesString(serverpaswd);
serverpaswd=desEncrypt.getStrM();//smtp密码需要解密
transport = mailSession.getTransport("smtp");
transport.connect(host, servername, serverpaswd);
result.set(0, 1);
result.set(1, props);
result.set(2, transport);
} catch (Exception e) {
e.printStackTrace();
System.out.println("验证失败");
}
return result;
}
}
... ...
package com.espeed.yxy.tool;
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import javax.servlet.http.HttpServlet;
public class ServiceInit extends HttpServlet{
private Connection conn;
private ResultSet rs;
private PreparedStatement pst;
//项目初始化
public void init(){
//更新待发邮件状态
try {
//获取数据库链接
conn=DBUtil.getConnection();
String sql="update yxy_send_mail_master set isuse=0";
pst=conn.prepareStatement(sql);
pst.executeUpdate();
System.out.println("服务启动初始化成功!");
} catch (Exception e) {
System.out.println("服务启动初始化失败!");
}finally{
DBUtil.close(rs, pst, conn);
}
}
}
... ...
package com.espeed.yxy.tool;
import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.security.Key;
import java.security.SecureRandom;
import javax.crypto.Cipher;
import javax.crypto.CipherInputStream;
import javax.crypto.CipherOutputStream;
import javax.crypto.KeyGenerator;
import javax.crypto.SecretKey;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.DESKeySpec;
import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;
/**
* 程序名称: EspeedMail_时速邮箱
* 程序版本: V1.0
* 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776)
* 版权所有: 深圳市科飞时速网络技术有限公司
* 技术支持: Tech@21gmail.com
* 单元名称: DES加密工具类(营销游)
* 开始时间: 2013.12.09
* 程 序 员: 谢勇
* 最后修改:
* 备 注: 如需修改请通知程序员
*/
public class Encrypt {
/** 密钥算法*/
private static final String KEY_ALGORITHM = "DES";
private static final String DEFAULT_CIPHER_ALGORITHM = "DES/ECB/PKCS5Padding";
static byte[] byteArray=null;
/** 初始化密钥*/
public static byte[] initSecretKey() throws Exception{
//返回生成指定算法的秘密密钥的 KeyGenerator 对象
KeyGenerator kg = KeyGenerator.getInstance("DES");
//初始化此密钥生成器,使其具有确定的密钥大小
kg.init(56);
//生成一个密钥
SecretKey secretKey = kg.generateKey();
byteArray=secretKey.getEncoded();
return secretKey.getEncoded();
}
/**转换密钥*/
private static Key toKey() throws Exception{
//实例化DES密钥规则
DESKeySpec dks = new DESKeySpec(byteArray);
//实例化密钥工厂
SecretKeyFactory skf = SecretKeyFactory.getInstance("DES");
//生成密钥 ,工厂中对密钥进行处理加工
SecretKey secretKey = skf.generateSecret(dks);
return secretKey;
}
/**获得密钥*/
public static Key getKey() throws Exception {
Key kp =toKey();
return kp;
}
/**文件加密需要传入一个流跟一个文件保存的路径*/
public static Object encrypt(InputStream is, String dest) throws Exception {
Cipher cipher = Cipher.getInstance("DES");
//初始化密钥
initSecretKey();
//获得密钥
Object key =getKey();
cipher.init(Cipher.ENCRYPT_MODE,(Key)key);
//写入文件
OutputStream out = new FileOutputStream(dest);
CipherInputStream cis = new CipherInputStream(is, cipher);
byte[] buffer = new byte[1024];
int r;
while ((r = cis.read(buffer)) > 0) {
out.write(buffer, 0, r);
}
//数据库保存需要一个字符
BASE64Encoder enc=new BASE64Encoder();
String string=enc.encode(byteArray);
cis.close();
is.close();
out.close();
return string;
}
/**文件解密返回一个流*/
public static InputStream decrypt(String file,Key key) throws IOException {
CipherInputStream cis = null;
InputStream is =null;
try {
Cipher cipher = Cipher.getInstance("DES");
cipher.init(Cipher.DECRYPT_MODE,key);
is = new FileInputStream(file);
cis = new CipherInputStream(is, cipher);
} catch (Exception e) {
e.printStackTrace();
return null;
}
return cis;
}
/**通过传过来的流生成文件*/
public static void decrypt(String outfile,String fileName,CipherInputStream in) throws Exception {
File file=new File(outfile);
if(!file.exists()){
file.mkdirs();
}
OutputStream out = new FileOutputStream(outfile+"\\"+fileName);
byte[] buffer = new byte[1024];
int r;
while ((r = in.read(buffer)) >= 0) {
out.write(buffer, 0, r);
}
out.close();
in.close();
}
/**文件解密返回一个字符串*/
public static String decryptAndGetString(String file,Key key) throws Exception {
Cipher cipher = Cipher.getInstance("DES");
cipher.init(Cipher.DECRYPT_MODE,key);
InputStream is = new FileInputStream(file);
CipherInputStream cis = new CipherInputStream(is, cipher);
return convertStreamToString(cis);
}
public static String inputStream2String(InputStream is) throws IOException{
ByteArrayOutputStream baos = new ByteArrayOutputStream();
int i=-1;
while((i=is.read())!=-1){
baos.write(i);
}
return baos.toString();
}
public static String convertStreamToString(InputStream is) {
BufferedReader reader = new BufferedReader(new InputStreamReader(is));
StringBuilder sb = new StringBuilder();
String line = null;
try {
while ((line = reader.readLine()) != null) {
sb.append(line + "/n");
}
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
is.close();
} catch (IOException e) {
e.printStackTrace();
}
}
return sb.toString();
}
/**转换密钥*/
public static Key toKey(byte[] key) throws Exception{
//实例化DES密钥规则
DESKeySpec dks = new DESKeySpec(key);
//实例化密钥工厂
SecretKeyFactory skf = SecretKeyFactory.getInstance("DES");
//生成密钥 ,工厂中对密钥进行处理加工
SecretKey secretKey = skf.generateSecret(dks);
return secretKey;
}
public static void main(String[] args){
/* Encrypt.saveDesKey();
System.out.println("生成key");
Encrypt.getKey();
System.out.println("获取key");
try {
Encrypt.encrypt("d:\\dd.eml", "d:\\e.eml");
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println("加密");*/
try {
//Encrypt.decrypt("d:\\dddd.eml", "d:\\ccc.eml");
BASE64Decoder enc=new BASE64Decoder();
Key a=Encrypt.toKey(enc.decodeBuffer("MQ5RobbCg8s="));
System.out.println("qqq"+Encrypt.decryptAndGetString("H:\\test.txt",a));
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println("解密");
// System.out.println("加密");*/
// try {
// Encrypt.decrypt("c:/test.txt", "d:\\ccc.eml");
// } catch (Exception e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// }
// System.out.println("解密");
}
}
\ No newline at end of file
... ...
package com.espeed.yxy.dao.impl;
import java.util.List;
import com.espeed.yxy.dao.YxySendSmtpInfoDao;
import com.espeed.yxy.pojo.YxySendMailDetail;
import com.espeed.yxy.pojo.YxySendSmtpInfo;
/**
* 程序名称: EspeedMail_时速邮箱
* 程序版本: V1.0
* 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776)
* 版权所有: 深圳市科飞时速网络技术有限公司
* 技术支持: Tech@21gmail.com
* 单元名称: SMTP DAO实现类
* 开始时间: 2013.11.27
* 程 序 员: 谢勇
* 最后修改:
* 备 注: 如需修改请通知程序员
*/
public class YxySendSmtpInfoDaoImpl extends HibernateBaseDAOImpl<YxySendSmtpInfo,Long> implements YxySendSmtpInfoDao{
// /**查询可用的smtp*/
// public List<YxySendSmtpInfo> findAllSmtp(int num) throws Exception {
// String hql="from YxySendSmtpInfo where smtp_service_isuse=0 or smtp_service_isuse=1 order by smtp_service_userdate";
// return super.getAll(hql);
// }
// /**更新smtp状态*/
// public void updateSmtpStatus(YxySendSmtpInfo o) throws Exception {
// super.update(o);
//
// }
// /**HQL查询*/
// public List<YxySendSmtpInfo> findByHql(String hql) throws Exception {
//
// return super.getAll(hql);
// }
/**批量插入*/
public void addPiPojo(List<YxySendSmtpInfo> o)throws Exception{
super.addPi(o);
}
/**实体添加*/
public int addPojo(YxySendSmtpInfo o)throws Exception{
return super.add(o);
}
/**HQL查询*/
public List<YxySendSmtpInfo> findByHql(String hql)throws Exception{
return super.getAll(hql);
}
/**SQL查询*/
public List<Object> findbysql(String sql)throws Exception{
return super.findBySql(sql);
}
/**SQL更新*/
public void updateBySql(String sql)throws Exception{
super.updateorDelBySql(sql);
}
/**HQL更新*/
public void updateByHql(String hql)throws Exception{
super.updateorDelByHql(hql);
}
}
... ...
package com.espeed.yxy.service;
import java.util.List;
import java.util.Map;
import com.espeed.centre.pojo.CentreTrackSet;
import com.espeed.centre.pojo.CentreYxyedmNewcustomer;
import com.espeed.centre.pojo.CentreYxyedmOldcustomer;
import com.espeed.yxy.pojo.YxySendMailDetail;
import com.espeed.yxy.pojo.YxySendMailMaster;
import com.espeed.yxy.pojo.YxySendSmtpInfo;
import com.espeed.yxy.pojo.YxySmtpSendSelfOverset;
import com.espeed.yxy.pojo.YxySmtpSendSelfSet;
import com.espeed.yxy.pojo.YxySmtpSendSet;
import com.espeed.yxy.pojo.YxySmtpSuffixSet;
import com.espeed.yxy.pojo.YxySysParamatersValue;
import com.espeed.yxy.pojo.YxyUserAddress;
/**
* 程序名称: EspeedMail_时速邮箱
* 程序版本: V1.0
* 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776)
* 版权所有: 深圳市科飞时速网络技术有限公司
* 技术支持: Tech@21gmail.com
* 单元名称: 邮件发送service业务接口(营销游)
* 开始时间: 2013.12.09
* 程 序 员: 谢勇
* 最后修改:
* 备 注: 如需修改请通知程序员
*/
public interface YxySendMailService {
//------------------------待发邮件操作模块-----------------------------
/**查询所有待发邮件*/
public List<YxySendMailMaster> findByMailNum(int mailNum)throws Exception;
/**修改邮件使用状态*/
public void updateMailUseStatus(int mailid, int isuse,String timer)throws Exception;
/**修改邮件异常量*/
public void updateMailExpStatus(int mailid,int expnum)throws Exception;
/**同时修改待发邮件状态与基本邮件信息状态*/
public void updateMailStatus(int status,int mailid,String mailuid)throws Exception;
/**加入待发邮件*/
public void addMailMaster(YxySendMailMaster master,List<YxyUserAddress> sendaddress,int planid,int plan_differen)throws Exception;
/**更新待发邮件图片与附件路径*/
public void updatepicattrpath(int masterid,String picpath,String attrpath)throws Exception;
/**根据hql获取待发邮件*/
public List<YxySendMailMaster> getMailMasterByHql(String hql)throws Exception;
//------------------------待发地址操作模块-----------------------------
/**根据待发邮件ID查询待发地址*/
public List<YxySendMailDetail> findAddressByMailID(int mailID)throws Exception;
/**修改此地址为已发送*/
public void updateMailDetailstatus(int addressid)throws Exception;
/**更新地址状态为异常地址*/
public void updateExp(int addressid,int expnum)throws Exception;
/**根据邮件ID查询是否还存在待发地址*/
public boolean isHaveAddress(int mailid)throws Exception;
//------------------------SMTP操作模块---------------------------------
/**查询所有SMTP*/
public List<YxySendSmtpInfo> findSmtpInfoSetNum()throws Exception;
/**更新smtp使用状态*/
public void updateSmtpUseStatus(int status,int smtpid,String nowdate)throws Exception;
/**更新smtp状态所有的*/
public void updatesmtpstatus()throws Exception;
/**根据客户类型查询smtp*/
public YxySendSmtpInfo findSmtpInfoByCusType(List<YxySendSmtpInfo> smtp_list,int cus_type)throws Exception;
/**查找自主域名投递的smtp*/
public YxySendSmtpInfo findSmtpInfoByCusType2(List<YxySendSmtpInfo> smtp_list,YxySendMailMaster master)throws Exception;
//------------------------SMTP后缀设置参数模块-------------------------
/**查询后缀信息*/
public List<YxySmtpSuffixSet> findAllSmtpSuffixSet()throws Exception;
//------------------------SMTP后缀发送量模块----------------------------
/**查询该smtp对应后缀在时间段的发送量*/
public List<YxySmtpSendSet> findAllSmtpSendSet(String smtpservice,String nowDay)throws Exception;
/**删除后缀已发量信息*/
public void delmSmtpSet(String smtpService)throws Exception;
/**更新发送量信息*/
public void updateSmtpSet(List<YxySmtpSendSet> o)throws Exception;
//------------------------控制参数模块---------------------------------
/**code查询控制参数(有用户级返回用户级,否则返回默认参数)*/
public String findCompanyParamByCode(String code,String loginid,String domain)throws Exception;
/**paraid查询企业级控制参数*/
public List<YxySysParamatersValue> findCompanyParamValues(String domian,int para_id)throws Exception;
//------------------------自配SMTP发送量模块-----------------------------
/**通过smtpID查询此smtp的发送参数*/
public List<YxySmtpSendSelfSet> findSendSelfSetByService(String smtpservice)throws Exception;
/**查询自配账号的已发送量信息*/
public List<YxySmtpSendSelfOverset> findBySmtpAccount(String account)throws Exception;
/**添加自配账号的已发量信息*/
public void addSendSelfSet(YxySmtpSendSelfOverset o)throws Exception;
/**更新自配已发量*/
public void updateSendSelfSet(YxySmtpSendSelfOverset o)throws Exception;
/**查询SMTP判断是否阻塞*/
public void updateinitsmtpstatus()throws Exception;
/**获取跟踪配置信息*/
public List<CentreTrackSet> getTrackSetByHql(String hql)throws Exception;
/**获取开发客户配置信息*/
public List<CentreYxyedmNewcustomer> getNewCustomerSet(String hql)throws Exception;
/**获取盘活客户配置信息*/
public List<CentreYxyedmOldcustomer> getOldCustomerSet(String hql)throws Exception;
/**获取用户信息*/
public List<Object> getUserInfoBySql(String sql)throws Exception;
}
... ...
package com.espeed.yxy.pojo;
import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
/**
* 程序名称: EspeedMail_时速邮箱
* 程序版本: V1.0
* 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776)
* 版权所有: 深圳市科飞时速网络技术有限公司
* 技术支持: Tech@21gmail.com
* 单元名称: smtp后缀设置信息实体(营销游)
* 开始时间: 2013.12.09
* 程 序 员: 谢勇
* 最后修改:
* 备 注: 如需修改请通知程序员
*/
@Entity
@Table(name="yxy_smtp_suffix_set")
public class YxySmtpSuffixSet implements Serializable{
private int smtp_suffix_id ;//主键ID
private String smtp_suffix_name;//smtp后缀名
private int smtp_suffix_ten;//该后缀十分钟发送量
private int smtp_suffix_hour;//该后缀一个小时发送量
private int smtp_suffix_day;//该后缀一天发送量
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
public int getSmtp_suffix_id() {
return smtp_suffix_id;
}
public void setSmtp_suffix_id(int smtpSuffixId) {
smtp_suffix_id = smtpSuffixId;
}
public String getSmtp_suffix_name() {
return smtp_suffix_name;
}
public void setSmtp_suffix_name(String smtpSuffixName) {
smtp_suffix_name = smtpSuffixName;
}
public int getSmtp_suffix_ten() {
return smtp_suffix_ten;
}
public void setSmtp_suffix_ten(int smtpSuffixTen) {
smtp_suffix_ten = smtpSuffixTen;
}
public int getSmtp_suffix_hour() {
return smtp_suffix_hour;
}
public void setSmtp_suffix_hour(int smtpSuffixHour) {
smtp_suffix_hour = smtpSuffixHour;
}
public int getSmtp_suffix_day() {
return smtp_suffix_day;
}
public void setSmtp_suffix_day(int smtpSuffixDay) {
smtp_suffix_day = smtpSuffixDay;
}
}
... ...
package com.espeed.yxy.dao.impl;
import java.util.List;
import com.espeed.yxy.dao.YxyMarketingPlanDao;
import com.espeed.yxy.pojo.YxyMarketingPlan;
public class YxyMarketingPlanDaoImpl extends HibernateBaseDAOImpl<YxyMarketingPlan, Long> implements YxyMarketingPlanDao {
/**HQL查询*/
public List<YxyMarketingPlan> findByHql(String hql)throws Exception{
return super.getAll(hql);
}
/**指定条记录*/
public List<YxyMarketingPlan> findByHqlSet(String hql,int num)throws Exception{
return super.findBySet(hql, num);
}
/**HQL更新*/
public void updateByHql(String hql)throws Exception{
super.updateorDelByHql(hql);
}
}
... ...
package com.espeed.yxy.dao.impl;
import java.util.List;
import com.espeed.centre.pojo.CentreYxyedmOldcustomer;
import com.espeed.yxy.dao.CentreYxyedmOldcustomerDao;
/**
* 项目名称: 统一验证中心系统
* 版权所有: 深圳市科飞时速网络技术有限公司(0755-88843776)
* 技术支持: info@21gmail.com
* 单元名称: 营销邮盘活客户配置Dao实现类
* 开始时间: 2018.04.08
* 开发人员: 陈南巧
*/
public class CentreYxyedmOldcustomerDaoImpl extends CentreHibernateBaseDAOImpl<CentreYxyedmOldcustomer, Long> implements CentreYxyedmOldcustomerDao {
/**实体插入*/
public int addPojo(CentreYxyedmOldcustomer o)throws Exception{
return super.add(o);
}
/**实体编辑*/
public void updatePojo(CentreYxyedmOldcustomer o)throws Exception{
super.update(o);
}
/**HQL查询*/
public List<CentreYxyedmOldcustomer> findByHql(String hql)throws Exception{
return super.getAll(hql);
}
/**HQL查询数量*/
public int findByHqlCount(String hql)throws Exception{
return super.count(hql);
}
/**SQL查询*/
public List<Object> findBySqlFind(String sql)throws Exception{
return super.findBySql(sql);
}
/**HQL更新*/
public void updateByHql(String hql)throws Exception{
super.updateorDelBySql(hql);
}
}
... ...
package com.espeed.yxy.dao.impl;
import java.util.List;
import com.espeed.webmail.pojo.YxyCustomerEmail;
import com.espeed.yxy.dao.YxyCustomerEmailDao;
/**
* 程序名称: EspeedMail_时速邮箱
* 程序版本: V1.0
* 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776)
* 版权所有: 深圳市科飞时速网络技术有限公司
* 技术支持: Tech@21gmail.com
* 单元名称: 分类下的所有dao实现类(营销游)
* 开始时间: 2015.04.08
* 程 序 员: 陈南巧
* 最后修改:
* 备 注: 如需修改请通知程序员
*/
public class YxyCustomerEmailDaoImpl extends WebmailHibernateBaseDAOImpl<YxyCustomerEmail, Long> implements YxyCustomerEmailDao{
/**实体插入*/
public int addPojo(YxyCustomerEmail o)throws Exception{
return super.add(o);
}
/**实体编辑*/
public void updatePojo(YxyCustomerEmail o)throws Exception{
super.update(o);
}
/**HQL查询*/
public List<YxyCustomerEmail> findByHql(String hql)throws Exception{
return super.getAll(hql);
}
/**HQL数量查询*/
public int findByHqlCount(String hql)throws Exception{
return super.count(hql);
}
/**指定条记录*/
public List<YxyCustomerEmail> findByHqlSet(String hql,int num)throws Exception{
return super.findBySet(hql, num);
}
/**SQL查询*/
public List<Object> findBySqlQuery(String sql)throws Exception{
return super.findBySql(sql);
}
/**HQL更新*/
public void updateByHql(String hql)throws Exception{
super.updateorDelBySql(hql);
}
}
... ...
package com.espeed.yxy.pojo;
import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
/**
* 程序名称: EspeedMail_时速邮箱
* 程序版本: V1.0
* 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776)
* 版权所有: 深圳市科飞时速网络技术有限公司
* 技术支持: Tech@21gmail.com
* 单元名称: smtp实体(营销游)
* 开始时间: 2013.12.09
* 程 序 员: 谢勇
* 最后修改:
* 备 注: 如需修改请通知程序员
*/
@Entity
@Table(name="yxy_send_smtp_info")
public class YxySendSmtpInfo implements Serializable{
private static final long serialVersionUID = 1L;
private int smtp_service_id;//主键ID
private String smtp_service_number;//smtp服务器
private String smtp_service_account;//smtp账号
private String smtp_service_password;//smtp密码
private int smtp_service_isyxy;//是自配还是运营0默认自配1:运营
private String smtp_service_creatdate;//创建时间
private String smtp_service_userdate;//发第一封的时间
private int smtp_service_isuse;//该smtp是否可用...0可用1不可用
private int smtp_service_sendNum;//smtp发送封数
private String smtp_user_loginid;//用户账号
private String smtp_user_domain;//用户所属域名
private int smtp_is_ssl;//是否使用SSL加密
private String smtp_service_port;//端口
private int smtp_service_type;//0:新客户营销,1:老客户跟进,2:自主域名投递
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
public int getSmtp_service_id() {
return smtp_service_id;
}
public void setSmtp_service_id(int smtpServiceId) {
smtp_service_id = smtpServiceId;
}
public String getSmtp_service_number() {
return smtp_service_number;
}
public void setSmtp_service_number(String smtpServiceNumber) {
smtp_service_number = smtpServiceNumber;
}
public String getSmtp_service_account() {
return smtp_service_account;
}
public void setSmtp_service_account(String smtpServiceAccount) {
smtp_service_account = smtpServiceAccount;
}
public String getSmtp_service_password() {
return smtp_service_password;
}
public void setSmtp_service_password(String smtpServicePassword) {
smtp_service_password = smtpServicePassword;
}
public String getSmtp_service_creatdate() {
return smtp_service_creatdate;
}
public void setSmtp_service_creatdate(String smtpServiceCreatdate) {
smtp_service_creatdate = smtpServiceCreatdate;
}
public String getSmtp_service_userdate() {
return smtp_service_userdate;
}
public void setSmtp_service_userdate(String smtpServiceUserdate) {
smtp_service_userdate = smtpServiceUserdate;
}
public int getSmtp_service_isuse() {
return smtp_service_isuse;
}
public void setSmtp_service_isuse(int smtpServiceIsuse) {
smtp_service_isuse = smtpServiceIsuse;
}
public int getSmtp_service_sendNum() {
return smtp_service_sendNum;
}
public void setSmtp_service_sendNum(int smtpServiceSendNum) {
smtp_service_sendNum = smtpServiceSendNum;
}
public int getSmtp_service_isyxy() {
return smtp_service_isyxy;
}
public void setSmtp_service_isyxy(int smtpServiceIsyxy) {
smtp_service_isyxy = smtpServiceIsyxy;
}
public String getSmtp_user_loginid() {
return smtp_user_loginid;
}
public void setSmtp_user_loginid(String smtpUserLoginid) {
smtp_user_loginid = smtpUserLoginid;
}
public String getSmtp_user_domain() {
return smtp_user_domain;
}
public void setSmtp_user_domain(String smtpUserDomain) {
smtp_user_domain = smtpUserDomain;
}
public int getSmtp_is_ssl() {
return smtp_is_ssl;
}
public void setSmtp_is_ssl(int smtp_is_ssl) {
this.smtp_is_ssl = smtp_is_ssl;
}
public String getSmtp_service_port() {
return smtp_service_port;
}
public void setSmtp_service_port(String smtp_service_port) {
this.smtp_service_port = smtp_service_port;
}
public int getSmtp_service_type() {
return smtp_service_type;
}
public void setSmtp_service_type(int smtp_service_type) {
this.smtp_service_type = smtp_service_type;
}
}
... ...
package com.espeed.centre.pojo;
import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
/**
* 项目名称: 统一验证中心系统
* 版权所有: 深圳市科飞时速网络技术有限公司(0755-88843776)
* 技术支持: info@21gmail.com
* 单元名称: 中央数据库用户实体类
* 开始时间: 2017.09.29
* 开发人员: 陈南巧
*/
@Entity
@Table(name="centre_user")
public class CentreUser implements Serializable{
private static final long serialVersionUID = 1L;
private int user_id;//用户id
private String user_name;//姓名
private String login_id;//帐号
private int company_id;//企业id
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
public int getUser_id() {
return user_id;
}
public void setUser_id(int user_id) {
this.user_id = user_id;
}
public String getLogin_id() {
return login_id;
}
public void setLogin_id(String login_id) {
this.login_id = login_id;
}
public int getCompany_id() {
return company_id;
}
public void setCompany_id(int company_id) {
this.company_id = company_id;
}
public String getUser_name() {
return user_name;
}
public void setUser_name(String user_name) {
this.user_name = user_name;
}
}
... ...
package com.espeed.yxy.dao.impl;
import java.util.List;
import com.espeed.yxy.dao.YxyMarketingWeekDao;
import com.espeed.yxy.pojo.YxyMarketingWeek;
public class YxyMarketingWeekDaoImpl extends HibernateBaseDAOImpl<YxyMarketingWeek, Long> implements YxyMarketingWeekDao {
/**HQL查询*/
public List<YxyMarketingWeek> findByHql(String hql)throws Exception{
return super.getAll(hql);
}
/**指定条记录*/
public List<YxyMarketingWeek> findByHqlSet(String hql,int num)throws Exception{
return super.findBySet(hql, num);
}
/**HQL更新*/
public void updateByHql(String hql) throws Exception {
super.updateorDelByHql(hql);
}
}
... ...
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<filter>
<filter-name>openSessionInView</filter-name>
<filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>openSessionInView</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!-- 配置spring监听器 -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<!-- Spring乱码处理 -->
<filter>
<filter-name>characterEncoding</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
<init-param>
<param-name>forceEncoding</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<!-- 开机运行方法 -->
<servlet>
<servlet-name>initServlet</servlet-name>
<servlet-class>com.espeed.yxy.tool.ServiceInit</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
</web-app>
... ...
package com.espeed.yxy.dao;
import java.util.List;
import com.espeed.yxy.pojo.YxySendSmtpInfo;
/**
* 程序名称: EspeedMail_时速邮箱
* 程序版本: V1.0
* 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776)
* 版权所有: 深圳市科飞时速网络技术有限公司
* 技术支持: Tech@21gmail.com
* 单元名称: SMTP DAO(营销游)
* 开始时间: 2013.12.09
* 程 序 员: 谢勇
* 最后修改:
* 备 注: 如需修改请通知程序员
*/
public interface YxySendSmtpInfoDao {
// /**查询可用的smtp*/
// public List<YxySendSmtpInfo> findAllSmtp(int num)throws Exception;
// /**更新smtp状态*/
// public void updateSmtpStatus(YxySendSmtpInfo o)throws Exception;
// /**HQL查询*/
// public List<YxySendSmtpInfo> findByHql(String hql)throws Exception;
/**批量插入*/
public void addPiPojo(List<YxySendSmtpInfo> o)throws Exception;
/**实体添加*/
public int addPojo(YxySendSmtpInfo o)throws Exception;
/**HQL查询*/
public List<YxySendSmtpInfo> findByHql(String hql)throws Exception;
/**SQL查询*/
public List<Object> findbysql(String sql)throws Exception;
/**SQL更新*/
public void updateBySql(String sql)throws Exception;
/**HQL更新*/
public void updateByHql(String hql)throws Exception;
}
... ...
package com.espeed.yxy.pojo;
import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
/**
* 程序名称: EspeedMail_时速邮箱
* 程序版本: V1.0
* 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776)
* 版权所有: 深圳市科飞时速网络技术有限公司
* 技术支持: Tech@21gmail.com
* 单元名称: 邮件基本信息实体(营销游)
* 开始时间: 2013.12.09
* 程 序 员: 谢勇
* 最后修改:
* 备 注: 如需修改请通知程序员
*/
@Entity
@Table(name="yxy_send_mail_master_base")
public class YxySendMailMasterBase implements Serializable{
private static final long serialVersionUID = 1L;
private int send_mail_id;//发送邮件ID
private String user_loginid;//创建用户账号
private String user_domain;//创建用户域名
private String create_time;//创建时间
private int is_unsubscribe;//是否退订
private int unsubscribe_language;//退订选择语言(0.中文1.英文)
private int include_link;//是否包含嵌入链接
private String link_context;//链接地址
private String mail_account;//发送邮箱账号
private String sender;//发件人
private String send_email;//发件人邮箱
private String reply_email;//回复邮箱
private String subject;//主题
private int auto_change_subject;//是否多主题变换
private String body;//邮件正文
private String attarchment_path ;//附件保存路径
private String image_path;//图片保存路径
private String eml_file_path;//EML文件路径
private String eml_encode_key;//EML文件KEY
private int mail_size;//邮件大小
private int plans_send;//是否定时发送
private String plans_send_time;//定时发送时间
private int status ;//处理状态
private int folder_id;//所属文件夹ID
private String mail_uid; //mail唯一性标识
private int is_high_precision;//是否使用高精准发信
private int exptionnum;//发送过程中异常的次数
private String txtaddresspath;//txt地址文件路径
private int send_num;//发送量
private int isuse;//是否使用中
private int sendci;//发送次数
private int iscrm;//是不是老客户营销
private int isold;
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
public int getSend_mail_id() {
return send_mail_id;
}
public void setSend_mail_id(int sendMailId) {
send_mail_id = sendMailId;
}
public String getUser_loginid() {
return user_loginid;
}
public void setUser_loginid(String userLoginid) {
user_loginid = userLoginid;
}
public String getUser_domain() {
return user_domain;
}
public void setUser_domain(String userDomain) {
user_domain = userDomain;
}
public String getCreate_time() {
return create_time;
}
public void setCreate_time(String createTime) {
create_time = createTime;
}
public int getIs_unsubscribe() {
return is_unsubscribe;
}
public void setIs_unsubscribe(int isUnsubscribe) {
is_unsubscribe = isUnsubscribe;
}
public int getUnsubscribe_language() {
return unsubscribe_language;
}
public void setUnsubscribe_language(int unsubscribeLanguage) {
unsubscribe_language = unsubscribeLanguage;
}
public int getInclude_link() {
return include_link;
}
public void setInclude_link(int includeLink) {
include_link = includeLink;
}
public String getLink_context() {
return link_context;
}
public void setLink_context(String linkContext) {
link_context = linkContext;
}
public String getMail_account() {
return mail_account;
}
public void setMail_account(String mailAccount) {
mail_account = mailAccount;
}
public String getSender() {
return sender;
}
public void setSender(String sender) {
this.sender = sender;
}
public String getSend_email() {
return send_email;
}
public void setSend_email(String sendEmail) {
send_email = sendEmail;
}
public String getReply_email() {
return reply_email;
}
public void setReply_email(String replyEmail) {
reply_email = replyEmail;
}
public String getSubject() {
return subject;
}
public void setSubject(String subject) {
this.subject = subject;
}
public int getAuto_change_subject() {
return auto_change_subject;
}
public void setAuto_change_subject(int autoChangeSubject) {
auto_change_subject = autoChangeSubject;
}
public String getBody() {
return body;
}
public void setBody(String body) {
this.body = body;
}
public String getAttarchment_path() {
return attarchment_path;
}
public void setAttarchment_path(String attarchmentPath) {
attarchment_path = attarchmentPath;
}
public String getImage_path() {
return image_path;
}
public void setImage_path(String imagePath) {
image_path = imagePath;
}
public String getEml_file_path() {
return eml_file_path;
}
public void setEml_file_path(String emlFilePath) {
eml_file_path = emlFilePath;
}
public String getEml_encode_key() {
return eml_encode_key;
}
public void setEml_encode_key(String emlEncodeKey) {
eml_encode_key = emlEncodeKey;
}
public int getMail_size() {
return mail_size;
}
public void setMail_size(int mailSize) {
mail_size = mailSize;
}
public int getPlans_send() {
return plans_send;
}
public void setPlans_send(int plansSend) {
plans_send = plansSend;
}
public String getPlans_send_time() {
return plans_send_time;
}
public void setPlans_send_time(String plansSendTime) {
plans_send_time = plansSendTime;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public int getFolder_id() {
return folder_id;
}
public void setFolder_id(int folderId) {
folder_id = folderId;
}
public String getMail_uid() {
return mail_uid;
}
public void setMail_uid(String mailUid) {
mail_uid = mailUid;
}
public int getIs_high_precision() {
return is_high_precision;
}
public void setIs_high_precision(int isHighPrecision) {
is_high_precision = isHighPrecision;
}
public int getExptionnum() {
return exptionnum;
}
public void setExptionnum(int exptionnum) {
this.exptionnum = exptionnum;
}
public String getTxtaddresspath() {
return txtaddresspath;
}
public void setTxtaddresspath(String txtaddresspath) {
this.txtaddresspath = txtaddresspath;
}
public int getSend_num() {
return send_num;
}
public void setSend_num(int sendNum) {
send_num = sendNum;
}
public int getIsuse() {
return isuse;
}
public void setIsuse(int isuse) {
this.isuse = isuse;
}
public int getSendci() {
return sendci;
}
public void setSendci(int sendci) {
this.sendci = sendci;
}
public int getIscrm() {
return iscrm;
}
public void setIscrm(int iscrm) {
this.iscrm = iscrm;
}
public int getIsold() {
return isold;
}
public void setIsold(int isold) {
this.isold = isold;
}
}
... ...