浏览代码

fix:“优化订单分析筛选功能“

soobin 1 年之前
父节点
当前提交
70bfa33b19

+ 27 - 15
src/main/java/com/szwl/controller/TOrderController.java

@@ -489,12 +489,12 @@ public class TOrderController {
                     return R.fail(ResponseCodesEnum.A0001, "设备不存在");
                 }
             }
-            if (startDate != null) {
-                query.gt(TCoinOrder::getPayDate, startDate);
-            }
-            if (endDate != null) {
-                query.lt(TCoinOrder::getPayDate, endDate);
-            }
+//            if (startDate != null) {
+//                query.gt(TCoinOrder::getPayDate, startDate);
+//            }
+//            if (endDate != null) {
+//                query.lt(TCoinOrder::getPayDate, endDate);
+//            }
             SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
             if (StringUtils.isNotEmpty(startDate)) {
                 try {
@@ -1095,6 +1095,7 @@ public class TOrderController {
                     return R.fail(ResponseCodesEnum.A0001, "找不到商家");
                 }
                 n_adminId = admin.getId();
+
             }
             List<OrderDaoChuDTO> OrderDaoChuDTOList = new ArrayList<>();
             Long OrderDaoChuTotal = 0L;
@@ -1115,6 +1116,12 @@ public class TOrderController {
                         queryWrapper.eq(TOrder::getCompanyType, "1");
                     }
                 }
+                if (n_adminId != null) {
+                    queryWrapper.eq(TOrder::getAdminId, n_adminId);
+                }
+                if (StringUtils.isNotEmpty(clientId)) {
+                    queryWrapper.eq(TOrder::getClientId, clientId);
+                }
                 // ------ 分组 ------
                 if (type.equals("2")) {
                     queryWrapper.groupBy(TOrder::getAdminId);
@@ -1142,6 +1149,12 @@ public class TOrderController {
                         queryWrapper.eq(TCoinOrder::getCompanyType, "1");
                     }
                 }
+                if (n_adminId != null) {
+                    queryWrapper.eq(TCoinOrder::getAdminId, n_adminId);
+                }
+                if (StringUtils.isNotEmpty(clientId)) {
+                    queryWrapper.eq(TCoinOrder::getClientId, clientId);
+                }
                 // ------ 分组 ------
                 if (type.equals("2")) {
                     queryWrapper.groupBy(TCoinOrder::getAdminId);
@@ -1237,18 +1250,18 @@ public class TOrderController {
                 if (data == null || data.getId() == null) {
                     return R.fail(ResponseCodesEnum.A0001, "找不到商家");
                 }
-                adminId = data.getId();
+                n_adminId = data.getId();
             }
 
-            List<OrderDaoChuDTO> OrderDaoChuDTOList = new ArrayList<>();
+            List<OrderDaoChuDTO> orderDaoChuDTOList;
             if (ifForeign.equals("0")) {
                 //大陆
-                OrderDaoChuDTOList = orderService.orderDaoChu(simpleDateFormat.format(begin), simpleDateFormat.format(end), n_adminId, clientId, type, companyType, current, size);
+                orderDaoChuDTOList = orderService.orderDaoChu(simpleDateFormat.format(begin), simpleDateFormat.format(end), n_adminId, clientId, type, companyType, current, size);
             } else {
                 //查海外
-                OrderDaoChuDTOList = coinOrderService.orderDaoChu(simpleDateFormat.format(begin), simpleDateFormat.format(end), n_adminId, clientId, type, companyType, current, size);
+                orderDaoChuDTOList = coinOrderService.orderDaoChu(simpleDateFormat.format(begin), simpleDateFormat.format(end), n_adminId, clientId, type, companyType, current, size);
             }
-            for (OrderDaoChuDTO orderDaoChuDTO : OrderDaoChuDTOList) {
+            for (OrderDaoChuDTO orderDaoChuDTO : orderDaoChuDTOList) {
                 String adminId1 = orderDaoChuDTO.getAdminId().toString();
                 ResponseModel<TAdmin> admin1 = szwlFeign.getAdmin(adminId1);
                 TAdmin admin = admin1.getData();
@@ -1269,7 +1282,7 @@ public class TOrderController {
 //                        orderDaoChuDTO.setEquipmentTotal(String.valueOf(stringList.size()));
 //                    }
                     List<TEquipment> equipmentList = R.getDataIfSuccess(szwlFeign.listEquipment(adminId1));
-                    if (equipmentList != null && equipmentList.size() > 0) {
+                    if (equipmentList != null && !equipmentList.isEmpty()) {
                         orderDaoChuDTO.setEquipmentTotal(String.valueOf(equipmentList.size()));
                     }
                     //商户为单位
@@ -1295,7 +1308,7 @@ public class TOrderController {
             Workbook workbook = null;
             if (!StringUtils.isEmpty(type) && type.equals("2")) {
                 List<OrderByAdminTarget> orderByAdminTargetList = new ArrayList<>();
-                for (OrderDaoChuDTO orderDaoChuDTO : OrderDaoChuDTOList) {
+                for (OrderDaoChuDTO orderDaoChuDTO : orderDaoChuDTOList) {
                     OrderByAdminTarget orderByAdminTarget = new OrderByAdminTarget();
                     orderByAdminTarget.setUsername(orderDaoChuDTO.getUsername());
                     orderByAdminTarget.setAddress(orderDaoChuDTO.getAddress());
@@ -1309,7 +1322,7 @@ public class TOrderController {
                 workbook = ExcelExportUtil.exportExcel(exportParams, OrderByAdminTarget.class, orderByAdminTargetList);
             } else {
                 List<OrderByClientidTarget> orderByClientidTargetList = new ArrayList<>();
-                for (OrderDaoChuDTO orderDaoChuDTO : OrderDaoChuDTOList) {
+                for (OrderDaoChuDTO orderDaoChuDTO : orderDaoChuDTOList) {
                     OrderByClientidTarget orderByClientidTarget = new OrderByClientidTarget();
                     orderByClientidTarget.setAddress(orderDaoChuDTO.getAddress());
                     orderByClientidTarget.setClientId(orderDaoChuDTO.getClientId());
@@ -1547,7 +1560,6 @@ public class TOrderController {
                 }
             }
         }
-        ;
 
         //1,线下
         if (type.equals("1")) {

+ 3 - 0
src/main/java/com/szwl/mapper/xml/TCoinOrderMapper.xml

@@ -73,6 +73,9 @@
         <if test="clientId != null and clientId !=''">
             and client_id = #{clientId}
         </if>
+        <if test="adminId != null and adminId !=''">
+            and admin_id = #{adminId}
+        </if>
         <choose>
             <when test="companyType != null and companyType !='' and companyType.equals(&quot;0&quot;)">
                 AND (company_type IS NULL OR company_type = '0')

+ 3 - 0
src/main/java/com/szwl/mapper/xml/TOrderMapper.xml

@@ -354,6 +354,9 @@
         <if test="clientId != null and clientId !=''">
             and client_id = #{clientId}
         </if>
+        <if test="adminId != null and adminId !=''">
+            and admin_id = #{adminId}
+        </if>
         <choose>
             <when test="companyType != null and companyType !='' and companyType.equals(&quot;0&quot;)">
                 AND (company_type IS NULL OR company_type = '0')