yumeng 11 hónapja
szülő
commit
d24721b35b

+ 20 - 13
ruixuan-live/src/main/java/com/ruixuan/isc/controller/SupplyChainController.java

@@ -2708,33 +2708,38 @@ public class SupplyChainController extends BaseController {
     public void exportShopList(HttpServletRequest request, HttpServletResponse response, @RequestBody JSONObject requestJson) throws IOException {
 
         try {
+
+
             if (Check.isNull(requestJson.getString("orderStartDate")) || Check.isNull(requestJson.getString("orderEndDate"))) {
                 throw new Exception("请输入开始时间和结束时间");
             }
 
-            Long userId = requestJson.getLong("userId");
-            if (Check.isNull(userId)) {
-                throw new Exception("请输入用户ID");
+            if (Check.isNull(requestJson.getLong("userId"))) {
+                throw new Exception("请输入用户id");
             }
-
-
             Map<String, Object> requestMap = new HashMap<>();
-            requestMap.put("start", requestJson.getString("orderStartDate"));
-            requestMap.put("end", requestJson.getString("orderEndDate"));
-            requestMap.put("fieId", "orderNum");
-            requestMap.put("sort", "desc");
 
-            String roleKey = sysUserService.getRoleKeyByUserId(userId);
+            String roleKey = sysUserService.getRoleKeyByUserId(requestJson.getLong("userId"));
             if (roleKey.equals("courtship")) {
-                List<Long> itemIds = supplyChainService.getItemIdsByUserId(userId);
+                List<Long> itemIds = supplyChainService.getItemIdsByUserId(requestJson.getLong("userId"));
                 requestMap.put("itemIds", itemIds);
             }
 
             if (roleKey.equals("courtshipManager")) {
-                Long deptId = deptService.getDeptIdByUserId(userId);
+                Long deptId = deptService.getDeptIdByUserId(requestJson.getLong("userId"));
                 List<Long> itemIds = supplyChainService.getItemIdsByDeptId(deptId);
                 requestMap.put("itemIds", itemIds);
             }
+
+
+            requestMap.put("start", DateUtils.strDateToInt(requestJson.getString("orderStartDate")));
+            requestMap.put("end", DateUtils.strDateToInt(requestJson.getString("orderEndDate")));
+            if (!Check.isNull(requestJson.getLong("sellerId"))) {
+                requestMap.put("sellerId", requestJson.getLong("sellerId"));
+
+            }
+            requestMap.put("fieId", "orderNum");
+            requestMap.put("sort", "desc");
             List<JSONObject> list = supplyChainService.shopList(requestMap);
             List<List<Object>> exportList = new ArrayList<>();
             if (!Check.isNull(list)) {
@@ -2746,6 +2751,8 @@ public class SupplyChainController extends BaseController {
                     export.add(date.getString("orderNum"));
                     export.add(date.getString("validOrderNUm"));
                     export.add(date.getString("validRadio"));
+                    export.add(date.getString("settledOrderNUm"));
+                    export.add(date.getString("settledOrderRate"));
                     export.add(date.getString("payAmount"));
                     export.add(date.getString("deliveryNum"));
                     export.add(date.getString("shippingGreen"));
@@ -2755,7 +2762,7 @@ public class SupplyChainController extends BaseController {
                     exportList.add(export);
                 }
             }
-            String[] headers = {"店铺ID", "店铺名称", "单量", "有效单量", "有效率", "付款金额", "发货数", "发货率", "有效发货数", "未发货数", "有效发货率"};
+            String[] headers = {"店铺ID", "店铺名称", "单量", "有效单量", "有效率", "已结单量", "结算率", "付款金额", "发货数", "发货率", "有效发货数", "未发货数", "有效发货率"};
             OutputStream os = response.getOutputStream();
             ExportExcelUtils eeu = new ExportExcelUtils();
             XSSFWorkbook workbook = new XSSFWorkbook();

+ 6 - 5
ruixuan-live/src/main/resources/mapper/isc/SupplyChainMapper.xml

@@ -3927,8 +3927,11 @@
         ORDER BY tag_oid_num DESC limit 5
     </select>
     <select id="shopList" resultType="com.alibaba.fastjson.JSONObject">
-        select t2.seller_name as 'sellerName', t1.*
-        from (select seller_id as 'sellerId',
+        select seller_id as 'sellerId',
+        seller_nick_name as 'sellerName',
+        sum(case when order_status = 60 then 1 else 0 end) as 'settledOrderNUm',
+        round(sum(case when order_status = 60 then 1 else 0 end) / count(oid) * 100,
+        2) as 'settledOrderRate',
         count(oid) as 'orderNum',
         round(sum(case when order_status != 80 then pay_amount else 0 end) / 100,
         2) as 'payAmount',
@@ -3968,9 +3971,7 @@
             </foreach>
 
         </if>
-        group by seller_id) t1
-        left join kuaishou_seller_info t2
-        on t1.sellerId = t2.seller_id
+        group by seller_id
         order by ${fieId} ${sort}
 
     </select>