wangming 2 tuần trước cách đây
mục cha
commit
4e442e748e
17 tập tin đã thay đổi với 320 bổ sung43 xóa
  1. 2 2
      yami-shop-api/src/main/resources/redisson/redisson-dev.yml
  2. 24 8
      yami-shop-bean/src/main/java/com/yami/shop/bean/vo/FreightStatisticsVo.java
  3. 8 1
      yami-shop-platform/src/main/java/com/yami/shop/platform/controller/ChannelController.java
  4. 45 4
      yami-shop-platform/src/main/java/com/yami/shop/platform/controller/OrderController.java
  5. 45 1
      yami-shop-platform/src/main/java/com/yami/shop/platform/controller/OrderRefundController.java
  6. 46 1
      yami-shop-platform/src/main/java/com/yami/shop/platform/controller/PointsRechargeController.java
  7. 3 13
      yami-shop-platform/src/main/java/com/yami/shop/platform/controller/SkuController.java
  8. 31 0
      yami-shop-platform/src/main/java/com/yami/shop/platform/controller/UserEnterpriseController.java
  9. 2 2
      yami-shop-platform/src/main/resources/redisson/redisson-dev.yml
  10. 5 0
      yami-shop-service/src/main/java/com/yami/shop/dao/SkuMapper.java
  11. 5 1
      yami-shop-service/src/main/java/com/yami/shop/service/SkuService.java
  12. 20 6
      yami-shop-service/src/main/java/com/yami/shop/service/impl/SkuServiceImpl.java
  13. 1 1
      yami-shop-service/src/main/resources/mapper/OrderRefundMapper.xml
  14. 69 0
      yami-shop-service/src/main/resources/mapper/SkuMapper.xml
  15. 2 0
      yami-shop-sys/src/main/java/com/yami/shop/sys/controller/SysUserController.java
  16. 2 0
      yami-shop-sys/src/main/java/com/yami/shop/sys/service/SysUserService.java
  17. 10 3
      yami-shop-sys/src/main/java/com/yami/shop/sys/service/impl/SysUserServiceImpl.java

+ 2 - 2
yami-shop-api/src/main/resources/redisson/redisson-dev.yml

@@ -1,8 +1,8 @@
 # 单节点设置
 singleServerConfig:
-  address: redis://47.109.23.229:6379
+  address: redis://47.109.84.152:6379
   database: 5
-  password: zswladmin
+  password:
   idleConnectionTimeout: 10000
   pingTimeout: 1000
   connectTimeout: 10000

+ 24 - 8
yami-shop-bean/src/main/java/com/yami/shop/bean/vo/FreightStatisticsVo.java

@@ -1,45 +1,61 @@
 
 package com.yami.shop.bean.vo;
 
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.AllArgsConstructor;
 import lombok.Data;
 import lombok.NoArgsConstructor;
-import org.springframework.format.annotation.DateTimeFormat;
-
-import java.util.Date;
 
 @Data
 @NoArgsConstructor
 @AllArgsConstructor
 public class FreightStatisticsVo {
 
+    @ApiModelProperty("排序")
+    @ExcelProperty("序号")
+    private Integer sort;
+
     @ApiModelProperty("日期")
-    @DateTimeFormat(pattern="yyyy/MM/dd")
-    private Date date;
+    @ExcelProperty("日期")
+    @JsonFormat(pattern = "yyyy/MM/dd")
+    private String payTime;
 
     @ApiModelProperty("寄方")
-    private String sendSize;
+    @ExcelProperty("寄方")
+    private String sendSize = "中数未来(贵州)商业服务有限公司";
 
     @ApiModelProperty("收方")
+    @ExcelProperty("收方")
     private String receiver;
 
     @ApiModelProperty("运输公司")
-    private String delivery;
+    @ExcelProperty("运输公司")
+    private String delivery = "邮政";
 
     @ApiModelProperty("运单号")
+    @ExcelProperty("运单号")
     private String deliveryNo;
 
     @ApiModelProperty("寄件地区")
-    private String sendArea;
+    @ExcelProperty("寄件地区")
+    private String sendArea = "铜仁市";
 
     @ApiModelProperty("到件地址")
+    @ExcelProperty("到件地址")
     private String toAddress;
 
+    @ApiModelProperty("经手人")
+    @ExcelProperty("经手人")
+    private String handler = "谭靖";
+
     @ApiModelProperty("费用")
+    @ExcelProperty("费用(元)")
     private String money;
 
     @ApiModelProperty("订/退单号")
+    @ExcelProperty("订/退单号")
     private String orderNo;
 
 

+ 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);
     }
 }

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

