📄 getmaillist.java
字号:
package com.digipower.automail.mailsender;
/**
* <p>Title: </p>
* <p>Description: TestStruts</p>
* <p>Copyright: Copyright (c) 2004</p>
* <p>Company: foxconn</p>
* @author conti
* @version 1.0
*/
import java.sql.*;
import javax.sql.*;
import java.io.*;
import java.util.*;
import java.text.*;
import com.digipower.common.basic.*;
public class GetMailList {
Connection conn = null;
ConnectionDB_Oracle db = null;
Statement stmt = null;
ResultSet rst = null;
PreparedStatement myPrepStatement = null;
public GetMailList() throws Exception {
db = new ConnectionDB_Oracle();
conn = db.getConnection();
}
public Collection getFolderName() throws Exception {
Collection ret = new ArrayList();
try
{
stmt = conn.createStatement();
String sql = "select * from AutoMail_Master where IsSend = 'N'";
rst = stmt.executeQuery(sql);
while (rst.next()) {
String item = rst.getString("FolderNameM");
ret.add(item);
}
}
catch(Exception e)
{
e.printStackTrace();
}
finally
{
try
{
if (stmt!=null) {stmt.close();}
if (rst != null) {rst.close();}
}
catch(Exception e)
{
e.printStackTrace();
}
return ret;
}
// return ret;
}
public Collection getSubject() throws Exception {
Collection ret = new ArrayList();
try
{
Statement stmt = conn.createStatement();
String sql = "select * from AutoMail_Master where IsSend = 'N'";
ResultSet rst = stmt.executeQuery(sql);
while (rst.next()) {
String item = rst.getString("Subject");
ret.add(item);
}
}
catch(Exception e)
{
e.printStackTrace();
}
finally
{
try
{
if (stmt!=null) {stmt.close();}
if (rst != null) {rst.close();}
}
catch(Exception e)
{
e.printStackTrace();
}
}
return ret;
}
public Collection getReply() throws Exception {
Collection ret = new ArrayList();
try
{
stmt = conn.createStatement();
String sql = "select * from AutoMail_Master where IsSend = 'N'";
rst = stmt.executeQuery(sql);
while (rst.next()) {
String item = rst.getString("IsReply");
ret.add(item);
}
}
catch(Exception e)
{
e.printStackTrace();
}
finally
{
try
{
if (stmt!=null) {stmt.close();}
if (rst != null) {rst.close();}
}
catch(Exception e)
{
e.printStackTrace();
}
return ret;
}
}
public void sendOver(String folderNameM) throws Exception {
try {
String sql =
"update AutoMail_Master set IsSend = ? where FolderNameM = ?";
conn.setAutoCommit(false);
myPrepStatement = conn.prepareStatement(sql);
myPrepStatement.setString(1, "Y");
myPrepStatement.setString(2, folderNameM);
myPrepStatement.executeUpdate();
conn.commit();
}
catch(Exception e)
{
if(conn != null) {conn.rollback();}
e.printStackTrace();
}
finally
{
try
{
if(myPrepStatement != null) myPrepStatement.close();
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
public void setMailDate(String folderNameM) throws Exception {
try {
java.util.Date nowDate = new java.util.Date();
Format formatter = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
String s = formatter.format(nowDate);
java.util.Date g = new java.util.Date(s);
String sql =
"update AutoMail_Master set MailDate = ? where FolderNameM = ?";
conn.setAutoCommit(false);
myPrepStatement = conn.prepareStatement(sql);
myPrepStatement.setTimestamp(1,new java.sql.Timestamp(g.getTime()));
myPrepStatement.setString(2, folderNameM);
myPrepStatement.executeUpdate();
conn.commit();
}
catch(Exception e)
{
if(conn != null)
{
conn.rollback();
}
e.printStackTrace();
}
finally
{
try
{
if(myPrepStatement != null)
{
myPrepStatement.close();
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
public void disconn() throws Exception
{
System.out.println("disconn");
if (conn != null) conn.close();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -