ソースを参照

导出订单来源展示数据不对处理

yfh 1 週間 前
コミット
9194b6dd8d

+ 14 - 0
fs-admin/src/main/java/com/fs/store/controller/FsStoreHealthOrderController.java

@@ -16,6 +16,8 @@ import com.fs.erp.service.IErpOrderService;
 import com.fs.store.cache.IFsStoreProductCacheService;
 import com.fs.store.cache.IFsWarehouseCacheService;
 import com.fs.store.cache.impl.FsWarehouseCacheServiceImpl;
+import com.fs.store.domain.FsCoursePlaySourceConfig;
+import com.fs.store.domain.FsStorePayment;
 import com.fs.store.domain.FsStoreProduct;
 import com.fs.store.domain.FsWarehouses;
 import com.fs.store.dto.StoreOrderProductDTO;
@@ -24,6 +26,7 @@ import com.fs.store.service.*;
 import com.fs.store.vo.FsStoreOrderExportVO;
 import com.fs.store.vo.FsStoreOrderItemExportVO;
 import com.fs.store.vo.FsStoreOrderVO;
+import org.apache.commons.collections4.CollectionUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -44,6 +47,11 @@ public class FsStoreHealthOrderController extends BaseController {
     @Autowired
     private IFsStoreProductCacheService fsStoreProductCacheService;
 
+    @Autowired
+    private IFsCoursePlaySourceConfigService fsCoursePlaySourceConfigService;
+    @Autowired
+    private IFsStorePaymentService fsStorePaymentService;
+
     /**
      * 查询健康商城订单列表
      */
@@ -126,6 +134,12 @@ public class FsStoreHealthOrderController extends BaseController {
                 if (vo.getUserPhone() != null) {
                     vo.setUserPhone(vo.getUserPhone().replaceAll("(\\d{3})\\d*(\\d{4})", "$1****$2"));
                 }
+                List<FsStorePayment> fsStorePayments = fsStorePaymentService.selectFsStorePaymentByOrderIdNew(vo.getId());
+                if (CollectionUtils.isEmpty(fsStorePayments)) {continue;}
+                FsCoursePlaySourceConfig fsCoursePlaySourceConfig = fsCoursePlaySourceConfigService.selectFsCoursePlaySourceConfigByAppId(fsStorePayments.get(0).getAppId());
+                if(ObjectUtil.isNotEmpty(fsCoursePlaySourceConfig)){
+                    vo.setOrderSource(fsCoursePlaySourceConfig.getName());
+                }
             }
         }
         ExcelUtil<FsStoreOrderExportVO> util = new ExcelUtil<FsStoreOrderExportVO>(FsStoreOrderExportVO.class);

+ 16 - 2
fs-admin/src/main/java/com/fs/store/controller/FsStoreOrderController.java

@@ -34,6 +34,7 @@ import com.fs.store.service.*;
 import com.fs.store.vo.*;
 import com.hc.openapi.tool.fastjson.JSON;
 import io.swagger.annotations.ApiOperation;
