‘linchangsheng’ vor 3 Tagen
Ursprung
Commit
9f04475c30

+ 3 - 1
mall-server-api/src/main/java/com/gree/mall/manager/commonmapper/CommonMapper.java

@@ -229,7 +229,9 @@ public interface CommonMapper {
                                             @Param("ex") WorkOrderZfireParam zfireParamBean,
                                             @Param("adminUserType") Integer adminUserType
             ,@Param("companyWechatId") String companyWechatId,
-            @Param("orderBaseId") List<String> orderBaseId
+            @Param("orderBaseId") List<String> orderBaseId,
+            @Param("sqlBase") String sqlBase
+
                                             );
 
     /**

+ 6 - 4
mall-server-api/src/main/java/com/gree/mall/manager/controller/workerorder/ESOrderBaseController.java

@@ -75,12 +75,13 @@ public class ESOrderBaseController {
 
     @PostMapping("/list/export")
     @ApiOperation(value = "导出")
-    public synchronized void listExport(@RequestBody WorkOrderZfireParam zfireParamBean, HttpServletRequest request, HttpServletResponse response) throws Exception {
+    public synchronized void listExport(@RequestBody WorkOrderZfireParam zfireParamBean,
+                                        HttpServletRequest request, HttpServletResponse response) throws Exception {
         //1.组装查询条件
         ZfireParamBean zfireParam = FieldUtils.supplyParam(zfireParamBean);
         //2.查询要导出的内容
 
-        List<OrderBaseVO> orderBaseVOIPage = orderBaseEsLogic.listExport(zfireParamBean);
+        List<OrderBaseVO> orderBaseVOIPage = orderBaseEsLogic.listExport(zfireParamBean,request);
 
         //3.导出
         FieldUtils.exportData(orderBaseVOIPage, zfireParam.getExportFields(), request, response);
@@ -92,9 +93,10 @@ public class ESOrderBaseController {
             @RequestParam(required = false) String startTime,
             @RequestParam(required = false) String endTime,
             @RequestParam(required = false) String orderSmallType,
-            @RequestParam(required = false) String orderSmallTypeText
+            @RequestParam(required = false) String orderSmallTypeText,
+            HttpServletRequest request
     ) {
-        List<Map<String, Object>> maps = orderBaseEsLogic.countStatus(startTime,endTime,orderSmallType,orderSmallTypeText);
+        List<Map<String, Object>> maps = orderBaseEsLogic.countStatus(startTime,endTime,orderSmallType,orderSmallTypeText,request);
         return ResponseHelper.success(maps);
     }
 

+ 18 - 13
mall-server-api/src/main/java/com/gree/mall/manager/controller/workerorder/OrderBaseController.java

@@ -27,6 +27,7 @@ import com.gree.mall.manager.plus.entity.PgOrderBase;
 import com.gree.mall.manager.plus.entity.PgOrderOperatorLog;
 import com.gree.mall.manager.plus.entity.PgOrderProduct;
 import com.gree.mall.manager.plus.entity.PgOrderWorker;
+import com.gree.mall.manager.utils.CommonUtils;
 import com.gree.mall.manager.utils.excel.ExcelUtils;
 import com.gree.mall.manager.zfire.bean.ZfireParamBean;
 import com.gree.mall.manager.zfire.util.FieldUtils;
@@ -67,9 +68,10 @@ public class OrderBaseController {
     @PostMapping("/list")
     @ApiOperation(value = "列表")
     public ResponseHelper<Page<OrderBaseVO>> list(
-            @RequestBody WorkOrderZfireParam workOrderZfireParam
+            @RequestBody WorkOrderZfireParam workOrderZfireParam,
+            HttpServletRequest request
     ) {
-        IPage<OrderBaseVO> orderBaseVOIPage = orderBaseLogic.orderBaseList(workOrderZfireParam);
+        IPage<OrderBaseVO> orderBaseVOIPage = orderBaseLogic.orderBaseList(workOrderZfireParam,request);
         return ResponseHelper.success(orderBaseVOIPage, new TypeReference<OrderBaseVO>() {});
     }
 
@@ -80,7 +82,7 @@ public class OrderBaseController {
         ZfireParamBean zfireParam = FieldUtils.supplyParam(zfireParamBean);
         zfireParam.setPageSize(10000);
         //2.查询要导出的内容
-        IPage<OrderBaseVO> page = orderBaseLogic.orderBaseList(zfireParamBean);
+        IPage<OrderBaseVO> page = orderBaseLogic.orderBaseList(zfireParamBean,request);
         //3.导出
         FieldUtils.exportData(page.getRecords(), zfireParam.getExportFields(), request, response);
     }
@@ -104,9 +106,10 @@ public class OrderBaseController {
             @RequestParam(required = false) String startTime,
             @RequestParam(required = false) String endTime,
             @RequestParam(required = false) String orderSmallType,
-            @RequestParam(required = false) String orderSmallTypeText
+            @RequestParam(required = false) String orderSmallTypeText,
+            HttpServletRequest request
     ) {
-        List<Map<String, Object>> maps = orderBaseEsLogic.countStatus(startTime,endTime,orderSmallType,orderSmallTypeText);
+        List<Map<String, Object>> maps = orderBaseEsLogic.countStatus(startTime,endTime,orderSmallType,orderSmallTypeText,request);
        // List<Map<String, Object>> maps = orderBaseLogic.countStatus(startTime,endTime,orderSmallType,orderSmallTypeText);
         return ResponseHelper.success(maps);
     }
@@ -241,23 +244,24 @@ public class OrderBaseController {
 
     @PostMapping("/detail")
     @ApiOperation(value = "工单-详情")
-    public ResponseHelper<OrderAddBeanDTO> detail(@RequestParam String orderBaseId){
-        OrderAddBeanDTO detail = orderBaseLogic.detail(orderBaseId);
+    public ResponseHelper<OrderAddBeanDTO> detail(@RequestParam String orderBaseId, HttpServletRequest request){
+        OrderAddBeanDTO detail = orderBaseLogic.detail(orderBaseId,request);
         return ResponseHelper.success(detail);
     }
 
     @PostMapping("/worker/list")
     @ApiOperation(value = "工单师傅-列表")
-    public ResponseHelper<List<PgOrderWorker>> workerList(@RequestParam String orderBaseId){
-        List<PgOrderWorker> orderWorkers = orderBaseLogic.orderWorkerList(orderBaseId);
+    public ResponseHelper<List<PgOrderWorker>> workerList(@RequestParam String orderBaseId,HttpServletRequest request){
+        String year = CommonUtils.getYear(request);
+        List<PgOrderWorker> orderWorkers = orderBaseLogic.orderWorkerList(orderBaseId,year);
         return ResponseHelper.success(orderWorkers);
     }
 
 
     @PostMapping("/product/list")
     @ApiOperation(value = "服务单-工单机型列表")
-    public ResponseHelper<List<PgOrderProduct>> productList(@RequestParam String orderBaseId) {
-        List<PgOrderProduct> orderProducts = orderBaseLogic.listOrderProduct(orderBaseId);
+    public ResponseHelper<List<PgOrderProduct>> productList(@RequestParam String orderBaseId,HttpServletRequest request) {
+        List<PgOrderProduct> orderProducts = orderBaseLogic.listOrderProduct(orderBaseId,request);
         return ResponseHelper.success(orderProducts);
     }
 
@@ -308,9 +312,10 @@ public class OrderBaseController {
     @PostMapping("/log/list")
     @ApiOperation(value = "工单操作明细-列表")
     public ResponseHelper<List<PgOrderOperatorLog>> orderOperatorLog(
-            @RequestParam String orderBaseId
+            @RequestParam String orderBaseId,
+            HttpServletRequest request
     ) {
-        List<PgOrderOperatorLog> pgOrderOperatorLogs = orderLogLogic.operatorLogList(orderBaseId);
+        List<PgOrderOperatorLog> pgOrderOperatorLogs = orderLogLogic.operatorLogList(orderBaseId,request);
         return ResponseHelper.success(pgOrderOperatorLogs);
     }
 

+ 6 - 2
mall-server-api/src/main/java/com/gree/mall/manager/controller/workerorder/OrderBaseCountController.java

@@ -12,6 +12,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
+import javax.servlet.http.HttpServletRequest;
+
 @RequiredArgsConstructor
 @Slf4j
 @RestController
@@ -25,8 +27,10 @@ public class OrderBaseCountController {
     @PostMapping("/status/count")
     @ApiOperation(value = "按工单状态统计")
     public ResponseHelper<OrderBaseCountBean> countStatus(   @RequestParam(required = false) String startTime,
-                                                             @RequestParam(required = false) String endTime) {
-        OrderBaseCountBean orderBaseCountBean = orderBaseCountLogic.baseCountBean(startTime,endTime);
+                                                             @RequestParam(required = false) String endTime,
+                                                             HttpServletRequest request
+                                                             ) {
+        OrderBaseCountBean orderBaseCountBean = orderBaseCountLogic.baseCountBean(startTime,endTime,request);
         return ResponseHelper.success(orderBaseCountBean);
     }
 

+ 41 - 14
mall-server-api/src/main/java/com/gree/mall/manager/logic/workorder/OrderBaseCountLogic.java

@@ -4,6 +4,9 @@ import cn.hutool.core.convert.Convert;
 import cn.hutool.core.date.DateUtil;
 import com.google.common.collect.Lists;
 import com.gree.mall.manager.bean.admin.AdminUserCom;
+import com.gree.mall.manager.bean.es.OrderBase2022Es;
+import com.gree.mall.manager.bean.es.OrderBase2023Es;
+import com.gree.mall.manager.bean.es.OrderBase2024Es;
 import com.gree.mall.manager.bean.es.OrderBaseEs;
 import com.gree.mall.manager.bean.workorder.OrderBaseCountBean;
 import com.gree.mall.manager.bean.workorder.OrderCount7DayBean;
@@ -14,6 +17,7 @@ import com.gree.mall.manager.enums.workorder.OrderTypeEnum;
 import com.gree.mall.manager.logic.common.CommonLogic;
 import com.gree.mall.manager.plus.entity.PgOrderBase;
 import com.gree.mall.manager.plus.service.PgOrderBaseService;
+import com.gree.mall.manager.utils.CommonUtils;
 import io.swagger.models.auth.In;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
@@ -40,6 +44,7 @@ import org.springframework.data.elasticsearch.core.query.NativeSearchQueryBuilde
 import org.springframework.stereotype.Service;
 import org.springframework.web.bind.annotation.RequestParam;
 
+import javax.servlet.http.HttpServletRequest;
 import java.text.SimpleDateFormat;
 import java.time.LocalDateTime;
 import java.time.ZoneOffset;
@@ -61,8 +66,10 @@ public class OrderBaseCountLogic {
      * @return
      */
     public OrderBaseCountBean baseCountBean( String startTime,
-                                             String endTime){
+                                             String endTime,
+                                             HttpServletRequest request){
         AdminUserCom adminUser = commonLogic.getAdminUser();
+        String year = CommonUtils.getYear(request);
         OrderBaseCountBean orderBaseCountBean = new OrderBaseCountBean();
         BoolQueryBuilder queryBuilderCount = QueryBuilders.boolQuery();
 
@@ -88,7 +95,7 @@ public class OrderBaseCountLogic {
                         .must(QueryBuilders.termsQuery("order_status","DSHPG","CJ","YPD","DXSPD","DZBPG","DWDSPGP","DXSSPGP","DTJXSSPGP","DZBSPGP","DFZXPD","DFZXSPGP","DWDPG","DWDPD")
                 ))))
                 .build();