@@ -17,26 +17,27 @@ 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;
 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;
 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;
 
 /**
@@ -61,6 +62,8 @@ public class OrderController {
     private final OrderSettlementService orderSettlementService;
     private final AppConnectMapper appConnectMapper;
 
+    @Autowired
+    private SysUserService sysUserService;
     /**
      * 分页获取
      */
@@ -77,6 +80,16 @@ 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);
+            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);
     }
@@ -84,6 +97,19 @@ public class OrderController {
     @GetMapping("/deliverListStatusNum")
     @ApiOperation("后管端-快递订单列表-订单状态数量")
     public R<Map<String, Integer>> deliverListStatusNum(BackendOrderParam orderParam) {
+        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);
+            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));
     }
 
@@ -236,6 +262,21 @@ 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 = null;
+            try {
+                userId = SecurityUtils.getSysUser().getUserId();
+            } catch (Exception e) {
+                throw new GlobalException("获取当前登录用户失败");
+            }
+            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);
     }

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

@@ -13,18 +13,23 @@ 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;
 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.*;
 
 import javax.servlet.http.HttpServletResponse;
+import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -47,7 +52,8 @@ public class OrderRefundController {
 
     private final RefundAppointmentMapper refundAppointmentMapper;
     private final RefundDeliveryMapper refundDeliveryMapper;
-
+    @Autowired
+    private SysUserService sysUserService;
     /**
      * 分页查询
      *
@@ -116,6 +122,16 @@ 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);
+            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()) {
             record.setOrderRefundSkuList(orderRefundskuMapper.selectByRefundId(record.getRefundId()));
@@ -129,6 +145,19 @@ public class OrderRefundController {
     @ApiOperation("统计退款订单数量")
     @GetMapping("/orderRefundCount")
     public R<OrderRefundCountParam> orderRefundCount(OrderRefundStaisticsParam orderRefund) {
+        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);
+            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));
     }
 
@@ -143,6 +172,21 @@ public class OrderRefundController {
         if (orderRefund.getChannelIdList()==null||orderRefund.getChannelIdList().isEmpty()){
             throw new GlobalException("请求参数-所属企业不允许为空");
         }
+        if (orderRefund.getChannelIdList().contains(0L)){
+            Long userId = null;
+            try {
+                userId = SecurityUtils.getSysUser().getUserId();
+            } catch (Exception e) {
+                throw new GlobalException("获取当前登录用户失败");
+            }
+            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);
     }
 

+ 46 - 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;
@@ -15,15 +16,18 @@ 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;
 
 import javax.servlet.http.HttpServletResponse;
 import javax.validation.Valid;
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 
@@ -40,6 +44,8 @@ import java.util.List;
 public class PointsRechargeController {
 
     private final PointsRechargeService pointsRechargeService;
+    @Autowired
+    private SysUserService sysUserService;
 
     /**
      * 分页获取积分充值列表
@@ -49,8 +55,18 @@ 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);
+            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)
         );
@@ -63,6 +79,19 @@ public class PointsRechargeController {
      */
     @GetMapping("/statisticsList")
     public R<IPage<PointsRechargeVO>> statisticsList(PageParam<PointsRecharge> pageParam, PointsRecharge pointsRecharge) {
+        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);
+            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);
     }
@@ -145,6 +174,22 @@ public class PointsRechargeController {
         if (pointsRecharge.getChannelIdList()==null||pointsRecharge.getChannelIdList().isEmpty()){
             throw new GlobalException("请求参数-所属企业不允许为空");
         }
+        if (pointsRecharge.getChannelIdList().contains(0L)){
+            Long userId = null;
+            try {
+                userId = SecurityUtils.getSysUser().getUserId();
+            } catch (Exception e) {
+                throw new GlobalException("获取当前登录用户失败");
+            }
+            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);
     }
 

+ 3 - 13
yami-shop-platform/src/main/java/com/yami/shop/platform/controller/SkuController.java

@@ -11,7 +11,6 @@
 package com.yami.shop.platform.controller;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.yami.shop.bean.model.Sku;
 import com.yami.shop.bean.po.FreightStatisticsPo;
 import com.yami.shop.bean.po.SkuStatisticsPo;