+import org.apache.commons.collections4.CollectionUtils;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.annotation.Validated;
@@ -85,8 +86,9 @@ public class FsStoreOrderController extends BaseController {
     private IFsStoreProductCacheService fsStoreProductCacheService;
 
     @Autowired
-    private FsWarehousesMapper fsWarehousesMapper;
-
+    private IFsCoursePlaySourceConfigService fsCoursePlaySourceConfigService;
+    @Autowired
+    private IFsStorePaymentService fsStorePaymentService;
     @Autowired
     private FsStoreOrderMapper fsStoreOrderMapper;
 
@@ -198,6 +200,12 @@ public class FsStoreOrderController extends BaseController {
     @Log(title = "订单", businessType = BusinessType.EXPORT)
     @GetMapping("/export")
     public AjaxResult export(FsStoreOrderParam param) {
+        // 将逗号分隔的字符串转换为 List
+        List<String> orderSourceList = null;
+        if (StringUtils.isNotBlank(param.getOrderSource())) {
+            orderSourceList = Arrays.asList(param.getOrderSource().split(","));
+            param.setOrderSources(orderSourceList);
+        }
         if (param.getBeginTime().equals("") && param.getEndTime().equals("")){
             param.setBeginTime(null);
             param.setEndTime(null);
@@ -231,6 +239,12 @@ public class FsStoreOrderController extends BaseController {
                 if (vo.getUserAddress()!=null){
                     vo.setUserAddress(ParseUtils.parseAddress(vo.getUserAddress()));
                 }
+                List<FsStorePayment> fsStorePayments = fsStorePaymentService.selectFsStorePaymentByOrderIdNew(vo.getId());
+                if (CollectionUtils.isEmpty(fsStorePayments)) {continue;}
+                FsCoursePlaySourceConfig fsCoursePlaySourceConfig = fsCoursePlaySourceConfigService.selectFsCoursePlaySourceConfigByAppId(fsStorePayments.get(0).getAppId());
+                if(ObjectUtil.isNotEmpty(fsCoursePlaySourceConfig)){
+                    vo.setOrderSource(fsCoursePlaySourceConfig.getName());
+                }
             }
         }
         ExcelUtil<FsStoreOrderExportVO> util = new ExcelUtil<FsStoreOrderExportVO>(FsStoreOrderExportVO.class);

+ 9 - 0
fs-service-system/src/main/java/com/fs/store/mapper/FsStoreOrderMapper.java

@@ -553,10 +553,19 @@ public interface FsStoreOrderMapper
             " from fs_store_order o  left JOIN fs_store_product_package p on o.package_id=p.package_id left join fs_user u on o.user_id=u.user_id  " +
             " left join company c on c.company_id=o.company_id left join company_user cu on cu.user_id=o.company_user_id left join crm_customer cc on cc.customer_id=o.customer_id left join company_tcm_schedule cts on cts.id = o.schedule_id " +
             " left join fs_store_delivers deliver on deliver.order_id=o.id "+
+            "<if test='maps.orderSources != null and maps.orderSources.size() > 0'>" +
+            "left join fs_store_payment sp on o.id = sp.order_id " +
+            "</if>" +
             "where 1=1 " +
             "<if test = 'maps.orderCode != null and  maps.orderCode !=\"\"    '> " +
             "and o.order_code like CONCAT('%',#{maps.orderCode},'%') " +
             "</if>" +
+            "<if test='maps.orderSources != null and maps.orderSources.size() > 0'>" +
+            "and sp.app_id in " +
+            "<foreach collection='maps.orderSources' item='source' open='(' separator=',' close=')'>" +
+            "#{source}" +
+            "</foreach>" +
+            "</if>" +
             "<if test = 'maps.userId != null      '> " +
             "and o.user_id =#{maps.userId} " +
             "</if>" +

+ 1 - 1
fs-service-system/src/main/java/com/fs/store/mapper/FsStorePaymentMapper.java

@@ -391,6 +391,6 @@ public interface FsStorePaymentMapper
     List<FsStorePayment> queryByBankTrxId(@Param("list") List<String> bankTrxIds);
 
     @MapKey("orderId")
-    @Select("select order_id,bank_transaction_id,app_id from fs_store_payment where bank_transaction_id is not null")
+    @Select("select order_id,bank_transaction_id from fs_store_payment where bank_transaction_id is not null")
     Map<Long,FsStorePayment> selectAllPayments();
 }

+ 7 - 0
fs-service-system/src/main/java/com/fs/store/service/IFsCoursePlaySourceConfigService.java

@@ -64,4 +64,11 @@ public interface IFsCoursePlaySourceConfigService {
      * @return
      */
     List<FsCoursePlaySourceConfig> selectFsCoursePlaySourceConfigAll();
+
+    /**
+     * 通过appId查询
+     * @param orderSource
+     * @return
+     */
+    FsCoursePlaySourceConfig selectFsCoursePlaySourceConfigByAppId(String orderSource);
 }

+ 5 - 0
fs-service-system/src/main/java/com/fs/store/service/impl/FsCoursePlaySourceConfigServiceImpl.java

@@ -98,4 +98,9 @@ public class FsCoursePlaySourceConfigServiceImpl  implements IFsCoursePlaySource
     public List<FsCoursePlaySourceConfig> selectFsCoursePlaySourceConfigAll() {
         return baseMapper.selectFsCoursePlaySourceConfigAll();
     }
+
+    @Override
+    public FsCoursePlaySourceConfig selectFsCoursePlaySourceConfigByAppId(String orderSource) {
+        return baseMapper.selectFsCoursePlaySourceConfigByAppId(orderSource);
+    }
 }

+ 0 - 4
fs-service-system/src/main/java/com/fs/store/service/impl/FsStoreOrderServiceImpl.java

@@ -2708,10 +2708,6 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService
             FsStorePayment fsStorePayment = paymentMap.get(item.getId());
             if(ObjectUtil.isNotNull(fsStorePayment)){
                 item.setBankTrxId(fsStorePayment.getBankTransactionId());
-                FsCoursePlaySourceConfig fsCoursePlaySourceConfig = fsCoursePlaySourceConfigMapper.selectFsCoursePlaySourceConfigByAppId(fsStorePayment.getAppId());
-                if(ObjectUtil.isNotEmpty(fsCoursePlaySourceConfig)){
-                    item.setOrderSource(fsCoursePlaySourceConfig.getName());
-                }
             }
         }
         return fsStoreOrderExportVOS;