From ade2dd215d87c1de07453124c69f0c5bb14d0c4c Mon Sep 17 00:00:00 2001 From: anthonywj Date: Mon, 18 Sep 2023 09:30:08 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=90=8C=E6=AD=A5=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E7=9B=B8=E5=85=B3=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/glxp/api/config/HdSchemaExecutor.java | 4 ++-- .../service/sync/SpsSyncDownloadService.java | 20 +++++++++++-------- .../sync/impl/BasicExportServiceImpl.java | 4 ++-- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/glxp/api/config/HdSchemaExecutor.java b/src/main/java/com/glxp/api/config/HdSchemaExecutor.java index d4ac94ea..367ca515 100644 --- a/src/main/java/com/glxp/api/config/HdSchemaExecutor.java +++ b/src/main/java/com/glxp/api/config/HdSchemaExecutor.java @@ -49,7 +49,7 @@ public class HdSchemaExecutor implements ApplicationRunner { String sql = IoUtil.readUtf8(inputStream); try { //判断版本表是否存在 - int count = hdCommonDao.selectTableExist("hd_version"); + int count = hdCommonDao.selectTableExist("sys_db_version"); if (count == 0) { hdCommonDao.updateSql(sql); } @@ -85,4 +85,4 @@ public class HdSchemaExecutor implements ApplicationRunner { // schema.add(new SchemaData("v2.2", "schema_v2.2.sql")); // schema.add(new SchemaData("v2.3", "schema_v2.3.sql")); } -} \ No newline at end of file +} diff --git a/src/main/java/com/glxp/api/service/sync/SpsSyncDownloadService.java b/src/main/java/com/glxp/api/service/sync/SpsSyncDownloadService.java index 1beeda9c..906e3dab 100644 --- a/src/main/java/com/glxp/api/service/sync/SpsSyncDownloadService.java +++ b/src/main/java/com/glxp/api/service/sync/SpsSyncDownloadService.java @@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.glxp.api.common.res.BaseResponse; import com.glxp.api.common.util.ResultVOUtils; import com.glxp.api.constant.*; +import com.glxp.api.constant.Constant; import com.glxp.api.dao.basic.BasicProductsDao; import com.glxp.api.entity.basic.*; import com.glxp.api.entity.inout.*; @@ -29,12 +30,10 @@ import com.glxp.api.service.inout.*; import com.glxp.api.service.inout.impl.IoOrderInvoiceService; import com.glxp.api.service.purchase.*; import com.glxp.api.service.thrsys.IThrBusTypeOriginService; -import com.glxp.api.util.CustomUtil; -import com.glxp.api.util.DateUtil; -import com.glxp.api.util.JsonUtils; -import com.glxp.api.util.RedisUtil; +import com.glxp.api.util.*; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.exception.ExceptionUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.BeanUtils; @@ -93,22 +92,25 @@ public class SpsSyncDownloadService { log.info("创建单据同步任务"); //自动创建要求被下载已完成单据任务. // 1.判断是否同步任务已存在 + Date curTime = new Date(); BasicExportStatusEntity basicExportStatusEntity1 = basicExportService.getOne(Wrappers.lambdaQuery(BasicExportStatusEntity.class) .eq(BasicExportStatusEntity::getType, NEW_ALL_ORDER) .orderByDesc(BasicExportStatusEntity::getStartTime) .last("limit 1") ); - + log.info("no1:" + basicExportStatusEntity1.getStatus() + "---" + BasicExportStatusEnum.COMPLETED.getCode()); //首次任务or上次任务结束 - if (basicExportStatusEntity1 == null || BasicExportStatusEnum.COMPLETED.getCode().equals(basicExportStatusEntity1.getStatus())) { - + if (basicExportStatusEntity1 == null || IntUtil.value(BasicExportStatusEnum.COMPLETED.getCode()) == IntUtil.value(basicExportStatusEntity1.getStatus())) { + log.info("no2:" + basicExportStatusEntity1.getStatus() + "---" + BasicExportStatusEnum.COMPLETED.getCode()); SpsSyncDataRequest spsSyncDataRequest = getRequest(ConstantStatus.SYNC_DOWNLOAD_SCAN_ORDER); if (lastUpdateTime != null) spsSyncDataRequest.setLastUpdateTime(DateUtil.formatDateTime(lastUpdateTime)); BaseResponse baseResponse = findOrder(spsSyncDataRequest); SpsSyncOrderResponse syncOrderResponse = baseResponse.getData(); + log.info("no4:" + syncOrderResponse); // 2.查看是否有需要更新的数据 if (CollUtil.isNotEmpty(syncOrderResponse.getOrderEntities())) { + log.info("no5:" + syncOrderResponse.getOrderEntities().size()); // 3.插入到任务表,等待获取 BasicExportStatusEntity orderStatusEntity = new BasicExportStatusEntity(); orderStatusEntity.setId(CustomUtil.getId()); @@ -116,7 +118,7 @@ public class SpsSyncDownloadService { orderStatusEntity.setType(NEW_ALL_ORDER); orderStatusEntity.setUpdateTime(new Date()); orderStatusEntity.setStatus(BasicExportStatusEnum.WAIT_SYNC.getCode()); - orderStatusEntity.setStartTime(new Date()); + orderStatusEntity.setStartTime(curTime); orderStatusEntity.setScheduleType(BasicProcessStatus.SCHEDULE_NORMAL); if (lastUpdateTime != null) { @@ -127,6 +129,7 @@ public class SpsSyncDownloadService { orderStatusEntity.setRemark(baseResponse.getData().getSyncRemark()); } catch (IOException e) { e.printStackTrace(); + log.error("no6:" + ExceptionUtils.getStackTrace(e)); } } basicExportService.insertExportStatus(orderStatusEntity); @@ -931,6 +934,7 @@ public class SpsSyncDownloadService { syncOrderResponse.setOrderDetailCodeEntities(orderDetailCodeEntities); syncOrderResponse.setOrderDetailResultEntities(orderDetailResultEntities); syncOrderResponse.setOrderInvoiceEntities(orderInvoiceEntities); + log.info("no3:" + logs); return ResultVOUtils.success(syncOrderResponse); } diff --git a/src/main/java/com/glxp/api/service/sync/impl/BasicExportServiceImpl.java b/src/main/java/com/glxp/api/service/sync/impl/BasicExportServiceImpl.java index 500c23c5..92c62f70 100644 --- a/src/main/java/com/glxp/api/service/sync/impl/BasicExportServiceImpl.java +++ b/src/main/java/com/glxp/api/service/sync/impl/BasicExportServiceImpl.java @@ -16,7 +16,7 @@ import java.util.List; @Service @Transactional(rollbackFor = Exception.class) -public class BasicExportServiceImpl extends ServiceImpl implements BasicExportService { +public class BasicExportServiceImpl extends ServiceImpl implements BasicExportService { @Resource BasicExportDao basicExportDao; @@ -67,6 +67,6 @@ public class BasicExportServiceImpl extends ServiceImpl