Pārlūkot izejas kodu

修改导出全部时为空的情况

zhangxin 2 nedēļas atpakaļ
vecāks
revīzija
bf254beca3

+ 17 - 4
yami-shop-platform/src/main/java/com/yami/shop/platform/controller/OrderController.java

@@ -17,6 +17,7 @@ import com.yami.shop.bean.enums.DvyType;
 import com.yami.shop.bean.enums.OrderStatus;
 import com.yami.shop.bean.model.*;
 import com.yami.shop.bean.param.*;
+import com.yami.shop.common.config.Constant;
 import com.yami.shop.common.exception.GlobalException;
 import com.yami.shop.common.util.PageParam;
 import com.yami.shop.common.util.R;
@@ -36,10 +37,7 @@ import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletResponse;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
+import java.util.*;
 import java.util.stream.Collectors;
 
 /**
@@ -86,6 +84,11 @@ public class OrderController {
             Long userId = SecurityUtils.getSysUser().getUserId();
             List<Long> channelIdList =  sysUserService.findByUserIdListId(userId);
             orderParam.setChannelIdList(channelIdList);
+            if (userId != Constant.SUPER_ADMIN_ID&&(orderParam.getChannelIdList()==null||orderParam.getChannelIdList().isEmpty())){
+                List<Long> longs = new ArrayList<>();
+                longs.add(0L);
+                orderParam.setChannelIdList(longs);
+            }
         }
         IPage<Order> orderIPage = orderService.deliverList(page, orderParam);
         return R.SUCCESS(orderIPage);
@@ -98,6 +101,11 @@ public class OrderController {
             Long userId = SecurityUtils.getSysUser().getUserId();
             List<Long> channelIdList =  sysUserService.findByUserIdListId(userId);
             orderParam.setChannelIdList(channelIdList);
+            if (userId != Constant.SUPER_ADMIN_ID&&(orderParam.getChannelIdList()==null||orderParam.getChannelIdList().isEmpty())){
+                List<Long> longs = new ArrayList<>();
+                longs.add(0L);
+                orderParam.setChannelIdList(longs);
+            }
         }
         return R.SUCCESS(orderService.deliverListStatusNum(orderParam));
     }
@@ -261,6 +269,11 @@ public class OrderController {
             }
             List<Long> channelIdList =  sysUserService.findByUserIdListId(userId);
             orderParam.setChannelIdList(channelIdList);
+            if (userId != Constant.SUPER_ADMIN_ID&&(orderParam.getChannelIdList()==null||orderParam.getChannelIdList().isEmpty())){
+                List<Long> longs = new ArrayList<>();
+                longs.add(0L);
+                orderParam.setChannelIdList(longs);
+            }
         }
          orderService.export(orderParam,response);
     }

+ 17 - 0
yami-shop-platform/src/main/java/com/yami/shop/platform/controller/OrderRefundController.java

@@ -13,6 +13,7 @@ import com.yami.shop.bean.param.OrderRefundCountParam;
 import com.yami.shop.bean.param.OrderRefundStaisticsParam;
 import com.yami.shop.bean.vo.OrderRefundSkuVo;
 import com.yami.shop.bean.vo.OrderRefundVo;
+import com.yami.shop.common.config.Constant;
 import com.yami.shop.common.exception.GlobalException;
 import com.yami.shop.common.util.PageParam;
 import com.yami.shop.common.util.R;
@@ -28,6 +29,7 @@ import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletResponse;
+import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -124,6 +126,11 @@ public class OrderRefundController {
             Long userId = SecurityUtils.getSysUser().getUserId();
             List<Long> channelIdList =  sysUserService.findByUserIdListId(userId);
             orderRefund.setChannelIdList(channelIdList);
+            if (userId != Constant.SUPER_ADMIN_ID&&(orderRefund.getChannelIdList()==null||orderRefund.getChannelIdList().isEmpty())){
+                List<Long> longs = new ArrayList<>();
+                longs.add(0L);
+                orderRefund.setChannelIdList(longs);
+            }
         }
         IPage<OrderRefundVo> page1 = orderRefundService.orderRefundPage(page, orderRefund);
         for (OrderRefundVo record : page1.getRecords()) {
@@ -142,6 +149,11 @@ public class OrderRefundController {
             Long userId = SecurityUtils.getSysUser().getUserId();
             List<Long> channelIdList =  sysUserService.findByUserIdListId(userId);
             orderRefund.setChannelIdList(channelIdList);
+            if (userId != Constant.SUPER_ADMIN_ID&&(orderRefund.getChannelIdList()==null||orderRefund.getChannelIdList().isEmpty())){
+                List<Long> longs = new ArrayList<>();
+                longs.add(0L);
+                orderRefund.setChannelIdList(longs);
+            }
         }
         return R.SUCCESS(orderRefundService.orderRefundCount(orderRefund));
     }
@@ -166,6 +178,11 @@ public class OrderRefundController {
             }
             List<Long> channelIdList =  sysUserService.findByUserIdListId(userId);
             orderRefund.setChannelIdList(channelIdList);
+            if (userId != Constant.SUPER_ADMIN_ID&&(orderRefund.getChannelIdList()==null||orderRefund.getChannelIdList().isEmpty())){
+                List<Long> longs = new ArrayList<>();
+                longs.add(0L);
+                orderRefund.setChannelIdList(longs);
+            }
         }
         orderRefundService.export(orderRefund,response);
     }

+ 19 - 1
yami-shop-platform/src/main/java/com/yami/shop/platform/controller/PointsRechargeController.java

@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.yami.shop.bean.model.PointsRecharge;
 import com.yami.shop.bean.po.EnterpriseUserPo;
 import com.yami.shop.bean.vo.PointsRechargeVO;
+import com.yami.shop.common.config.Constant;
 import com.yami.shop.common.exception.GlobalException;
 import com.yami.shop.common.util.PageParam;
 import com.yami.shop.common.util.R;
@@ -26,6 +27,7 @@ import org.springframework.web.multipart.MultipartFile;
 
 import javax.servlet.http.HttpServletResponse;
 import javax.validation.Valid;
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 
@@ -57,9 +59,14 @@ public class PointsRechargeController {
             Long userId = SecurityUtils.getSysUser().getUserId();
             List<Long> channelIdList =  sysUserService.findByUserIdListId(userId);
             pointsRecharge.setChannelIdList(channelIdList);
+            if (userId != Constant.SUPER_ADMIN_ID&&(pointsRecharge.getChannelIdList()==null||pointsRecharge.getChannelIdList().isEmpty())){
+                List<Long> longs = new ArrayList<>();
+                longs.add(0L);
+                pointsRecharge.setChannelIdList(longs);
+            }
         }
         IPage<PointsRecharge> page = pointsRechargeService.page(pageParam,new LambdaQueryWrapper<PointsRecharge>()
-                .in(PointsRecharge::getChannelId,pointsRecharge.getChannelIdList())
+                .in(ObjectUtils.isNotEmpty(pointsRecharge.getChannelIdList()),PointsRecharge::getChannelId,pointsRecharge.getChannelIdList())
                 .eq(ObjectUtils.isNotEmpty(pointsRecharge.getUserPhone()),PointsRecharge::getUserPhone,pointsRecharge.getUserPhone())
                 .orderByDesc(PointsRecharge::getCreateTime)
         );
@@ -79,6 +86,11 @@ public class PointsRechargeController {
             Long userId = SecurityUtils.getSysUser().getUserId();
             List<Long> channelIdList =  sysUserService.findByUserIdListId(userId);
             pointsRecharge.setChannelIdList(channelIdList);
+            if (userId != Constant.SUPER_ADMIN_ID&&(pointsRecharge.getChannelIdList()==null||pointsRecharge.getChannelIdList().isEmpty())){
+                List<Long> longs = new ArrayList<>();
+                longs.add(0L);
+                pointsRecharge.setChannelIdList(longs);
+            }
         }
         IPage<PointsRechargeVO> page = pointsRechargeService.statisticsList(pointsRecharge);
         return R.SUCCESS(page);
@@ -171,7 +183,13 @@ public class PointsRechargeController {
             }
             List<Long> channelIdList =  sysUserService.findByUserIdListId(userId);
             pointsRecharge.setChannelIdList(channelIdList);
+            if (userId != Constant.SUPER_ADMIN_ID&&(pointsRecharge.getChannelIdList()==null||pointsRecharge.getChannelIdList().isEmpty())){
+                List<Long> longs = new ArrayList<>();
+                longs.add(0L);
+                pointsRecharge.setChannelIdList(longs);
+            }
         }
+
         pointsRechargeService.export(pointsRecharge,response);
     }
 

+ 12 - 0
yami-shop-platform/src/main/java/com/yami/shop/platform/controller/UserEnterpriseController.java

@@ -6,6 +6,7 @@ import com.yami.shop.bean.param.OrderRefundStaisticsParam;
 import com.yami.shop.bean.po.EnterpriseUserLogPo;
 import com.yami.shop.bean.po.EnterpriseUserPo;
 import com.yami.shop.bean.vo.EnterpriseUserVo;
+import com.yami.shop.common.config.Constant;
 import com.yami.shop.common.exception.GlobalException;
 import com.yami.shop.common.util.PageParam;
 import com.yami.shop.common.util.R;
@@ -19,6 +20,7 @@ import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
 import javax.servlet.http.HttpServletResponse;
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 
@@ -71,6 +73,11 @@ public class UserEnterpriseController {
             Long userId = SecurityUtils.getSysUser().getUserId();
            List<Long> channelIdList =  sysUserService.findByUserIdListId(userId);
             po.setChannelIdList(channelIdList);
+            if (userId != Constant.SUPER_ADMIN_ID&&(po.getChannelIdList()==null||po.getChannelIdList().isEmpty())){
+                List<Long> longs = new ArrayList<>();
+                longs.add(0L);
+                po.setChannelIdList(longs);
+            }
         }
         IPage<EnterpriseUserVo> userPage =  userService.enterpriseUserList(page,po);
         return R.SUCCESS(userPage);
@@ -137,6 +144,11 @@ public class UserEnterpriseController {
             }
             List<Long> channelIdList =  sysUserService.findByUserIdListId(userId);
             po.setChannelIdList(channelIdList);
+            if (userId != Constant.SUPER_ADMIN_ID&&(po.getChannelIdList()==null||po.getChannelIdList().isEmpty())){
+                List<Long> longs = new ArrayList<>();
+                longs.add(0L);
+                po.setChannelIdList(longs);
+            }
         }
         userService.export(po,response);
     }

+ 1 - 0
yami-shop-security/yami-shop-security-platform/src/main/java/com/yami/shop/security/platform/config/ResourceServerConfiguration.java

@@ -64,6 +64,7 @@ public class ResourceServerConfiguration extends ResourceServerConfigurerAdapter
                     "/admin/enterprise/downloadXlsx",
                     "/admin/enterprise/downloadExcel",
                     "/admin/enterprise/downloadErrorExcel",
+                    "/admin/enterprise/export",
                     "/captcha.jpg").permitAll()
             .and()
             .authorizeRequests()