@@ -66,23 +65,14 @@ public class SkuController {
 
     @GetMapping("/freightStatisticsList")
     @ApiOperation(value = "运费明细表-列表")
-    public R<IPage<FreightStatisticsVo>> skuStatisticsList(PageParam<FreightStatisticsPo> page, FreightStatisticsPo po) {
-        IPage<FreightStatisticsVo> commList = new Page<>();
-        return R.SUCCESS(commList);
+    public R<IPage<FreightStatisticsVo>> freightStatisticsList(PageParam<FreightStatisticsPo> page, FreightStatisticsPo po) {
+        return R.SUCCESS(skuService.freightStatisticsList(page,po));
     }
 
     @GetMapping("/freightStatisticsExcel")
     @ApiOperation("运费明细表-导出")
     public R<Void> freightStatisticsExcel(HttpServletResponse response, FreightStatisticsPo po) {
+        skuService.freightStatisticsExcel(response,po);
         return R.SUCCESS();
     }
-
-
-    @GetMapping("/test")
-    @ApiOperation("导出测试")
-    public R<Void> test(HttpServletResponse response) {
-        skuService.test(response);
-        return R.SUCCESS();
-    }
-
 }

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

@@ -6,11 +6,13 @@ 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;
 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;
@@ -18,7 +20,9 @@ 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;
 
 @RestController
 @RequestMapping("/admin/enterprise")
@@ -26,6 +30,8 @@ public class UserEnterpriseController {
 
     @Autowired
     private UserService userService;
+    @Autowired
+    private SysUserService sysUserService;
 
     @GetMapping("/downloadErrorExcel")
     @ApiOperation("导出失败记录")
@@ -63,6 +69,16 @@ 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);
+            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);
     }
@@ -119,6 +135,21 @@ public class UserEnterpriseController {
         if (po.getChannelIdList()==null||po.getChannelIdList().isEmpty()){
             throw new GlobalException("请求参数-所属企业不允许为空");
         }
+        if (po.getChannelIdList().contains(0L)){
+            Long userId = null;
+            try {
+                userId = SecurityUtils.getSysUser().getUserId();
+            } catch (Exception e) {
+                throw new GlobalException("获取当前登录用户失败");
+            }
+            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);
     }
 }

+ 2 - 2
yami-shop-platform/src/main/resources/redisson/redisson-dev.yml

@@ -1,8 +1,8 @@
 # 单节点设置
 singleServerConfig:
-  address: redis://192.168.1.242:6379
+  address: redis://47.109.84.152:6379
   database: 1
-  password: FaajjVy8rl(k
+  password:
   idleConnectionTimeout: 10000
   pingTimeout: 1000
   connectTimeout: 10000

+ 5 - 0
yami-shop-service/src/main/java/com/yami/shop/dao/SkuMapper.java

@@ -13,7 +13,9 @@ package com.yami.shop.dao;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.yami.shop.bean.model.Sku;
+import com.yami.shop.bean.po.FreightStatisticsPo;
 import com.yami.shop.bean.po.SkuStatisticsPo;
+import com.yami.shop.bean.vo.FreightStatisticsVo;
 import com.yami.shop.bean.vo.SkuBuyTogetherOftenVo;
 import com.yami.shop.bean.vo.SkuStatisticsVo;
 import com.yami.shop.common.util.PageParam;
@@ -67,4 +69,7 @@ public interface SkuMapper extends BaseMapper<Sku> {
 
     IPage<SkuStatisticsVo> skuStatisticsList(@Param("page") PageParam<SkuStatisticsPo> page, @Param("po") SkuStatisticsPo po);
     List<SkuStatisticsVo> skuStatisticsList2(@Param("po") SkuStatisticsPo po);
+
+    IPage<FreightStatisticsVo> freightStatisticsList(@Param("page") PageParam<FreightStatisticsPo> page, @Param("po") FreightStatisticsPo po);
+    List<FreightStatisticsVo> freightStatisticsList2(@Param("po") FreightStatisticsPo po);
 }

+ 5 - 1
yami-shop-service/src/main/java/com/yami/shop/service/SkuService.java

@@ -13,7 +13,9 @@ package com.yami.shop.service;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.yami.shop.bean.model.Sku;
+import com.yami.shop.bean.po.FreightStatisticsPo;
 import com.yami.shop.bean.po.SkuStatisticsPo;
+import com.yami.shop.bean.vo.FreightStatisticsVo;
 import com.yami.shop.bean.vo.SkuBuyTogetherOftenVo;
 import com.yami.shop.bean.vo.SkuStatisticsVo;
 import com.yami.shop.common.util.PageParam;
@@ -74,5 +76,7 @@ public interface SkuService extends IService<Sku> {
 
     void skuStatisticsExcel(HttpServletResponse response, SkuStatisticsPo po);
 
-    void test(HttpServletResponse response);
+    void freightStatisticsExcel(HttpServletResponse response, FreightStatisticsPo po);
+
+    IPage<FreightStatisticsVo> freightStatisticsList(PageParam<FreightStatisticsPo> page, FreightStatisticsPo po);
 }

+ 20 - 6
yami-shop-service/src/main/java/com/yami/shop/service/impl/SkuServiceImpl.java

@@ -19,11 +19,11 @@ import com.alibaba.excel.write.style.HorizontalCellStyleStrategy;
 import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.google.common.collect.Lists;
 import com.yami.shop.bean.model.Sku;
+import com.yami.shop.bean.po.FreightStatisticsPo;
 import com.yami.shop.bean.po.SkuStatisticsPo;
+import com.yami.shop.bean.vo.FreightStatisticsVo;
 import com.yami.shop.bean.vo.SkuBuyTogetherOftenVo;
-import com.yami.shop.bean.vo.SkuStatisticsExcel;
 import com.yami.shop.bean.vo.SkuStatisticsVo;
 import com.yami.shop.common.exception.GlobalException;
 import com.yami.shop.common.util.PageParam;
@@ -41,6 +41,8 @@ import org.springframework.stereotype.Service;
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 import java.net.URLEncoder;
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
@@ -203,13 +205,20 @@ public class SkuServiceImpl extends ServiceImpl<SkuMapper, Sku> implements SkuSe
     }
 
     @Override
