费用提交
This commit is contained in:
+14
@@ -0,0 +1,14 @@
|
||||
package com.baiyue.lastleg.procurement.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
/** 方向变更只读门禁,购买与收货事实仍归原履约模型。 */
|
||||
@Mapper
|
||||
public interface ProcurementDirectionMapper {
|
||||
/** 已发生的购买或起运仓事实禁止通过审核切换方向。 */
|
||||
@Select("SELECT EXISTS(SELECT 1 FROM ll_procurement_flow WHERE order_id=#{orderId} AND "
|
||||
+ "(purchased_at IS NOT NULL OR actual_warehouse_id IS NOT NULL OR overseas_shipped_at IS NOT NULL))")
|
||||
boolean hasStarted(@Param("orderId") long orderId);
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package com.baiyue.lastleg.procurement.repository;
|
||||
|
||||
import com.baiyue.lastleg.procurement.mapper.ProcurementDirectionMapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/** 采购方向审核的数据访问边界。 */
|
||||
@Repository
|
||||
@RequiredArgsConstructor
|
||||
public class ProcurementDirectionRepository {
|
||||
private final ProcurementDirectionMapper mapper;
|
||||
/** 在订单行锁内读取履约事实,避免改向重解释原始货物来源。 */
|
||||
public boolean hasStarted(long orderId) { return mapper.hasStarted(orderId); }
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
package com.baiyue.lastleg.procurement.service;
|
||||
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.web.server.ResponseStatusException;
|
||||
|
||||
/** 采购方向决定起运仓类型,历史两段编码分别代表起运段和目的地段。 */
|
||||
public final class ProcurementDirection {
|
||||
public static final String IMPORT = "OVERSEAS_TO_DOMESTIC";
|
||||
public static final String EXPORT = "DOMESTIC_TO_OVERSEAS";
|
||||
private ProcurementDirection() { }
|
||||
/** 旧订单缺少方向时保持原进口流程。 */
|
||||
public static String normalize(String value) {
|
||||
if (value == null) return IMPORT;
|
||||
if (!IMPORT.equals(value) && !EXPORT.equals(value)) throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "采购方向无效");
|
||||
return value;
|
||||
}
|
||||
/** 展示区域随方向切换,不改历史技术段编码和关联。 */
|
||||
public static String display(String text, String direction) {
|
||||
if (text == null || !EXPORT.equals(normalize(direction))) return text;
|
||||
return text.replace("海外", "__ORIGIN__").replace("国内", "海外").replace("__ORIGIN__", "国内");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user