Commit cd582bdc by chenxi

5.8.6版本 采购、调拨全链路增加产品ID字段

1 parent 7f151276
Showing 30 changed files with 143 additions and 23 deletions
...@@ -267,6 +267,7 @@ public class PurchaseOrderDeliveryController { ...@@ -267,6 +267,7 @@ public class PurchaseOrderDeliveryController {
} }
} }
purchaseOrderShipmentGoodsExportVO.setUpgradeGoodsName(data.getUpgradeGoodsName()); purchaseOrderShipmentGoodsExportVO.setUpgradeGoodsName(data.getUpgradeGoodsName());
purchaseOrderShipmentGoodsExportVO.setUpgradeGoodsCommodityCode(data.getUpgradeGoodsCommodityCode());
purchaseOrderShipmentGoodsExportVO.setThirdPartyCode(data.getThirdPartyCode()); purchaseOrderShipmentGoodsExportVO.setThirdPartyCode(data.getThirdPartyCode());
purchaseOrderShipmentGoodsExportVO.setThirdPartyName(data.getThirdPartyName()); purchaseOrderShipmentGoodsExportVO.setThirdPartyName(data.getThirdPartyName());
purchaseOrderShipmentGoodsExportVO.setPurchaseGoodsName(data.getPurchaseGoodsName()); purchaseOrderShipmentGoodsExportVO.setPurchaseGoodsName(data.getPurchaseGoodsName());
......
...@@ -66,6 +66,7 @@ public class PurchaseOrderDeliveryDetailController { ...@@ -66,6 +66,7 @@ public class PurchaseOrderDeliveryDetailController {
if (CollectionUtils.isNotEmpty(pagination.getList())) { if (CollectionUtils.isNotEmpty(pagination.getList())) {
resp.setList(pagination.getList().parallelStream().map(o->{ resp.setList(pagination.getList().parallelStream().map(o->{
PurchaseOrderDeliveryDetailPageResponse item = PurchaseOrderDeliveryDetailDTOConvert.INSTANCE.toPurchaseOrderDeliveryDetailPageResponse(o); PurchaseOrderDeliveryDetailPageResponse item = PurchaseOrderDeliveryDetailDTOConvert.INSTANCE.toPurchaseOrderDeliveryDetailPageResponse(o);
item.setUpgradeCommodityCode(o.getUpgradeCommodityCode());
//用户只能操作自己下单的采购订单 //用户只能操作自己下单的采购订单
if (Objects.equals(o.getMerchantId(), loginMerchantId)) { if (Objects.equals(o.getMerchantId(), loginMerchantId)) {
item.setOperatorStatus(1); item.setOperatorStatus(1);
......
...@@ -62,4 +62,10 @@ public class GoodsWarehousingInfoPageRequest extends AbstractRopRequest { ...@@ -62,4 +62,10 @@ public class GoodsWarehousingInfoPageRequest extends AbstractRopRequest {
@ApiModelProperty(notes="膜卷号", dataType="string") @ApiModelProperty(notes="膜卷号", dataType="string")
private String filmRollNo; private String filmRollNo;
/**
* 产品ID(升级商品编码),模糊匹配采购订单商品
*/
@ApiModelProperty(notes = "产品ID(升级商品编码),模糊匹配采购订单商品")
private String commodityCode;
} }
...@@ -58,4 +58,7 @@ public class MerchantGoodsStockReduceRecordSearchRequest extends AbstractRopRequ ...@@ -58,4 +58,7 @@ public class MerchantGoodsStockReduceRecordSearchRequest extends AbstractRopRequ
@ApiModelProperty(notes="库存类型(1-虚拟 2:实物)") @ApiModelProperty(notes="库存类型(1-虚拟 2:实物)")
private Byte inventoryType; private Byte inventoryType;
@ApiModelProperty(notes = "产品ID")
private String commodityCode;
} }
...@@ -90,4 +90,10 @@ public class StockFlowPageRequest extends AbstractRopRequest { ...@@ -90,4 +90,10 @@ public class StockFlowPageRequest extends AbstractRopRequest {
@ApiModelProperty(notes = "下单门店-查询条件") @ApiModelProperty(notes = "下单门店-查询条件")
private String orderMerchantName; private String orderMerchantName;
/**
* 产品ID(升级商品编码),模糊匹配采购订单商品
*/
@ApiModelProperty(notes = "产品ID(升级商品编码),模糊匹配采购订单商品")
private String commodityCode;
} }
...@@ -73,4 +73,9 @@ public class BusinessReviewRequest extends AbstractRopRequest { ...@@ -73,4 +73,9 @@ public class BusinessReviewRequest extends AbstractRopRequest {
*/ */
private List<PurchaseOrderAuditGoodsDTO> purchaseOrderAuditGoods; private List<PurchaseOrderAuditGoodsDTO> purchaseOrderAuditGoods;
/**
* 产品ID(升级商品编码),模糊匹配采购订单商品
*/
@ApiModelProperty(notes = "产品ID(升级商品编码),模糊匹配采购订单商品")
private String commodityCode;
} }
...@@ -49,4 +49,10 @@ public class DirectorReviewRequest extends AbstractRopRequest { ...@@ -49,4 +49,10 @@ public class DirectorReviewRequest extends AbstractRopRequest {
@ApiModelProperty(notes = "操作人") @ApiModelProperty(notes = "操作人")
private String operatorName; private String operatorName;
/**
* 产品ID(升级商品编码),模糊匹配采购订单商品
*/
@ApiModelProperty(notes = "产品ID(升级商品编码),模糊匹配采购订单商品")
private String commodityCode;
} }
...@@ -73,4 +73,11 @@ public class ManagerReviewRequest extends AbstractRopRequest { ...@@ -73,4 +73,11 @@ public class ManagerReviewRequest extends AbstractRopRequest {
@ApiModelProperty(notes = "操作人") @ApiModelProperty(notes = "操作人")
private String operatorName; private String operatorName;
/**
* 产品ID(升级商品编码),模糊匹配采购订单商品
*/
@ApiModelProperty(notes = "产品ID(升级商品编码),模糊匹配采购订单商品")
private String commodityCode;
} }
...@@ -126,4 +126,10 @@ public class PurchaseOrderDeliveryDetailPageRequest extends AbstractRopRequest { ...@@ -126,4 +126,10 @@ public class PurchaseOrderDeliveryDetailPageRequest extends AbstractRopRequest {
@ApiModelProperty(notes="入库状态") @ApiModelProperty(notes="入库状态")
private String putStatusStr; private String putStatusStr;
/**
* 产品ID(升级商品编码),模糊匹配采购订单商品
*/
@ApiModelProperty(notes = "产品ID(升级商品编码),模糊匹配采购订单商品")
private String upgradeCommodityCode;
} }
...@@ -83,4 +83,10 @@ public class PurchaseOrderShippingListRequest extends AbstractRopRequest { ...@@ -83,4 +83,10 @@ public class PurchaseOrderShippingListRequest extends AbstractRopRequest {
@ApiModelProperty(notes="签收状态") @ApiModelProperty(notes="签收状态")
private String signStatusStr; private String signStatusStr;
/**
* 产品ID(升级商品编码),模糊匹配采购订单商品
*/
@ApiModelProperty(notes = "产品ID(升级商品编码),模糊匹配采购订单商品")
private String commodityCode;
} }
...@@ -60,4 +60,10 @@ public class WarehouseDeliveryRequest extends AbstractRopRequest { ...@@ -60,4 +60,10 @@ public class WarehouseDeliveryRequest extends AbstractRopRequest {
@ApiModelProperty(notes = "供应商编码,模糊搜索") @ApiModelProperty(notes = "供应商编码,模糊搜索")
private String thirdPartyCode; private String thirdPartyCode;
/**
* 产品ID(升级商品编码),模糊匹配采购订单商品
*/
@ApiModelProperty(notes = "产品ID(升级商品编码),模糊匹配采购订单商品")
private String commodityCode;
} }
...@@ -70,4 +70,10 @@ public class StockAllocateDeliveryPageRequest extends AbstractRopRequest { ...@@ -70,4 +70,10 @@ public class StockAllocateDeliveryPageRequest extends AbstractRopRequest {
*/ */
@ApiModelProperty(notes = "关联采购订单编号") @ApiModelProperty(notes = "关联采购订单编号")
private String purchaseOrderCode; private String purchaseOrderCode;
/**
* 产品ID(升级商品编码),模糊匹配采购订单商品
*/
@ApiModelProperty(notes = "产品ID(升级商品编码),模糊匹配采购订单商品")
private String commodityCode;
} }
...@@ -56,4 +56,10 @@ public class StockAllocatePageRequest extends AbstractRopRequest { ...@@ -56,4 +56,10 @@ public class StockAllocatePageRequest extends AbstractRopRequest {
*/ */
@ApiModelProperty(notes = "关联采购订单编号") @ApiModelProperty(notes = "关联采购订单编号")
private String purchaseOrderCode; private String purchaseOrderCode;
/**
* 产品ID(升级商品编码),模糊匹配采购订单商品
*/
@ApiModelProperty(notes = "产品ID(升级商品编码),模糊匹配采购订单商品")
private String commodityCode;
} }
...@@ -34,4 +34,10 @@ public class StockAllocateReviewPageRequest extends AbstractRopRequest { ...@@ -34,4 +34,10 @@ public class StockAllocateReviewPageRequest extends AbstractRopRequest {
@NotNull @NotNull
@ApiModelProperty(notes = "查询类型(1.运营审核查询,2:商务审核查询)") @ApiModelProperty(notes = "查询类型(1.运营审核查询,2:商务审核查询)")
private Byte queryType; private Byte queryType;
/**
* 产品ID(升级商品编码),模糊匹配采购订单商品
*/
@ApiModelProperty(notes = "产品ID(升级商品编码),模糊匹配采购订单商品")
private String commodityCode;
} }
...@@ -22,6 +22,9 @@ public class MerchantGoodsStockReduceRecordPageResponse implements Serializable ...@@ -22,6 +22,9 @@ public class MerchantGoodsStockReduceRecordPageResponse implements Serializable
@ApiModelProperty(notes="商品名称") @ApiModelProperty(notes="商品名称")
private String upgradeGoodsName; private String upgradeGoodsName;
@ApiModelProperty(notes="产品ID")
private String commodityCode;
@ApiModelProperty(notes="系列") @ApiModelProperty(notes="系列")
private String goodsSeries; private String goodsSeries;
......
...@@ -25,6 +25,12 @@ public class StockFlowPageResponse { ...@@ -25,6 +25,12 @@ public class StockFlowPageResponse {
private String upgradeGoodsName; private String upgradeGoodsName;
/** /**
* 产品ID
*/
@ApiModelProperty(notes = "产品ID")
private String commodityCode;
/**
* 商品编码 * 商品编码
*/ */
@ApiModelProperty(notes = "商品编码", example = "P20260129001") @ApiModelProperty(notes = "商品编码", example = "P20260129001")
......
...@@ -173,4 +173,10 @@ public class PurchaseOrderDeliveryDetailPageResponse implements Serializable { ...@@ -173,4 +173,10 @@ public class PurchaseOrderDeliveryDetailPageResponse implements Serializable {
@ApiModelProperty(notes="是否支持扫码入库") @ApiModelProperty(notes="是否支持扫码入库")
private Boolean canScanEnable; private Boolean canScanEnable;
/**
* 产品ID(升级商品编码),模糊匹配采购订单商品
*/
@ApiModelProperty(notes = "产品ID(升级商品编码),模糊匹配采购订单商品")
private String upgradeCommodityCode;
} }
...@@ -164,4 +164,7 @@ public class PurchaseOrderDeliveryDetailResponse implements Serializable { ...@@ -164,4 +164,7 @@ public class PurchaseOrderDeliveryDetailResponse implements Serializable {
@ApiModelProperty(notes = "膜卷号(来自调拨商品详情中)") @ApiModelProperty(notes = "膜卷号(来自调拨商品详情中)")
private String filmRollNo; private String filmRollNo;
@ApiModelProperty(notes = "产品ID")
private String upgradeCommodityCode;
} }
...@@ -148,4 +148,7 @@ public class PurchaseOrderShippingPageResponse implements Serializable { ...@@ -148,4 +148,7 @@ public class PurchaseOrderShippingPageResponse implements Serializable {
@ApiModelProperty(notes = "发货单凭证") @ApiModelProperty(notes = "发货单凭证")
private String uploadFileUrls; private String uploadFileUrls;
@ApiModelProperty(notes = "产品ID")
private String upgradeGoodsCommodityCode;
} }
...@@ -116,5 +116,6 @@ public class WarehouseDeliveryPageResponse implements Serializable { ...@@ -116,5 +116,6 @@ public class WarehouseDeliveryPageResponse implements Serializable {
@ApiModelProperty(notes = "素材换算数值", example = "11") @ApiModelProperty(notes = "素材换算数值", example = "11")
private BigDecimal conversionValue; private BigDecimal conversionValue;
@ApiModelProperty(notes = "产品ID")
private String upgradeGoodsCommodityCode;
} }
...@@ -54,4 +54,7 @@ public class StockAllocateDetailResponse implements Serializable { ...@@ -54,4 +54,7 @@ public class StockAllocateDetailResponse implements Serializable {
@ApiModelProperty(notes = "已发货数量") @ApiModelProperty(notes = "已发货数量")
private BigDecimal deliveryNumber; private BigDecimal deliveryNumber;
@ApiModelProperty(notes = "产品ID")
private String upgradeGoodsCommodityCode;
} }
...@@ -11,6 +11,11 @@ public class GoodsStockAllocateDetailExportVo implements Serializable{ ...@@ -11,6 +11,11 @@ public class GoodsStockAllocateDetailExportVo implements Serializable{
private static final long serialVersionUID = -3802676918903131403L; private static final long serialVersionUID = -3802676918903131403L;
/** 商品名称**/ /** 商品名称**/
private String goodsName; private String goodsName;
/**
* 产品ID
*/
private String commodityCode;
/** 规格**/ /** 规格**/
private String specificationData; private String specificationData;
/** 系列**/ /** 系列**/
......
...@@ -28,6 +28,9 @@ public class GoodsWarehousingInfoExportVo implements Serializable { ...@@ -28,6 +28,9 @@ public class GoodsWarehousingInfoExportVo implements Serializable {
@ExcelProperty(value = "产品名称") @ExcelProperty(value = "产品名称")
private String upgradeGoodsName; private String upgradeGoodsName;
@ExcelProperty(value = "产品ID")
private String commodityCode;
@ExcelProperty(value = "规格") @ExcelProperty(value = "规格")
private String specificationData; private String specificationData;
......
...@@ -26,6 +26,9 @@ public class MerchantGoodsStockReduceRecordExportVO implements Serializable { ...@@ -26,6 +26,9 @@ public class MerchantGoodsStockReduceRecordExportVO implements Serializable {
@ExcelProperty(value="产品名称") @ExcelProperty(value="产品名称")
private String upgradeGoodsName; private String upgradeGoodsName;
@ExcelProperty(value="产品ID")
private String commodityCode;
@ExcelProperty(value="规格") @ExcelProperty(value="规格")
private String specificationData; private String specificationData;
......
...@@ -70,7 +70,14 @@ public class PurchaseOrderShipmentGoodsExportVO implements Serializable { ...@@ -70,7 +70,14 @@ public class PurchaseOrderShipmentGoodsExportVO implements Serializable {
@ExcelProperty(value = "产品名称") @ExcelProperty(value = "产品名称")
private String upgradeGoodsName; private String upgradeGoodsName;
/**
* 产品Id(升级商品编码)
*/
@ExcelMergeRow(columIndex = 11) @ExcelMergeRow(columIndex = 11)
@ExcelProperty(value = "产品Id")
private String upgradeGoodsCommodityCode;
@ExcelMergeRow(columIndex = 12)
@ExcelProperty(value = "供应商名称") @ExcelProperty(value = "供应商名称")
private String thirdPartyName; private String thirdPartyName;
...@@ -82,107 +89,107 @@ public class PurchaseOrderShipmentGoodsExportVO implements Serializable { ...@@ -82,107 +89,107 @@ public class PurchaseOrderShipmentGoodsExportVO implements Serializable {
/** /**
* 商品采购数量 卷/件 * 商品采购数量 卷/件
*/ */
@ExcelMergeRow(columIndex = 12) @ExcelMergeRow(columIndex = 13)
@ExcelProperty(value = "审核数量") @ExcelProperty(value = "审核数量")
private String goodsNumber; private String goodsNumber;
/** /**
* 库存总量 米/件 * 库存总量 米/件
*/ */
@ExcelMergeRow(columIndex = 13) @ExcelMergeRow(columIndex = 14)
@ExcelProperty(value = "库存总量") @ExcelProperty(value = "库存总量")
private String stockNum; private String stockNum;
/** /**
* 已发货数量 卷/件 * 已发货数量 卷/件
*/ */
@ExcelMergeRow(columIndex = 14) @ExcelMergeRow(columIndex = 15)
@ExcelProperty(value = "发货数量") @ExcelProperty(value = "发货数量")
private String shippedNumber; private String shippedNumber;
/** /**
* 欠货数量 卷/件 = 发货数量 - 审核数量 * 欠货数量 卷/件 = 发货数量 - 审核数量
*/ */
@ExcelMergeRow(columIndex = 15) @ExcelMergeRow(columIndex = 16)
@ExcelProperty(value = "欠货数量") @ExcelProperty(value = "欠货数量")
private String toBeShippedNumber; private String toBeShippedNumber;
@ExcelMergeRow(columIndex = 16) @ExcelMergeRow(columIndex = 17)
@ExcelProperty(value = "下单时间") @ExcelProperty(value = "下单时间")
@DateTimeFormat(value="yyyy-MM-dd HH:mm:ss") @DateTimeFormat(value="yyyy-MM-dd HH:mm:ss")
private Date orderTime; private Date orderTime;
@ExcelMergeRow(columIndex = 17) @ExcelMergeRow(columIndex = 18)
@ExcelValueReplace(replace={"待签收_0","部分签收_1","全部签收_2"}) @ExcelValueReplace(replace={"待签收_0","部分签收_1","全部签收_2"})
@ExcelProperty(value = "签收状态",converter= ReplaceIntegerToStringConvert.class) @ExcelProperty(value = "签收状态",converter= ReplaceIntegerToStringConvert.class)
private Integer signStatus; private Integer signStatus;
@ExcelMergeRow(columIndex = 18) @ExcelMergeRow(columIndex = 19)
@ExcelValueReplace(replace={"未发货_1","全部发货_2","部分发货_3","结束发货_4"}) @ExcelValueReplace(replace={"未发货_1","全部发货_2","部分发货_3","结束发货_4"})
@ExcelProperty(value = "发货状态",converter= ReplaceByteToStringConvert.class) @ExcelProperty(value = "发货状态",converter= ReplaceByteToStringConvert.class)
private Byte deliveryStatus; private Byte deliveryStatus;
@ExcelMergeRow(columIndex = 19) @ExcelMergeRow(columIndex = 20)
@ExcelValueReplace(replace={"已审核_5"}) @ExcelValueReplace(replace={"已审核_5"})
@ExcelProperty(value = "订单状态",converter= ReplaceByteToStringConvert.class) @ExcelProperty(value = "订单状态",converter= ReplaceByteToStringConvert.class)
private Byte purchaseOrderStatus = 5; private Byte purchaseOrderStatus = 5;
@ExcelMergeRow(columIndex = 20) @ExcelMergeRow(columIndex = 21)
@ExcelProperty(value = "备注") @ExcelProperty(value = "备注")
private String purchaseOrderRemark; private String purchaseOrderRemark;
@ExcelMergeRow(columIndex = 21) @ExcelMergeRow(columIndex = 22)
@ExcelProperty(value = "运营审核人") @ExcelProperty(value = "运营审核人")
private String operatorReviewedBy; private String operatorReviewedBy;
@ExcelMergeRow(columIndex = 22) @ExcelMergeRow(columIndex = 23)
@ExcelProperty(value = "运营审核时间") @ExcelProperty(value = "运营审核时间")
@DateTimeFormat(value="yyyy-MM-dd HH:mm:ss") @DateTimeFormat(value="yyyy-MM-dd HH:mm:ss")
private Date operatorReviewedDate; private Date operatorReviewedDate;
@ExcelMergeRow(columIndex = 23) @ExcelMergeRow(columIndex = 24)
@ExcelProperty(value = "运营审核备注") @ExcelProperty(value = "运营审核备注")
private String operatorReviewRemark; private String operatorReviewRemark;
@ExcelMergeRow(columIndex = 24) @ExcelMergeRow(columIndex = 25)
@ExcelProperty(value = "商务审核人") @ExcelProperty(value = "商务审核人")
private String businessReviewedBy; private String businessReviewedBy;
@ExcelMergeRow(columIndex = 25) @ExcelMergeRow(columIndex = 26)
@ExcelProperty(value = "商务审核时间") @ExcelProperty(value = "商务审核时间")
@DateTimeFormat(value="yyyy-MM-dd HH:mm:ss") @DateTimeFormat(value="yyyy-MM-dd HH:mm:ss")
private Date businessReviewedDate; private Date businessReviewedDate;
@ExcelMergeRow(columIndex = 26) @ExcelMergeRow(columIndex = 27)
@ExcelProperty(value = "商务审核备注") @ExcelProperty(value = "商务审核备注")
private String businessReviewRemark; private String businessReviewRemark;
@ExcelMergeRow(columIndex = 27) @ExcelMergeRow(columIndex = 28)
@ExcelProperty(value = "收货人") @ExcelProperty(value = "收货人")
private String contactName; private String contactName;
@ExcelMergeRow(columIndex = 28) @ExcelMergeRow(columIndex = 29)
@ExcelProperty(value = "收货人电话") @ExcelProperty(value = "收货人电话")
private String contactPhone; private String contactPhone;
@ExcelMergeRow(columIndex = 29) @ExcelMergeRow(columIndex = 30)
@ExcelProperty(value = "收货人地址") @ExcelProperty(value = "收货人地址")
private String contactAddress; private String contactAddress;
@ExcelMergeRow(columIndex = 30) @ExcelMergeRow(columIndex = 31)
@ExcelProperty(value = "凭证") @ExcelProperty(value = "凭证")
private String uploadFileUrls; private String uploadFileUrls;
@ExcelMergeRow(columIndex = 36) @ExcelMergeRow(columIndex = 37)
@ExcelProperty(value = "采购总价") @ExcelProperty(value = "采购总价")
private BigDecimal goodsTotalPrice; private BigDecimal goodsTotalPrice;
@ExcelMergeRow(columIndex = 37) @ExcelMergeRow(columIndex = 38)
@ExcelProperty(value = "备注") @ExcelProperty(value = "备注")
private String remark; private String remark;
@ExcelMergeRow(columIndex = 38) @ExcelMergeRow(columIndex = 39)
@ExcelProperty(value = "订单总价") @ExcelProperty(value = "订单总价")
private BigDecimal totalPrice; private BigDecimal totalPrice;
......
...@@ -33,6 +33,12 @@ public class StockFlowPageExportVO { ...@@ -33,6 +33,12 @@ public class StockFlowPageExportVO {
private String upgradeGoodsName; private String upgradeGoodsName;
/** /**
* 商品名称
*/
@ExcelProperty(value = "产品ID")
private String commodityCode;
/**
* 商品编码 * 商品编码
*/ */
@ExcelProperty(value = "产品编码") @ExcelProperty(value = "产品编码")
......
  • @wangxw1
    commented
    Master

    一、关键问题与优化建议(Top 3)

    1. 字段命名严重不一致(功能健壮性与可维护性)

    • 问题描述:本次提交的核心是“全链路增加产品ID字段”,但在不同层的类中,该字段的命名出现了三种不同的变体:
      • commodityCode(出现在 GoodsWarehousingInfoPageRequest 等大部分 Request 和部分 Response/VO 中)
      • upgradeCommodityCode(出现在 PurchaseOrderDeliveryDetailPageRequest、PurchaseOrderDeliveryDetailResponse 等中)
      • upgradeGoodsCommodityCode(出现在 PurchaseOrderShippingPageResponse、PurchaseOrderShipmentGoodsExportVO 等中)
    • 潜在风险:同一业务概念在全链路中命名不统一,不仅会让前端对接产生极大的困扰,还会导致在使用 BeanUtils 或 MapStruct 等对象映射工具时出现属性丢失(无法自动映射)的 Bug。
    • 优化建议:强烈建议在整个链路(Request -> Controller -> Service -> DTO -> Response/VO)中统一该字段的命名(例如统一使用 commodityCode 或 upgradeCommodityCode),确保契约一致性。

    2. parallelStream() 的滥用(性能与资源利用)

    • 问题描述:在 PurchaseOrderDeliveryDetailController.java 的第 68 行,对分页列表进行 DTO 转换时使用了 parallelStream(): pagination.getList().parallelStream().map(...)
    • 潜在风险:
      1. 性能负优化:分页列表(通常为 10-100 条)数据量极小,使用并行流会导致频繁的线程上下文切换,其开销远大于并行带来的收益,反而会降低性能。
      2. 线程安全与上下文丢失:在 Web 请求中使用并行流(默认使用公共的 ForkJoinPool),可能会导致 Request Context、Security Context(如当前登录用户信息)在子线程中丢失,引发不可预期的异常。
    • 优化建议:将 parallelStream() 替换为普通的 stream() 即可。

    3. Excel 导出类的硬编码索引及维护风险(最佳实践与可维护性)

    • 问题描述:在 PurchaseOrderShipmentGoodsExportVO.java 中,为了插入新的“产品Id”字段,开发者手动将后续所有字段的 @ExcelMergeRow(columIndex = XX) 注解的值全部递增了 1(从 11 改到 12,以此类推直到 39)。
    • 潜在风险:这种依赖绝对数值硬编码的实现方式极度脆弱(代码坏味道)。未来任何一次增删字段的操作,都需要开发者手动重新计算并修改几十个数字,极易因为粗心导致列错位或合并单元格错乱。同时,新增的查询入参(如模糊查询)均未添加 @Length 或 @Pattern 等参数校验注解,存在被输入超长字符耗尽数据库性能的风险。
    • 优化建议:
      1. 建议评估所使用的 Excel 导出组件(如 EasyExcel),尽量使用基于字段顺序的相对位置映射,而非绝对的 index 硬编码。若必须使用现有自定义注解,建议增加单元测试以校验列索引的连续性。
      2. 为 Request 中的 commodityCode 增加基础的参数校验(如 @Size(max = 64))。

    二、评分明细

    评审项 满分 得分 扣分说明
    1. 功能正确性与健壮性 40 35 核心业务逻辑正确,但字段命名不一致极易引发对象拷贝时的属性丢失。
    2. 安全性与潜在风险 30 28 无明显安全漏洞,但新增的查询参数缺乏基础的长度和合法性校验。
    3. 最佳实践与可维护性 20 12 命名规范未对齐(违背阿里规约);Excel 列索引硬编码修改方式维护成本极高。
    4. 性能与资源利用 5 3 分页场景下滥用 parallelStream(),存在性能下降和线程池资源抢占风险。
    5. 提交信息质量 5 5 Commit 信息清晰,准确概括了修改内容(版本号、业务域、修改点)。

    总分:83分

Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!