Commit 0c7e3fcb by chamberone

feat: 批量拉取数据调整

1 parent 97ab6586
package com.dituhui.pea.dispatch.service.impl; package com.dituhui.pea.dispatch.service.impl;
import com.dituhui.pea.dispatch.dao.DispatchBatchRepository; import java.time.LocalDateTime;
import com.dituhui.pea.dispatch.entity.DispatchBatch; import java.time.LocalTime;
import com.dituhui.pea.dispatch.service.BatchService; import java.time.format.DateTimeFormatter;
import lombok.extern.slf4j.Slf4j; import java.util.Optional;
import javax.persistence.EntityManager;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.annotation.Isolation; import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.support.DefaultTransactionDefinition;
import org.springframework.transaction.support.TransactionTemplate;
import javax.persistence.EntityManager; import com.dituhui.pea.dispatch.dao.DispatchBatchRepository;
import javax.sql.DataSource; import com.dituhui.pea.dispatch.entity.DispatchBatch;
import java.sql.Connection; import com.dituhui.pea.dispatch.service.BatchService;
import java.sql.SQLException;
import java.time.LocalDate; import lombok.extern.slf4j.Slf4j;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.util.List;
import java.util.Optional;
/** /**
...@@ -112,7 +105,12 @@ public class BatchServiceImpl implements BatchService { ...@@ -112,7 +105,12 @@ public class BatchServiceImpl implements BatchService {
" and appointment_method like 'AUTO%' and a.appointment_status in ('INIT', 'PRE')\n" + " and appointment_method like 'AUTO%' and a.appointment_status in ('INIT', 'PRE')\n" +
" and order_status ='NORMAL' and service_status='INIT'\n" + " and order_status ='NORMAL' and service_status='INIT'\n" +
" order by a.expect_time_begin asc "; " order by a.expect_time_begin asc ";
int orderCount = jdbcTemplate.update(sqlOrder, batchNo, groupId, batchDay); String tempDay = "2023-08-13";
int orderCount = jdbcTemplate.update(sqlOrder, batchNo, groupId,
/**
* FIXME 因为系统暂时没有订单,每次固定拉取2023-08-13号数据tempDay,上线后改成batchDay
*/
tempDay);
// confirm的要做预占用,所以也加入进来 // confirm的要做预占用,所以也加入进来
String sqlOrderConfirm = "INSERT INTO dispatch_order (group_id, batch_no, team_id, order_id , dt, x, y, \n" + String sqlOrderConfirm = "INSERT INTO dispatch_order (group_id, batch_no, team_id, order_id , dt, x, y, \n" +
...@@ -128,7 +126,7 @@ public class BatchServiceImpl implements BatchService { ...@@ -128,7 +126,7 @@ public class BatchServiceImpl implements BatchService {
" order by a.expect_time_begin asc "; " order by a.expect_time_begin asc ";
int orderConfirmCount = jdbcTemplate.update(sqlOrderConfirm, batchNo, groupId, batchDay); int orderConfirmCount = jdbcTemplate.update(sqlOrderConfirm, batchNo, groupId, batchDay);
log.info("准备批次数据 orderCount:{}, orderConfirmCount:{}", orderCount, orderConfirmCount); log.info("准备批次数据 engCount:{}, orderCount:{}, orderConfirmCount:{}", engCount, orderCount, orderConfirmCount);
if (orderCount + orderConfirmCount > 0) { if (orderCount + orderConfirmCount > 0) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!