|
@@ -4,8 +4,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.management.platform.entity.*;
|
|
|
import com.management.platform.entity.vo.TisTimeVO;
|
|
|
import com.management.platform.mapper.*;
|
|
|
-import com.zaxxer.hikari.HikariConfig;
|
|
|
-import com.zaxxer.hikari.HikariDataSource;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.core.ParameterizedTypeReference;
|
|
|
import org.springframework.http.*;
|
|
@@ -17,10 +15,6 @@ import org.springframework.util.CollectionUtils;
|
|
|
import org.springframework.web.client.RestTemplate;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
-import java.sql.Connection;
|
|
|
-import java.sql.PreparedStatement;
|
|
|
-import java.sql.ResultSet;
|
|
|
-import java.sql.SQLException;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
@@ -61,16 +55,16 @@ public class DataCollectTask {
|
|
|
private FmwDetailMapper fmwDetailMapper;
|
|
|
|
|
|
|
|
|
- private static HikariDataSource sqlServerDataSource;
|
|
|
-
|
|
|
- static {
|
|
|
- HikariConfig sqlServerConfig = new HikariConfig();
|
|
|
- sqlServerConfig.setJdbcUrl("jdbc:sqlserver://172.168.10.84:1433;databaseName=UFDATA_001_2023;encrypt=true;trustServerCertificate=true");
|
|
|
- sqlServerConfig.setUsername("zhangyuhua");
|
|
|
- sqlServerConfig.setPassword("ZC12zyh18");
|
|
|
- sqlServerConfig.setMaximumPoolSize(5);
|
|
|
- sqlServerDataSource = new HikariDataSource(sqlServerConfig);
|
|
|
- }
|
|
|
+// private static HikariDataSource sqlServerDataSource;
|
|
|
+//
|
|
|
+// static {
|
|
|
+// HikariConfig sqlServerConfig = new HikariConfig();
|
|
|
+// sqlServerConfig.setJdbcUrl("jdbc:sqlserver://172.168.10.84:1433;databaseName=UFDATA_001_2023;encrypt=true;trustServerCertificate=true");
|
|
|
+// sqlServerConfig.setUsername("zhangyuhua");
|
|
|
+// sqlServerConfig.setPassword("ZC12zyh18");
|
|
|
+// sqlServerConfig.setMaximumPoolSize(5);
|
|
|
+// sqlServerDataSource = new HikariDataSource(sqlServerConfig);
|
|
|
+// }
|
|
|
|
|
|
|
|
|
public void caDayTisTask(){
|
|
@@ -81,22 +75,24 @@ public class DataCollectTask {
|
|
|
String dateStr = sdfYmd.format(date);
|
|
|
// List<TisTimeVO> timeVOList = fmwDetailMapper.getTisTimeByDate(specialCompanyId,dateStr);
|
|
|
List<TisTimeVO> timeVOList = reportMapper.getTisTimeByDate(specialCompanyId,dateStr);
|
|
|
- for (TisTimeVO tisTimeVO : timeVOList) {
|
|
|
- String sqlQuery = "select top 1 iRealCOID from ca_batchmap where cMOCode = ? and iMOSubSN = ? ";
|
|
|
- try (Connection connection = sqlServerDataSource.getConnection()) {
|
|
|
- PreparedStatement queryStmt = connection.prepareStatement(sqlQuery);
|
|
|
- queryStmt.setString(1,tisTimeVO.getOrderId());
|
|
|
- queryStmt.setInt(2,tisTimeVO.getLine());
|
|
|
- ResultSet queryRs = queryStmt.executeQuery();
|
|
|
- if (queryRs.next()) {
|
|
|
- tisTimeVO.setCoId(queryRs.getString("iRealCOID"));
|
|
|
- tisTimeVO.setDateStr(dateStr);
|
|
|
- }
|
|
|
- } catch (SQLException e) {
|
|
|
- System.err.println("数据库操作错误: " + e.getMessage());
|
|
|
- }
|
|
|
- }
|
|
|
+
|
|
|
+// for (TisTimeVO tisTimeVO : timeVOList) {
|
|
|
+// String sqlQuery = "select top 1 iRealCOID from ca_batchmap where cMOCode = ? and iMOSubSN = ? ";
|
|
|
+// try (Connection connection = sqlServerDataSource.getConnection()) {
|
|
|
+// PreparedStatement queryStmt = connection.prepareStatement(sqlQuery);
|
|
|
+// queryStmt.setString(1,tisTimeVO.getOrderId());
|
|
|
+// queryStmt.setInt(2,tisTimeVO.getLine());
|
|
|
+// ResultSet queryRs = queryStmt.executeQuery();
|
|
|
+// if (queryRs.next()) {
|
|
|
+// tisTimeVO.setCoId(queryRs.getString("iRealCOID"));
|
|
|
+//
|
|
|
+// }
|
|
|
+// } catch (SQLException e) {
|
|
|
+// System.err.println("数据库操作错误: " + e.getMessage());
|
|
|
+// }
|
|
|
+// }
|
|
|
if(!CollectionUtils.isEmpty(timeVOList)){
|
|
|
+ timeVOList.forEach(t->t.setDateStr(dateStr));
|
|
|
HttpHeaders headers = new HttpHeaders();
|
|
|
headers.setContentType(MediaType.APPLICATION_JSON);
|
|
|
Map<String, Object> requestBody = new HashMap<>();
|