Commit c3ce0fa4 by yunpeng.song

入账逻辑修改,日志多线程配置。

parent e4f3e361
...@@ -30,14 +30,14 @@ private: ...@@ -30,14 +30,14 @@ private:
FlowControl(FlowControl const&); FlowControl(FlowControl const&);
FlowControl& operator=(FlowControl const&); FlowControl& operator=(FlowControl const&);
typedef struct ORDER_PROPERPY // typedef struct ORDER_PROPERPY
{ // {
bool bReaded;//是否成功入账过 // bool bReaded;//是否成功入账过
bool bCancled;//是否成功退款入账过 // bool bCancled;//是否成功退款入账过
bool entryType;//入账类型 // bool entryType;//入账类型
int pullNum;//入账失败次数 // int pullNum;//入账失败次数
//QDateTime btimeStamp; // //QDateTime btimeStamp;
}OrderProperpy; // }OrderProperpy;
typedef struct TOPULL_ORDER typedef struct TOPULL_ORDER
{ {
...@@ -85,9 +85,8 @@ private: ...@@ -85,9 +85,8 @@ private:
JQHttpServer::TcpServerManage* m_tcpServerManage; JQHttpServer::TcpServerManage* m_tcpServerManage;
QMap<QString, QMultiMap<QString, dishesObject> >m_dishesMap; QMap<QString, QMultiMap<QString, dishesObject> >m_dishesMap;
// 入账list
// 已接单的订单 QStringList m_ordersEntryList;
QMap<QString, OrderProperpy> m_ordersEntryMap;
//订单号与pos短号映射 //订单号与pos短号映射
QMap<QString,QString> m_orderIdToPosSalesIdMap; QMap<QString,QString> m_orderIdToPosSalesIdMap;
//记录当前订单操作 //记录当前订单操作
...@@ -174,7 +173,7 @@ signals: ...@@ -174,7 +173,7 @@ signals:
* */ * */
void showDailyReportData(QJsonObject); void showDailyReportData(QJsonObject);
void doPullOrder(const QString& orderId,const QString& channel); void doPullOrder(const QString& orderId = QString(),const QString& channel = QString());
/* 功能:通知开始提醒 /* 功能:通知开始提醒
* 参数:[1]提醒类型 * 参数:[1]提醒类型
* 返回:NULL * 返回:NULL
......
...@@ -374,3 +374,83 @@ bool Orderstatus::deleteRecord(QString creatTime) ...@@ -374,3 +374,83 @@ bool Orderstatus::deleteRecord(QString creatTime)
return result; return result;
} }
bool Orderstatus::queryValue(const QString &orderId, const QString& key, QString &error, QVariant & value)
{
QMutexLocker mutex(&m_mutex);
if(!db.open())
{
error.append(QString("db open failed").append(db.lastError().text()));
return false;
}
QSqlQuery query(db);
query.prepare(QString("select %1 from status where orderId='%1'").arg(key).arg(orderId));
if(!query.exec())
{
error.append(query.lastError().text());
db.close();
return false;
}
else{
while(query.next())
{
value= query.value(0);
}
}
db.close();
return true;
}
bool Orderstatus::updatekey(const QString &orderId, const QString &key, const int value, QString &error, bool &result)
{
QMutexLocker mutex(&m_mutex);
if(!db.open())
{
error.append(QString("数据库打开失败").append(db.lastError().text()));
return false;
}
QSqlQuery query(db);
query.prepare(QString("update status set %1=%2 where orderId='%3'").arg(key)
.arg(QString::number(value)).arg(orderId));
if(!query.exec())
{
error.append(query.lastError().text());
db.close();
return false;
}
else{
result = true;
}
db.close();
return true;
}
bool Orderstatus::queryIsNull(const QString &orderId, const QString &key, QString &error, bool &result)
{
QMutexLocker mutex(&m_mutex);
if(!db.open())
{
error.append(QString("数据库打开失败").append(db.lastError().text()));
return false;
}
QSqlQuery query(db);
query.prepare(QString("select %1 from status where orderId=%2 and %3 is null").arg(orderId,orderId,key));
if(!query.exec())
{
error.append(query.lastError().text());
db.close();
return false;
}
else{
if(query.first())
{
result= true;
}
else{
result = false;
}
}
db.close();
return true;
}
...@@ -79,6 +79,14 @@ public: ...@@ -79,6 +79,14 @@ public:
bool PosSalesIdupdate(const QString& orderId, const QString &posSalesId); bool PosSalesIdupdate(const QString& orderId, const QString &posSalesId);
bool getPosSalesId(const QString& orderId, QString &posSalesId); bool getPosSalesId(const QString& orderId, QString &posSalesId);
bool queryValue(const QString& orderId, const QString& key, QString& error, QVariant &value);
bool updatekey(const QString& orderId, const QString& key, const int value, QString &error, bool &result);
bool queryIsNull(const QString &orderId, const QString& key,QString &error, bool &result);
bool deleteRecord(QString creatTime); bool deleteRecord(QString creatTime);
private: private:
QMutex m_mutex; QMutex m_mutex;
......
...@@ -141,6 +141,8 @@ public: ...@@ -141,6 +141,8 @@ public:
Q_PROPERTY (int channelNum READ getchannelNum WRITE setchannelNum) Q_PROPERTY (int channelNum READ getchannelNum WRITE setchannelNum)
Q_PROPERTY (int order_index READ getorder_index WRITE setorder_index) Q_PROPERTY (int order_index READ getorder_index WRITE setorder_index)
Q_PROPERTY (bool has_invoiced READ gethas_invoiced WRITE sethas_invoiced) Q_PROPERTY (bool has_invoiced READ gethas_invoiced WRITE sethas_invoiced)
Q_PROPERTY (bool isPut READ getisPut WRITE setisPut)
Q_PROPERTY (bool isCancle READ getisCancle WRITE setisCancle)
Q_PROPERTY (QString invoice_title READ getinvoice_title WRITE setinvoice_title) Q_PROPERTY (QString invoice_title READ getinvoice_title WRITE setinvoice_title)
Q_PROPERTY (QString courier_name READ getcourier_name WRITE setcourier_name) Q_PROPERTY (QString courier_name READ getcourier_name WRITE setcourier_name)
Q_PROPERTY (QString courier_phone READ getcourier_phone WRITE setcourier_phone) Q_PROPERTY (QString courier_phone READ getcourier_phone WRITE setcourier_phone)
...@@ -157,6 +159,8 @@ public: ...@@ -157,6 +159,8 @@ public:
Q_PROPERTY (int product_fee READ getproduct_fee WRITE setproduct_fee) Q_PROPERTY (int product_fee READ getproduct_fee WRITE setproduct_fee)
Q_PROPERTY (int order_type READ getorder_type WRITE setorder_type) Q_PROPERTY (int order_type READ getorder_type WRITE setorder_type)
Q_PROPERTY (int update_time READ getupdate_time WRITE setupdate_time) Q_PROPERTY (int update_time READ getupdate_time WRITE setupdate_time)
Q_PROPERTY (int putType READ getputType WRITE setputType)
Q_PROPERTY (int putTimes READ getputTimes WRITE setputTimes)
int service_fee; //平台佣金 int service_fee; //平台佣金
int dis_platform_fee; //平台承担的优惠金额 int dis_platform_fee; //平台承担的优惠金额
...@@ -164,6 +168,10 @@ public: ...@@ -164,6 +168,10 @@ public:
int package_fee; //打包费 int package_fee; //打包费
QString possale_id; //pos短号 QString possale_id; //pos短号
bool isPut; //是否入账
bool isCancle; //是否撤单
int putType; //入账类型
int putTimes; //入账次数
QString address; //地址 QString address; //地址
QString channel; //渠道 QString channel; //渠道
QString channel_name; //渠道名称 QString channel_name; //渠道名称
...@@ -208,6 +216,22 @@ public: ...@@ -208,6 +216,22 @@ public:
protected: protected:
inline bool getisPut() const{return isPut;}
inline void setisPut(const bool &v){isPut = v;}
inline bool getisCancle() const{return isCancle;}
inline void setisCancle(const bool &v){isCancle = v;}
inline int getputType() const{return putType;}
inline void setputType(const int &v){putType = v;}
inline int getputTimes() const{return putTimes;}
inline void setputTimes(const int &v){putTimes = v;}
inline int getupdate_time() const{return update_time;} inline int getupdate_time() const{return update_time;}
inline void setupdate_time(const int &v){update_time = v;} inline void setupdate_time(const int &v){update_time = v;}
......
INCLUDEPATH += $$PWD INCLUDEPATH += $$PWD
#DEFINES += QS_LOG_LINE_NUMBERS # automatically writes the file and line for each log message #DEFINES += QS_LOG_LINE_NUMBERS # automatically writes the file and line for each log message
#DEFINES += QS_LOG_DISABLE # logging code is replaced with a no-op #DEFINES += QS_LOG_DISABLE # logging code is replaced with a no-op
#DEFINES += QS_LOG_SEPARATE_THREAD # messages are queued and written from a separate thread DEFINES += QS_LOG_SEPARATE_THREAD # messages are queued and written from a separate thread
#DEFINES += QS_LOG_WIN_PRINTF_CONSOLE # Use fprintf instead of OutputDebugString on Windows #DEFINES += QS_LOG_WIN_PRINTF_CONSOLE # Use fprintf instead of OutputDebugString on Windows
SOURCES += $$PWD/QsLogDest.cpp \ SOURCES += $$PWD/QsLogDest.cpp \
$$PWD/QsLog.cpp \ $$PWD/QsLog.cpp \
......
...@@ -75,7 +75,8 @@ void MainForm::MyShow() ...@@ -75,7 +75,8 @@ void MainForm::MyShow()
#ifdef QT_DEBUG #ifdef QT_DEBUG
this->show(); this->show();
#else #else
this->showFullScreen(); this->show();
//this->showFullScreen();
#endif #endif
// 考虑到坐标问题放到这里构建 // 考虑到坐标问题放到这里构建
......
...@@ -99,6 +99,9 @@ ...@@ -99,6 +99,9 @@
#define JSON_FAILEDSUM "fail_total_fee" #define JSON_FAILEDSUM "fail_total_fee"
#define JSON_DAILYSUMMARYS "daily_summarys" #define JSON_DAILYSUMMARYS "daily_summarys"
#define MAXPUTTIMES 4
// 订单的操作码 // 订单的操作码
#define OPERATION_GETDELIVERS "getDelivers" #define OPERATION_GETDELIVERS "getDelivers"
#define OPERATION_CONFRIM "confirm" #define OPERATION_CONFRIM "confirm"
......
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