收费出库明细

lh_dev_fifo
yewj 8 months ago
parent 694d4bd65e
commit 758057f70f

@ -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<ThrInvOrderMapper, Thr
List<ThrInvOrderResponse> 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);
}

@ -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<PageSimpleResponse<ThrInvResultResponse>> baseResponse = erpInvClient.getInvSfResult(filterInvProductRequest);
if (baseResponse.getCode() == 20000) {
List<ThrInvResultResponse> list = baseResponse.getData().getList();
@ -162,6 +170,7 @@ public class ThrInvOrderServiceImpl implements ThrInvOrderService {
}
@Override
public void handleExternalThrInvPhOrder(FilterInvProductRequest filterInvProductRequest) {
BaseResponse<PageSimpleResponse<ThrInvResultResponse>> 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("已下载户略");
}
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("已下载户略");
}
}
@ -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);

@ -51,4 +51,19 @@
</where>
ORDER BY tio.billdate DESC
</select>
<select id="countDownloadsInRange" parameterType="com.glxp.api.req.thrsys.FilterThrInvOrderRequest"
resultType="java.lang.Integer">
select count(0)
from thr_inv_order
<where>
startDate BETWEEN #{startDate} AND #{endDate}
OR endDate BETWEEN #{startDate} AND #{endDate}
OR (
<![CDATA[ DATE_FORMAT(endDate, '%Y-%m-%d %H:%i:%S') >= DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%i:%S') ]]>
and <![CDATA[ DATE_FORMAT(startDate, '%Y-%m-%d %H:%i:%S') <= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%i:%S') ]]>
)
</where>
</select>
</mapper>

Loading…
Cancel
Save