Index: lib/page/customer_store/controller/customer_store_list_controller.dart
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP
<+>import 'package:application/const/store/store.dart';\nimport 'package:application/core/database/db_helper.dart';\nimport 'package:application/core/database/db_manager.dart';\nimport 'package:application/core/extension/string_parser_extension.dart';\nimport 'package:application/page/menu/controller/dict_controller.dart';\nimport 'package:application/page/menu/model/dict_list_model.dart';\nimport 'package:application/page/store/model/store_list_model.dart';\nimport 'package:application/res/strings.dart';\nimport 'package:application/utils/smart_manager.dart';\nimport 'package:flutter/material.dart';\nimport 'package:isar/isar.dart';\nimport 'package:public_lib/net/model/result_data.dart';\nimport 'package:public_lib/ui/base_getx.dart';\nimport 'package:get/get.dart';\nimport 'package:public_lib/ui/base_viewmodel.dart';\nimport 'package:public_lib/ui/page_state.dart';\n\nimport '../../../config/flavors.dart';\nimport '../../../core/database/mp_application.dart';\nimport '../../../core/http/http.dart';\nimport '../../../model/system/sale_unit_model.dart';\n\nclass CustomerStoreListBindings extends BaseBindings {\n  @override\n  void dependencies() {\n   Get.put(CustomerStoreListController());\n  }\n}\n\nclass CustomerStoreListController extends BaseController {\n  final _apiService = Get.find<ApiService>();\n\n  ///从字典获取筛选条件信息\n  //类型数据\n  List<DictItemModel> typeData = [];\n\n  //门店类型数据\n  List<DictItemModel> shopTypeData = [];\n\n  //销售状态数据\n  List<DictItemModel> saleType = [];\n\n  int initTypeData = -1;\n\n  List<int> initShopTypeList = [0];\n\n  int initSaleType = -1;\n\n  ///当前类型数据\n  String typeDataStr = '';\n\n  ///当前门店类型数据\n  List<String> shopTypeDataStr = [];\n\n  ///当前销售状态数据\n  String saleTypeStr = '';\n\n  ///判断当前是否使用筛选搜索\n  RxBool isSearch = false.obs;\n\n  ///检查是否含有筛选\n  RxBool isSearchCheck = false.obs;\n\n  ///检查是否为搜索模式\n  void checkSearch() {\n    isSearch.value = initTypeData != -1 ||\n        initShopTypeList != [0] ||\n        initSaleType != -1 ||\n        searchController.text.isNotEmpty;\n  }\n\n  ///检查是否含有筛选\n  void checkSearchCheck() {\n    isSearchCheck.value = initTypeData!= -1 ||\n        initShopTypeList.first!=0 ||\n        initSaleType!= -1 ;\n  }\n\n  ///列表原数据\n  Rx<PageWrapListState<StoreListModel, StoreListRecords>> storeList =\n      PageWrapListState<StoreListModel, StoreListRecords>(\n          (parentModel) => parentModel.records).obs;\n\n  ///搜索数据\n  Rx<PageWrapListState<StoreListModel, StoreListRecords>> searchList =\n      PageWrapListState<StoreListModel, StoreListRecords>(\n          (parentModel) => parentModel.records).obs;\n\n  ///门店全部\n  DictItemModel allDict =\n      DictItemModel(dictKey: '', dictValue: Ids.secondBatchOfMerchants.tr, code: '');\n\n  ///输入框\n  TextEditingController searchController = TextEditingController();\n\n  ///是否显示删除按钮\n  RxBool showDelete = false.obs;\n\n  ///销售单位信息\n  String productLineCode = '';\n\n @override\n  void onReady() {\n   searchController.addListener(() {\n     showDelete.value = searchController.text.isNotEmpty;\n   });\n    super.onReady();\n  }\n\n  @override\n  void onClose() {\n    searchController.dispose();\n    super.onClose();\n  }\n\n  ///获取字典数据\n  void getDictData() async {\n    DictController dictController = Get.put(DictController());\n    typeData = dictController.subCustomerType;\n    if(typeData.isEmpty){\n      typeData=await dictController.getDictItem(Store.SUB_CUSTOMER_TYPE);\n    }\n    shopTypeData = dictController.shopType;\n    if(shopTypeData.isEmpty){\n      shopTypeData=await dictController.getDictItem(Store.SHOP_TYPE);\n    }\n    saleType = dictController.saleStatus;\n    if(saleType.isEmpty){\n      saleType=await dictController.getDictItem(Store.SALE_STATUS);\n    }\n    if (shopTypeData.isNotEmpty&&shopTypeData.first.dictValue != Ids.secondBatchOfMerchants.tr &&\n        !shopTypeData.map((e) => e.dictValue).toList().contains(Ids.secondBatchOfMerchants.tr)) {\n      shopTypeData.insert(0, allDict);\n    }\n  }\n\n  ///获取销售单位信息\n  Future<String> getSaleUnitInfo() async {\n    ///先查看数据库是否有数据\n    SaleUnitModel? saleUnitModel = await DatabaseManager.getInstance()\n        .isar\n        ?.saleUnitModels\n        .filter()\n        .customerCodeEqualTo(MpApplication.customerCode)\n        .clientTypeEqualTo(F.clientType)\n        .findFirst();\n\n    ///获取当前时间的时间戳\n    String currentTime = DateTime.now().millisecondsSinceEpoch.toString();\n    if (saleUnitModel != null) {\n      if (currentTime.isOver24Hours()) {\n        return saveSaleUnitInfo(currentTime,ids: saleUnitModel.ids);\n      } else {\n        return saleUnitModel.productLineCode ?? '';\n      }\n    } else {\n      return saveSaleUnitInfo(currentTime);\n    }\n  }\n\n  Future<String> saveSaleUnitInfo(String currentTime,{Id? ids}) async {\n    ResultData resultData = await _apiService.getCustomerSaleUnitList(\n      MpApplication.customerCode,\n    );\n    if (resultData.isSuccess()) {\n      List<SaleUnitModel> units = resultData.data;\n      if (units.isNotEmpty) {\n        if(ids!=null){\n          units.first.ids=ids;\n        }\n        await DatabaseManager.getInstance().saveData(() async {\n          await DatabaseManager.getInstance()\n              .isar!\n              .saleUnitModels\n              .put(units.first\n                ..customerCode = MpApplication.customerCode\n                ..clientType = F.clientType\n                ..getData = currentTime);\n        });\n        return units.first.productLineCode ?? '';\n      }\n    }\n    return '';\n  }\n\n  ///获取商店列表数据\n  Future<ResultData> getStoreList(\n      {int? page, bool isSearch = false, bool isShowLoading = false}) async {\n    String selectedShopType = '';\n    if (shopTypeDataStr.isNotEmpty) {\n      if (shopTypeDataStr.length == 1) {\n        selectedShopType = '';\n      } else {\n        selectedShopType = shopTypeDataStr.join(',');\n      }\n    }\n    if (productLineCode.isEmpty) {\n      productLineCode = await getSaleUnitInfo();\n    }\n    if (isSearch) {\n      searchList\n        ..put('subCustomerQueryStr', searchController.text)\n        ..put('processStatus', '')\n        ..put('customerType', typeDataStr)\n        ..put('shopType', selectedShopType)\n        ..put('productLineCode', productLineCode)\n        ..put('saleStatus', saleTypeStr)\n        ..put('isMobile', \"Y\")\n        ..put('current', page)\n        ..put('size', 20);\n      return searchList\n          .request((p0) => _apiService.getStoreList(p0, isShowLoading: true));\n    } else {\n      storeList\n        ..put('productLineCode', productLineCode)\n        ..put('isMobile', \"Y\")\n        ..put('current', page)\n        ..put('size', 20);\n      return storeList.request(\n          (p0) => _apiService.getStoreList(p0, isShowLoading: isShowLoading));\n    }\n  }\n\n  ///进入先获取数据库的数据，然后拉取接口，但是这个过程不显示加载\n  Future<void> getListInfo() async {\n    ///先获取数据库\n    StoreListModel? storeListModel = await DateBaseHelper().getStoreListInfo();\n    if (storeListModel != null) {\n      ///不为空，则先获取数据库数据，然后再执行下载回显缓存到数据库\n      storeList.value.data = storeListModel.records?.map((e) => e).toList();\n      storeList.setState(ViewState.Idle);\n      ResultData resultData = await getStoreList(page: 1);\n      await getListAndSave(resultData,id: storeListModel.id);\n    } else {\n      ///为空，则先下载回显缓存到数据库,需要加载动画\n      ResultData resultData = await getStoreList(page: 1, isShowLoading: true);\n      await getListAndSave(resultData);\n    }\n  }\n\n  ///下载回显缓存到数据库\n  Future<void> getListAndSave(ResultData resultData, {Id? id}) async {\n    if (resultData.isSuccess()) {\n      ///请求成功\n      StoreListModel model = resultData.data;\n      if (model.records != null && model.records!.isNotEmpty) {\n        storeList.value.data = model.records;\n        storeList.setState(ViewState.Idle);\n        await DatabaseManager.getInstance().saveData(() async {\n          if (id != null) {\n            await DatabaseManager.getInstance().isar!.storeListModels.put(model\n              ..customerCode = MpApplication.customerCode\n              ..clientType = F.clientType\n              ..id = id);\n          } else {\n            await DatabaseManager.getInstance().isar!.storeListModels.put(model\n              ..customerCode = MpApplication.customerCode\n              ..clientType = F.clientType);\n          }\n        });\n      }\n    } else {\n      ///请求失败\n      storeList.setState(ViewState.Error);\n    }\n  }\n}\n
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/lib/page/customer_store/controller/customer_store_list_controller.dart b/lib/page/customer_store/controller/customer_store_list_controller.dart
--- a/lib/page/customer_store/controller/customer_store_list_controller.dart	(revision e6c83b956c6ff25d8df5c6df7380f27bbf1f217c)
+++ b/lib/page/customer_store/controller/customer_store_list_controller.dart	(date 1713171505237)
@@ -2,6 +2,7 @@
 import 'package:application/core/database/db_helper.dart';
 import 'package:application/core/database/db_manager.dart';
 import 'package:application/core/extension/string_parser_extension.dart';
+import 'package:application/core/mp_core_config.dart';
 import 'package:application/page/menu/controller/dict_controller.dart';
 import 'package:application/page/menu/model/dict_list_model.dart';
 import 'package:application/page/store/model/store_list_model.dart';
@@ -14,6 +15,7 @@
 import 'package:get/get.dart';
 import 'package:public_lib/ui/base_viewmodel.dart';
 import 'package:public_lib/ui/page_state.dart';
+import 'package:sp_util/sp_util.dart';
 
 import '../../../config/flavors.dart';
 import '../../../core/database/mp_application.dart';
@@ -197,6 +199,7 @@
     if (productLineCode.isEmpty) {
       productLineCode = await getSaleUnitInfo();
     }
+    searchList.put(MpCoreConfig.IPO_STATUS, SpUtil.getString(MpCoreConfig.IPO_STATUS));
     if (isSearch) {
       searchList
         ..put('subCustomerQueryStr', searchController.text)
Index: lib/page/store/controller/store_list_controller.dart
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP
<+>import 'package:application/core/database/mp_application.dart';\nimport 'package:public_lib/ui/base_getx.dart';\nimport 'package:application/core/http/http.dart';\nimport 'package:application/res/strings.dart';\nimport 'package:application/page/store/model/store_list_model.dart';\nimport 'package:flutter/cupertino.dart';\nimport 'package:get/get.dart';\nimport 'package:public_lib/net/model/result_data.dart';\nimport 'package:public_lib/ui/page_state.dart';\n\nimport '../../../config/flavors.dart';\nimport '../../../const/home/auth.dart';\nimport '../../../core/database/cache_manager.dart';\nimport '../../../model/system/sale_unit_model.dart';\nimport '../../menu/model/dict_list_model.dart';\n\nclass StoreBindings extends BaseBindings {\n  @override\n  void dependencies() {\n    Get.lazyPut<StoreListController>(() => StoreListController());\n  }\n}\n\nclass StoreListController extends BaseController {\n  //搜索输入内容\n  String subCustomerQueryStr = \"\";\n\n  //tabbar识别状态\n  String selectedHeaderId = \"\";\n\n  //筛选类型\n  RxString selectedCustomerType = \"\".obs;\n\n  //筛选门店类型\n  String selectedShopType = \"\";\n\n  //多选情况下多门店存放列表\n  RxList<String> shopList = [''].obs;\n\n  //筛选销售状态\n  RxString selectedSaleStatus = \"\".obs;\n\n  //类型数据\n  List<DictItemModel> typeData = [];\n\n  //门店类型数据\n  List<DictItemModel> shopTypeData = [];\n\n  //销售状态数据\n  List<DictItemModel> saleType = [];\n\n  //门店全部\n  DictItemModel allDict =\n      DictItemModel(dictKey: '', dictValue: Ids.all.tr, code: '');\n\n  var _apiService = Get.find<ApiService>();\n  var _cacheManager = Get.find<CacheManager>();\n\n  Rx<PageWrapListState<StoreListModel, StoreListRecords>> storeList =\n      PageWrapListState<StoreListModel, StoreListRecords>(\n          (parentModel) => parentModel.records).obs;\n\n  Future<String> getProductLineCode() async {\n    String _productLineCode =\n        _cacheManager.getCacheSync(AuthConst.PRODUCT_LINE_CACHE_KEY) ?? '';\n    if (_productLineCode.isEmpty) {\n      List<SaleUnitModel> units;\n      if (F.isCustomerClient) {\n        units = await _apiService\n            .getCustomerSaleUnitList(MpApplication.customerCode)\n            .then((value) => value.data);\n      } else {\n        units =\n            await _apiService.getSaleUnitList({}).then((value) => value.data);\n      }\n      _productLineCode = units[0]?.productLineCode ?? '';\n      _cacheManager.setCache(\n          AuthConst.PRODUCT_LINE_CACHE_KEY, _productLineCode);\n    }\n    return _productLineCode;\n  }\n\n  //获取商店列表数据\n  Future<ResultData> getStoreList({int? page}) async {\n    if(shopList.isNotEmpty){\n      if(shopList.length==1){\n        selectedShopType='';\n      }else{\n        selectedShopType=shopList.join(',');\n      }\n    }\n    String productLineCode = await getProductLineCode();\n    storeList\n      ..put('subCustomerQueryStr', subCustomerQueryStr)\n      ..put('processStatus', selectedHeaderId)\n      ..put('customerType', selectedCustomerType)\n      ..put('shopType', selectedShopType)\n      ..put('productLineCode', productLineCode)\n      ..put('saleStatus', selectedSaleStatus)\n      ..put('isMobile', \"Y\")\n      ..put('current', page)\n      ..put('size', 20);\n    return storeList.request(_apiService.getStoreList);\n  }\n\n  void closeKeyboard() {\n    FocusScope.of(Get.context!).requestFocus(FocusNode());\n  }\n\n  setTabStatus(int index) {\n    switch (index) {\n      case 0:\n        selectedHeaderId = '';\n        break;\n      case 1:\n        selectedHeaderId = '01';\n        break;\n      case 2:\n        selectedHeaderId = '02,03';\n        break;\n      case 3:\n        selectedHeaderId = '05';\n        break;\n    }\n  }\n}\n
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/lib/page/store/controller/store_list_controller.dart b/lib/page/store/controller/store_list_controller.dart
--- a/lib/page/store/controller/store_list_controller.dart	(revision e6c83b956c6ff25d8df5c6df7380f27bbf1f217c)
+++ b/lib/page/store/controller/store_list_controller.dart	(date 1713171505240)
@@ -1,4 +1,5 @@
 import 'package:application/core/database/mp_application.dart';
+import 'package:application/core/mp_core_config.dart';
 import 'package:public_lib/ui/base_getx.dart';
 import 'package:application/core/http/http.dart';
 import 'package:application/res/strings.dart';
@@ -7,6 +8,7 @@
 import 'package:get/get.dart';
 import 'package:public_lib/net/model/result_data.dart';
 import 'package:public_lib/ui/page_state.dart';
+import 'package:sp_util/sp_util.dart';
 
 import '../../../config/flavors.dart';
 import '../../../const/home/auth.dart';
@@ -89,7 +91,7 @@
         selectedShopType=shopList.join(',');
       }
     }
-    String productLineCode = await getProductLineCode();
+    // String productLineCode = await getProductLineCode();
     storeList
       ..put('subCustomerQueryStr', subCustomerQueryStr)
       ..put('processStatus', selectedHeaderId)
