diff --git a/lib/common/services/database/dao/canteen_spu_dao.dart b/lib/common/services/database/dao/canteen_spu_dao.dart index 6eae38a..a790cf1 100644 --- a/lib/common/services/database/dao/canteen_spu_dao.dart +++ b/lib/common/services/database/dao/canteen_spu_dao.dart @@ -1,6 +1,4 @@ -import 'package:common_utils/common_utils.dart'; import 'package:floor/floor.dart'; -import 'package:get/get.dart'; import 'package:pj_supermarket_cloud/common/index.dart'; @@ -28,10 +26,10 @@ abstract class CanteenSpuDao { @Query(""" UPDATE canteen_spu SET isDefault = :isDefault WHERE - serviceUniqueCode = :uniqueCode AND hourType = :hourType - AND strftime('%Y-%m-%d', saleDate) = strftime('%Y-%m-%d', 'now', 'localtime') + serviceUniqueCode = :uniqueCode + AND hourType = :hourType """) - Future edit(bool isDefault, String uniqueCode, String hourType); + Future editDefault(bool isDefault, String uniqueCode, String hourType); @update Future batchEdit(List entitys); @@ -59,7 +57,7 @@ abstract class CanteenSpuDao { @Query(''' SELECT canteen_spu.* FROM canteen_spu - LEFT JOIN classify ON canteen_spu.classifyServiceUniqueCode = classify.serviceUniqueCode + LEFT JOIN classify ON canteen_spu.classifyServiceUniqueCode = classify.serviceUniqueCode AND classify.delFlag = 0 WHERE (:classifyServiceUniqueCode = '-1' OR canteen_spu.classifyServiceUniqueCode = :classifyServiceUniqueCode) AND (:hourType = '-1' OR INSTR(',' || hourType || ',', ',' || :hourType || ',') > 0) @@ -75,7 +73,7 @@ abstract class CanteenSpuDao { @Query(''' SELECT canteen_spu.* FROM canteen_spu - LEFT JOIN classify ON canteen_spu.classifyServiceUniqueCode = classify.serviceUniqueCode + LEFT JOIN classify ON canteen_spu.classifyServiceUniqueCode = classify.serviceUniqueCode AND classify.delFlag = 0 WHERE (:classifyServiceUniqueCode = '-1' OR canteen_spu.classifyServiceUniqueCode = :classifyServiceUniqueCode) AND (:hourType = '-1' OR INSTR(',' || canteen_spu.hourType || ',', ',' || :hourType || ',') > 0) @@ -95,6 +93,7 @@ abstract class CanteenSpuDao { WHERE isDefault = 1 AND (:hourType = '-1' OR hourType = :hourType) + AND strftime('%Y-%m-%d', saleDate) = strftime('%Y-%m-%d', 'now', 'localtime') ''') Future> getDefault(String hourType); } diff --git a/lib/common/services/database/dao/supermarket_spu_dao.dart b/lib/common/services/database/dao/supermarket_spu_dao.dart index c354fc5..5fc8d89 100644 --- a/lib/common/services/database/dao/supermarket_spu_dao.dart +++ b/lib/common/services/database/dao/supermarket_spu_dao.dart @@ -10,7 +10,7 @@ abstract class SupermarketSpuDao { @Query(''' SELECT supermarket_spu.* FROM supermarket_spu - LEFT JOIN classify ON supermarket_spu.classifyServiceUniqueCode = classify.serviceUniqueCode + LEFT JOIN classify ON supermarket_spu.classifyServiceUniqueCode = classify.serviceUniqueCode AND classify.delFlag = 0 WHERE supermarket_spu.delFlag = 0 AND (:classifyServiceUniqueCode = '-1' OR supermarket_spu.classifyServiceUniqueCode = :classifyServiceUniqueCode) @@ -28,7 +28,7 @@ abstract class SupermarketSpuDao { @Query(''' SELECT supermarket_spu.* FROM supermarket_spu - LEFT JOIN classify ON supermarket_spu.classifyServiceUniqueCode = classify.serviceUniqueCode + LEFT JOIN classify ON supermarket_spu.classifyServiceUniqueCode = classify.serviceUniqueCode AND classify.delFlag = 0 WHERE supermarket_spu.delFlag = 0 AND (:classifyServiceUniqueCode = '-1' OR supermarket_spu.classifyServiceUniqueCode = :classifyServiceUniqueCode) diff --git a/lib/common/services/database/database.g.dart b/lib/common/services/database/database.g.dart index ec5f988..9906865 100644 --- a/lib/common/services/database/database.g.dart +++ b/lib/common/services/database/database.g.dart @@ -679,13 +679,13 @@ class _$CanteenSpuDao extends CanteenSpuDao { } @override - Future edit( + Future editDefault( bool isDefault, String uniqueCode, String hourType, ) async { await _queryAdapter.queryNoReturn( - 'UPDATE canteen_spu SET isDefault = ?1 WHERE serviceUniqueCode = ?2 AND hourType = ?3 AND strftime(\'%Y-%m-%d\', saleDate) = strftime(\'%Y-%m-%d\', \'now\', \'localtime\')', + 'UPDATE canteen_spu SET isDefault = ?1 WHERE serviceUniqueCode = ?2 AND hourType = ?3', arguments: [_boolConverter.encode(isDefault), uniqueCode, hourType]); } @@ -715,7 +715,7 @@ class _$CanteenSpuDao extends CanteenSpuDao { String saleDate, ) async { return _queryAdapter.queryList( - 'SELECT canteen_spu.* FROM canteen_spu LEFT JOIN classify ON canteen_spu.classifyServiceUniqueCode = classify.serviceUniqueCode WHERE (?1 = \'-1\' OR canteen_spu.classifyServiceUniqueCode = ?1) AND (?2 = \'-1\' OR INSTR(\',\' || hourType || \',\', \',\' || ?2 || \',\') > 0) AND (?3 = \'-1\' OR strftime(\'%Y-%m-%d\', saleDate) = strftime(\'%Y-%m-%d\', ?3)) ORDER BY classify.sort, canteen_spu.price', + 'SELECT canteen_spu.* FROM canteen_spu LEFT JOIN classify ON canteen_spu.classifyServiceUniqueCode = classify.serviceUniqueCode AND classify.delFlag = 0 WHERE (?1 = \'-1\' OR canteen_spu.classifyServiceUniqueCode = ?1) AND (?2 = \'-1\' OR INSTR(\',\' || hourType || \',\', \',\' || ?2 || \',\') > 0) AND (?3 = \'-1\' OR strftime(\'%Y-%m-%d\', saleDate) = strftime(\'%Y-%m-%d\', ?3)) ORDER BY classify.sort, canteen_spu.price', mapper: (Map row) => CanteenSpuEntity(id: row['id'] as int?, serviceUniqueCode: row['serviceUniqueCode'] as String, classifyServiceUniqueCode: row['classifyServiceUniqueCode'] as String, hourType: row['hourType'] == null ? null : ProductHourType.values[row['hourType'] as int], saleDate: _dateTimeConverter.decode(row['saleDate'] as String), name: row['name'] as String, price: row['price'] as int, image: row['image'] as String?, isDefault: _boolConverter.decode(row['isDefault'] as int), status: row['status'] as int, sort: row['sort'] as int, createTime: _dateTimeConverter.decode(row['createTime'] as String), updateTime: _dateTimeConverter.decode(row['updateTime'] as String)), arguments: [classifyServiceUniqueCode, hourType, saleDate]); } @@ -728,7 +728,7 @@ class _$CanteenSpuDao extends CanteenSpuDao { int offset, ) async { return _queryAdapter.queryList( - 'SELECT canteen_spu.* FROM canteen_spu LEFT JOIN classify ON canteen_spu.classifyServiceUniqueCode = classify.serviceUniqueCode WHERE (?1 = \'-1\' OR canteen_spu.classifyServiceUniqueCode = ?1) AND (?2 = \'-1\' OR INSTR(\',\' || canteen_spu.hourType || \',\', \',\' || ?2 || \',\') > 0) AND strftime(\'%Y-%m-%d\', saleDate) = strftime(\'%Y-%m-%d\', \'now\', \'localtime\') ORDER BY classify.sort, classify.id, canteen_spu.price LIMIT ?3 OFFSET ?4', + 'SELECT canteen_spu.* FROM canteen_spu LEFT JOIN classify ON canteen_spu.classifyServiceUniqueCode = classify.serviceUniqueCode AND classify.delFlag = 0 WHERE (?1 = \'-1\' OR canteen_spu.classifyServiceUniqueCode = ?1) AND (?2 = \'-1\' OR INSTR(\',\' || canteen_spu.hourType || \',\', \',\' || ?2 || \',\') > 0) AND strftime(\'%Y-%m-%d\', saleDate) = strftime(\'%Y-%m-%d\', \'now\', \'localtime\') ORDER BY classify.sort, classify.id, canteen_spu.price LIMIT ?3 OFFSET ?4', mapper: (Map row) => CanteenSpuEntity(id: row['id'] as int?, serviceUniqueCode: row['serviceUniqueCode'] as String, classifyServiceUniqueCode: row['classifyServiceUniqueCode'] as String, hourType: row['hourType'] == null ? null : ProductHourType.values[row['hourType'] as int], saleDate: _dateTimeConverter.decode(row['saleDate'] as String), name: row['name'] as String, price: row['price'] as int, image: row['image'] as String?, isDefault: _boolConverter.decode(row['isDefault'] as int), status: row['status'] as int, sort: row['sort'] as int, createTime: _dateTimeConverter.decode(row['createTime'] as String), updateTime: _dateTimeConverter.decode(row['updateTime'] as String)), arguments: [classifyServiceUniqueCode, hourType, pageSize, offset]); } @@ -736,7 +736,7 @@ class _$CanteenSpuDao extends CanteenSpuDao { @override Future> getDefault(String hourType) async { return _queryAdapter.queryList( - 'SELECT * FROM canteen_spu WHERE isDefault = 1 AND (?1 = \'-1\' OR hourType = ?1)', + 'SELECT * FROM canteen_spu WHERE isDefault = 1 AND (?1 = \'-1\' OR hourType = ?1) AND strftime(\'%Y-%m-%d\', saleDate) = strftime(\'%Y-%m-%d\', \'now\', \'localtime\')', mapper: (Map row) => CanteenSpuEntity(id: row['id'] as int?, serviceUniqueCode: row['serviceUniqueCode'] as String, classifyServiceUniqueCode: row['classifyServiceUniqueCode'] as String, hourType: row['hourType'] == null ? null : ProductHourType.values[row['hourType'] as int], saleDate: _dateTimeConverter.decode(row['saleDate'] as String), name: row['name'] as String, price: row['price'] as int, image: row['image'] as String?, isDefault: _boolConverter.decode(row['isDefault'] as int), status: row['status'] as int, sort: row['sort'] as int, createTime: _dateTimeConverter.decode(row['createTime'] as String), updateTime: _dateTimeConverter.decode(row['updateTime'] as String)), arguments: [hourType]); } @@ -921,7 +921,7 @@ class _$SupermarketSpuDao extends SupermarketSpuDao { Future> getAll( String classifyServiceUniqueCode) async { return _queryAdapter.queryList( - 'SELECT supermarket_spu.* FROM supermarket_spu LEFT JOIN classify ON supermarket_spu.classifyServiceUniqueCode = classify.serviceUniqueCode WHERE supermarket_spu.delFlag = 0 AND (?1 = \'-1\' OR supermarket_spu.classifyServiceUniqueCode = ?1) ORDER BY classify.sort', + 'SELECT supermarket_spu.* FROM supermarket_spu LEFT JOIN classify ON supermarket_spu.classifyServiceUniqueCode = classify.serviceUniqueCode AND classify.delFlag = 0 WHERE supermarket_spu.delFlag = 0 AND (?1 = \'-1\' OR supermarket_spu.classifyServiceUniqueCode = ?1) ORDER BY classify.sort', mapper: (Map row) => SupermarketSpuEntity(id: row['id'] as int?, serviceUniqueCode: row['serviceUniqueCode'] as String, classifyServiceUniqueCode: row['classifyServiceUniqueCode'] as String, productCode: row['productCode'] as String, productName: row['productName'] as String, productNature: _supermarketNatureConverter.decode(row['productNature'] as String), barCode: row['barCode'] as String?, packageNum: row['packageNum'] as int, unit: row['unit'] as String, spec: row['spec'] as String, picUrl: row['picUrl'] as String?, stock: row['stock'] as double?, salesCount: row['salesCount'] as double?, purchasePrice: row['purchasePrice'] as int, retailPrice: row['retailPrice'] as int, promotionPrice: row['promotionPrice'] as int, sort: row['sort'] as int, createTime: _dateTimeConverter.decode(row['createTime'] as String), updateTime: _dateTimeConverter.decode(row['updateTime'] as String), delFlag: _boolConverter.decode(row['delFlag'] as int)), arguments: [classifyServiceUniqueCode]); } @@ -940,7 +940,7 @@ class _$SupermarketSpuDao extends SupermarketSpuDao { int offset, ) async { return _queryAdapter.queryList( - 'SELECT supermarket_spu.* FROM supermarket_spu LEFT JOIN classify ON supermarket_spu.classifyServiceUniqueCode = classify.serviceUniqueCode WHERE supermarket_spu.delFlag = 0 AND (?1 = \'-1\' OR supermarket_spu.classifyServiceUniqueCode = ?1) ORDER BY classify.sort LIMIT ?2 OFFSET ?3', + 'SELECT supermarket_spu.* FROM supermarket_spu LEFT JOIN classify ON supermarket_spu.classifyServiceUniqueCode = classify.serviceUniqueCode AND classify.delFlag = 0 WHERE supermarket_spu.delFlag = 0 AND (?1 = \'-1\' OR supermarket_spu.classifyServiceUniqueCode = ?1) ORDER BY classify.sort LIMIT ?2 OFFSET ?3', mapper: (Map row) => SupermarketSpuEntity(id: row['id'] as int?, serviceUniqueCode: row['serviceUniqueCode'] as String, classifyServiceUniqueCode: row['classifyServiceUniqueCode'] as String, productCode: row['productCode'] as String, productName: row['productName'] as String, productNature: _supermarketNatureConverter.decode(row['productNature'] as String), barCode: row['barCode'] as String?, packageNum: row['packageNum'] as int, unit: row['unit'] as String, spec: row['spec'] as String, picUrl: row['picUrl'] as String?, stock: row['stock'] as double?, salesCount: row['salesCount'] as double?, purchasePrice: row['purchasePrice'] as int, retailPrice: row['retailPrice'] as int, promotionPrice: row['promotionPrice'] as int, sort: row['sort'] as int, createTime: _dateTimeConverter.decode(row['createTime'] as String), updateTime: _dateTimeConverter.decode(row['updateTime'] as String), delFlag: _boolConverter.decode(row['delFlag'] as int)), arguments: [classifyServiceUniqueCode, pageSize, offset]); } diff --git a/lib/common/values/constants.dart b/lib/common/values/constants.dart index 3f0f278..8090c51 100644 --- a/lib/common/values/constants.dart +++ b/lib/common/values/constants.dart @@ -10,9 +10,9 @@ class Constants { static const pwdEncKey = 'pigxpigxpigxpigx'; /// 服务 url - // static const apiUrl = 'https://stgl.pj.gov.cn/api'; + static const apiUrl = 'https://stgl.pj.gov.cn/api'; - static const apiUrl = 'http://192.168.101.123:9999'; + // static const apiUrl = 'http://192.168.101.123:9999'; /// 静态资源 url static const ossUrl = apiUrl; diff --git a/lib/common/widgets/order/order_caneen_common.dart b/lib/common/widgets/order/order_caneen_common.dart index 0396685..76cdff4 100644 --- a/lib/common/widgets/order/order_caneen_common.dart +++ b/lib/common/widgets/order/order_caneen_common.dart @@ -20,7 +20,12 @@ Widget orderCaneenSpuCard( ), image: appImg(image, width: double.infinity, height: 150.h), subtitle: [ - Text(name, style: theme.typography.lg), + Text( + name, + maxLines: 2, + overflow: TextOverflow.ellipsis, + style: theme.typography.base.copyWith(height: 1), + ), SizedBox(height: 5.h), appPrice(context, price), ] diff --git a/lib/pages/setting/widgets/setting_baseInfo.dart b/lib/pages/setting/widgets/setting_baseInfo.dart index d545b7f..9ec4bba 100644 --- a/lib/pages/setting/widgets/setting_baseInfo.dart +++ b/lib/pages/setting/widgets/setting_baseInfo.dart @@ -20,8 +20,10 @@ Future _bindServiceDialog(BuildContext context, SysSetting sys) async { // uniqueCodeC.text = "1894303392833716226"; // 正式环境-测试 // uniqueCodeC.text = "1896157295523049473"; + // 正式环境-新县府02 + uniqueCodeC.text = "1887466308336488450"; // 测试环境-测试设备 - uniqueCodeC.text = "1877592554489143298"; + // uniqueCodeC.text = "1877592554489143298"; // 测试环境-食堂-浦阳 // uniqueCodeC.text = "1914567628657778690"; } diff --git a/lib/pages/setting/widgets/setting_product.dart b/lib/pages/setting/widgets/setting_product.dart index b3ed0a2..9fe431c 100644 --- a/lib/pages/setting/widgets/setting_product.dart +++ b/lib/pages/setting/widgets/setting_product.dart @@ -165,7 +165,7 @@ class ProductManageController extends GetxController { final productDao = appC.dataBase.getCanteenSpuDao; final editObj = CanteenSpuEntity.fromJson(v.toJson()); editObj.isDefault = !editObj.isDefault; - await productDao.edit( + await productDao.editDefault( editObj.isDefault, editObj.serviceUniqueCode, hourType.code, @@ -282,8 +282,12 @@ Widget _buildCanteenList(BuildContext context) { ), ), image: appImg(v.image, width: double.infinity, height: 120.h), - title: - Text(v.name, maxLines: 2, style: theme.typography.base).center(), + title: Text( + v.name, + maxLines: 2, + overflow: TextOverflow.ellipsis, + style: theme.typography.xs, + ).center(), subtitle: appPrice(context, v.price.toString()) .center() .paddingOnly(top: 10.h),