|
|
@@ -62,21 +62,8 @@ public class UploadAttachImpl implements UploadAttach {
|
|
|
String cd_varchar50_4 = map.get("cd_varchar50_4");
|
|
|
if (cd_varchar50_9!=null) {
|
|
|
cd_varchar50_9 = cd_varchar50_9.replace(";", ",").substring(0, cd_varchar50_9.length() - 1);
|
|
|
- ResultSet results = statement.executeQuery("select fp_path from " + sob + ".filepath where " +
|
|
|
- "fp_id in (" + cd_varchar50_9 + ")");
|
|
|
- while (results.next()) {
|
|
|
- String path = results.getString("fp_path");
|
|
|
- String substring = path.substring(path.lastIndexOf("."));
|
|
|
- File file = new File(path);
|
|
|
- if (client != null) {
|
|
|
- String name = cd_varchar50_4+ "_" + s + substring;
|
|
|
- boolean ip = upload(client, config.get("ip").toString(), folder, file, name);
|
|
|
- if (ip){
|
|
|
- statement.execute("update "+sob+".customtabledetail set cd_number_10 = -1 where cd_id = "+cd_id);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
+ uploadAttachFtp(statement,sob,cd_varchar50_9,client,config.get("ip").toString(),folder,
|
|
|
+ cd_varchar50_4,s,cd_id);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -133,6 +120,23 @@ public class UploadAttachImpl implements UploadAttach {
|
|
|
}
|
|
|
return maps;
|
|
|
}
|
|
|
+ private void uploadAttachFtp(Statement statement,String sob,String attach,FTPClient client,String ip,
|
|
|
+ String folder,String attachName,String dateString,String cd_id) throws SQLException {
|
|
|
+ ResultSet results = statement.executeQuery("select fp_path from " + sob + ".filepath where " +
|
|
|
+ "fp_id in (" + attach + ")");
|
|
|
+ while (results.next()) {
|
|
|
+ String path = results.getString("fp_path");
|
|
|
+ String substring = path.substring(path.lastIndexOf("."));
|
|
|
+ File file = new File(path);
|
|
|
+ if (client != null) {
|
|
|
+ String name = attachName+ "_" + dateString + substring;
|
|
|
+ boolean bo = upload(client, ip, folder, file, name);
|
|
|
+ if (bo){
|
|
|
+ statement.execute("update "+sob+".customtabledetail set cd_number_10 = -1 where cd_id = "+cd_id);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
private boolean upload(FTPClient client,String ip,String folder,File file,String name){
|
|
|
boolean flag = false;
|