袁少华 4 năm trước cách đây
mục cha
commit
7771d057f2

+ 22 - 5
src/main/java/org/jeecg/modules/appInterface/controller/FbsWorkingStatisticsController.java

@@ -1,9 +1,12 @@
 package org.jeecg.modules.appInterface.controller;
 
 import java.io.File;
+import java.io.InputStream;
 import java.math.BigDecimal;
 import java.sql.Connection;
 import java.sql.DriverManager;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
 import java.util.*;
 import java.io.IOException;
 import java.io.UnsupportedEncodingException;
@@ -16,6 +19,7 @@ import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.system.query.QueryGenerator;
 import org.jeecg.common.util.oConvertUtils;
 import org.jeecg.modules.appInterface.FileList;
+import org.jeecg.modules.appInterface.ImageUtil;
 import org.jeecg.modules.appInterface.ResHttpStatus;
 import org.jeecg.modules.appInterface.entity.FbsWorkingStatistics;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -61,22 +65,35 @@ public class FbsWorkingStatisticsController {
 	 private IFbsWorkshopDispatchListService fbsWorkshopDispatchListService;
 	 @Autowired
 	 private IFbsPersonService fbsPersonService;
-//	 @Value("${jeecg.path.upload}")
+	 @Value("${jeecg.path.upload}")
 	 private String upLoadPath;
-//	 @Value("${jeecg.path.upvedio}")
+	 @Value("${jeecg.path.upvedio}")
 	 private String upVedio;
 
-	 public static void main1(String[] srg) {
+	 public static void main(String[] srg) {
 		 String driverName = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
 		 //加载JDBC驱动
-		 String dbURL = "jdbc:sqlserver://103.40.192.17:43110;DatabaseName=UFDATA_006_2019";
+		 String dbURL = "jdbc:sqlserver://47.103.119.148;DatabaseName=UFDATA_100_2019";
 		 //连接服务器和数据库
 		 String userName = "sa"; //默认用户名
-		 String userPwd = "admin"; //密码
+		 String userPwd = "Wakeup@123"; //密码
 		 Connection dbConn;
+		 PreparedStatement ps = null;
+		 ResultSet rs = null;
+		 String targetPath = "D:/img/1.png";
 		 try {
 			 Class.forName(driverName);
 			 dbConn = DriverManager.getConnection(dbURL, userName, userPwd);
+
+			 String sql = "select * from VoucherAccessories where voucherID ='1000000003'";
+			 ps = dbConn.prepareStatement(sql);
+//			 ps.setInt(1, 1);
+			 rs = ps.executeQuery();
+			 while (rs.next()) {
+				 InputStream in = rs.getBinaryStream("FileContent");
+				 ImageUtil.readBin2Image(in, targetPath);
+			 }
+
 			 System.out.println("Connection Successful!");
 			 //如果连接成功 控制台输出Connection  Successful!
 		 } catch (Exception e) {