فهرست منبع

feat:区分爆米花数据

soobin 2 سال پیش
والد
کامیت
b4e1d51b58

+ 41 - 11
src/main/java/com/szwl/controller/TOrderController.java

@@ -83,8 +83,7 @@ public class TOrderController {
     public ResponseModel<IPage<?>> pageOrder(String equipmentId, String adminId, String adminType,
     public ResponseModel<IPage<?>> pageOrder(String equipmentId, String adminId, String adminType,
                                              String type, String sn, String status, String userName,
                                              String type, String sn, String status, String userName,
                                              String payType, String productNo, String clientId,
                                              String payType, String productNo, String clientId,
-                                             String trxNo, String dateType, String startDate, String companyType,
-                                             String endDate, long current, long size) {
+                                             String trxNo, String dateType, String startDate, String companyType, String machineType, String endDate, long current, long size) {
         //判断当前账号状态
         //判断当前账号状态
         TAdmin admin = R.getDataIfSuccess(szwlFeign.getAdmin(adminId));
         TAdmin admin = R.getDataIfSuccess(szwlFeign.getAdmin(adminId));
         if (StringUtils.isEmpty(type)) {
         if (StringUtils.isEmpty(type)) {
@@ -214,6 +213,15 @@ public class TOrderController {
                     query.eq(TOrder::getCompanyType, companyType);
                     query.eq(TOrder::getCompanyType, companyType);
                 }
                 }
             }
             }
+            if (StringUtils.isNotEmpty(machineType)) {
+                if (machineType.equals("0")) {
+                    query.isNull(TOrder::getMachineType).or()
+                            .eq(TOrder::getMachineType, machineType);
+                } else {
+                    query.eq(TOrder::getMachineType, machineType);
+                }
+            }
+
             if (StringUtils.isNotEmpty(clientId)) {
             if (StringUtils.isNotEmpty(clientId)) {
                 TEquipment equipment = R.getDataIfSuccess(szwlFeign.findEquipmentByClientId(clientId));
                 TEquipment equipment = R.getDataIfSuccess(szwlFeign.findEquipmentByClientId(clientId));
                 //判断机器是否属于这个登陆账号
                 //判断机器是否属于这个登陆账号
@@ -572,11 +580,6 @@ public class TOrderController {
         return R.fail(ResponseCodesEnum.A0001);
         return R.fail(ResponseCodesEnum.A0001);
     }
     }
 
 
-    /**
-     * 获取首页数据统计
-     *
-     * @return
-     */
     private String isForeignUser(String userId) {
     private String isForeignUser(String userId) {
         if (StringUtils.isNotEmpty(userId)) {
         if (StringUtils.isNotEmpty(userId)) {
             try {
             try {
@@ -1290,10 +1293,11 @@ public class TOrderController {
     }
     }
 
 
     @RequestMapping(value = "/orderExport", method = RequestMethod.GET)
     @RequestMapping(value = "/orderExport", method = RequestMethod.GET)
-    public Object orderExport(HttpServletResponse response, String adminId, String adminType,
-                              String type, String userName, String payType, String productNo,
-                              String clientId, String dateType, String startDate, String endDate,
-                              String status, String equipmentId, long current, long size) throws ParseException {
+    public Object orderExport(HttpServletResponse response, String equipmentId, String adminId,
+                              String adminType, String type, String status, String userName,
+                              String payType, String productNo, String clientId, String dateType,
+                              String startDate, String endDate, String companyType, String machineType,
+                              long current, long size) throws ParseException {
         current = 1L;
         current = 1L;
         size = 1000L;
         size = 1000L;
         SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@@ -1503,6 +1507,32 @@ public class TOrderController {
                     }
                     }
                 }
                 }
             }
             }
+            // 公司平台
+            // 申泽平台管理员
+            if (admin.getId() == 2738) {
+                companyType = "0";
+            }
+            // 七云平台管理员
+            if (admin.getId() == 2739) {
+                companyType = "1";
+            }
+            if (StringUtils.isNotEmpty(companyType)) {
+                if (companyType.equals("0")) {
+                    query.isNull(TOrder::getCompanyType).or()
+                            .eq(TOrder::getCompanyType, companyType);
+                } else {
+                    query.eq(TOrder::getCompanyType, companyType);
+                }
+            }
+            if (StringUtils.isNotEmpty(machineType)) {
+                if (machineType.equals("0")) {
+                    query.isNull(TOrder::getMachineType).or()
+                            .eq(TOrder::getMachineType, machineType);
+                } else {
+                    query.eq(TOrder::getMachineType, machineType);
+                }
+            }
+
             Page<TOrder> page = new Page<>(current, size, true);
             Page<TOrder> page = new Page<>(current, size, true);
             IPage<TOrder> iPage = orderService.page(page, query);
             IPage<TOrder> iPage = orderService.page(page, query);
             List<TOrder> list = iPage.getRecords();
             List<TOrder> list = iPage.getRecords();

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

@@ -359,6 +359,14 @@
                 AND company_type = '1'
                 AND company_type = '1'
             </when>
             </when>
         </choose>
         </choose>
+        <choose>
+            <when test="machineType != null and machineType !='' and machineType.equals(&quot;0&quot;)">
+                AND (machine_type IS NULL OR machine_type = '0')
+            </when>
+            <when test="machineType != null and machineType !='' and machineType.equals(&quot;1&quot;)">
+                AND machine_type = '1'
+            </when>
+        </choose>
         and status = 1
         and status = 1
         and create_date >= STR_TO_DATE(CONCAT(#{begin},' 00:00:00'),'%Y-%m-%d %H:%i:%s')
         and create_date >= STR_TO_DATE(CONCAT(#{begin},' 00:00:00'),'%Y-%m-%d %H:%i:%s')
          <![CDATA[ and create_date <= STR_TO_DATE(CONCAT(#{end},' 23:59:59'),'%Y-%m-%d %H:%i:%s') ]]>
          <![CDATA[ and create_date <= STR_TO_DATE(CONCAT(#{end},' 23:59:59'),'%Y-%m-%d %H:%i:%s') ]]>

+ 3 - 0
src/main/java/com/szwl/model/query/StatisticsParam.java

@@ -70,4 +70,7 @@ public class StatisticsParam {
 
 
     @ApiModelProperty(value = "公司平台,0或空为申泽,1为七云")
     @ApiModelProperty(value = "公司平台,0或空为申泽,1为七云")
     private String companyType;
     private String companyType;
+
+    @ApiModelProperty(value = "设备类型,0:棉花糖,1,爆米花")
+    private String machineType;
 }
 }

+ 17 - 1
src/main/java/com/szwl/service/es/EsTEquipmentService.java

@@ -219,6 +219,23 @@ public class EsTEquipmentService extends EsBaseService<TEquipment, TEquipmentPar
                 boolQueryBuilder.must(QueryBuilders.termQuery("companyType","1"));
                 boolQueryBuilder.must(QueryBuilders.termQuery("companyType","1"));
             }
             }
         }
         }
+        // 设备类型
+        String machineType = param.getMachineType();
+        if(StringUtils.isNotEmpty(machineType)) {
+            if(machineType.equals("0")) {
+                boolQueryBuilder.must(
+                        QueryBuilders.boolQuery().should(
+                                QueryBuilders.termQuery("machineType", "0")
+                        ).should(
+                                QueryBuilders.boolQuery().mustNot(
+                                        QueryBuilders.existsQuery("machineType")
+                                )
+                        )
+                );
+            } else {
+                boolQueryBuilder.must(QueryBuilders.termQuery("machineType","1"));
+            }
+        }
         if("1".equals(param.getChangeType())){
         if("1".equals(param.getChangeType())){
             // 花型统计
             // 花型统计
             return getEquipmentStatistics(boolQueryBuilder,esTOrderService.getTableName(),"productName.keyword");
             return getEquipmentStatistics(boolQueryBuilder,esTOrderService.getTableName(),"productName.keyword");
@@ -279,7 +296,6 @@ public class EsTEquipmentService extends EsBaseService<TEquipment, TEquipmentPar
 
 
             return chartColumn;
             return chartColumn;
         }
         }
-//        return null;
     }
     }
     /**
     /**
      * 统计 国外
      * 统计 国外

+ 18 - 0
src/main/java/com/szwl/service/es/EsTOrderService.java

@@ -325,6 +325,24 @@ public class EsTOrderService extends EsBaseService<TOrder, TOrderParam> {
                 }
                 }
             }
             }
 
 
+            // 设备类型
+            String machineType = param.getMachineType();
+            if(StringUtils.isNotEmpty(machineType)) {
+                if(machineType.equals("0")) {
+                    queryBuilder.must(
+                            QueryBuilders.boolQuery().should(
+                                    QueryBuilders.termQuery("machineType", "0")
+                            ).should(
+                                    QueryBuilders.boolQuery().mustNot(
+                                            QueryBuilders.existsQuery("machineType")
+                                    )
+                            )
+                    );
+                } else {
+                    queryBuilder.must(QueryBuilders.termQuery("machineType","1"));
+                }
+            }
+
             // 时间聚合
             // 时间聚合
             AggregationBuilder dateHistogram = AggregationBuilders.dateHistogram(aggregationResultName)
             AggregationBuilder dateHistogram = AggregationBuilders.dateHistogram(aggregationResultName)
                     .field("createDate")
                     .field("createDate")