Prechádzať zdrojové kódy

Merge remote-tracking branch 'origin/dev_20260131_youshen430' into dev_20260131_youshen430

donglang 4 dní pred
rodič
commit
0619e1cbe6

+ 3 - 5
sckw-modules-api/sckw-order-api/src/main/java/com/sckw/order/api/feign/OrderStatisticsFeignService.java

@@ -16,17 +16,15 @@ public interface OrderStatisticsFeignService {
 
     @GetMapping("/kwoTradeOrderStatistics/getDailyShipmentByCategory")
     BaseResult<List<DailyShipmentStatisticsDto>> getDailyShipmentByCategory(
-            @RequestParam("entId") Long entId,
             @RequestParam("days") Integer days);
 
     @GetMapping("/kwoTradeOrderStatistics/getDailySalesByCategory")
     BaseResult<List<DailySalesStatisticsDto>> getDailySalesByCategory(
-            @RequestParam("entId") Long entId,
             @RequestParam("days") Integer days);
 
     @GetMapping("/kwoTradeOrderStatistics/getGoodsVolumeTop5")
-    BaseResult<List<GoodsVolumeStatisticsDto>> getGoodsVolumeTop5(@RequestParam("entId") Long entId);
+    BaseResult<List<GoodsVolumeStatisticsDto>> getGoodsVolumeTop5();
 
     @GetMapping("/kwoTradeOrderStatistics/getGoodsAmountTop5")
-    BaseResult<List<GoodsAmountStatisticsDto>> getGoodsAmountTop5(@RequestParam("entId") Long entId);
-}
+    BaseResult<List<GoodsAmountStatisticsDto>> getGoodsAmountTop5();
+}

+ 7 - 8
sckw-modules/sckw-order/src/main/java/com/sckw/order/controller/KwoTradeOrderStatisticsController.java