-        SearchHits responseDPG = elasticsearchRestTemplate.search(searchQueryDPG, OrderBaseEs.class);
+        SearchHits responseDPG = this.search(searchQueryDPG,year);
 
         orderBaseCountBean.setDpg(Convert.toInt(this.getWorkerOrderCountResult(responseDPG.getAggregations(),"DPG")));
 
@@ -103,7 +110,7 @@ public class OrderBaseCountLogic {
                         .mustNot(QueryBuilders.termsQuery("order_status", "YQX", "FWQX", "FL", "FWZT", "YCGB","YZP"))
                 )))
                 .build();
-        SearchHits responseDJS = elasticsearchRestTemplate.search(searchQueryDJS, OrderBaseEs.class);
+        SearchHits responseDJS = this.search(searchQueryDJS,year);
 
         orderBaseCountBean.setDjs(Convert.toInt(this.getWorkerOrderCountResult(responseDJS.getAggregations(),"DJS")));
 
@@ -116,7 +123,7 @@ public class OrderBaseCountLogic {
                         .must(QueryBuilders.termsQuery("order_status","DQD")
                         ))))
                 .build();
-        SearchHits responseDQD = elasticsearchRestTemplate.search(searchQueryDQD, OrderBaseEs.class);
+        SearchHits responseDQD = this.search(searchQueryDQD,year);
 
         orderBaseCountBean.setDqd(Convert.toInt(this.getWorkerOrderCountResult(responseDQD.getAggregations(),"DQD")));
 
@@ -129,7 +136,7 @@ public class OrderBaseCountLogic {
                         .must(QueryBuilders.termsQuery("order_status","FWZ","GCSZT","BFWG","DSM","WDBH","XSBH","TJXSBH","ZBBH","FZXBH")
                         ))))
                 .build();
-        SearchHits responsefwz = elasticsearchRestTemplate.search(searchQueryfwz, OrderBaseEs.class);
+        SearchHits responsefwz = this.search(searchQueryfwz,year);
 
         orderBaseCountBean.setFwz(Convert.toInt(this.getWorkerOrderCountResult(responsefwz.getAggregations(),"fwz")));
 
@@ -145,7 +152,7 @@ public class OrderBaseCountLogic {
                         .mustNot(QueryBuilders.existsQuery("appointment_time"))
                 )))
                 .build();
-        SearchHits responseDYY = elasticsearchRestTemplate.search(searchQueryDYY, OrderBaseEs.class);
+        SearchHits responseDYY = this.search(searchQueryDYY,year);
 
         orderBaseCountBean.setDyy(Convert.toInt(this.getWorkerOrderCountResult(responseDYY.getAggregations(),"DYY")));
 
@@ -159,7 +166,7 @@ public class OrderBaseCountLogic {
 
                 )))
                 .build();
-        SearchHits responseYCDCL = elasticsearchRestTemplate.search(searchQueryYCDCL, OrderBaseEs.class);
+        SearchHits responseYCDCL = this.search(searchQueryYCDCL,year);
 
         orderBaseCountBean.setYcdcl(Convert.toInt(this.getWorkerOrderCountResult(responseYCDCL.getAggregations(),"YCDCL")));
 
@@ -173,7 +180,7 @@ public class OrderBaseCountLogic {
 
                 )))
                 .build();
-        SearchHits responseCP = elasticsearchRestTemplate.search(searchQueryCP, OrderBaseEs.class);
+        SearchHits responseCP = this.search(searchQueryCP,year);
 
         orderBaseCountBean.setCp(Convert.toInt(this.getWorkerOrderCountResult(responseCP.getAggregations(),"CP")));
 
