修改退单sku

This commit is contained in:
牛叉闪闪 2024-08-02 15:48:56 +08:00
parent 7da9604c55
commit 6359f9b466
3 changed files with 33 additions and 4 deletions

View File

@ -48,6 +48,8 @@ public interface TbOrderInfoMapper {
List<SkuInfoPo> selectSkuByOrderId(String orderId);
List<SkuInfoPo> selectSkuByOrderIdAndType(String orderId);
TbOrderInfo selectById(Integer id);
}

View File

@ -909,11 +909,21 @@ public class OrderService {
orderInfo.setImgUrl("https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/20240223/a04e0d3beef74d099ebd0fd1f7c41873.jpg");
}
List<SkuInfoPo> skuInfoPos=tbOrderInfoMapper.selectSkuByOrderId(orderInfo.getId().toString());
if(Objects.isNull(skuInfoPos)||skuInfoPos.size()<0){
skuInfoPos=new ArrayList<>();
if(orderInfo.getOrderType().equals("return")){
List<SkuInfoPo> skuInfoPos=tbOrderInfoMapper.selectSkuByOrderIdAndType(orderInfo.getId().toString());
if(Objects.isNull(skuInfoPos)||skuInfoPos.size()<0){
skuInfoPos=new ArrayList<>();
}
orderInfo.setSkuInfos(skuInfoPos);
}else {
List<SkuInfoPo> skuInfoPos=tbOrderInfoMapper.selectSkuByOrderId(orderInfo.getId().toString());
if(Objects.isNull(skuInfoPos)||skuInfoPos.size()<0){
skuInfoPos=new ArrayList<>();
}
orderInfo.setSkuInfos(skuInfoPos);
}
orderInfo.setSkuInfos(skuInfoPos);
orderInfo.setZdNo("POS");
orderInfo.setNames(orderInfo.getProductName() == null ? new String[]{""} : orderInfo.getProductName().split(","));
}

View File

@ -610,5 +610,22 @@ select * from tb_order_info where trade_day = #{day} and table_id = #{masterId}
<select id="selectById" resultMap="BaseResultMap">
select * from tb_order_info where id=#{id} and status='closed'
</select>
<select id="selectSkuByOrderIdAndType" resultType="com.chaozhanggui.system.cashierservice.entity.po.SkuInfoPo">
SELECT
d.product_name AS productName,
d.num,
d.product_sku_name AS productSkuName,
'' AS categoryId,
d.price_amount as priceAmount,
d.pack_amount as packAmount
FROM
tb_order_detail d
where d.order_id=#{orderId}
</select>
</mapper>