@@ -65,6 +65,7 @@ public class KwoTradeOrderStatisticsController {
     public HttpResult workbenchPurchaseList() {
         return HttpResult.ok(kwoTradeOrderStatisticsService.workbenchPurchaseList());
     }
+
     /**
      * 查询销售报表数据
      *
@@ -78,25 +79,23 @@ public class KwoTradeOrderStatisticsController {
 
     @GetMapping("/getDailyShipmentByCategory")
     public BaseResult<List<DailyShipmentStatisticsDto>> getDailyShipmentByCategory(
-            @RequestParam("entId") Long entId,
             @RequestParam(value = "days", defaultValue = "7") Integer days) {
-        return BaseResult.success(kwoTradeOrderStatisticsService.getDailyShipmentByCategory(entId, days));
+        return BaseResult.success(kwoTradeOrderStatisticsService.getDailyShipmentByCategory(days));
     }
 
     @GetMapping("/getDailySalesByCategory")
     public BaseResult<List<DailySalesStatisticsDto>> getDailySalesByCategory(
-            @RequestParam("entId") Long entId,
             @RequestParam(value = "days", defaultValue = "7") Integer days) {
-        return BaseResult.success(kwoTradeOrderStatisticsService.getDailySalesByCategory(entId, days));
+        return BaseResult.success(kwoTradeOrderStatisticsService.getDailySalesByCategory(days));
     }
 
     @GetMapping("/getGoodsVolumeTop5")
-    public BaseResult<List<GoodsVolumeStatisticsDto>> getGoodsVolumeTop5(@RequestParam("entId") Long entId) {
-        return BaseResult.success(kwoTradeOrderStatisticsService.getGoodsVolumeTop5(entId));
+    public BaseResult<List<GoodsVolumeStatisticsDto>> getGoodsVolumeTop5() {
+        return BaseResult.success(kwoTradeOrderStatisticsService.getGoodsVolumeTop5());
     }
 
     @GetMapping("/getGoodsAmountTop5")
-    public BaseResult<List<GoodsAmountStatisticsDto>> getGoodsAmountTop5(@RequestParam("entId") Long entId) {
-        return BaseResult.success(kwoTradeOrderStatisticsService.getGoodsAmountTop5(entId));
+    public BaseResult<List<GoodsAmountStatisticsDto>> getGoodsAmountTop5() {
+        return BaseResult.success(kwoTradeOrderStatisticsService.getGoodsAmountTop5());
     }
 }

+ 4 - 4
sckw-modules/sckw-order/src/main/java/com/sckw/order/dao/KwoTradeOrderMapper.java

@@ -188,7 +188,7 @@ public interface KwoTradeOrderMapper extends BaseMapper<KwoTradeOrder> {
      * @param endTime 结束时间
      * @return 每日出货量统计列表
      */
-    List<DailyShipmentStatisticsDTO> selectDailyShipmentByCategory(@Param("entId") Long entId,
+    List<DailyShipmentStatisticsDTO> selectDailyShipmentByCategory(
                                                                    @Param("startTime") Date startTime,
                                                                    @Param("endTime") Date endTime);
 
@@ -199,7 +199,7 @@ public interface KwoTradeOrderMapper extends BaseMapper<KwoTradeOrder> {
      * @param endTime 结束时间
      * @return 每日销售额统计列表
      */
-    List<DailySalesStatisticsDTO> selectDailySalesByCategory(@Param("entId") Long entId,
+    List<DailySalesStatisticsDTO> selectDailySalesByCategory(
                                                              @Param("startTime") Date startTime,
                                                              @Param("endTime") Date endTime);
 
@@ -208,13 +208,13 @@ public interface KwoTradeOrderMapper extends BaseMapper<KwoTradeOrder> {
      * @param entId 企业ID
      * @return 商品销量统计列表
      */
-    List<GoodsVolumeStatisticsDTO> selectGoodsVolumeTop5(@Param("entId") Long entId);
+    List<GoodsVolumeStatisticsDTO> selectGoodsVolumeTop5();
 
     /**
      * 按最低级分类统计历史完成订单的销售金额总和(取前5名)
      * @param entId 企业ID
      * @return 商品销售金额统计列表
      */
-    List<GoodsAmountStatisticsDTO> selectGoodsAmountTop5(@Param("entId") Long entId);
+    List<GoodsAmountStatisticsDTO> selectGoodsAmountTop5();
 
 }

+ 8 - 8
sckw-modules/sckw-order/src/main/java/com/sckw/order/serivce/KwoTradeOrderStatisticsService.java

@@ -448,10 +448,10 @@ public class KwoTradeOrderStatisticsService {
         return result;
     }
 
-    public List<DailyShipmentStatisticsDto> getDailyShipmentByCategory(Long entId, Integer days) {
+    public List<DailyShipmentStatisticsDto> getDailyShipmentByCategory( Integer days) {
         Date endTime = new Date();
         Date startTime = DateUtils.getStartTime(days, LocalDateTime.now());
-        List<DailyShipmentStatisticsDTO> list = tradeOrderMapper.selectDailyShipmentByCategory(entId, startTime, endTime);
+        List<DailyShipmentStatisticsDTO> list = tradeOrderMapper.selectDailyShipmentByCategory( startTime, endTime);
         return list.stream().map(dto -> {
             DailyShipmentStatisticsDto result = new DailyShipmentStatisticsDto();
             result.setOrderDate(dto.getOrderDate());
@@ -461,10 +461,10 @@ public class KwoTradeOrderStatisticsService {
         }).collect(Collectors.toList());
     }
 
-    public List<DailySalesStatisticsDto> getDailySalesByCategory(Long entId, Integer days) {
+    public List<DailySalesStatisticsDto> getDailySalesByCategory( Integer days) {
         Date endTime = new Date();
         Date startTime = DateUtils.getStartTime(days, LocalDateTime.now());
-        List<DailySalesStatisticsDTO> list = tradeOrderMapper.selectDailySalesByCategory(entId, startTime, endTime);
+        List<DailySalesStatisticsDTO> list = tradeOrderMapper.selectDailySalesByCategory( startTime, endTime);
         return list.stream().map(dto -> {
             DailySalesStatisticsDto result = new DailySalesStatisticsDto();
             result.setOrderDate(dto.getOrderDate());
@@ -474,8 +474,8 @@ public class KwoTradeOrderStatisticsService {
         }).collect(Collectors.toList());
     }
 
-    public List<GoodsVolumeStatisticsDto> getGoodsVolumeTop5(Long entId) {
-        List<GoodsVolumeStatisticsDTO> list = tradeOrderMapper.selectGoodsVolumeTop5(entId);
+    public List<GoodsVolumeStatisticsDto> getGoodsVolumeTop5() {
+        List<GoodsVolumeStatisticsDTO> list = tradeOrderMapper.selectGoodsVolumeTop5();
         return list.stream().map(dto -> {
             GoodsVolumeStatisticsDto result = new GoodsVolumeStatisticsDto();
             result.setGoodsName(dto.getGoodsName());
@@ -484,8 +484,8 @@ public class KwoTradeOrderStatisticsService {
         }).collect(Collectors.toList());
     }
 
-    public List<GoodsAmountStatisticsDto> getGoodsAmountTop5(Long entId) {
-        List<GoodsAmountStatisticsDTO> list = tradeOrderMapper.selectGoodsAmountTop5(entId);
+    public List<GoodsAmountStatisticsDto> getGoodsAmountTop5() {
+        List<GoodsAmountStatisticsDTO> list = tradeOrderMapper.selectGoodsAmountTop5();
         return list.stream().map(dto -> {
             GoodsAmountStatisticsDto result = new GoodsAmountStatisticsDto();
             result.setGoodsName(dto.getGoodsName());

+ 5 - 10
sckw-modules/sckw-order/src/main/resources/mapper/KwoTradeOrderMapper.xml

@@ -1034,8 +1034,7 @@
             kto.del_flag = 0
               and kto.status = 4
               and ku.ent_id in (538038314096136193, 538039617157337089, 538040297439891457)
-            group by kto.id,
-                     d.firm_name
+            group by d.firm_name
         </where>
     </select>
 
@@ -1079,8 +1078,7 @@
                  inner join kwo_trade_order_goods ktog on kto.id = ktog.t_order_id and ktog.del_flag = 0
                  inner join kwo_trade_order_unit ku on kto.id = ku.t_order_id and ku.unit_type = '2' and ku.del_flag = 0
         where kto.del_flag = 0
-          and kto.status = 5
-          and ku.top_ent_id = #{entId}
+          and kto.status = 4
           and kto.create_time >= #{startTime}
           and kto.create_time &lt;= #{endTime}
         group by DATE_FORMAT(kto.create_time, '%Y-%m-%d'), ktog.goods_type
@@ -1095,8 +1093,7 @@
                  inner join kwo_trade_order_goods ktog on kto.id = ktog.t_order_id and ktog.del_flag = 0
                  inner join kwo_trade_order_unit ku on kto.id = ku.t_order_id and ku.unit_type = '2' and ku.del_flag = 0
         where kto.del_flag = 0
-          and kto.status = 5
-          and ku.top_ent_id = #{entId}
+          and kto.status = 4
           and kto.create_time >= #{startTime}
           and kto.create_time &lt;= #{endTime}
         group by DATE_FORMAT(kto.create_time, '%Y-%m-%d'), ktog.goods_type
@@ -1110,8 +1107,7 @@
                  inner join kwo_trade_order_goods ktog on kto.id = ktog.t_order_id and ktog.del_flag = 0
                  inner join kwo_trade_order_unit ku on kto.id = ku.t_order_id and ku.unit_type = '2' and ku.del_flag = 0
         where kto.del_flag = 0
-          and kto.status = 5
-          and ku.top_ent_id = #{entId}
+          and kto.status = 4
         group by ktog.goods_name
         order by totalVolume desc
         limit 5;
@@ -1124,8 +1120,7 @@
                  inner join kwo_trade_order_goods ktog on kto.id = ktog.t_order_id and ktog.del_flag = 0
                  inner join kwo_trade_order_unit ku on kto.id = ku.t_order_id and ku.unit_type = '2' and ku.del_flag = 0
         where kto.del_flag = 0
-          and kto.status = 5
-          and ku.top_ent_id = #{entId}
+          and kto.status = 4
         group by ktog.goods_name
         order by totalAmount desc
         limit 5;

+ 22 - 17
sckw-modules/sckw-report/src/main/java/com/sckw/report/service/impl/KwBiReportServiceImpl.java

@@ -1,13 +1,16 @@
 package com.sckw.report.service.impl;
 
-import com.sckw.core.web.context.LoginUserHolder;
+import com.alibaba.fastjson.JSONObject;
 import com.sckw.core.web.response.BaseResult;
 import com.sckw.order.api.feign.OrderStatisticsFeignService;
 import com.sckw.order.api.model.DailySalesStatisticsDto;
 import com.sckw.order.api.model.DailyShipmentStatisticsDto;
 import com.sckw.order.api.model.GoodsAmountStatisticsDto;
 import com.sckw.order.api.model.GoodsVolumeStatisticsDto;
-import com.sckw.report.model.vo.*;
+import com.sckw.report.model.vo.DailySalesAmountVo;
+import com.sckw.report.model.vo.DailyShipmentAmountVo;
+import com.sckw.report.model.vo.GoodsSalesAmountRatioVo;
+import com.sckw.report.model.vo.GoodsSalesVolumeRatioVo;
 import com.sckw.report.service.KwBiReportService;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
@@ -18,7 +21,10 @@ import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.time.LocalDate;
 import java.time.format.DateTimeFormatter;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
 import java.util.stream.Collectors;
 
 @Service
@@ -31,9 +37,8 @@ public class KwBiReportServiceImpl implements KwBiReportService {
 
     @Override
     public DailyShipmentAmountVo getDailyShipmentAmount() {
-        Long entId = LoginUserHolder.getEntId();
-        BaseResult<List<DailyShipmentStatisticsDto>> result = orderStatisticsFeignService.getDailyShipmentByCategory(entId, 7);
-        
+        BaseResult<List<DailyShipmentStatisticsDto>> result = orderStatisticsFeignService.getDailyShipmentByCategory(7);
+        log.info("getDailyShipmentAmount {}", JSONObject.toJSONString(result));
         DailyShipmentAmountVo vo = new DailyShipmentAmountVo();
         List<String> dates = generateLast7Days();
         vo.setDates(dates);
@@ -57,7 +62,7 @@ public class KwBiReportServiceImpl implements KwBiReportService {
         dataMap.forEach((category, dateAmountMap) -> {
             DailyShipmentAmountVo.ShipmentCategoryData data = new DailyShipmentAmountVo.ShipmentCategoryData();
             data.setCategoryName(category);
-            
+
             List<BigDecimal> amounts = new ArrayList<>();
             for (String date : dates) {
                 amounts.add(dateAmountMap.getOrDefault(date, BigDecimal.ZERO));
@@ -72,8 +77,8 @@ public class KwBiReportServiceImpl implements KwBiReportService {
 
     @Override
     public DailySalesAmountVo getDailySalesAmount() {
-        Long entId = LoginUserHolder.getEntId();
-        BaseResult<List<DailySalesStatisticsDto>> result = orderStatisticsFeignService.getDailySalesByCategory(entId, 7);
+        BaseResult<List<DailySalesStatisticsDto>> result = orderStatisticsFeignService.getDailySalesByCategory(7);
+        log.info("getDailySalesAmount {}", JSONObject.toJSONString(result));
 
         DailySalesAmountVo vo = new DailySalesAmountVo();
         List<String> dates = generateLast7Days();
@@ -113,8 +118,8 @@ public class KwBiReportServiceImpl implements KwBiReportService {
 
     @Override
     public GoodsSalesVolumeRatioVo getGoodsSalesVolumeRatio() {
-        Long entId = LoginUserHolder.getEntId();
-        BaseResult<List<GoodsVolumeStatisticsDto>> result = orderStatisticsFeignService.getGoodsVolumeTop5(entId);
+        BaseResult<List<GoodsVolumeStatisticsDto>> result = orderStatisticsFeignService.getGoodsVolumeTop5();
+        log.info("getGoodsSalesVolumeRatio {}", JSONObject.toJSONString(result));
 
         GoodsSalesVolumeRatioVo vo = new GoodsSalesVolumeRatioVo();
 
@@ -133,7 +138,7 @@ public class KwBiReportServiceImpl implements KwBiReportService {
             GoodsSalesVolumeRatioVo.GoodsVolumeRatioItem item = new GoodsSalesVolumeRatioVo.GoodsVolumeRatioItem();
             item.setGoodsName(dto.getGoodsName());
             item.setVolume(dto.getTotalVolume() != null ? dto.getTotalVolume() : BigDecimal.ZERO);
-            
+
             BigDecimal percentage = BigDecimal.ZERO;
             if (totalVolume.compareTo(BigDecimal.ZERO) > 0) {
                 percentage = item.getVolume().multiply(new BigDecimal("100"))
@@ -149,8 +154,8 @@ public class KwBiReportServiceImpl implements KwBiReportService {
 
     @Override
     public GoodsSalesAmountRatioVo getGoodsSalesAmountRatio() {
-        Long entId = LoginUserHolder.getEntId();
-        BaseResult<List<GoodsAmountStatisticsDto>> result = orderStatisticsFeignService.getGoodsAmountTop5(entId);
+        BaseResult<List<GoodsAmountStatisticsDto>> result = orderStatisticsFeignService.getGoodsAmountTop5();
+        log.info("getGoodsSalesAmountRatio {}", JSONObject.toJSONString(result));
 
         GoodsSalesAmountRatioVo vo = new GoodsSalesAmountRatioVo();
 
@@ -187,12 +192,12 @@ public class KwBiReportServiceImpl implements KwBiReportService {
         List<String> dates = new ArrayList<>();
         DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd");
         LocalDate today = LocalDate.now();
-        
+
         for (int i = 6; i >= 0; i--) {
             LocalDate date = today.minusDays(i);
             dates.add(date.format(formatter));
         }
-        
+
         return dates;
     }
-}
+}