@@ -228,7 +235,7 @@ public class OrderBaseCountLogic {
 
 
         // 执行查询并获取聚合结果
-        SearchHits<OrderBaseEs> searchHitsXZGD = elasticsearchRestTemplate.search(searchQueryDay, OrderBaseEs.class);
+        SearchHits<OrderBaseEs> searchHitsXZGD = this.search(searchQueryDay,year);
 
         var aggregationsXZGD = searchHitsXZGD.getAggregations();
 
@@ -273,7 +280,7 @@ public class OrderBaseCountLogic {
 
 
         // 执行查询并获取聚合结果
-        SearchHits<OrderBaseEs> searchHitsXWGD = elasticsearchRestTemplate.search(searchQueryWGD, OrderBaseEs.class);
+        SearchHits<OrderBaseEs> searchHitsXWGD = this.search(searchQueryWGD,year);
 
         var aggregationsWGD = searchHitsXWGD.getAggregations();
 
@@ -317,7 +324,7 @@ public class OrderBaseCountLogic {
 
 
         // 执行查询并获取聚合结果
-        SearchHits<OrderBaseEs> searchHitsJXZ= elasticsearchRestTemplate.search(searchQueryJXZ, OrderBaseEs.class);
+        SearchHits<OrderBaseEs> searchHitsJXZ= this.search(searchQueryJXZ,year);
 
         var aggregationsJXZ = searchHitsJXZ.getAggregations();
 
@@ -363,7 +370,7 @@ public class OrderBaseCountLogic {
                         .calendarInterval(DateHistogramInterval.DAY)
                         .format("yyyy-MM-dd"))
                 .build();
-        SearchHits responseQTSM = elasticsearchRestTemplate.search(searchQueryQTSM, OrderBaseEs.class);
+        SearchHits responseQTSM = this.search(searchQueryQTSM,year);
 
         var aggregationsQTSM = responseQTSM.getAggregations();
 
@@ -417,7 +424,7 @@ public class OrderBaseCountLogic {
                         .calendarInterval(DateHistogramInterval.DAY)
                         .format("yyyy-MM-dd"))
                 .build();
-        SearchHits responseAZ = elasticsearchRestTemplate.search(searchQueryAZ, OrderBaseEs.class);
+        SearchHits responseAZ = this.search(searchQueryAZ,year);
 
         var aggregationsAZ = responseAZ.getAggregations();
 
@@ -458,7 +465,7 @@ public class OrderBaseCountLogic {
                         .calendarInterval(DateHistogramInterval.DAY)
                         .format("yyyy-MM-dd"))
                 .build();
-        SearchHits responseWX = elasticsearchRestTemplate.search(searchQueryWX, OrderBaseEs.class);
+        SearchHits responseWX = this.search(searchQueryWX,year);
 
         var aggregationsWX = responseWX.getAggregations();
 
@@ -482,6 +489,26 @@ public class OrderBaseCountLogic {
         return orderBaseCountBean;
     }
 
+    private SearchHits search(NativeSearchQuery searchQuery,String year) {
+
+        if (year.equals("2023")) {
+            SearchHits response = elasticsearchRestTemplate.search(searchQuery, OrderBase2023Es.class);
+            return response;
+        }
+        if (year.equals("2024")) {
+            SearchHits response = elasticsearchRestTemplate.search(searchQuery, OrderBase2024Es.class);
+            return response;
+        }
+
+        if (year.equals("2022") || Convert.toInt(year) < 2022) {
+            SearchHits response = elasticsearchRestTemplate.search(searchQuery, OrderBase2022Es.class);
+            return response;
+        }else {
+            SearchHits response = elasticsearchRestTemplate.search(searchQuery, OrderBaseEs.class);
+            return response;
+        }
+    }
+
 
     public AbstractAggregationBuilder<?> getAggs(FilterAggregationBuilder filter) {
         return filter.subAggregation(AggregationBuilders.sum("total_mac_sum").field("total_num"))

+ 228 - 55
mall-server-api/src/main/java/com/gree/mall/manager/logic/workorder/OrderBaseEsLogic.java

@@ -194,7 +194,7 @@ public class OrderBaseEsLogic {
                     .stream()
                     .map(OrderBaseVO::getId)
                     .collect(Collectors.toList());
-            Map<String, List<PgOrderFlag>> mapList = orderFlagLogic.list(orderBaseIds);
+            Map<String, List<PgOrderFlag>> mapList = orderFlagLogic.list(orderBaseIds,year);
 
             List<WorkerOrder> workerOrderList = workerOrderService.lambdaQuery().in(WorkerOrder::getWorkerOrderId, orderBaseIds)
                     .eq(WorkerOrder::getPayStatus, MaterialExamineStatusEnum.PAID.getKey())
@@ -407,8 +407,10 @@ public class OrderBaseEsLogic {
         }*/
     }
 
-    public List<Map<String, Object>> countStatus(String startTime, String endTime, String orderSmallType, String orderSmallTypeText) {
+    public List<Map<String, Object>> countStatus(String startTime, String endTime, String orderSmallType, String orderSmallTypeText,HttpServletRequest request) {
         AdminUserCom adminUser = commonLogic.getAdminUser();
+
+        String year = CommonUtils.getYear(request);
         BoolQueryBuilder queryBuilder = QueryBuilders.boolQuery();
 
         List<Map<String, Object>> maps = new ArrayList<>();
@@ -443,15 +445,15 @@ public class OrderBaseEsLogic {
                                 .lte(endTime)
                         ))))
                 .build();
-        SearchHits response = elasticsearchRestTemplate.search(searchQuery, OrderBaseEs.class);
 
+        SearchHits response = this.search(searchQuery,year);
         HashMap<String, Object> dyy = new HashMap<>();
-        dyy.put("total",this.getWorkerOrderCountResult(response.getAggregations(),"DYY"));
-        dyy.put("orderStatus","DYY");
-
+        dyy.put("total", this.getWorkerOrderCountResult(response.getAggregations(), "DYY"));
+        dyy.put("orderStatus", "DYY");
         maps.add(dyy);
 
 
+
         //待抢单
         NativeSearchQuery searchQueryDqd = new NativeSearchQueryBuilder()
                 .withQuery(queryBuilder)
@@ -459,12 +461,12 @@ public class OrderBaseEsLogic {
                 .addAggregation(this.getAggs(AggregationBuilders.filter("DQD", QueryBuilders.boolQuery()
                         .must(QueryBuilders.termQuery("order_status","DQD")))))
                 .build();
-        SearchHits responsedqd = elasticsearchRestTemplate.search(searchQueryDqd, OrderBaseEs.class);
+
+        SearchHits responsedqd = this.search(searchQueryDqd,year);
 
         HashMap<String, Object> dqd = new HashMap<>();
         dqd.put("total",this.getWorkerOrderCountResult(responsedqd.getAggregations(),"DQD"));
         dqd.put("orderStatus","DQD");
-
         maps.add(dqd);
 
 
@@ -476,7 +478,7 @@ public class OrderBaseEsLogic {
                         .must(QueryBuilders.termsQuery("order_status","DSHPG","CJ","YPD","DXSPD","DZBPG","DWDSPGP","DXSSPGP",
                                 "DTJXSSPGP","DZBSPGP","DFZXPD","DFZXSPGP")))))
                 .build();
-        SearchHits responseDshpg = elasticsearchRestTemplate.search(searchQueryDshpg, OrderBaseEs.class);
+        SearchHits responseDshpg =this.search(searchQueryDshpg,year);
 
         HashMap<String, Object> dshpg = new HashMap<>();
         dshpg.put("total",this.getWorkerOrderCountResult(responseDshpg.getAggregations(),"DSHPG"));
@@ -492,7 +494,7 @@ public class OrderBaseEsLogic {
                 .addAggregation(this.getAggs(AggregationBuilders.filter("DWDPG", QueryBuilders.boolQuery()
                         .must(QueryBuilders.termsQuery("order_status","DWDPG","DWDPD")))))
                 .build();
-        SearchHits responseDwdpg = elasticsearchRestTemplate.search(searchQueryDwdpg, OrderBaseEs.class);
+        SearchHits responseDwdpg = this.search(searchQueryDwdpg,year);
 
         HashMap<String, Object> DWDPG = new HashMap<>();
         DWDPG.put("total",this.getWorkerOrderCountResult(responseDwdpg.getAggregations(),"DWDPG"));
@@ -510,7 +512,7 @@ public class OrderBaseEsLogic {
                         .should(QueryBuilders.termsQuery("order_status", "DJD")))
                         )))
                 .build();
