1、thin: + urlIp + : + sid; con = DriverManager.getConnection(url, user, password); return con; /* * * 中利用定数。/p * */public class Constants public static final String TYOUHYOU_ID = TYOUHYOU_ID; public static final String RIYOUKANNSYO_CD = RIYOUKANNSYO_CD public static final String LOCAL_PDF_BASYO = LOCA
2、L_PDF_BASYO public static final String SERVER_PDF_BASYO = SERVER_PDF_BASYO public static final String DB_USER_ID = DB_USER_ID public static final String DB_SID = DB_SID public static final String DB_PASSWORD = DB_PASSWORD public static final String DB_URL = DB_URL public static final String TAJYUUKI
3、DOU_ERROR = 多重起動:要確認 public static final String SONOTA = sonota public static final String SONOTA_UNCOMP = sonota_uncomp public static final String TYOUHYOUJIDOUSYUTURYOKU = 帳票自動出力処理実行 public static final String TEYIJI = 提示 public static final String HOUTEI = houtei public static final String HOUTEI
4、_UNCOMP = houtei_uncomp public static final String PDF = pdf public static final String JPG = .jpg public static final String C_PATH_TMP = C:/batch/tmp public static final String LOG_FILE = lastTime.txt public static final String START_FILE = start.txt public static final String DB_ERROR = DB接続時発生 p
5、ublic static final String INTERNET_ERROR = 接続 public static final String PRINT_ERROR = 接続、自動印刷処理中断。 public static final String JIDOUPRINT_ERROR = 自動印刷処理中断 public static final String PDFPRINT_ERROR = PDF印刷途中発生 public static final String PRINT_IP = PRINT_IP public static final String APP_INTERVAL = AP
6、P_INTERVAL public static final String PROFILEPATH = batchconfigAutoPrint.conf public static final String STARTTXTJIKANGSETE = C:/batch/tmp配下lastTime.txt日付時間設定。(日付時間yy-MM-dd HH:mm:ss.SSSSSS)import java.sql.PreparedStatement;import java.sql.ResultSet;import java.sql.Timestamp;import java.util.ArrayLis
7、t;import java.util.List;public class Dao public String getFirstMaxTime(Connection conn, String hoyukansho_cdStr, String chohyo_idstr) throws SQLException String firstMaxTime = null; PreparedStatement pre = null; ResultSet result = null; String sql = select max(to_char(tazzm208.shutsuryoku_date) + fr
8、om tazzm208 where tazzm208.hoyukansho_cd in (_IN_STRING2_) .replaceFirst(_IN_STRING2_, hoyukansho_cdStr); sql = sqland tazzm208.chohyo_id in (_IN_STRING_).replaceFirst( _IN_STRING_, chohyo_idstr); try pre = conn.prepareStatement(sql); result = pre.executeQuery(); while (result.next() firstMaxTime =
9、result.getString(1); finally try if (result != null) result.close(); if (pre ! pre.close(); if (conn ! conn.close(); catch (Exception e) e.printStackTrace(); return firstMaxTime; public List getOutputpath(Connection conn, String hoyukansho_cdStr, String chohyo_idstr, String maxTimeStr, String previo
10、usTimeStr) throws SQLException List outputpathList = new ArrayList(); if (previousTimeStr = null) sql = select tazzm208.outputpath, + tazzm208.chohyo_id , to_char(tazzm208.shutsuryoku_date) from tazzm208 where to_char(tazzm208.shutsuryoku_date) ? pre.setString(1, maxTimeStr); if (previousTimeStr !=
11、null) pre.setString(2, previousTimeStr); String outputpath = result.getString(1); String chohyo_id = result.getString(2); String shutsuryoku_date = result.getString(3); String record = new String3; record0 = outputpath; record1 = chohyo_id; record2 = shutsuryoku_date; outputpathList.add(record); ret
12、urn outputpathList; /* * param conn * param chohyo_idp * param shutsuryoku_date * return * throws SQLException public String getCheckOutputpathResult(Connection conn, String chohyo_idparam, String shutsuryoku_dateparam) throws SQLException String outputpathStr = null; select tazzm208.outputpath wher
13、e tazzm208.chohyo_id = ? and to_char(tazzm208.shutsuryoku_date) = ? pre.setString(1, chohyo_idparam); pre.setString(2, shutsuryoku_dateparam); outputpathStr = outputpath; return outputpathStr;import java.awt.image.BufferedImage;import java.io.BufferedReader;import java.io.BufferedWriter;import java.
14、io.File;import java.io.FileInputStream;import java.io.FileNotFoundException;import java.io.FileOutputStream;import java.io.FileReader;import java.io.FileWriter;import java.io.IOException;import java.io.InputStream;import .ConnectException;import javax.imageio.ImageIO;import javax.print.Doc;import ja
15、vax.print.DocFlavor;import javax.print.DocPrintJob;import javax.print.PrintException;import javax.print.PrintService;import javax.print.PrintServiceLookup;import javax.print.SimpleDoc;import javax.print.attribute.DocAttributeSet;import javax.print.attribute.HashDocAttributeSet;import javax.print.att
16、ribute.HashPrintRequestAttributeSet;import javax.print.attribute.standard.MediaPrintableArea;import javax.print.attribute.standard.MediaSizeName;import javax.print.attribute.standard.OrientationRequested;import org.apache.http.HttpResponse;import org.apache.http.StatusLine;import org.apache.http.cli
17、ent.ClientProtocolException;import org.apache.http.client.HttpClient;import org.apache.http.client.methods.HttpPost;import org.apache.http.impl.client.DefaultHttpClient;import org.apache.log4j.Logger;import org.apache.pdfbox.pdmodel.PDDocument;import org.apache.pdfbox.pdmodel.PDPage;public class MyT
18、hread extends Thread boolean printFlag = false; private static Logger logger = Logger.getLogger(MyThread.class); public void run() BufferedWriter bw = null; BufferedReader input = null; BufferedReader inputstatus = null; File status = new File(/batch/status File filestatus = new File(status, status.
19、txt checkoutputpathresult = new ArrayList outputpathNotNull = new ArrayList logger.info(二重起動 / 二重起動 / 1以下存在、存在場合二重起動見表示、処理中断 / 二重起動:【】tmpstart.txt File filepathstart = new File(Constants.C_PATH_TMP); File filestart = new File(filepathstart, Constants.START_FILE); if (filestart.exists() logger.info(*
20、二重起動* / 表示、処理中断 / :”多重起動:要確認” Object options = OK ; JOptionPane.showOptionDialog(null, Constants.TAJYUUKIDOU_ERROR, Constants.TEYIJI, JOptionPane.OK_OPTION, JOptionPane.INFORMATION_MESSAGE, null, options, options0); System.exit(0); while (true) try inputstatus = new BufferedReader(new FileReader(filestatus); String statusStr = String statusread = inputstatus.readLine(); if (statusread ! statusStr = statusread; if (500.equals(statusStr) inputstatus.close(); logger.info(処理中断 Ob
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1