Selaa lähdekoodia

新增全部判断

zhangxin 2 viikkoa sitten
vanhempi
commit
aa0384bb4a

+ 8 - 1
yami-shop-platform/src/main/java/com/yami/shop/platform/controller/ChannelController.java

@@ -18,6 +18,7 @@ import lombok.AllArgsConstructor;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 
@@ -110,7 +111,13 @@ public class ChannelController {
         }else {
             channels = sysUserService.findByUserId(userId);
         }
-
+        Channel channel = new Channel();
+        channel.setId(0L);
+        channel.setChannelName("全部");
+        if (channels==null){
+            channels =new ArrayList<Channel>();
+        }
+        channels.add(0,channel);
         return R.SUCCESS(channels);
     }
 }

+ 20 - 1
yami-shop-platform/src/main/java/com/yami/shop/platform/controller/OrderController.java

@@ -22,11 +22,14 @@ import com.yami.shop.common.util.PageParam;
 import com.yami.shop.common.util.R;
 import com.yami.shop.security.comment.dao.AppConnectMapper;
 import com.yami.shop.security.comment.model.AppConnect;
+import com.yami.shop.security.platform.util.SecurityUtils;
 import com.yami.shop.service.*;
+import com.yami.shop.sys.service.SysUserService;
 import com.yami.shop.utils.CullenUtils;
 import com.yami.shop.wx.service.impl.WxProviderServiceImpl;
 import io.swagger.annotations.ApiOperation;
 import lombok.AllArgsConstructor;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.format.annotation.DateTimeFormat;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.transaction.annotation.Transactional;