-        SearchHits responseDJD = elasticsearchRestTemplate.search(searchQueryDJD, OrderBaseEs.class);
+        SearchHits responseDJD = this.search(searchQueryDJD,year);
 
         HashMap<String, Object> DJD = new HashMap<>();
         DJD.put("total",this.getWorkerOrderCountResult(responseDJD.getAggregations(),"DJD"));
@@ -526,7 +528,7 @@ public class OrderBaseEsLogic {
                         .must(QueryBuilders.termsQuery("order_status","FWZ","GCSZT","BFWG",
                                 "DSM","WDBH", "XSBH","TJXSBH","ZBBH","FZXBH")))))
                 .build();
-        SearchHits responseFWZ = elasticsearchRestTemplate.search(searchQueryfwz, OrderBaseEs.class);
+        SearchHits responseFWZ = this.search(searchQueryfwz,year);
 
         HashMap<String, Object> FWZ = new HashMap<>();
         FWZ.put("total",this.getWorkerOrderCountResult(responseFWZ.getAggregations(),"FWZ"));
@@ -543,7 +545,7 @@ public class OrderBaseEsLogic {
                         .must(QueryBuilders.termQuery("is_exception",true))
                         .mustNot(QueryBuilders.termsQuery("order_status", "YWG", "YWGO", "YJS")))))
                 .build();
-        SearchHits responseYCD = elasticsearchRestTemplate.search(searchQueryYCD, OrderBaseEs.class);
+        SearchHits responseYCD = this.search(searchQueryYCD,year);
 
         HashMap<String, Object> YCD = new HashMap<>();
         YCD.put("total",this.getWorkerOrderCountResult(responseYCD.getAggregations(),"YCD"));
