Compare commits

...
6 Commits
Author SHA1 Message Date
timi 1b221b13d1 Merge pull request 'v1.0.53' (#65) from dev into master
Reviewed-on: #65
2026-09-21 17:32:02 +00:00
Timi 48eaf2356f v1.0.53
CI / build-deploy (pull_request) Successful in 26s
CI / notify-on-failure (pull_request) Skipped
2026-09-22 01:31:15 +08:00
Timi 970952d9fa clone fulfillment attach to stock out 2026-09-21 23:59:13 +08:00
timi 135996ce19 Merge pull request 'v1.0.52' (#64) from dev into master
Reviewed-on: #64
2026-09-20 17:22:39 +00:00
Timi e5bfb59a1c v1.0.52
CI / build-deploy (pull_request) Successful in 27s
CI / notify-on-failure (pull_request) Skipped
2026-09-21 01:18:35 +08:00
Timi 51c1d20d3c more filter for sales order 2026-09-20 15:40:03 +08:00
7 changed files with 90 additions and 7 deletions
+1 -1
View File
@@ -11,7 +11,7 @@
<groupId>com.imyeyu.timiserverapi</groupId>
<artifactId>TimiServerAPI</artifactId>
<version>1.0.51</version>
<version>1.0.53</version>
<packaging>jar</packaging>
<name>TimiServerAPI</name>
<description>imyeyu.com API</description>
@@ -184,6 +184,7 @@ public class AttachmentServiceImplement extends AbstractEntityService<Attachment
try (InputStream inputStream = getInputStreamByMongoId(source.getMongoId())) {
target.setInputStream(inputStream);
create(target);
target.setInputStream(null);
return target;
} catch (IOException e) {
if (target.getMongoId() != null) {
@@ -1,5 +1,6 @@
package com.imyeyu.api.modules.gao.service;
import com.imyeyu.api.modules.common.entity.Attachment;
import com.imyeyu.api.modules.gao.entity.GaoProductStock;
import com.imyeyu.api.modules.gao.entity.GaoProductStockRecord;
import com.imyeyu.api.modules.gao.vo.GaoProductStockChangeRequest;
@@ -62,6 +63,10 @@ public interface GaoProductStockService {
/// 履约出库
List<GaoProductStock> outForFulfillment(String storeId, String bizId, List<GaoStockChangeItem> items, String requestNo, String operatorUserId);
/// 履约出库并复制履约附件到出库流水
List<GaoProductStock> outForFulfillment(String storeId, String bizId, List<GaoStockChangeItem> items, String requestNo,
String operatorUserId, List<Attachment> attachmentList);
/// 履约库存冲正入库
List<GaoProductStock> revokeForFulfillment(String storeId, String bizId, List<GaoStockChangeItem> items, String requestNo, String operatorUserId);
@@ -261,8 +261,10 @@ public class GaoOrderFulfillmentServiceImplement extends AbstractEntityService<G
applySkuSpecSnapshots(stockItems, fulfillmentItemList);
String verifierUserId = userLoginService.getRequireLoginUserId();
if (!stockItems.isEmpty()) {
List<Attachment> attachmentList = attachmentService.listByBizId(
Attachment.BizType.GAO_ORDER_FULFILLMENT, fulfillment.getId());
productStockService.outForFulfillment(order.getStoreId(), fulfillment.getId(), stockItems,
stockRequestNo(fulfillment, "OUT"), verifierUserId);
stockRequestNo(fulfillment, "OUT"), verifierUserId, attachmentList);
}
TimiException.requiredTrue(1 == mapper.updateStatus(fulfillment.getId(), GaoOrderFulfillment.Status.VERIFIED,
verifierUserId, Time.now(), request.getReason()), "履约状态已变化");
@@ -232,6 +232,14 @@ public class GaoProductStockServiceImplement implements GaoProductStockService {
return executeInternal(storeId, bizId, items, requestNo, operatorUserId, GaoProductStockRecord.OperationType.ORDER_OUT, null);
}
@Override
@Transactional(TimiServerDBConfig.ROLLBACKER)
public List<GaoProductStock> outForFulfillment(String storeId, String bizId, List<GaoStockChangeItem> items, String requestNo,
String operatorUserId, List<Attachment> attachmentList) {
return executeInternal(storeId, bizId, items, requestNo, operatorUserId,
GaoProductStockRecord.OperationType.ORDER_OUT, null, null, attachmentList);
}
@Override
@Transactional(TimiServerDBConfig.ROLLBACKER)
public List<GaoProductStock> revokeForFulfillment(String storeId, String bizId, List<GaoStockChangeItem> items, String requestNo, String operatorUserId) {
@@ -445,7 +453,11 @@ public class GaoProductStockServiceImplement implements GaoProductStockService {
record.setOperatorUserId(operatorUserId);
record.setOccurredAt(TimiJava.defaultIfNull(occurredAt, Time.now()));
record.setRemark(remark);
recordService.createOperationRecord(record, attachmentList);
recordService.createOperationRecord(record,
operationType == GaoProductStockRecord.OperationType.ORDER_OUT ? null : attachmentList);
if (operationType == GaoProductStockRecord.OperationType.ORDER_OUT) {
copyAttachments(record.getId(), attachmentList);
}
stock.setOnHandQuantity(onHandAfter);
stock.setReservedQuantity(reservedAfter);
stock.setUpdatedBy(operatorUserId);
@@ -455,6 +467,23 @@ public class GaoProductStockServiceImplement implements GaoProductStockService {
return result;
}
/// 复制履约附件到出库流水
///
/// @param recordId 出库流水 ID
/// @param sourceAttachmentList 履约附件
private void copyAttachments(String recordId, List<Attachment> sourceAttachmentList) {
for (Attachment source : TimiJava.safeIterable(sourceAttachmentList)) {
if (source == null) {
continue;
}
TimiException.required(source.getId(), "履约附件 ID 不能为空");
Attachment copy = attachmentService.clone(source.getId());
copy.setBizType(Attachment.BizType.GAO_STOCK_RECORD);
copy.setBizId(recordId);
attachmentService.update(copy);
}
}
private GaoProductStock lockOrCreateStock(String storeId, String skuId) {
GaoProductStock stock = stockMapper.selectForUpdate(storeId, skuId);
if (stock != null) {
@@ -5,6 +5,8 @@ import com.imyeyu.java.bean.BasePage;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.List;
/// GAO 销售订单分页请求
///
/// @author Codex
@@ -25,15 +27,27 @@ public class GaoSalesOrderPage extends BasePage {
/// 订单类型
private GaoSalesOrder.OrderType orderType;
/// 订单类型列表
private List<GaoSalesOrder.OrderType> orderTypeList;
/// 订单状态
private GaoSalesOrder.Status status;
/// 订单状态列表
private List<GaoSalesOrder.Status> statusList;
/// 付款状态
private GaoSalesOrder.PaymentStatus paymentStatus;
/// 付款状态列表
private List<GaoSalesOrder.PaymentStatus> paymentStatusList;
/// 退款状态
private GaoSalesOrder.RefundStatus refundStatus;
/// 退款状态列表
private List<GaoSalesOrder.RefundStatus> refundStatusList;
/// true 为筛选可收款且未付清订单
private Boolean pendingReceive;
@@ -31,10 +31,42 @@
AND cp.`deleted_at` IS NULL
)
</if>
<if test="orderType != null">AND o.`order_type` = #{orderType}</if>
<if test="status != null">AND o.`status` = #{status}</if>
<if test="paymentStatus != null">AND o.`payment_status` = #{paymentStatus}</if>
<if test="refundStatus != null">AND o.`refund_status` = #{refundStatus}</if>
<choose>
<when test="orderTypeList != null and 0 &lt; orderTypeList.size()">
AND o.`order_type` IN
<foreach collection="orderTypeList" item="orderTypeItem" open="(" separator="," close=")">
#{orderTypeItem}
</foreach>
</when>
<when test="orderType != null">AND o.`order_type` = #{orderType}</when>
</choose>
<choose>
<when test="statusList != null and 0 &lt; statusList.size()">
AND o.`status` IN
<foreach collection="statusList" item="statusItem" open="(" separator="," close=")">
#{statusItem}
</foreach>
</when>
<when test="status != null">AND o.`status` = #{status}</when>
</choose>
<choose>
<when test="paymentStatusList != null and 0 &lt; paymentStatusList.size()">
AND o.`payment_status` IN
<foreach collection="paymentStatusList" item="paymentStatusItem" open="(" separator="," close=")">
#{paymentStatusItem}
</foreach>
</when>
<when test="paymentStatus != null">AND o.`payment_status` = #{paymentStatus}</when>
</choose>
<choose>
<when test="refundStatusList != null and 0 &lt; refundStatusList.size()">
AND o.`refund_status` IN
<foreach collection="refundStatusList" item="refundStatusItem" open="(" separator="," close=")">
#{refundStatusItem}
</foreach>
</when>
<when test="refundStatus != null">AND o.`refund_status` = #{refundStatus}</when>
</choose>
<if test="pendingReceive != null and pendingReceive">AND o.`status` IN ('ACTIVE', 'FULFILLED') AND o.`payment_status` IN ('UNPAID', 'PARTIALLY_PAID')</if>
<if test="fulfilledButUnpaid != null and fulfilledButUnpaid">AND o.`status` = 'FULFILLED' AND o.`paid_amount` &lt; o.`sale_amount`</if>
<if test="keyword != null and keyword.trim() != ''">AND (o.`order_no` LIKE CONCAT('%', #{keyword}, '%') OR c.`name` LIKE CONCAT('%', #{keyword}, '%') OR c.`code` LIKE CONCAT('%', #{keyword}, '%'))</if>