From 758057f70f793a633275361f1bb033fc975d4ad9 Mon Sep 17 00:00:00 2001 From: yewj Date: Sat, 26 Oct 2024 18:28:46 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B6=E8=B4=B9=E5=87=BA=E5=BA=93=E6=98=8E?= =?UTF-8?q?=E7=BB=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/dao/thrsys/ThrInvOrderMapper.java | 4 +-- .../thrsys/impl/ThrInvOrderServiceImpl.java | 27 +++++++++---------- .../mapper/thrsys/ThrInvOrderMapper.xml | 27 ++++++++++++++----- 3 files changed, 36 insertions(+), 22 deletions(-) diff --git a/src/main/java/com/glxp/api/dao/thrsys/ThrInvOrderMapper.java b/src/main/java/com/glxp/api/dao/thrsys/ThrInvOrderMapper.java index b37adfbe2..f793a9ab9 100644 --- a/src/main/java/com/glxp/api/dao/thrsys/ThrInvOrderMapper.java +++ b/src/main/java/com/glxp/api/dao/thrsys/ThrInvOrderMapper.java @@ -6,6 +6,7 @@ import com.glxp.api.entity.thrsys.ThrInvOrderDetail; import com.glxp.api.req.thrsys.FilterThrInvOrderRequest; import com.glxp.api.res.thrsys.ThrInvOrderResponse; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; import java.util.Date; @@ -16,7 +17,6 @@ public interface ThrInvOrderMapper extends BaseMapperPlus filterThrInvOrder(FilterThrInvOrderRequest filterThrInvOrderRequest); - @Select("SELECT COUNT(*) FROM thr_inv_order WHERE startDate <= #{startDate} AND endDate >= #{endDate}") - int countDownloadsInRange(Date startDate, Date endDate); + int countDownloadsInRange(@Param(value = "startDate") Date startDate, @Param(value = "endDate") Date endDate); } diff --git a/src/main/java/com/glxp/api/service/thrsys/impl/ThrInvOrderServiceImpl.java b/src/main/java/com/glxp/api/service/thrsys/impl/ThrInvOrderServiceImpl.java index 1737f36ce..dee6749ef 100644 --- a/src/main/java/com/glxp/api/service/thrsys/impl/ThrInvOrderServiceImpl.java +++ b/src/main/java/com/glxp/api/service/thrsys/impl/ThrInvOrderServiceImpl.java @@ -68,6 +68,7 @@ import javax.annotation.Resource; import java.math.BigDecimal; import java.text.ParseException; import java.text.SimpleDateFormat; +import java.time.LocalDateTime; import java.util.*; import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Collectors; @@ -119,6 +120,13 @@ public class ThrInvOrderServiceImpl implements ThrInvOrderService { @Override public BaseResponse handleExternalThrInvSfOrder(FilterInvProductRequest filterInvProductRequest) { + + if (thrInvOrderMapper.countDownloadsInRange(filterInvProductRequest.getStartDate(), filterInvProductRequest.getEndDate()) <= 0) { + log.info("自动抓取第三方收费出入库明细生成单据定时任务结束=" + filterInvProductRequest.getStartDate() + "---" + filterInvProductRequest.getEndDate()); + } else { + log.info("已下载忽略"); + return ResultVOUtils.error(20001, "已下载忽略"); + } BaseResponse> baseResponse = erpInvClient.getInvSfResult(filterInvProductRequest); if (baseResponse.getCode() == 20000) { List list = baseResponse.getData().getList(); @@ -162,6 +170,7 @@ public class ThrInvOrderServiceImpl implements ThrInvOrderService { } + @Override public void handleExternalThrInvPhOrder(FilterInvProductRequest filterInvProductRequest) { BaseResponse> baseResponse = erpInvClient.getInvPhResult(filterInvProductRequest); @@ -341,21 +350,11 @@ public class ThrInvOrderServiceImpl implements ThrInvOrderService { filterInvProductRequest.setStartDate(stringToDate(days + " 00:00:00")); filterInvProductRequest.setEndDate(stringToDate(days + " 12:59:59")); - if (thrInvOrderMapper.countDownloadsInRange(filterInvProductRequest.getStartDate(), filterInvProductRequest.getEndDate()) <= 0) { - handleExternalThrInvSfOrder(filterInvProductRequest); - log.info("自动抓取第三方收费出入库明细生成单据定时任务结束"); - } else { - log.info("已下载户略"); - } + handleExternalThrInvSfOrder(filterInvProductRequest); filterInvProductRequest.setStartDate(stringToDate(days + " 13:00:00")); filterInvProductRequest.setEndDate(stringToDate(days + " 23:59:59")); - if (thrInvOrderMapper.countDownloadsInRange(filterInvProductRequest.getStartDate(), filterInvProductRequest.getEndDate()) <= 0) { - handleExternalThrInvSfOrder(filterInvProductRequest); - log.info("自动抓取第三方收费出入库明细生成单据定时任务结束"); - } else { - log.info("已下载户略"); - } + handleExternalThrInvSfOrder(filterInvProductRequest); } @@ -820,8 +819,8 @@ public class ThrInvOrderServiceImpl implements ThrInvOrderService { log.info("手动抓取第三方收费出入库明细生成单据定时任务开始"); FilterInvProductRequest filterInvProductRequest = new FilterInvProductRequest(); filterInvProductRequest.setThirdSys(filterDownloadInvOrderRequest.getThirdSysFk()); - filterInvProductRequest.setStartDate(stringToDate(filterDownloadInvOrderRequest.getStartDate() + " 00:00:00")); - filterInvProductRequest.setEndDate(stringToDate(filterDownloadInvOrderRequest.getEndDate() + " 23:59:59")); + filterInvProductRequest.setStartDate(stringToDate(filterDownloadInvOrderRequest.getStartDate())); + filterInvProductRequest.setEndDate(stringToDate(filterDownloadInvOrderRequest.getEndDate())); log.info("手动抓取第三方收费出入库明细生成单据定时任务结束"); return handleExternalThrInvSfOrder(filterInvProductRequest); diff --git a/src/main/resources/mybatis/mapper/thrsys/ThrInvOrderMapper.xml b/src/main/resources/mybatis/mapper/thrsys/ThrInvOrderMapper.xml index 573a0c51b..687b20b39 100644 --- a/src/main/resources/mybatis/mapper/thrsys/ThrInvOrderMapper.xml +++ b/src/main/resources/mybatis/mapper/thrsys/ThrInvOrderMapper.xml @@ -5,8 +5,8 @@ resultType="com.glxp.api.res.thrsys.ThrInvOrderResponse"> SELECT tio.*, bbt.name billTypeName, aw.name invName FROM thr_inv_order tio - left join basic_bussiness_type bbt on tio.billType = bbt.action - left join auth_warehouse aw on tio.invCode = aw.code + left join basic_bussiness_type bbt on tio.billType = bbt.action + left join auth_warehouse aw on tio.invCode = aw.code AND billNo like concat('%', #{billNo}, '%') @@ -43,12 +43,27 @@ AND ( - sickerCode like concat('%', #{sicker}, '%') - OR - sickerName like concat('%', #{sicker}, '%') - ) + sickerCode like concat('%', #{sicker}, '%') + OR + sickerName like concat('%', #{sicker}, '%') + ) ORDER BY tio.billdate DESC + + +