@@ -558,7 +560,7 @@ public class OrderBaseEsLogic {
                 .addAggregation(this.getAggs(AggregationBuilders.filter("YWG", QueryBuilders.boolQuery()
                         .must(QueryBuilders.termsQuery("order_status","YWG","GCSZX","WDWG","YWGO")))))
                 .build();
-        SearchHits responseYWG = elasticsearchRestTemplate.search(searchQueryYWGDJS, OrderBaseEs.class);
+        SearchHits responseYWG = this.search(searchQueryYWGDJS,year);
 
         HashMap<String, Object> YWG = new HashMap<>();
         YWG.put("total",this.getWorkerOrderCountResult(responseYWG.getAggregations(),"YWG"));
@@ -574,7 +576,7 @@ public class OrderBaseEsLogic {
                 .addAggregation(this.getAggs(AggregationBuilders.filter("YJS", QueryBuilders.boolQuery()
                         .must(QueryBuilders.termsQuery("order_status","YJS","LRCD")))))
                 .build();
-        SearchHits responseYJS = elasticsearchRestTemplate.search(searchQueryYJS, OrderBaseEs.class);
+        SearchHits responseYJS = this.search(searchQueryYJS,year);
 
         HashMap<String, Object> YJS = new HashMap<>();
         YJS.put("total",this.getWorkerOrderCountResult(responseYJS.getAggregations(),"YJS"));
@@ -589,7 +591,7 @@ public class OrderBaseEsLogic {
                 .addAggregation(this.getAggs(AggregationBuilders.filter("YQX", QueryBuilders.boolQuery()
                         .must(QueryBuilders.termsQuery("order_status","YZP","YQX","FWZT","YCGB","FWQX","FL")))))
                 .build();
-        SearchHits responseYQX = elasticsearchRestTemplate.search(searchQueryYQX, OrderBaseEs.class);
+        SearchHits responseYQX = this.search(searchQueryYQX,year);
 
         HashMap<String, Object> YQX = new HashMap<>();
         YQX.put("total",this.getWorkerOrderCountResult(responseYQX.getAggregations(),"YQX"));
@@ -605,7 +607,7 @@ public class OrderBaseEsLogic {
                 .addAggregation(this.getAggs(AggregationBuilders.filter("PJSQZ", QueryBuilders.boolQuery()
                         .must(QueryBuilders.termQuery("parts_apply_status","ING")))))
                 .build();
-        SearchHits responsePJSQZ = elasticsearchRestTemplate.search(searchQueryPJSQZ, OrderBaseEs.class);
+        SearchHits responsePJSQZ = this.search(searchQueryPJSQZ,year);
 
         HashMap<String, Object> PJSQZ = new HashMap<>();
         PJSQZ.put("total",this.getWorkerOrderCountResult(responsePJSQZ.getAggregations(),"PJSQZ"));
@@ -621,7 +623,7 @@ public class OrderBaseEsLogic {
                 .addAggregation(this.getAggs(AggregationBuilders.filter("PJYDH", QueryBuilders.boolQuery()
                         .must(QueryBuilders.termQuery("parts_apply_status","END")))))
                 .build();
-        SearchHits responsePJYDH = elasticsearchRestTemplate.search(searchQueryPJYDH, OrderBaseEs.class);
+        SearchHits responsePJYDH =  this.search(searchQueryPJYDH,year);
 
         HashMap<String, Object> PJYDH = new HashMap<>();
         PJYDH.put("total",this.getWorkerOrderCountResult(responsePJYDH.getAggregations(),"PJYDH"));
@@ -637,7 +639,7 @@ public class OrderBaseEsLogic {
                 .addAggregation(this.getAggs(AggregationBuilders.filter("PJYQX", QueryBuilders.boolQuery()
                         .must(QueryBuilders.termQuery("parts_apply_status","CANCEL")))))
                 .build();
-        SearchHits responsePJYQX = elasticsearchRestTemplate.search(searchQueryPJYQX, OrderBaseEs.class);
+        SearchHits responsePJYQX = this.search(searchQueryPJYQX,year);
 
         HashMap<String, Object> PJYQX = new HashMap<>();
         PJYQX.put("total",this.getWorkerOrderCountResult(responsePJYQX.getAggregations(),"PJYQX"));
@@ -664,7 +666,7 @@ public class OrderBaseEsLogic {
                             .must(QueryBuilders.termsQuery("id",orderBaseId))
                     )))
                     .build();
-            SearchHits responseDZF = elasticsearchRestTemplate.search(searchQueryDZF, OrderBaseEs.class);
+            SearchHits responseDZF = this.search(searchQueryDZF,year);
             DZF.put("total",this.getWorkerOrderCountResult(responseDZF.getAggregations(),"DZF"));
             DZF.put("orderStatus","DZF");
 
@@ -675,6 +677,27 @@ public class OrderBaseEsLogic {
         return maps;
     }
 
+
+    private SearchHits search(NativeSearchQuery searchQuery,String year) {
+
+        if (year.equals("2023")) {
+            SearchHits response = elasticsearchRestTemplate.search(searchQuery, OrderBase2023Es.class);
+             return response;
+        }
+        if (year.equals("2024")) {
+            SearchHits response = elasticsearchRestTemplate.search(searchQuery, OrderBase2024Es.class);
+            return response;
+        }
+
+        if (year.equals("2022") || Convert.toInt(year) < 2022) {
+            SearchHits response = elasticsearchRestTemplate.search(searchQuery, OrderBase2022Es.class);
+            return response;
+        }else {
+            SearchHits response = elasticsearchRestTemplate.search(searchQuery, OrderBaseEs.class);
+            return response;
+        }
+    }
+
     public AbstractAggregationBuilder<?> getAggs(FilterAggregationBuilder filter) {
         return filter.subAggregation(AggregationBuilders.sum("total_mac_sum").field("total_num"))
                 .subAggregation(AggregationBuilders.terms("order_type_group").field("order_type")
@@ -727,10 +750,12 @@ public class OrderBaseEsLogic {
         orderWorkerEsRepository.saveAll(pgOrderWorkerEs);
     }
 
-    public List<OrderBaseVO> listExport(WorkOrderZfireParam zfireParamBean) {
+    public List<OrderBaseVO> listExport(WorkOrderZfireParam zfireParamBean,HttpServletRequest request) {
 
         AdminUserCom adminUser = commonLogic.getAdminUser();
 
+        String year = CommonUtils.getYear(request);
+
         BoolQueryBuilder queryBuilder1 = QueryBuilders.boolQuery();
         this.montage(queryBuilder1,zfireParamBean);
 
@@ -774,51 +799,199 @@ public class OrderBaseEsLogic {
 
 
         // 2. 初始化 Scroll
-        SearchScrollHits<OrderBaseEs> scrollHits = elasticsearchRestTemplate.searchScrollStart(
-                60000, // Scroll 上下文保持时间(毫秒)
-                query,
-                OrderBaseEs.class,
-                IndexCoordinates.of("pg_order_base")
-        );
 
-        String scrollId = scrollHits.getScrollId();
-        int batch = 0;
+        List<OrderBaseVO> orderBaseVOS1 = new ArrayList<>();
 
-        if (scrollHits.getTotalHits() > 60000)
-            throw  new RemoteServiceException("数据超过六万上限,请分批导出");
+        if (year.equals("2023")) {
+
+            List<OrderBase2023Es> orderBaseVOS = new ArrayList<>();
+            SearchScrollHits<OrderBase2023Es> scrollHits = elasticsearchRestTemplate.searchScrollStart(
+                    60000, // Scroll 上下文保持时间(毫秒)
+                    query,
+                    OrderBase2023Es.class,
+                    IndexCoordinates.of("pg_order_base_2023")
+            );
 
-        List<OrderBaseEs> orderBaseVOS = new ArrayList<>();
+            String scrollId = scrollHits.getScrollId();
+            int batch = 0;
 
-        try {
-            while (!scrollHits.isEmpty()) {
-                // 3. 处理当前批次数据
-                scrollHits.forEach(hit -> {
-                    OrderBaseEs entity = hit.getContent();
-                    orderBaseVOS.add(entity);
-                });
+            if (scrollHits.getTotalHits() > 60000)
+                throw  new RemoteServiceException("数据超过六万上限,请分批导出");
 
-                batch++;
 
-                // 4. 获取下一批次
-                scrollHits = elasticsearchRestTemplate.searchScrollContinue(
-                        scrollId,
-                        60000,
-                        OrderBaseEs.class,
-                        IndexCoordinates.of("pg_order_base")
-                );
-                scrollId = scrollHits.getScrollId(); // 更新 scrollId
+            try {
+                while (!scrollHits.isEmpty()) {
+                    // 3. 处理当前批次数据
+                    scrollHits.forEach(hit -> {
+                        OrderBase2023Es entity = hit.getContent();
+                        orderBaseVOS.add(entity);
+                    });
+
+                    batch++;
+
+                    // 4. 获取下一批次
+                    scrollHits = elasticsearchRestTemplate.searchScrollContinue(
+                            scrollId,
+                            60000,
+                            OrderBase2023Es.class,
+                            IndexCoordinates.of("pg_order_base_2023")
+                    );
+                    scrollId = scrollHits.getScrollId(); // 更新 scrollId
+                }
+            } finally {
+                // 5. 清理 Scroll 上下文
+                if (scrollId != null) {
+                    List<String> scroll = new ArrayList<>();
+                    scroll.add(scrollId);
+                    elasticsearchRestTemplate.searchScrollClear(scroll);
+                }
             }
-        } finally {
-            // 5. 清理 Scroll 上下文
-            if (scrollId != null) {
-                List<String> scroll = new ArrayList<>();
-                scroll.add(scrollId);
-                elasticsearchRestTemplate.searchScrollClear(scroll);
+
+            orderBaseVOS1 = BeanUtil.copyToList(orderBaseVOS,OrderBaseVO.class);
+        }
+
+        if (year.equals("2024")) {
+
+            List<OrderBase2024Es> orderBaseVOS = new ArrayList<>();
+            SearchScrollHits<OrderBase2024Es> scrollHits = elasticsearchRestTemplate.searchScrollStart(
+                    60000, // Scroll 上下文保持时间(毫秒)
+                    query,
+                    OrderBase2024Es.class,
+                    IndexCoordinates.of("pg_order_base_2024")
+            );
+
+            String scrollId = scrollHits.getScrollId();
+            int batch = 0;
+
+            if (scrollHits.getTotalHits() > 60000)
+                throw  new RemoteServiceException("数据超过六万上限,请分批导出");
+
+
+            try {
+                while (!scrollHits.isEmpty()) {
+                    // 3. 处理当前批次数据
+                    scrollHits.forEach(hit -> {
+                        OrderBase2024Es entity = hit.getContent();
+                        orderBaseVOS.add(entity);
+                    });
+
+                    batch++;
+
+                    // 4. 获取下一批次
+                    scrollHits = elasticsearchRestTemplate.searchScrollContinue(
+                            scrollId,
+                            60000,
+                            OrderBase2024Es.class,
+                            IndexCoordinates.of("pg_order_base_2024")
+                    );
+                    scrollId = scrollHits.getScrollId(); // 更新 scrollId
+                }
+            } finally {
+                // 5. 清理 Scroll 上下文
+                if (scrollId != null) {
+                    List<String> scroll = new ArrayList<>();
+                    scroll.add(scrollId);
+                    elasticsearchRestTemplate.searchScrollClear(scroll);
+                }
             }
+
+            orderBaseVOS1 = BeanUtil.copyToList(orderBaseVOS,OrderBaseVO.class);
         }
 
-        List<OrderBaseVO> orderBaseVOS1 = BeanUtil.copyToList(orderBaseVOS, OrderBaseVO.class);
 
+        if (year.equals("2022") || Convert.toInt(year) < 2022) {
+
+            List<OrderBase2022Es> orderBaseVOS = new ArrayList<>();
+            SearchScrollHits<OrderBase2022Es> scrollHits = elasticsearchRestTemplate.searchScrollStart(
+                    60000, // Scroll 上下文保持时间(毫秒)
+                    query,
+                    OrderBase2022Es.class,
+                    IndexCoordinates.of("pg_order_base_2022")
+            );
+
+            String scrollId = scrollHits.getScrollId();
+            int batch = 0;
+
+            if (scrollHits.getTotalHits() > 60000)
+                throw  new RemoteServiceException("数据超过六万上限,请分批导出");
+
+
+            try {
+                while (!scrollHits.isEmpty()) {
+                    // 3. 处理当前批次数据
+                    scrollHits.forEach(hit -> {
+                        OrderBase2022Es entity = hit.getContent();
+                        orderBaseVOS.add(entity);
+                    });
+
+                    batch++;
+
+                    // 4. 获取下一批次
+                    scrollHits = elasticsearchRestTemplate.searchScrollContinue(
+                            scrollId,
+                            60000,
+                            OrderBase2022Es.class,
+                            IndexCoordinates.of("pg_order_base_2022")
+                    );
+                    scrollId = scrollHits.getScrollId(); // 更新 scrollId
+                }
+            } finally {
+                // 5. 清理 Scroll 上下文
+                if (scrollId != null) {
+                    List<String> scroll = new ArrayList<>();
+                    scroll.add(scrollId);
+                    elasticsearchRestTemplate.searchScrollClear(scroll);
+                }
+            }
+
+            orderBaseVOS1 = BeanUtil.copyToList(orderBaseVOS,OrderBaseVO.class);
+        }else {
+
+            List<OrderBaseEs> orderBaseVOS = new ArrayList<>();
+            SearchScrollHits<OrderBaseEs> scrollHits = elasticsearchRestTemplate.searchScrollStart(
+                    60000, // Scroll 上下文保持时间(毫秒)
+                    query,
+                    OrderBaseEs.class,
+                    IndexCoordinates.of("pg_order_base")
+            );
+
+            String scrollId = scrollHits.getScrollId();
+            int batch = 0;
+
+            if (scrollHits.getTotalHits() > 60000)
+                throw  new RemoteServiceException("数据超过六万上限,请分批导出");
+
+
+            try {
+                while (!scrollHits.isEmpty()) {
+                    // 3. 处理当前批次数据
+                    scrollHits.forEach(hit -> {
+                        OrderBaseEs entity = hit.getContent();
+                        orderBaseVOS.add(entity);
+                    });
+
+                    batch++;
+
+                    // 4. 获取下一批次
+                    scrollHits = elasticsearchRestTemplate.searchScrollContinue(
+                            scrollId,
+                            60000,
+                            OrderBaseEs.class,
+                            IndexCoordinates.of("pg_order_base")
+                    );
+                    scrollId = scrollHits.getScrollId(); // 更新 scrollId
+                }
+            } finally {
+                // 5. 清理 Scroll 上下文
+                if (scrollId != null) {
+                    List<String> scroll = new ArrayList<>();
+                    scroll.add(scrollId);
+                    elasticsearchRestTemplate.searchScrollClear(scroll);
+                }
+            }
+
+            orderBaseVOS1 = BeanUtil.copyToList(orderBaseVOS,OrderBaseVO.class);
+        }
 
         List<String> orderBaseIds = orderBaseVOS1
                 .stream()

+ 91 - 15
mall-server-api/src/main/java/com/gree/mall/manager/logic/workorder/OrderBaseLogic.java

@@ -2,6 +2,7 @@ package com.gree.mall.manager.logic.workorder;
 
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.collection.CollectionUtil;
+import cn.hutool.core.convert.Convert;
 import cn.hutool.core.date.DateTime;
 import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.util.ObjectUtil;
@@ -60,6 +61,7 @@ import org.springframework.data.elasticsearch.core.query.NativeSearchQueryBuilde
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import javax.servlet.http.HttpServletRequest;
 import java.math.BigDecimal;
 import java.text.SimpleDateFormat;
 import java.util.*;
@@ -81,10 +83,19 @@ public class OrderBaseLogic {
     private final CommonMapper commonMapper;
     private final OrderBaseCMapper orderBaseCMapper;
     private final PgOrderBaseService pgOrderBaseService;
+    private final PgOrderBase2022Service pgOrderBase2022Service;
+    private final PgOrderBase2023Service pgOrderBase2023Service;
+    private final PgOrderBase2024Service pgOrderBase2024Service;
     private final PgOrderWorkerService pgOrderWorkerService;
+    private final PgOrderWorker2022Service pgOrderWorker2022Service;
+    private final PgOrderWorker2023Service pgOrderWorker2023Service;
+    private final PgOrderWorker2024Service pgOrderWorker2024Service;
     private final AdminWebsitService adminWebsitService;
     private final OrderSmallTypeService orderSmallTypeService;
     private final PgOrderProductService pgOrderProductService;
+    private final PgOrderProduct2022Service pgOrderProduct2022Service;
+    private final PgOrderProduct2023Service pgOrderProduct2023Service;
+    private final PgOrderProduct2024Service pgOrderProduct2024Service;
     private final UserAddressService userAddressService;
     private final GoodsCategoryService goodsCategoryService;
     private final UserService userService;
@@ -116,7 +127,9 @@ public class OrderBaseLogic {
      * @param zfireParamBean
      * @return
      */
-    public IPage<OrderBaseVO> orderBaseList(WorkOrderZfireParam zfireParamBean) {
+    public IPage<OrderBaseVO> orderBaseList(WorkOrderZfireParam zfireParamBean, HttpServletRequest request) {
+
+        String year = CommonUtils.getYear(request);
 
         //特殊处理 "异常单","待预约","配件申请中","配件已到货","配件已取消" 的查询条件
         if (zfireParamBean.getParamValue("a.order_status") instanceof String) {
@@ -154,8 +167,21 @@ public class OrderBaseLogic {
         FieldUtils.supplyParam(zfireParamBean, OrderBaseVO.class, commonLogic.getAdminUser());
         zfireParamBean.setAdminWebsitIds(zfireParamBean.getAdminWebsitIds());
 
+        String sqlBase = "pg_order_base";
+        if (year.equals("2024")) {
+            sqlBase = "pg_order_base_2024";
+        }
+        if (year.equals("2023")) {
+            sqlBase = "pg_order_base_2023";
+        }
+
+        if (year.equals("2022") || Convert.toInt(year) < 2022) {
+            sqlBase = "pg_order_base_2022";
+        }
+
+
         IPage<OrderBaseVO> page = commonMapper.orderBaseList(new Page(zfireParamBean.getPageNum(), zfireParamBean.getPageSize()),
-                zfireParamBean, adminUser.getType(), adminUser.getType().equals(1) ? adminUser.getCompanyWechatId() : null, orderBaseId);
+                zfireParamBean, adminUser.getType(), adminUser.getType().equals(1) ? adminUser.getCompanyWechatId() : null, orderBaseId, sqlBase);
 
         //服务单标识
         if (zfireParamBean.getPageSize() != -1 && page.getTotal() > 0) {
@@ -163,7 +189,7 @@ public class OrderBaseLogic {
                     .stream()
                     .map(OrderBaseVO::getId)
                     .collect(Collectors.toList());
-            Map<String, List<PgOrderFlag>> mapList = orderFlagLogic.list(orderBaseIds);
+            Map<String, List<PgOrderFlag>> mapList = orderFlagLogic.list(orderBaseIds, year);
 
             List<WorkerOrder> workerOrderList = workerOrderService.lambdaQuery().in(WorkerOrder::getWorkerOrderId, orderBaseIds)
                     .eq(WorkerOrder::getPayStatus, MaterialExamineStatusEnum.PAID.getKey())
@@ -281,7 +307,7 @@ public class OrderBaseLogic {
         }
 
         if (!StringUtil.isEmpty(orderSmallTypeText))
-            queryBuilder.must(QueryBuilders.termsQuery("order_small_type_text",orderSmallTypeText));
+            queryBuilder.must(QueryBuilders.termsQuery("order_small_type_text", orderSmallTypeText));
 
 
         if (startTime != null)
@@ -1098,22 +1124,53 @@ public class OrderBaseLogic {
      * @param id
      * @return
      */
-    public OrderAddBeanDTO detail(String id) {
-        PgOrderBase orderBase = pgOrderBaseService.getById(id);
+    public OrderAddBeanDTO detail(String id,HttpServletRequest request) {
+        String year = CommonUtils.getYear(request);
+
+        PgOrderBase orderBase = this.getOrderBase(id,year);
         if (Objects.isNull(orderBase)) {
             throw new RemoteServiceException("工单编号不存在");
         }
         OrderAddBeanDTO orderAddBeanDTO = BeanUtil.copyProperties(orderBase, OrderAddBeanDTO.class);
         //产品信息
-        List<PgOrderProduct> list = pgOrderProductService.lambdaQuery().eq(PgOrderProduct::getOrderBaseId, id).list();
+        List<PgOrderProduct> list = this.getOrderProductList(id,year);
         orderAddBeanDTO.setOrderProducts(list);
         //师傅信息
-        orderAddBeanDTO.setOrderWorkers(this.orderWorkerList(id));
+        orderAddBeanDTO.setOrderWorkers(this.orderWorkerList(id,year));
         //标记
-        orderAddBeanDTO.setOrderFlags(orderFlagLogic.list(id));
+        orderAddBeanDTO.setOrderFlags(orderFlagLogic.list(id,year));
         return orderAddBeanDTO;
     }
 
+    private List<PgOrderProduct> getOrderProductList(String id, String year) {
+
+        if (year.equals("2024"))
+            return BeanUtil.copyToList(pgOrderProduct2024Service.lambdaQuery().eq(PgOrderProduct2024::getOrderBaseId,id).list(),PgOrderProduct.class);
+
+        if (year.equals("2023"))
+            return BeanUtil.copyToList(pgOrderProduct2023Service.lambdaQuery().eq(PgOrderProduct2023::getOrderBaseId,id).list(),PgOrderProduct.class);
+
+        if (year.equals("2022"))
+            return BeanUtil.copyToList(pgOrderProduct2022Service.lambdaQuery().eq(PgOrderProduct2022::getOrderBaseId,id).list(),PgOrderProduct.class);
+
+
+        return pgOrderProductService.lambdaQuery().eq(PgOrderProduct::getOrderBaseId,id).list();
+    }
+
+    private PgOrderBase getOrderBase(String id, String year) {
+        if (year.equals("2024"))
+            return BeanUtil.toBean(pgOrderBase2024Service.getById(id),PgOrderBase.class);
+
+        if (year.equals("2023"))
+            return BeanUtil.toBean(pgOrderBase2023Service.getById(id),PgOrderBase.class);
+
+        if (year.equals("2022"))
+            return BeanUtil.toBean(pgOrderBase2022Service.getById(id),PgOrderBase.class);
+
+
+        return pgOrderBaseService.getById(id);
+    }
+
     /**
      * 打标记/取消标记
      *
@@ -1141,8 +1198,19 @@ public class OrderBaseLogic {
      * @param orderBaseId
      * @return
      */
-    public List<PgOrderWorker> orderWorkerList(String orderBaseId) {
+    public List<PgOrderWorker> orderWorkerList(String orderBaseId,String year) {
         //师傅信息
+
+        if (year.equals("2024"))
+            return BeanUtil.copyToList( pgOrderWorker2024Service.lambdaQuery().eq(PgOrderWorker2024::getOrderBaseId, orderBaseId).list(),PgOrderWorker.class);
+
+        if (year.equals("2023"))
+            return BeanUtil.copyToList( pgOrderWorker2023Service.lambdaQuery().eq(PgOrderWorker2023::getOrderBaseId, orderBaseId).list(),PgOrderWorker.class);
+
+        if (year.equals("2022"))
+            return BeanUtil.copyToList( pgOrderWorker2022Service.lambdaQuery().eq(PgOrderWorker2022::getOrderBaseId, orderBaseId).list(),PgOrderWorker.class);
+
+
         List<PgOrderWorker> orderWorkers = pgOrderWorkerService.lambdaQuery().eq(PgOrderWorker::getOrderBaseId, orderBaseId).list();
         return orderWorkers;
     }
@@ -1489,6 +1557,14 @@ public class OrderBaseLogic {
     }
 
     /**
+     * 机型列表
+     */
+    public List<PgOrderProduct> listOrderProduct(String orderBaseId ,HttpServletRequest request) {
+        String year = CommonUtils.getYear(request);
+        return this.getOrderProductList(orderBaseId,year);
+    }
+
+    /**
      * 新增机型
      *
      * @param orderProduct
@@ -1850,7 +1926,7 @@ public class OrderBaseLogic {
                     .stream()
                     .map(OrderBase2VO::getId)
                     .collect(Collectors.toList());
-            Map<String, List<PgOrderFlag>> mapList = orderFlagLogic.list(orderBaseIds);
+            Map<String, List<PgOrderFlag>> mapList = orderFlagLogic.list(orderBaseIds,"2025");
             for (OrderBase2VO orderBaseVO : page.getRecords()) {
                 orderBaseVO.setOrderFlags(mapList.get(orderBaseVO.getId()));
             }
@@ -2311,17 +2387,17 @@ public class OrderBaseLogic {
         orderLogLogic.addLog(orderBaseId, "取消工单", "取消工单-家盛茂商城api", "");
     }
 
-    public List<PgOrderBaseDetail> orderDetailJsm(String saleOrderId,List<String> workerOrderIds) {
+    public List<PgOrderBaseDetail> orderDetailJsm(String saleOrderId, List<String> workerOrderIds) {
 
         if (StringUtil.isEmpty(saleOrderId) && CollectionUtil.isEmpty(workerOrderIds))
             return null;
 
         List<PgOrderBase> pgOrderBases = pgOrderBaseService.lambdaQuery()
-                .eq(!StringUtil.isEmpty(saleOrderId),PgOrderBase::getSaleOrderId, saleOrderId)
-                .in(!CollectionUtil.isEmpty(workerOrderIds),PgOrderBase::getId, workerOrderIds)
+                .eq(!StringUtil.isEmpty(saleOrderId), PgOrderBase::getSaleOrderId, saleOrderId)
+                .in(!CollectionUtil.isEmpty(workerOrderIds), PgOrderBase::getId, workerOrderIds)
                 .list();
 
-        List<PgOrderBaseDetail>  pgOrderBaseDetails = new ArrayList<>();
+        List<PgOrderBaseDetail> pgOrderBaseDetails = new ArrayList<>();
 
         for (PgOrderBase pgOrderBase : pgOrderBases) {
             PgOrderBaseDetail pgOrderBaseDetail = BeanUtil.toBean(pgOrderBase, PgOrderBaseDetail.class);

+ 33 - 10
mall-server-api/src/main/java/com/gree/mall/manager/logic/workorder/OrderFlagLogic.java

@@ -1,16 +1,13 @@
 package com.gree.mall.manager.logic.workorder;
 
+import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.collection.CollectionUtil;
 import com.gree.mall.manager.enums.MaterialExamineStatusEnum;
 import com.gree.mall.manager.enums.workorder.OrderFlagEnum;
 import com.gree.mall.manager.exception.RemoteServiceException;
 import com.gree.mall.manager.logic.common.CommonLogic;
-import com.gree.mall.manager.plus.entity.PgOrderBase;
-import com.gree.mall.manager.plus.entity.PgOrderFlag;
-import com.gree.mall.manager.plus.entity.RpMaterialOrder;
-import com.gree.mall.manager.plus.service.PgOrderBaseService;
-import com.gree.mall.manager.plus.service.PgOrderFlagService;
-import com.gree.mall.manager.plus.service.RpMaterialOrderService;
+import com.gree.mall.manager.plus.entity.*;
+import com.gree.mall.manager.plus.service.*;
 import com.gree.mall.manager.utils.StringUtil;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -31,6 +28,16 @@ public class OrderFlagLogic {
 
     @Autowired
     PgOrderFlagService pgOrderFlagService;
+
+    @Autowired
+    PgOrderFlag2022Service pgOrderFlag2022Service;
+
+    @Autowired
+    PgOrderFlag2023Service pgOrderFlag2023Service;
+
+    @Autowired
+    PgOrderFlag2024Service pgOrderFlag2024Service;
+
     @Autowired
     PgOrderBaseService pgOrderBaseService;
     @Autowired
@@ -136,11 +143,11 @@ public class OrderFlagLogic {
     /**
      * 查询服务单标识-列表
      */
-    public List<PgOrderFlag> list(String orderBaseId){
-        return this.list(orderBaseId,1);
+    public List<PgOrderFlag> list(String orderBaseId,String year){
+        return this.list(orderBaseId,1,year);
     }
 
-    public Map<String, List<PgOrderFlag>> list(List<String> orderBaseIds){
+    public Map<String, List<PgOrderFlag>> list(List<String> orderBaseIds,String year){
         if(CollectionUtil.isEmpty(orderBaseIds)){
             return Collections.emptyMap();
         }
@@ -153,7 +160,23 @@ public class OrderFlagLogic {
      * @param type 0=系统内部标注用  1=需要展示在服务单列表上的
      * @return
      */
-    public List<PgOrderFlag> list(String orderBaseId,Integer type){
+    public List<PgOrderFlag> list(String orderBaseId,Integer type,String year){
+
+        if (year.equals("2024")){
+            return BeanUtil.copyToList(pgOrderFlag2024Service.lambdaQuery()
+                    .eq(PgOrderFlag2024::getOrderBaseId, orderBaseId)
+                    .eq(type != null,PgOrderFlag2024::getType,type)
+                    .orderByAsc(PgOrderFlag2024::getSortNum)
+                    .list(),PgOrderFlag.class);
+        }
+        if (year.equals("2023")){
+            return BeanUtil.copyToList(pgOrderFlag2023Service.lambdaQuery()
+                    .eq(PgOrderFlag2023::getOrderBaseId, orderBaseId)
+                    .eq(type != null,PgOrderFlag2023::getType,type)
+                    .orderByAsc(PgOrderFlag2023::getSortNum)
+                    .list(),PgOrderFlag.class);
+        }
+
         return pgOrderFlagService.lambdaQuery()
                 .eq(PgOrderFlag::getOrderBaseId, orderBaseId)
                 .eq(type != null,PgOrderFlag::getType,type)

+ 47 - 1
mall-server-api/src/main/java/com/gree/mall/manager/logic/workorder/OrderLogLogic.java

@@ -29,6 +29,7 @@ import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import javax.servlet.http.HttpServletRequest;
 import java.math.BigDecimal;
 import java.text.SimpleDateFormat;
 import java.util.*;
@@ -42,6 +43,9 @@ public class OrderLogLogic {
     private final CommonLogic commonLogic;
     private final OrderFlagLogic orderFlagLogic;
     private final PgOrderOperatorLogService pgOrderOperatorLogService;
+    private final PgOrderOperatorLog2022Service pgOrderOperatorLog2022Service;
+    private final PgOrderOperatorLog2023Service pgOrderOperatorLog2023Service;
+    private final PgOrderOperatorLog2024Service pgOrderOperatorLog2024Service;
     private final PgOrderBaseService pgOrderBaseService;
     private final PgOrderSettleNormService pgOrderSettleNormService;
     private final PgSettleOrderService pgSettleOrderService;
@@ -66,8 +70,49 @@ public class OrderLogLogic {
      * @param orderBaseId
      * @return
      */
-    public List<PgOrderOperatorLog> operatorLogList(String orderBaseId){
+    public List<PgOrderOperatorLog> operatorLogList(String orderBaseId, HttpServletRequest request){
+        String year = CommonUtils.getYear(request);
+
+
+        return this.getOperatorLog(orderBaseId,year);
+
+
+    }
+
+    private List<PgOrderOperatorLog> getOperatorLog(String orderBaseId, String year) {
         AdminUserCom adminUser = commonLogic.getAdminUser();
+
+
+        if (year.equals("2024")){
+            return BeanUtil.copyToList(pgOrderOperatorLog2024Service.lambdaQuery()
+                    .eq(PgOrderOperatorLog2024::getOrderBaseId, orderBaseId)
+                    .eq(StringUtils.isNotBlank(adminUser.getCompanyWechatId()),
+                            PgOrderOperatorLog2024::getCompanyWechatId,
+                            adminUser.getCompanyWechatId())
+                    .orderByDesc(PgOrderOperatorLog2024::getCreateTime,PgOrderOperatorLog2024::getId)
+                    .list(),PgOrderOperatorLog.class);
+        }
+
+        if (year.equals("2023")){
+            return BeanUtil.copyToList(pgOrderOperatorLog2023Service.lambdaQuery()
+                    .eq(PgOrderOperatorLog2023::getOrderBaseId, orderBaseId)
+                    .eq(StringUtils.isNotBlank(adminUser.getCompanyWechatId()),
+                            PgOrderOperatorLog2023::getCompanyWechatId,
+                            adminUser.getCompanyWechatId())
+                    .orderByDesc(PgOrderOperatorLog2023::getCreateTime,PgOrderOperatorLog2023::getId)
+                    .list(),PgOrderOperatorLog.class);
+        }
+
+        if (year.equals("2022")){
+            return BeanUtil.copyToList(pgOrderOperatorLog2022Service.lambdaQuery()
+                    .eq(PgOrderOperatorLog2022::getOrderBaseId, orderBaseId)
+                    .eq(StringUtils.isNotBlank(adminUser.getCompanyWechatId()),
+                            PgOrderOperatorLog2022::getCompanyWechatId,
+                            adminUser.getCompanyWechatId())
+                    .orderByDesc(PgOrderOperatorLog2022::getCreateTime,PgOrderOperatorLog2022::getId)
+                    .list(),PgOrderOperatorLog.class);
+        }
+
         List<PgOrderOperatorLog> list = pgOrderOperatorLogService.lambdaQuery()
                 .eq(PgOrderOperatorLog::getOrderBaseId, orderBaseId)
                 .eq(StringUtils.isNotBlank(adminUser.getCompanyWechatId()),
@@ -75,6 +120,7 @@ public class OrderLogLogic {
                         adminUser.getCompanyWechatId())
                 .orderByDesc(PgOrderOperatorLog::getCreateTime,PgOrderOperatorLog::getId)
                 .list();
+
         return list;
     }
 

+ 1 - 1
mall-server-api/src/main/resources/mapper/CommonMapper.xml

@@ -320,7 +320,7 @@
     <select id="orderBaseList" resultType="com.gree.mall.manager.bean.listvo.workorder.OrderBaseVO">
         select
           ${ex.selected}
-        from pg_order_base a
+        from ${sqlBase} a
           ${ex.query}
           <if test="ex.orderSmallType != null and ex.orderSmallType !=''">
               and a.order_small_type = #{ex.orderSmallType}