-    public void test(HttpServletResponse response) {
+    public void freightStatisticsExcel(HttpServletResponse response,FreightStatisticsPo po) {
         try {
-            List<SkuStatisticsExcel> list = Lists.newArrayList();
+            List<FreightStatisticsVo> list = skuMapper.freightStatisticsList2(po);
+            if (!list.isEmpty()){
+                list.forEach(c->{
+                    LocalDateTime dateTime = LocalDateTime.parse(c.getPayTime(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
+                    String result = dateTime.format(DateTimeFormatter.ofPattern("yyyy/MM/dd"));
+                    c.setPayTime(result);
+                });
+            }
             response.setCharacterEncoding("utf-8");
-            String fileName = URLEncoder.encode("对账汇总表", "UTF-8").replaceAll("\\+", "%20");
+            String fileName = URLEncoder.encode("运费汇总表", "UTF-8").replaceAll("\\+", "%20");
             response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx");
-            EasyExcel.write(response.getOutputStream(), SkuStatisticsExcel.class)
+            EasyExcel.write(response.getOutputStream(), FreightStatisticsVo.class)
                     .registerWriteHandler(new LongestMatchColumnWidthStyleStrategy())
                     .sheet("列表").doWrite(list);
         } catch (IOException e) {
@@ -217,4 +226,9 @@ public class SkuServiceImpl extends ServiceImpl<SkuMapper, Sku> implements SkuSe
         }
     }
 
+    @Override
+    public IPage<FreightStatisticsVo> freightStatisticsList(PageParam<FreightStatisticsPo> page, FreightStatisticsPo po) {
+        return skuMapper.freightStatisticsList(page,po);
+    }
+
 }

+ 1 - 1
yami-shop-service/src/main/resources/mapper/OrderRefundMapper.xml

@@ -447,7 +447,7 @@
         COUNT(CASE WHEN re.return_money_sts = 65 THEN 1 END) AS buyerDeliveryCount,
         COUNT(CASE WHEN re.return_money_sts = 70 THEN 1 END) AS refundCompleteCount
         FROM tz_order_refund re
-        left join tz_order o on refund.order_id = o.order_id
+        left join tz_order o on re.order_id = o.order_id
         <where>
             <if test="orderRefund.orderNumber != null">
                 and re.order_number = #{orderRefund.orderNumber}

+ 69 - 0
yami-shop-service/src/main/resources/mapper/SkuMapper.xml

@@ -590,4 +590,73 @@
         GROUP BY a.sku_id HAVING prod_count>0
     </select>
 
+    <select id="freightStatisticsList" resultType="com.yami.shop.bean.vo.FreightStatisticsVo">
+        SELECT @row_number := @row_number + 1 AS sort,a.pay_time,CONCAT(b.receiver,'  ',b.mobile) receiver,a.dvy_flow_id delivery_no,b.address to_address,a.freight_amount money,a.order_number order_no
+        FROM (SELECT @row_number := 0) sort,
+        tz_order a
+        LEFT JOIN tz_user_addr_order b on a.addr_order_id =b.addr_order_id
+        WHERE a.is_payed=1 and a.dvy_type=1 and a.hb_order_status not in(0,60)
+        and a.channel_id in
+        <foreach collection="po.channelIds" item="id" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+
+        <if test="po.receiver != null and po.receiver != ''">
+            AND b.receiver like concat('%',#{po.receiver} ,'%')
+        </if>
+        <if test="po.mobile != null and po.mobile != ''">
+            AND b.mobile like concat('%',#{po.mobile} ,'%')
+        </if>
+        <if test="po.deliveryNo != null and po.deliveryNo != ''">
+            AND a.dvy_flow_id like concat('%',#{po.deliveryNo} ,'%')
+        </if>
+        <if test="po.toAddress != null and po.toAddress != ''">
+            AND b.address like concat('%',#{po.toAddress} ,'%')
+        </if>
+        <if test="po.orderNo != null and po.orderNo != ''">
+            AND a.order_number like concat('%',#{po.orderNo} ,'%')
+        </if>
+        <if test="po.startTime != null and po.startTime != ''">
+            and a.pay_time&gt;= #{po.startTime}
+        </if>
+        <if test="po.endTime != null and po.endTime != ''">
+            and a.pay_time&lt;= #{po.endTime}
+        </if>
+    </select>
+
+    <select id="freightStatisticsList2" resultType="com.yami.shop.bean.vo.FreightStatisticsVo">
+        SELECT @row_number := @row_number + 1 AS sort,a.pay_time,CONCAT(b.receiver,'  ',b.mobile) receiver,a.dvy_flow_id delivery_no,b.address to_address,a.freight_amount money,a.order_number order_no
+        FROM (SELECT @row_number := 0) sort,
+        tz_order a
+        LEFT JOIN tz_user_addr_order b on a.addr_order_id =b.addr_order_id
+        WHERE a.is_payed=1 and a.dvy_type=1 and a.hb_order_status not in(0,60)
+        and a.channel_id in
+        <foreach collection="po.channelIds" item="id" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+
+        <if test="po.receiver != null and po.receiver != ''">
+            AND b.receiver like concat('%',#{po.receiver} ,'%')
+        </if>
+        <if test="po.mobile != null and po.mobile != ''">
+            AND b.mobile like concat('%',#{po.mobile} ,'%')
+        </if>
+        <if test="po.deliveryNo != null and po.deliveryNo != ''">
+            AND a.dvy_flow_id like concat('%',#{po.deliveryNo} ,'%')
+        </if>
+        <if test="po.toAddress != null and po.toAddress != ''">
+            AND b.address like concat('%',#{po.toAddress} ,'%')
+        </if>
+        <if test="po.orderNo != null and po.orderNo != ''">
+            AND a.order_number like concat('%',#{po.orderNo} ,'%')
+        </if>
+        <if test="po.startTime != null and po.startTime != ''">
+            and a.pay_time&gt;= #{po.startTime}
+        </if>
+        <if test="po.endTime != null and po.endTime != ''">
+            and a.pay_time&lt;= #{po.endTime}
+        </if>
+    </select>
+
+
 </mapper>

+ 2 - 0
yami-shop-sys/src/main/java/com/yami/shop/sys/controller/SysUserController.java

@@ -101,6 +101,8 @@ public class SysUserController {
 		user.setUserId(null);
 		//获取用户所属的角色列表
 		List<Long> roleIdList = sysRoleService.listRoleIdByUserId(userId);
+		//获取用户所属企业列表
+		user.setChannelIdList(sysUserService.findByUserIdListId(userId));
 		user.setRoleIdList(roleIdList);
 		return  R.SUCCESS(user);
 	}

+ 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);
 }

+ 10 - 3
yami-shop-sys/src/main/java/com/yami/shop/sys/service/impl/SysUserServiceImpl.java

@@ -98,12 +98,14 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
         sysUserChannelMapper.deleteByUserId(user.getUserId());
         if (CollUtil.isEmpty(user.getRoleIdList())&& CollUtil.isEmpty(user.getChannelIdList())) {
             return;
-        }else if (!CollUtil.isEmpty(user.getRoleIdList())){
+        }
+        if (!CollUtil.isEmpty(user.getRoleIdList())){
             //保存用户与角色关系
             sysUserRoleMapper.insertUserAndUserRole(user.getUserId(), user.getRoleIdList());
-        }else if (!CollUtil.isEmpty(user.getChannelIdList())){
+        }
+        if (!CollUtil.isEmpty(user.getChannelIdList())){
             //保存用户与企业关系
-            sysUserChannelMapper.insertUserAndUserChannel(user.getUserId(), user.getRoleIdList());
+            sysUserChannelMapper.insertUserAndUserChannel(user.getUserId(), user.getChannelIdList());
         }
 
         // 更新用户部门信息
@@ -182,4 +184,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);
+    }
 }