Commit d3f381e4 by wuyang.zou

fix bug:

action 4 update checkno conflict Timer Trigger Presist Order Input Successed Record

Version: 3.2022.8.18
parent 6be63e92
Pipeline #41398 failed with stage
in 0 seconds
......@@ -52,7 +52,6 @@ bool CheckPoskeyExistPosDB::initCheckPoskeyExistPosDB(){
}
QLOG_INFO()<<QString::fromLocal8Bit("[<<<<---FM TakeOut Plugin Version:2.2021.10.27 Begin Check Poskey Whether Exist POS DB--->>>>]");
return bRet ;
}
......@@ -135,6 +134,7 @@ bool CheckPoskeyExistPosDB::queryValue(const QString& orderId, const QString& ke
return true;
}
bool CheckPoskeyExistPosDB::queryIsNull(const QString &orderId, const QString& key,QString &error, bool &result){
QMutexLocker mutex(&m_mutex);
if(!m_sqlDb.open()) {
......
......@@ -348,6 +348,7 @@ SimProcOrderDB &SimProcOrderDB::getInstance()
return simProcOrderDB;
}
bool SimProcOrderDB::insertSimProcOrder(const QString &orderId,const QString& creatTime)
{
//QMutexLocker mutex(&m_mutex);
......@@ -445,7 +446,6 @@ bool SimProcOrderDB::getDbOrderAllFlag(const QString& id, int& dataBaseIsOrderEx
m_sqlDb.close();
m_mutex.unlock();
return result;
}
......@@ -485,20 +485,22 @@ bool SimProcOrderDB::updateRefundOrderStatusAndChkNum(const QString &orderId, co
bool SimProcOrderDB::presistOrderInputPosSuccessRecord(const QString &orderId, const OrderObject::PresistInputPosSuccessRecord* pInPosSuRd)
{
/* // 单入口更新入机成功记录,无需加锁;
// 单入口更新入机成功记录,无需加锁; [错误理论]
// [多线程同时操作此表时,将会出现程序异常退出: action: 1,4,5,6,11,12.. 操作SimProcOrderDB表同时, 与定时持久化入机结果相冲突]
if ( !pInPosSuRd ) {
QLOG_ERROR()<<QString("[<<<<---SimProcOrderDB::presistOrderInputPosSuccessRecord orderId: %1 Pointer Is Null, Then Return--->>>>]").arg(orderId);
return false;
}
bool retTryLock = m_mutex.tryLock(VALUE_TRYLOCKNETTIMEOUT);
if(!retTryLock){
QLOG_ERROR()<<"[<<<<---SimProcOrderDB::presistOrderInputPosSuccessRecord Try Lock Failed--->>>>]";
return false;
}
*/
if ( !pInPosSuRd ) {
QLOG_ERROR()<<QString("[<<<<---SimProcOrderDB::presistOrderInputPosSuccessRecord orderId: %1 Pointer Is Null, Then Return--->>>>]").arg(orderId);
return false;
}
if(!m_sqlDb.open()) {
QLOG_ERROR()<<"[<<<<---SimProcOrderDB::presistOrderInputPosSuccessRecord Open DataBase Failed--->>>>]"<<m_sqlDb.lastError().text();
m_mutex.unlock();
return false;
}
......@@ -521,27 +523,32 @@ bool SimProcOrderDB::presistOrderInputPosSuccessRecord(const QString &orderId, c
}
m_sqlDb.close();
m_mutex.unlock();
return result;
}
bool SimProcOrderDB::queryPresistInputPosSuccessRecord(const QString &orderId, QJsonObject& pInPosSuRdJS)
{
/* // 单入口更新入机成功记录,无需加锁;
// 单入口更新入机成功记录,无需加锁; [错误理论]
// [多线程同时操作此表时,将会出现程序异常退出: action: 1,4,5,6,11,12.. 操作SimProcOrderDB表同时, 与定时持久化入机结果相冲突]
bool retTryLock = m_mutex.tryLock(VALUE_TRYLOCKNETTIMEOUT);
if(!retTryLock){
QLOG_ERROR()<<"[<<<<---SimProcOrderDB::queryPresistInputPosSuccessRecord Try Lock Failed--->>>>]";
return false;
}
*/
QString tempOrderId = orderId.trimmed();
if ( !tempOrderId.length() ) {
QLOG_ERROR()<<QString("[<<<<---SimProcOrderDB::queryPresistInputPosSuccessRecord orderId Is Empty, Then Return--->>>>]");
m_mutex.unlock();
return false;
}
if(!m_sqlDb.open()) {
QLOG_ERROR()<<"[<<<<---SimProcOrderDB::queryPresistInputPosSuccessRecord Open DataBase Failed--->>>>]"<<m_sqlDb.lastError().text();
m_mutex.unlock();
return false;
}
......@@ -554,7 +561,6 @@ bool SimProcOrderDB::queryPresistInputPosSuccessRecord(const QString &orderId, Q
QLOG_ERROR()<<QString("[<<<<---SimProcOrderDB::queryPresistInputPosSuccessRecord OrderId: %1, Error: %2 Failed--->>>>]").arg(tempOrderId).arg( query.lastError().text() );
} else {
if ( query.first() ) {
// query.value(0).toString() --> orderId;
QString type = query.value(1).toString();
QString status = query.value(2).toString();
QString storeId = query.value(3).toString();
......@@ -588,7 +594,6 @@ bool SimProcOrderDB::queryPresistInputPosSuccessRecord(const QString &orderId, Q
pInPosSuRdJS.insert(JSON_POS_MAC_ADDRESS, posMacAddress);
pInPosSuRdJS.insert(JSON_POS_PLUGIN_VERSION, posVersion);
pInPosSuRdJS.insert(JSON_TCP_DEVICE_TYPE , deviceType);
result= true;
QLOG_INFO()<<QString("[<<<<---SimProcOrderDB::Query OrderId: %1 ReqType: %2 Status: %3 Remark: %4 Successd --->>>>]")
.arg(tempOrderId).arg(type).arg(status).arg(remark);
......@@ -597,13 +602,13 @@ bool SimProcOrderDB::queryPresistInputPosSuccessRecord(const QString &orderId, Q
}
}
m_sqlDb.close();
m_mutex.unlock();
return result;
}
bool SimProcOrderDB::getPosOrderCheckNo(const QString &orderId,QString& posOrderCheckNo)
{
//QMutexLocker mutex(&m_mutex);
bool retTryLock = m_mutex.tryLock(VALUE_TRYLOCKNETTIMEOUT);
if(!retTryLock){
QLOG_ERROR()<<"[<<<<---SimProcOrderDB::getPosOrderCheckNo Try Lock Failed--->>>>]";
......@@ -619,6 +624,7 @@ bool SimProcOrderDB::getPosOrderCheckNo(const QString &orderId,QString& posOrder
query.prepare(QString("select posCheckNo from SimProcOrderTable where orderId='%1'").arg(orderId));
if(!query.exec()) {
QLOG_ERROR()<<query.lastError().text()<<orderId<<__FUNCTION__;
m_mutex.unlock();
return result;
}
while(query.next()) {
......
......@@ -7,8 +7,8 @@ IDI_ICON ICON DISCARDABLE "logo.ico"
#endif
VS_VERSION_INFO VERSIONINFO
//***每次修改后编译发版必须变更版本号(preDefine.h中APP_VERSION 需要一致)***//
FILEVERSION 2,2022,8,1
PRODUCTVERSION 2,2022,8,1
FILEVERSION 2,2022,8,18
PRODUCTVERSION 2,2022,8,18
//*************************************************************************//
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
......@@ -31,8 +31,8 @@ VS_VERSION_INFO VERSIONINFO
VALUE "OriginalFilename", "fmTakeout.exe"
VALUE "ProductName", "Delivery Order Plugin"
//***每次修改后编译发版必须变更版本号(preDefine.h中APP_VERSION 需要一致)***//
VALUE "ProductVersion", "2.2022.8.1"
VALUE "FileVersion", "2.2022.8.1"
VALUE "ProductVersion", "2.2022.8.18"
VALUE "FileVersion", "2.2022.8.18"
//*************************************************************************//
END
END
......
......@@ -42,7 +42,8 @@
//#define APP_VERSION "2.2021.9.24"
//#define APP_VERSION "2.2021.12.20"
//#define APP_VERSION "2.2022.1.18"
#define APP_VERSION "2.2022.8.1"
//#define APP_VERSION "2.2022.8.1"
#define APP_VERSION "2.2022.8.18"
//修正版本号时,切记修正 FmTakeout.rc 中的版本号
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment