lubo 3 months ago
parent
commit
607e128f98

+ 4 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/shop/order/ShopOrderController.java

@@ -571,6 +571,10 @@ public class ShopOrderController extends BaseController {
         bo.setEffective(true);
         bo.setCancellationMethod((CancellationMethod.UNCANCELED));
         List<ShopOrderWaitShipVo> list = iShopOrderService.businessWaitExport(bo);
+        list.forEach(vo -> {
+            vo.loadAllAddress();
+            vo.loadDescription();
+        });
         ExcelUtil.exportExcel(list, "待发货列表", ShopOrderWaitShipVo.class, response);
     }
 

+ 23 - 12
ruoyi-shop/src/main/java/com/ruoyi/shop/order/domain/vo/ShopOrderWaitShipVo.java

@@ -44,12 +44,18 @@ import java.util.List;
  */
 @Data
 @ApiModel("代发货视图对象")
-@ExcelTarget("ShopOrderVo")
+@ExcelTarget("ShopOrderWaitShipVo")
 @ExcelIgnoreUnannotated
 public class ShopOrderWaitShipVo implements Serializable {
 
     private static final long serialVersionUID = 1L;
 
+    /**
+     * 订单ID
+     */
+    @ApiModelProperty("订单ID")
+    private Long orderId;
+
     /**
      * 订单号
      */
@@ -243,13 +249,6 @@ public class ShopOrderWaitShipVo implements Serializable {
     @ExcelProperty(value = "收货地址")
     private String allAddress;
 
-    /**
-     * 物流公司代号
-     */
-    @ApiModelProperty(value = "物流公司编号", required = true)
-    @ExcelProperty(value = "物流公司编号")
-    private String expressCode;
-
     /**
      * 物流公司名称
      */
@@ -265,24 +264,36 @@ public class ShopOrderWaitShipVo implements Serializable {
     private String logisticCode;
 
 
+    @ApiModelProperty("订单地址")
+    private ShopOrderAddressVo orderAddress;
+
+
     /**
      * 加载收货地址
      */
-    public String loadAllAddress() {
-        return this.allAddress = provinceName + cityName + areaName + addressDetail;
+    public void loadAllAddress() {
+        this.allAddress = "";
+        if (this.getOrderAddress() != null) {
+           this.receiverName = this.getOrderAddress().getReceiverName();
+           this.receiverPhone = this.getOrderAddress().getReceiverPhone();
+           this.addressDetail = this.getOrderAddress().getAddressDetail();
+           this.provinceName = this.getOrderAddress().getProvinceName();
+           this.cityName = this.getOrderAddress().getCityName();
+           this.areaName = this.getOrderAddress().getAreaName();
+           this.allAddress = provinceName + cityName + areaName + addressDetail;
+        }
     }
 
     /**
      * 获取订单描述
      * @return
      */
-    public String loadDescription() {
+    public void loadDescription() {
         StringBuilder description = new StringBuilder();
         for (ShopOrderDetailVo shopOrderDetail : this.orderDetails) {
             description.append(String.format("%s %s * %d \\n",shopOrderDetail.getProductShortTitle(),shopOrderDetail.getSkuSetName(), shopOrderDetail.getProductNum()));
         }
         productDetails = description.toString();
-        return this.productDetails;
     }
 
 

+ 3 - 0
ruoyi-shop/src/main/java/com/ruoyi/shop/order/mapper/ShopOrderMapper.java

@@ -7,6 +7,7 @@ import com.ruoyi.shop.order.domain.bo.ShopOrderBo;
 import com.ruoyi.shop.order.domain.vo.ShopOrderTransactionStatusCountVo;
 import com.ruoyi.shop.order.domain.vo.ShopOrderVo;
 import com.ruoyi.common.core.mapper.BaseMapperPlus;
+import com.ruoyi.shop.order.domain.vo.ShopOrderWaitShipVo;
 import org.apache.ibatis.annotations.Param;
 
 import java.math.BigDecimal;
@@ -37,4 +38,6 @@ public interface ShopOrderMapper extends BaseMapperPlus<ShopOrderMapper, ShopOrd
     BigDecimal countOrderSale(@Param("bo") BusinessCountBo bo);
 
     List<ShopOrderTransactionStatusCountVo> countByBusiness(@Param("businessId") Long businessId);
+
+    List<ShopOrderWaitShipVo> businessWaitExport(@Param("bo") ShopOrderBo bo);
 }

+ 1 - 1
ruoyi-shop/src/main/java/com/ruoyi/shop/order/service/impl/ShopOrderServiceImpl.java

@@ -596,7 +596,7 @@ public class ShopOrderServiceImpl implements IShopOrderService {
 
     @Override
     public List<ShopOrderWaitShipVo> businessWaitExport(ShopOrderBo bo) {
-        return Collections.emptyList();
+        return this.baseMapper.businessWaitExport(bo);
     }
 
     @Override

+ 5 - 0
ruoyi-shop/src/main/java/com/ruoyi/shop/product/domain/Product.java

@@ -80,11 +80,13 @@ public class Product extends BaseEntity {
     /**
      * 供应商ID
      */
+    @TableField(updateStrategy = FieldStrategy.IGNORED)
     private Long supplierId;
 
     /**
      * 供应商名称
      */
+    @TableField(updateStrategy = FieldStrategy.IGNORED)
     private String supplierName;
 
     /**
@@ -103,6 +105,7 @@ public class Product extends BaseEntity {
      * 视频地址
      */
     @FilePathValue
+    @TableField(updateStrategy = FieldStrategy.IGNORED )
     private String videoUrl;
 
 //======================支付相关============================================
@@ -176,11 +179,13 @@ public class Product extends BaseEntity {
     /**
      * 物流模板ID
      */
+    @TableField(updateStrategy = FieldStrategy.IGNORED )
     private Long logisticsTemplateId;
 
     /**
      * 运费模板名称
      */
+    @TableField(updateStrategy = FieldStrategy.IGNORED )
     private String freightTemplateName;
 
 

+ 8 - 0
ruoyi-shop/src/main/java/com/ruoyi/shop/product/service/impl/ProductServiceImpl.java

@@ -271,11 +271,19 @@ public class ProductServiceImpl implements IProductService {
             Supplier supplier = supplierService.loadById(bo.getSupplierId(), true);
             bo.setSupplierName(supplier.getSupplierName());
         }
+        else
+        {
+            bo.setSupplierName(null);
+        }
 
         if (ObjectUtil.isNotNull(bo.getLogisticsTemplateId())) {
             FreightTemplate freightTemplate = freightTemplateService.loadById(bo.getLogisticsTemplateId(), true);
             bo.setFreightTemplateName(freightTemplate.getName());
         }
+        else
+        {
+            bo.setFreightTemplateName(null);
+        }
         Business business = businessService.loadById(bo.getBusinessId(), true);
         bo.setBusinessName(business.getBusinessName());
 

+ 59 - 3
ruoyi-shop/src/main/resources/mapper/order/ShopOrderMapper.xml

@@ -84,6 +84,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </collection>
     </resultMap>
 
+    <resultMap type="com.ruoyi.shop.order.domain.vo.ShopOrderWaitShipVo" id="exportShopOrderWaitShipResult" autoMapping="true">
+        <id property="orderId" column="order_id"/>
+        <association property="orderAddress" columnPrefix="oa_" autoMapping="true"
+                     javaType="com.ruoyi.shop.order.domain.vo.ShopOrderAddressVo">
+            <id property="orderAddressId" column="order_address_id"/>
+        </association>
+        <collection property="orderDetails" columnPrefix="od_" autoMapping="true" ofType="com.ruoyi.shop.order.domain.vo.ShopOrderDetailVo"
+                    javaType="java.util.List">
+            <id property="orderDetailId" column="order_detail_id"/>
+            <result property="skuSetValue" column="sku_set_value" typeHandler="com.ruoyi.shop.typehandler.ListToSkuItemTypeHandler"/>
+        </collection>
+    </resultMap>
+
     <resultMap type="com.ruoyi.shop.order.domain.vo.ShopOrderVo" id="shopOrderVoResult" autoMapping="true">
         <id property="orderId" column="order_id"/>
         <association property="orderAddress" columnPrefix="oa_" autoMapping="true"
@@ -246,7 +259,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             and o.user_mobile  like concat('%',#{bo.userMobile},'%')
         </if>
         <if test="bo.orderType != null">
-            and o.order_type = #{bo.orderType}
+            and o.order_type = #{bo.orderType.code}
         </if>
         <if test="bo.transactionStatus != null">
             and o.transaction_status = #{bo.transactionStatus.code}
@@ -255,7 +268,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             and o.order_no like concat('%',#{bo.orderNo},'%')
         </if>
         <if test="bo.marketingType!=null">
-            AND o.marketing_type = #{bo.marketingType}
+            AND o.marketing_type = #{bo.marketingType.code}
         </if>
         <if test="bo.transactionId!=null and bo.transactionId!=''">
             AND o.transaction_id like CONCAT('%',#{bo.transactionId},'%')
@@ -309,7 +322,48 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </where>
         order by o.create_time desc
     </select>
-
+    <select id="businessWaitExport" resultMap="exportShopOrderWaitShipResult">
+        select o.*,
+        <include refid="orderDetailcolumn"/>,
+        <include refid="shopOrderAddressColumn"/>
+        from tb_shop_order as o
+        left join tb_shop_order_detail as od on od.order_id = o.order_id
+        left join tb_shop_order_address as oa on oa.order_id = o.order_id
+        <where>
+            and o.business_id = #{bo.businessId}
+            and o.transaction_status = #{bo.transactionStatus.code}
+            and o.order_type = #{bo.orderType}
+            and o.shipping_status = #{bo.transactionStatus.code}
+            and o.effective = 1
+            and o.cancellation_method = 0
+            AND o.shipping_method = 0
+            <if test="bo.exchange != null">
+                and o.exchange = #{bo.exchange}
+            </if>
+            <if test="bo.userMobile != null">
+                and o.user_mobile  like concat('%',#{bo.userMobile},'%')
+            </if>
+            <if test="bo.orderNo != null">
+                and o.order_no like concat('%',#{bo.orderNo},'%')
+            </if>
+            <if test="bo.marketingType!=null">
+                AND o.marketing_type = #{bo.marketingType.code}
+            </if>
+            <if test="bo.receiverPhone!=null and bo.receiverPhone!=''">
+                AND oa.receiver_phone like CONCAT('%',#{bo.receiverPhone},'%')
+            </if>
+            <if test="bo.receiverName!=null and bo.receiverName!=''">
+                AND oa.receiver_name like CONCAT('%',#{bo.receiverName},'%')
+            </if>
+            <if test="bo.startTime!=null">
+                AND o.create_time &gt;= #{bo.startTime}
+            </if>
+            <if test="bo.endTime!=null">
+                AND o.create_time &lt;= #{bo.endTime}
+            </if>
+        </where>
+        order by o.create_time desc
+    </select>
     <select id="countByUser" resultType="com.ruoyi.shop.order.domain.vo.ShopOrderTransactionStatusCountVo">
         select count(*) as num, transaction_status
         from tb_shop_order
@@ -369,4 +423,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </where>
         GROUP BY transaction_status
     </select>
+
+
 </mapper>