fix:关闭广布bug

This commit is contained in:
dzc committed 2025-05-13 18:13:43 +08:00
1 parent 273759a549
commit d309b9fcbc
7 files changed
+60 -20

No files matched your search

@@ -13,8 +13,7 @@ abstract class BroadcastDao {
final sql = '''
UPDATE broadcast SET enable = ${enable ? 1 : 0}
WHERE
isDone = 0
AND (:hourType = '-1' OR hourType = :hourType)
(${hourType.code} = '-1' OR hourType = ${hourType.code})
AND strftime('%Y-%m-%d', createTime) = strftime('%Y-%m-%d', 'now', 'localtime')
''';
return await database.rawUpdate(sql, []);
+3 -3
View File
@@ -277,10 +277,10 @@ class _$BroadcastDao extends BroadcastDao {
final UpdateAdapter<BroadcastEntity> _broadcastEntityUpdateAdapter;
@override
Future<void> del(String serviceCode) async {
Future<void> del(String serviceOrderCode) async {
await _queryAdapter.queryNoReturn(
'DELETE FROM broadcast WHERE isDone = 0 AND (?1 = \'-1\' OR serviceCode = ?1)',
arguments: [serviceCode]);
'DELETE FROM broadcast WHERE isDone = 0 AND (?1 = \'-1\' OR serviceOrderCode = ?1)',
arguments: [serviceOrderCode]);
}
@override
+31
View File
@@ -47,4 +47,35 @@ class TtsManage {
static Future<void> dispose() async {
await _flutterTts.stop();
}
/// 将数字转换为中文读法(手机号码格式)
/// 特别处理:1读为"幺",其他数字正常读法
static String numberToChineseReading(String number) {
if (number.isEmpty) return "";
// 数字到中文读法的映射
const Map<String, String> digitToChinese = {
'0': '零',
'1': '幺', // 手机号中1读为"幺"
'2': '二',
'3': '三',
'4': '四',
'5': '五',
'6': '六',
'7': '七',
'8': '八',
'9': '九',
};
// 逐位转换
StringBuffer result = StringBuffer();
for (int i = 0; i < number.length; i++) {
String digit = number[i];
if (digitToChinese.containsKey(digit)) {
result.write(digitToChinese[digit]);
} else {
// 如果不是数字,保持原样
result.write(digit);
}
}
return result.toString();
}
}
+1 -1
View File
@@ -22,7 +22,7 @@ class SyncCheckTool {
Duration printInterval = const Duration(seconds: 60 * 10);
Duration broadcastInterval = const Duration(seconds: 60 * 3);
Duration broadcastInterval = const Duration(seconds: 60 * 2);
Timer? mqTimer;
@@ -76,7 +76,7 @@ abstract class SyncTakeFoodBroadcastTool {
}
String msg = "请手机尾号";
for (final content in uniqueContents) {
msg += "$content,";
msg += "${TtsManage.numberToChineseReading(content)},";
}
// 逗号会影响语音播报断句
msg = msg.substring(0, msg.length - 1);
@@ -143,16 +143,23 @@ abstract class SyncTakeFoodBroadcastTool {
}
return false;
}
// final serviceCodes =
// serviceList.records?.map((e) => e.id.toString()).toList();
// if (ObjectUtil.isEmptyList(serviceCodes)) {
// return result;
// }
// 根据服务码查询本地数据库
await broadcastDao.delAll();
// 转化为 BroadcastEntity
final saveList = serviceList.records!
.map((e) => _convertServiceBroadcastTodayToBroadcastEntity(e))
.toList();
// 查询全部本地数据
final localList = await broadcastDao.findAllPage("-1", 999, 0);
final localServiceCode = localList.map((i) => i.serviceCode).toList();
for (final i in saveList) {
if (localServiceCode.contains(i.serviceCode)) {
final target =
localList.firstWhereOrNull((j) => j.serviceCode == i.serviceCode);
if (target != null) {
i.enable = target.enable;
}
}
}
await broadcastDao.delAll();
await broadcastDao.batchSave(saveList);
return result;
}
+2 -2
View File
@@ -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.125:9999';
static const apiUrl = 'http://192.168.101.125:9999';
/// 静态资源 url
static const ossUrl = apiUrl;
+7 -4
View File
@@ -141,10 +141,13 @@ class PanelController extends GetxController {
Get.offAndToNamed(RouteNames.login);
break;
case PanelType.test:
await CashBoxManage.openCT1();
await CashBoxManage.openCT2();
final status = await CashBoxManage.checkStatus();
logger.e(status);
// await CashBoxManage.openCT1();
// await CashBoxManage.openCT2();
// final status = await CashBoxManage.checkStatus();
// logger.e(status);
String phon1 = TtsManage.numberToChineseReading("3144");
String phon2 = TtsManage.numberToChineseReading("3155");
TtsManage.speak("请手机尾号,$phon1、$phon2,的用户取餐");
break;
default:
break;