Bläddra i källkod

订单词典开发

zhangxin 1 vecka sedan
förälder
incheckning
aeb9d53803

+ 2 - 1
yami-shop-bean/src/main/java/com/yami/shop/bean/param/BackendOrderParam.java

@@ -15,6 +15,7 @@ import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import org.springframework.format.annotation.DateTimeFormat;
 
+import javax.print.DocFlavor;
 import java.util.Date;
 import java.util.List;
 
@@ -90,6 +91,6 @@ public class BackendOrderParam {
      * 20251203 v1.1.3
      * 人员属性 0-全部 1-正常人员 2-测试人员
      */
-    private Integer userAttrType;
+    private String userAttrType;
 
 }

+ 13 - 29
yami-shop-platform/src/main/java/com/yami/shop/platform/controller/OrderController.java

@@ -10,6 +10,7 @@
 
 package com.yami.shop.platform.controller;
 
+import cn.hutool.core.util.ObjectUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -30,6 +31,7 @@ import com.yami.shop.utils.CullenUtils;
 import com.yami.shop.wx.service.impl.WxProviderServiceImpl;
 import io.swagger.annotations.ApiOperation;
 import lombok.AllArgsConstructor;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.format.annotation.DateTimeFormat;
 import org.springframework.security.access.prepost.PreAuthorize;
@@ -77,19 +79,7 @@ public class OrderController {
     @GetMapping("/deliverList")
     @ApiOperation("后管端-快递订单列表")
     public R<IPage<Order>> deliverList(BackendOrderParam orderParam, PageParam<Order> page) {
-        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);
-            }
-        }
+        getBackendOrderParam(orderParam);
         IPage<Order> orderIPage = orderService.deliverList(page, orderParam);
         return R.SUCCESS(orderIPage);
     }
@@ -97,19 +87,7 @@ 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);
-            }
-        }
+        getBackendOrderParam(orderParam);
         return R.SUCCESS(orderService.deliverListStatusNum(orderParam));
     }
 
@@ -260,8 +238,16 @@ public class OrderController {
     @GetMapping("/export")
     @ApiOperation("后管端-快递订单列表导出")
     public void export(BackendOrderParam orderParam, HttpServletResponse response) {
+        getBackendOrderParam(orderParam);
+         orderService.export(orderParam,response);
+    }
+
+    private void getBackendOrderParam(BackendOrderParam orderParam){
         if (orderParam.getChannelIdList()==null||orderParam.getChannelIdList().isEmpty()){
-           throw new GlobalException("请求参数-所属企业不允许为空");
+            throw new GlobalException("请求参数-所属企业不允许为空");
+        }
+        if (ObjectUtil.isEmpty(orderParam.getUserAttrType())){
+            orderParam.setUserAttrType("1");//默认查询正常人员属性
         }
         if (orderParam.getChannelIdList().contains(0L)){
             Long userId = null;
@@ -278,7 +264,5 @@ public class OrderController {
                 orderParam.setChannelIdList(longs);
             }
         }
-         orderService.export(orderParam,response);
     }
-
 }

+ 6 - 17
yami-shop-platform/src/main/java/com/yami/shop/platform/controller/UserEnterpriseController.java

@@ -67,22 +67,7 @@ public class UserEnterpriseController {
     @ApiOperation("员工列表")
     @GetMapping("/enterpriseUserList")
     public R<IPage<EnterpriseUserVo>> enterpriseUserList(EnterpriseUserPo po, PageParam<EnterpriseUserPo> page) {
-        if (po.getChannelIdList()==null||po.getChannelIdList().isEmpty()){
-            throw new GlobalException("请求参数-所属企业不允许为空");
-        }
-        if (ObjectUtil.isEmpty(po.getUserAttrType())){
-            po.setUserAttrType("1");//默认查询正常人员属性
-        }
-        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);
-            }
-        }
+        getEnterpriseUserPo(po);
         IPage<EnterpriseUserVo> userPage =  userService.enterpriseUserList(page,po);
         return R.SUCCESS(userPage);
     }
@@ -137,6 +122,11 @@ public class UserEnterpriseController {
     @GetMapping("/export")
     @ApiOperation("后管端-用户列表导出")
     public void export(EnterpriseUserPo po, HttpServletResponse response) {
+        getEnterpriseUserPo(po);
+        userService.export(po,response);
+    }
+
+    private void getEnterpriseUserPo(EnterpriseUserPo po){
         if (po.getChannelIdList()==null||po.getChannelIdList().isEmpty()){
             throw new GlobalException("请求参数-所属企业不允许为空");
         }
@@ -158,6 +148,5 @@ public class UserEnterpriseController {
                 po.setChannelIdList(longs);
             }
         }
-        userService.export(po,response);
     }
 }

+ 11 - 3
yami-shop-service/src/main/resources/mapper/OrderMapper.xml

@@ -496,10 +496,10 @@
                 </foreach>
             </if>
             <if test="orderParam.dvyType != null and orderParam.dvyType != ''">
-                and d.dvy_type = #{orderParam.dvyType}
+                and a.dvy_type = #{orderParam.dvyType}
             </if>
-            <if test="orderParam.userAttrType != null and orderParam.userAttrType != 0">
-                AND d.user_attr_type = #{userAttrType}
+            <if test="orderParam.userAttrType != null and orderParam.userAttrType != '' and orderParam.userAttrType != 0">
+                AND d.user_attr_type = #{orderParam.userAttrType}
             </if>
             <if test="orderParam.shopId != null">
                 and a.shop_id = #{orderParam.shopId}
@@ -1013,6 +1013,7 @@
         SELECT count(a.order_id) FROM `tz_order` a
         LEFT JOIN tz_user_addr_order b on a.addr_order_id=b.addr_order_id
         LEFT JOIN tz_shop_detail c on a.shop_id=c.shop_id
+        left join  tz_user d on a.user_id = d.user_id
         <where>
             hb_order_status in
             <foreach collection="status" item="status" separator="," open="(" close=")">
@@ -1030,6 +1031,9 @@
             <if test="orderParam.dvyType != null and orderParam.dvyType != ''">
                 and a.dvy_type = #{orderParam.dvyType}
             </if>
+            <if test="orderParam.userAttrType != null and orderParam.userAttrType != '' and orderParam.userAttrType != 0">
+                AND d.user_attr_type = #{orderParam.userAttrType}
+            </if>
             <if test="orderParam.shopId != null">
                 and a.shop_id = #{orderParam.shopId}
             </if>
@@ -1173,6 +1177,7 @@
         LEFT JOIN tz_user_addr_order b on a.addr_order_id=b.addr_order_id
         LEFT JOIN tz_shop_detail c on a.shop_id=c.shop_id
         LEFT JOIN tz_channel d on a.channel_id=d.id
+        left join  tz_user e on a.user_id = e.user_id
         <where>
             <if test="orderParam.orderNumber != null and orderParam.orderNumber != ''">
                 and a.order_number = #{orderParam.orderNumber}
@@ -1183,6 +1188,9 @@
                     #{channelId}
                 </foreach>
             </if>
+            <if test="orderParam.userAttrType != null and orderParam.userAttrType != '' and orderParam.userAttrType != 0">
+                AND e.user_attr_type = #{orderParam.userAttrType}
+            </if>
             <if test="orderParam.dvyType != null and orderParam.dvyType != ''">
                 and a.dvy_type = #{orderParam.dvyType}
             </if>