Merge pull request 'v1.0.53' (#65) from dev into master

Reviewed-on: #65
This commit was merged in pull request #65.
This commit is contained in:
2026-09-21 17:32:02 +00:00
5 changed files with 40 additions and 3 deletions
+1 -1
View File
@@ -11,7 +11,7 @@
<groupId>com.imyeyu.timiserverapi</groupId> <groupId>com.imyeyu.timiserverapi</groupId>
<artifactId>TimiServerAPI</artifactId> <artifactId>TimiServerAPI</artifactId>
<version>1.0.52</version> <version>1.0.53</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>TimiServerAPI</name> <name>TimiServerAPI</name>
<description>imyeyu.com API</description> <description>imyeyu.com API</description>
@@ -184,6 +184,7 @@ public class AttachmentServiceImplement extends AbstractEntityService<Attachment
try (InputStream inputStream = getInputStreamByMongoId(source.getMongoId())) { try (InputStream inputStream = getInputStreamByMongoId(source.getMongoId())) {
target.setInputStream(inputStream); target.setInputStream(inputStream);
create(target); create(target);
target.setInputStream(null);
return target; return target;
} catch (IOException e) { } catch (IOException e) {
if (target.getMongoId() != null) { if (target.getMongoId() != null) {
@@ -1,5 +1,6 @@
package com.imyeyu.api.modules.gao.service; 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.GaoProductStock;
import com.imyeyu.api.modules.gao.entity.GaoProductStockRecord; import com.imyeyu.api.modules.gao.entity.GaoProductStockRecord;
import com.imyeyu.api.modules.gao.vo.GaoProductStockChangeRequest; 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<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); 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); applySkuSpecSnapshots(stockItems, fulfillmentItemList);
String verifierUserId = userLoginService.getRequireLoginUserId(); String verifierUserId = userLoginService.getRequireLoginUserId();
if (!stockItems.isEmpty()) { if (!stockItems.isEmpty()) {
List<Attachment> attachmentList = attachmentService.listByBizId(
Attachment.BizType.GAO_ORDER_FULFILLMENT, fulfillment.getId());
productStockService.outForFulfillment(order.getStoreId(), fulfillment.getId(), stockItems, 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, TimiException.requiredTrue(1 == mapper.updateStatus(fulfillment.getId(), GaoOrderFulfillment.Status.VERIFIED,
verifierUserId, Time.now(), request.getReason()), "履约状态已变化"); 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); 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 @Override
@Transactional(TimiServerDBConfig.ROLLBACKER) @Transactional(TimiServerDBConfig.ROLLBACKER)
public List<GaoProductStock> revokeForFulfillment(String storeId, String bizId, List<GaoStockChangeItem> items, String requestNo, String operatorUserId) { 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.setOperatorUserId(operatorUserId);
record.setOccurredAt(TimiJava.defaultIfNull(occurredAt, Time.now())); record.setOccurredAt(TimiJava.defaultIfNull(occurredAt, Time.now()));
record.setRemark(remark); 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.setOnHandQuantity(onHandAfter);
stock.setReservedQuantity(reservedAfter); stock.setReservedQuantity(reservedAfter);
stock.setUpdatedBy(operatorUserId); stock.setUpdatedBy(operatorUserId);
@@ -455,6 +467,23 @@ public class GaoProductStockServiceImplement implements GaoProductStockService {
return result; 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) { private GaoProductStock lockOrCreateStock(String storeId, String skuId) {
GaoProductStock stock = stockMapper.selectForUpdate(storeId, skuId); GaoProductStock stock = stockMapper.selectForUpdate(storeId, skuId);
if (stock != null) { if (stock != null) {