@@ -61,7 +64,8 @@ public class OrderController {
     private final OrderSettlementService orderSettlementService;
     private final AppConnectMapper appConnectMapper;
 
-
+    @Autowired
+    private SysUserService sysUserService;
     /**
      * 分页获取
      */
@@ -78,6 +82,11 @@ public class OrderController {
         if (orderParam.getChannelIdList()==null||orderParam.getChannelIdList().isEmpty()){
             return R.FAIL("请求参数-所属企业不允许为空");
         }
+        if (orderParam.getChannelIdList().contains(0L)){
+            Long userId = SecurityUtils.getSysUser().getUserId();
+            List<Long> channelIdList =  sysUserService.findByUserIdListId(userId);
+            orderParam.setChannelIdList(channelIdList);
+        }
         IPage<Order> orderIPage = orderService.deliverList(page, orderParam);
         return R.SUCCESS(orderIPage);
     }
@@ -85,6 +94,11 @@ public class OrderController {
     @GetMapping("/deliverListStatusNum")
     @ApiOperation("后管端-快递订单列表-订单状态数量")
     public R<Map<String, Integer>> deliverListStatusNum(BackendOrderParam orderParam) {
+        if (orderParam.getChannelIdList().contains(0L)){
+            Long userId = SecurityUtils.getSysUser().getUserId();
+            List<Long> channelIdList =  sysUserService.findByUserIdListId(userId);
+            orderParam.setChannelIdList(channelIdList);
+        }
         return R.SUCCESS(orderService.deliverListStatusNum(orderParam));
     }
 
@@ -237,6 +251,11 @@ public class OrderController {
     public void export(BackendOrderParam orderParam, HttpServletResponse response) {
         if (orderParam.getChannelIdList()==null||orderParam.getChannelIdList().isEmpty()){
            throw new GlobalException("请求参数-所属企业不允许为空");
+        }
+        if (orderParam.getChannelIdList().contains(0L)){
+            Long userId = SecurityUtils.getSysUser().getUserId();
+            List<Long> channelIdList =  sysUserService.findByUserIdListId(userId);
+            orderParam.setChannelIdList(channelIdList);
         }
          orderService.export(orderParam,response);
     }

+ 20 - 1
yami-shop-platform/src/main/java/com/yami/shop/platform/controller/OrderRefundController.java

@@ -17,10 +17,13 @@ import com.yami.shop.common.exception.GlobalException;
 import com.yami.shop.common.util.PageParam;
 import com.yami.shop.common.util.R;
 import com.yami.shop.dao.*;
+import com.yami.shop.security.platform.util.SecurityUtils;
 import com.yami.shop.service.OrderRefundService;
+import com.yami.shop.sys.service.SysUserService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.AllArgsConstructor;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 
@@ -47,7 +50,8 @@ public class OrderRefundController {
 
     private final RefundAppointmentMapper refundAppointmentMapper;
     private final RefundDeliveryMapper refundDeliveryMapper;
-
+    @Autowired
+    private SysUserService sysUserService;
     /**
      * 分页查询
      *
@@ -116,6 +120,11 @@ public class OrderRefundController {
         if (orderRefund.getChannelIdList()==null||orderRefund.getChannelIdList().isEmpty()){
             return R.FAIL("请求参数-所属企业不允许为空");
         }
+        if (orderRefund.getChannelIdList().contains(0L)){
+            Long userId = SecurityUtils.getSysUser().getUserId();
+            List<Long> channelIdList =  sysUserService.findByUserIdListId(userId);
+            orderRefund.setChannelIdList(channelIdList);
+        }
         IPage<OrderRefundVo> page1 = orderRefundService.orderRefundPage(page, orderRefund);
         for (OrderRefundVo record : page1.getRecords()) {
             record.setOrderRefundSkuList(orderRefundskuMapper.selectByRefundId(record.getRefundId()));
@@ -129,6 +138,11 @@ public class OrderRefundController {
     @ApiOperation("统计退款订单数量")
     @GetMapping("/orderRefundCount")
     public R<OrderRefundCountParam> orderRefundCount(OrderRefundStaisticsParam orderRefund) {
+        if (orderRefund.getChannelIdList().contains(0L)){
+            Long userId = SecurityUtils.getSysUser().getUserId();
+            List<Long> channelIdList =  sysUserService.findByUserIdListId(userId);
+            orderRefund.setChannelIdList(channelIdList);
+        }
         return R.SUCCESS(orderRefundService.orderRefundCount(orderRefund));
     }
 
@@ -143,6 +157,11 @@ public class OrderRefundController {
         if (orderRefund.getChannelIdList()==null||orderRefund.getChannelIdList().isEmpty()){
             throw new GlobalException("请求参数-所属企业不允许为空");
         }
+        if (orderRefund.getChannelIdList().contains(0L)){
+            Long userId = SecurityUtils.getSysUser().getUserId();
+            List<Long> channelIdList =  sysUserService.findByUserIdListId(userId);
+            orderRefund.setChannelIdList(channelIdList);
+        }
         orderRefundService.export(orderRefund,response);
     }
 

+ 14 - 0
yami-shop-platform/src/main/java/com/yami/shop/platform/controller/PointsRechargeController.java

@@ -15,10 +15,12 @@ import com.yami.shop.security.platform.model.YamiSysUser;
 import com.yami.shop.security.platform.util.SecurityUtils;
 import com.yami.shop.service.PointsRechargeService;
 import com.yami.shop.service.UserService;
+import com.yami.shop.sys.service.SysUserService;
 import io.swagger.annotations.ApiOperation;
 import lombok.AllArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.ObjectUtils;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
@@ -40,6 +42,8 @@ import java.util.List;
 public class PointsRechargeController {
 
     private final PointsRechargeService pointsRechargeService;
+    @Autowired
+    private SysUserService sysUserService;
 
     /**
      * 分页获取积分充值列表
@@ -49,6 +53,11 @@ public class PointsRechargeController {
         if (pointsRecharge==null||pointsRecharge.getChannelIdList()==null||pointsRecharge.getChannelIdList().isEmpty()){
             return R.FAIL("请求参数-所属企业不允许为空");
         }
+        if (pointsRecharge.getChannelIdList().contains(0L)){
+            Long userId = SecurityUtils.getSysUser().getUserId();
+            List<Long> channelIdList =  sysUserService.findByUserIdListId(userId);
+            pointsRecharge.setChannelIdList(channelIdList);
+        }
         IPage<PointsRecharge> page = pointsRechargeService.page(pageParam,new LambdaQueryWrapper<PointsRecharge>()
                 .in(PointsRecharge::getChannelId,pointsRecharge.getChannelIdList())
                 .eq(ObjectUtils.isNotEmpty(pointsRecharge.getUserPhone()),PointsRecharge::getUserPhone,pointsRecharge.getUserPhone())
@@ -145,6 +154,11 @@ public class PointsRechargeController {
         if (pointsRecharge.getChannelIdList()==null||pointsRecharge.getChannelIdList().isEmpty()){
             throw new GlobalException("请求参数-所属企业不允许为空");
         }
+        if (pointsRecharge.getChannelIdList().contains(0L)){
+            Long userId = SecurityUtils.getSysUser().getUserId();
+            List<Long> channelIdList =  sysUserService.findByUserIdListId(userId);
+            pointsRecharge.setChannelIdList(channelIdList);
+        }
         pointsRechargeService.export(pointsRecharge,response);
     }
 

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

@@ -11,6 +11,7 @@ import com.yami.shop.common.util.PageParam;
 import com.yami.shop.common.util.R;
 import com.yami.shop.security.platform.util.SecurityUtils;
 import com.yami.shop.service.UserService;
+import com.yami.shop.sys.service.SysUserService;
 import io.swagger.annotations.ApiOperation;
 import lombok.SneakyThrows;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -19,6 +20,7 @@ import org.springframework.web.multipart.MultipartFile;
 
 import javax.servlet.http.HttpServletResponse;
 import java.util.Date;
+import java.util.List;
 
 @RestController
 @RequestMapping("/admin/enterprise")
@@ -26,6 +28,8 @@ public class UserEnterpriseController {
 
     @Autowired
     private UserService userService;
+    @Autowired
+    private SysUserService sysUserService;
 
     @GetMapping("/downloadErrorExcel")
     @ApiOperation("导出失败记录")
@@ -63,6 +67,11 @@ public class UserEnterpriseController {
         if (po.getChannelIdList()==null||po.getChannelIdList().isEmpty()){
             throw new GlobalException("请求参数-所属企业不允许为空");
         }
+        if (po.getChannelIdList().contains(0L)){
+            Long userId = SecurityUtils.getSysUser().getUserId();
+           List<Long> channelIdList =  sysUserService.findByUserIdListId(userId);
+            po.setChannelIdList(channelIdList);
+        }
         IPage<EnterpriseUserVo> userPage =  userService.enterpriseUserList(page,po);
         return R.SUCCESS(userPage);
     }
@@ -119,6 +128,11 @@ public class UserEnterpriseController {
         if (po.getChannelIdList()==null||po.getChannelIdList().isEmpty()){
             throw new GlobalException("请求参数-所属企业不允许为空");
         }
+        if (po.getChannelIdList().contains(0L)){
+            Long userId = SecurityUtils.getSysUser().getUserId();
+            List<Long> channelIdList =  sysUserService.findByUserIdListId(userId);
+            po.setChannelIdList(channelIdList);
+        }
         userService.export(po,response);
     }
 }

+ 2 - 0
yami-shop-sys/src/main/java/com/yami/shop/sys/service/SysUserService.java

@@ -62,4 +62,6 @@ public interface SysUserService extends IService<SysUser> {
 	IPage<SysUser> selectPage(String username,PageParam<SysUser> page);
 
     List<Channel> findByUserId(Long userId);
+
+	List<Long> findByUserIdListId(Long userId);
 }

+ 5 - 0
yami-shop-sys/src/main/java/com/yami/shop/sys/service/impl/SysUserServiceImpl.java

@@ -182,4 +182,9 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
     public List<Channel> findByUserId(Long userId) {
         return sysUserMapper.findByUserId(userId);
     }
+
+    @Override
+    public List<Long> findByUserIdListId(Long userId) {
+        return sysUserChannelMapper.listChannelByUserId(userId);
+    }
 }