| | |
| | | m_menu = new QMenu(this); |
| | | m_menu->addAction("删除"); |
| | | m_menu->addAction("增加"); |
| | | m_menu->addAction("保存导出"); |
| | | |
| | | ui->treeWidget->setContextMenuPolicy(Qt::CustomContextMenu); |
| | | connect(ui->treeWidget,SIGNAL(customContextMenuRequested(QPoint)),this,SLOT(showMenu(QPoint))); |
| | | |
| | | connect(m_menu->actions().at(0),SIGNAL(triggered(bool)),this,SLOT(deleteInfo())); |
| | | connect(m_menu->actions().at(1),SIGNAL(triggered(bool)),this,SLOT(addInfo())); |
| | | connect(m_menu->actions().at(2),SIGNAL(triggered(bool)),this,SLOT(saveInfo())); |
| | | // 单位内容修改 |
| | | |
| | | // 右边可编辑内容 |
| | |
| | | { |
| | | if(m_curItem==nullptr)return; |
| | | qDebug()<<"删除公司信息,节点:"<<m_curItem->text(0); |
| | | auto resList = m_curItem->takeChildren(); |
| | | //auto resList = m_curItem->takeChildren(); |
| | | |
| | | qDebug()<<"删除数量:"<<resList.size(); |
| | | //qDebug()<<"删除数量:"<<resList.size(); |
| | | |
| | | // 删除数据库表里面对应的公司信息,并且再次刷新下拉框和树状图 |
| | | |
| | | // 数据库表有:封面信息表 all_company_info 综合信息表 comprehensive_entry_info 三合一的表 standing_book_info |
| | | QString name = m_curItem->text(0); |
| | | QStringList sp = name.split("(本级)"); |
| | | QStringList sp2 = name.split("下级数"); |
| | | qDebug()<<"拆开:"<<sp<<"汇总:"<<sp2; |
| | | if(sp.size() == 2){ |
| | | name = sp.at(0); |
| | | } |
| | | if(sp2.size() == 2){ // 得递归删除底下的所有单位 |
| | | name = sp2.at(0); |
| | | } |
| | | // 删除所有表中这个名字 |
| | | deleteAllByName(name); |
| | | |
| | | // 删除完了,还得去刷新下拉框 |
| | | for(auto it=m_nameAndComInfos.begin();it!=m_nameAndComInfos.end();){ |
| | | if(it.key() == name){ |
| | | m_nameAndComInfos.erase(it++); |
| | | break; |
| | | }else{ |
| | | it++; |
| | | } |
| | | } |
| | | |
| | | |
| | | // 去刷新树形图 |
| | | for(auto it=m_treeNodes.begin();it!=m_treeNodes.end();){ |
| | | // 如果等于键,那么要删除对应的所有的值 |
| | | if(it.key() == name){ |
| | | // 把所有的值对应的单位信息都删掉 |
| | | for(auto str:it.value()){ |
| | | auto p = m_nameAndComInfos.find(str); |
| | | if(p != m_nameAndComInfos.end()){ |
| | | deleteAllByName(str); // 还得再删掉数据库中的内容 |
| | | m_nameAndComInfos.erase(p); |
| | | } |
| | | } |
| | | m_treeNodes.erase(it++); |
| | | break; |
| | | } |
| | | // 只是某个值,只删除一个即可,遍历值里面的迭代器,找到删除即可 |
| | | else{ |
| | | auto p = it.value().find(name); |
| | | if(p != it.value().end()){ |
| | | it.value().erase(p); |
| | | } |
| | | it++; |
| | | } |
| | | } |
| | | |
| | | emit updateComboListSignal(m_nameAndComInfos); |
| | | createTreeNode(); |
| | | |
| | | |
| | | } |
| | | |
| | | void ConverInfo2::saveInfo() |
| | | { |
| | | if(m_curItem==nullptr)return; |
| | | qDebug()<<"保存公司信息,节点:"<<m_curItem->text(0); |
| | | QString name = m_curItem->text(0); |
| | | if(name.contains("(本级)")){ |
| | | name = name.split("(本级)").at(0); |
| | | }else if(name.contains("(汇总)")){ |
| | | name = name.split("(汇总)").at(0); |
| | | name = name + "(汇总)"; |
| | | } |
| | | qDebug()<<"保存公司名:"<<name; |
| | | ComInfo cif = m_nameAndComInfos[name]; |
| | | ExportToFile etf(this); |
| | | etf.saveToExcelFromComInfo(cif); |
| | | |
| | | } |
| | | |
| | | void ConverInfo2::on_treeWidget_doubleClicked(const QModelIndex &index) |
| | | { |
| | | QString name = index.model()->data(index).toString(); |
| | | qDebug()<<"双击"<<index<<name; |
| | | ComInfo curCominfo = m_nameAndComInfos[name]; |
| | | |
| | | ComInfo curCominfo; // 不要直接给值,可能会导致多添加新的名字进来 |
| | | if(name.contains("(本级)")){ |
| | | QStringList sps = name.split("(本级)"); |
| | | name = sps.at(0); |
| | |
| | | |
| | | } |
| | | curCominfo = allCominfo; |
| | | // 处理完了之后,还需要单独起一个汇总的名字 |
| | | name = name + "(汇总)"; |
| | | strcpy(curCominfo.name,name.toLocal8Bit().data()); |
| | | m_nameAndComInfos[name] = curCominfo; |
| | | |
| | | // 刷新组合下拉框的列表 |
| | | emit updateComboListSignal(m_nameAndComInfos); |
| | | |
| | | }else{ |
| | | curCominfo = m_nameAndComInfos[name]; |
| | | } |
| | | //ComInfo curCominfo = m_nameAndComInfos[name]; |
| | | // 一、单位基本情况 |
| | |
| | | // 最后存到map中 |
| | | m_nameAndComInfos[name.toString()]=curComInfo; |
| | | |
| | | // 更新到数据库中 |
| | | saveToSQL(curComInfo); |
| | | qDebug()<<"load Excel save to SQL ok:"<<name; |
| | | |
| | | |
| | | // 添加树形列表节点 |
| | | //addTreeWidgetNode(upName,name); |
| | | |
| | | if(upName.isValid()){ |
| | | if(name.isValid()){ |
| | | m_treeNodes[upName.toString()].push_back(name.toString()); |
| | | //m_treeNodes[upName.toString()].push_back(name.toString()); |
| | | m_treeNodes[upName.toString()].insert(name.toString()); |
| | | } |
| | | }else{ |
| | | if(name.isValid()){ |
| | | m_treeNodes[name.toString()].push_back(name.toString()); |
| | | //m_treeNodes[name.toString()].push_back(name.toString()); |
| | | m_treeNodes[name.toString()].insert(name.toString()); |
| | | } |
| | | } |
| | | |
| | |
| | | cntIdx++; |
| | | } |
| | | |
| | | // 再次查询数据库中所有的信息 |
| | | readAllSQLData(); |
| | | |
| | | createTreeNode(); // 构建树形节点 |
| | | |
| | | // 发射 加载完成的信号 |
| | | emit loadFinished(); |
| | | |
| | | // 更新其他界面的公司信息下拉框 |
| | | emit updateComboListSignal(m_nameAndComInfos); |
| | | |
| | | // QAxObject excel("./debug/Data/附件2_内审统01表_单位及内部审计机构基本情况表-1.301版(1).xls"); |
| | | // excel.setProperty("Visible",true); |
| | |
| | | |
| | | m_menu->addAction("删除"); |
| | | m_menu->addAction("增加"); |
| | | m_menu->addAction("保存导出"); |
| | | |
| | | ui->treeWidget->setContextMenuPolicy(Qt::CustomContextMenu); |
| | | connect(ui->treeWidget,SIGNAL(customContextMenuRequested(QPoint)),this,SLOT(showMenu(QPoint))); |
| | | |
| | | connect(m_menu->actions().at(0),SIGNAL(triggered(bool)),this,SLOT(deleteInfo())); |
| | | connect(m_menu->actions().at(1),SIGNAL(triggered(bool)),this,SLOT(addInfo())); |
| | | connect(m_menu->actions().at(2),SIGNAL(triggered(bool)),this,SLOT(saveInfo())); |
| | | } |
| | | |
| | | void ConverInfo2::on_pushButton_commit_clicked() |
| | |
| | | |
| | | |
| | | // 更新到数据库 |
| | | saveToSQL(curComInfo); |
| | | |
| | | // 先判断是不是已经存在公司名了,若已存在,则更新,不存在则插入 |
| | | QString sql = QString("select id,name from all_company_info where name='%1'").arg(name); |
| | | qDebug()<<"sql:"<<sql; |
| | | QSqlQuery query; |
| | | int rowCnt = 0; |
| | | if(query.exec(sql)){ |
| | | qDebug()<<"size:"<<query.size(); |
| | | // // 先判断是不是已经存在公司名了,若已存在,则更新,不存在则插入 |
| | | // QString sql = QString("select id,name from all_company_info where name='%1'").arg(name); |
| | | // qDebug()<<"sql:"<<sql; |
| | | // QSqlQuery query; |
| | | // int rowCnt = 0; |
| | | // if(query.exec(sql)){ |
| | | // qDebug()<<"size:"<<query.size(); |
| | | |
| | | while (query.next()) { |
| | | rowCnt++; |
| | | } |
| | | } |
| | | if(rowCnt == 0){ |
| | | // 不存在,则插入一条新数据 |
| | | qDebug()<<"不存在:"<<name; |
| | | sql = QString("insert into all_company_info (name,\ |
| | | code,\ |
| | | 机构类型,\ |
| | | 主要业务活动,\ |
| | | 行业代码,\ |
| | | 单位注册地及区域,\ |
| | | 区域代码,\ |
| | | 城乡代码,\ |
| | | 单位规模,\ |
| | | 从业期末人数,\ |
| | | 法定代表人,\ |
| | | 执行会记标准类别,\ |
| | | 长途区号,\ |
| | | 固定电话,\ |
| | | 邮政编码,\ |
| | | 电子邮箱,\ |
| | | 网址,\ |
| | | 是否有上一级法人,\ |
| | | 上一级统信代码,\ |
| | | 原组织代码,\ |
| | | 上级单位名称,\ |
| | | 是否设置总审计师,\ |
| | | 总审计师职位层级,\ |
| | | 总审任职方式,\ |
| | | 是否设置内审机构,\ |
| | | 内审机构名称,\ |
| | | 领导机构,\ |
| | | 是否独立设置内审机构,\ |
| | | 财务部门,\ |
| | | 法务部门,\ |
| | | 内部控制部门,\ |
| | | 纪检部门,\ |
| | | 其他部门,\ |
| | | 内审层级,\ |
| | | 编制数量,\ |
| | | 实有人数量,\ |
| | | 专职人员数量,\ |
| | | 拥有CIA人数,\ |
| | | 硕士学历以上人数,\ |
| | | 本科人数,\ |
| | | 专科及以下人数,\ |
| | | 高级职称人数,\ |
| | | 中级职称人数,\ |
| | | 初级职称人数,\ |
| | | 无职称人数,\ |
| | | 五十岁以上人数,\ |
| | | 三十至五十岁岁人数,\ |
| | | 三十岁以下人数,\ |
| | | 审计数量,\ |
| | | 会计数量,\ |
| | | 经济数量,\ |
| | | 法律数量,\ |
| | | 管理数量,\ |
| | | 信息技术数量,\ |
| | | 工程数量,\ |
| | | 其他数量,\ |
| | | 统计负责人,\ |
| | | 填表人,\ |
| | | 联系电话,\ |
| | | 填报日期) values ('%1','%2','%3','%4','%5','%6','%7','%8','%9',%10,\ |
| | | '%11','%12','%13','%14','%15','%16','%17','%18','%19','%20',\ |
| | | '%21','%22','%23','%24','%25','%26','%27','%28',%29,%30,\ |
| | | %31,%32,%33,'%34',%35,%36,%37,%38,%39,%40,\ |
| | | %41,%42,%43,%44,%45,%46,%47,%48,%49,%50,\ |
| | | %51,%52,%53,%54,%55,%56,'%57','%58','%59','%60'\ |
| | | )").arg(name).arg(creditCode).arg(comType).arg(business).arg(businessCode).arg(addr).arg(areaCode).arg(townCode).arg(scale).arg(people). |
| | | arg(representative).arg(standardType).arg(trunkCode).arg(fixedTel).arg(postCode).arg(email).arg(webSite).arg(hasUpLegal).arg(upCreditCode).arg(oldCreditCode). |
| | | arg(upName).arg(hasChiefDesigner).arg(ChiefDesignerLevel).arg(employmentMode).arg(hasSetIntervalAudit).arg(internalName).arg(leadingOrganization).arg(hasSetSeparateIA).arg(financeDepartment).arg(legalDepartment). |
| | | arg(internalConDepart).arg(disceplineInDepart).arg(otherDepart).arg(intavalAuditLeval).arg(organazationNum).arg(realNum).arg(professionalNum).arg(CIANum).arg(masterNum).arg(undergraduatesNum). |
| | | arg(juniorNum).arg(seniorNum).arg(intermediateNum).arg(primaryNum).arg(noTitleNum).arg(upFiftyOldNum).arg(upThirtyOldNum).arg(downThirtyOldNum).arg(auditNum).arg(accountingNum). |
| | | arg(economyNum).arg(lawNum).arg(managerNum).arg(itNum).arg(engineeringNum).arg(otherNum).arg(statisticalConOfficer).arg(personFilling).arg(officerTel).arg(fillingDateTime); |
| | | // while (query.next()) { |
| | | // rowCnt++; |
| | | // } |
| | | // } |
| | | // if(rowCnt == 0){ |
| | | // // 不存在,则插入一条新数据 |
| | | // qDebug()<<"不存在:"<<name; |
| | | // sql = QString("insert into all_company_info (name,\ |
| | | //code,\ |
| | | //机构类型,\ |
| | | //主要业务活动,\ |
| | | //行业代码,\ |
| | | //单位注册地及区域,\ |
| | | //区域代码,\ |
| | | //城乡代码,\ |
| | | //单位规模,\ |
| | | //从业期末人数,\ |
| | | //法定代表人,\ |
| | | //执行会记标准类别,\ |
| | | //长途区号,\ |
| | | //固定电话,\ |
| | | //邮政编码,\ |
| | | //电子邮箱,\ |
| | | //网址,\ |
| | | //是否有上一级法人,\ |
| | | //上一级统信代码,\ |
| | | //原组织代码,\ |
| | | //上级单位名称,\ |
| | | //是否设置总审计师,\ |
| | | //总审计师职位层级,\ |
| | | //总审任职方式,\ |
| | | //是否设置内审机构,\ |
| | | //内审机构名称,\ |
| | | //领导机构,\ |
| | | //是否独立设置内审机构,\ |
| | | //财务部门,\ |
| | | //法务部门,\ |
| | | //内部控制部门,\ |
| | | //纪检部门,\ |
| | | //其他部门,\ |
| | | //内审层级,\ |
| | | //编制数量,\ |
| | | //实有人数量,\ |
| | | //专职人员数量,\ |
| | | //拥有CIA人数,\ |
| | | //硕士学历以上人数,\ |
| | | //本科人数,\ |
| | | //专科及以下人数,\ |
| | | //高级职称人数,\ |
| | | //中级职称人数,\ |
| | | //初级职称人数,\ |
| | | //无职称人数,\ |
| | | //五十岁以上人数,\ |
| | | //三十至五十岁岁人数,\ |
| | | //三十岁以下人数,\ |
| | | //审计数量,\ |
| | | //会计数量,\ |
| | | //经济数量,\ |
| | | //法律数量,\ |
| | | //管理数量,\ |
| | | //信息技术数量,\ |
| | | //工程数量,\ |
| | | //其他数量,\ |
| | | //统计负责人,\ |
| | | //填表人,\ |
| | | //联系电话,\ |
| | | //填报日期) values ('%1','%2','%3','%4','%5','%6','%7','%8','%9',%10,\ |
| | | //'%11','%12','%13','%14','%15','%16','%17','%18','%19','%20',\ |
| | | //'%21','%22','%23','%24','%25','%26','%27','%28',%29,%30,\ |
| | | //%31,%32,%33,'%34',%35,%36,%37,%38,%39,%40,\ |
| | | //%41,%42,%43,%44,%45,%46,%47,%48,%49,%50,\ |
| | | //%51,%52,%53,%54,%55,%56,'%57','%58','%59','%60'\ |
| | | //)").arg(name).arg(creditCode).arg(comType).arg(business).arg(businessCode).arg(addr).arg(areaCode).arg(townCode).arg(scale).arg(people). |
| | | // arg(representative).arg(standardType).arg(trunkCode).arg(fixedTel).arg(postCode).arg(email).arg(webSite).arg(hasUpLegal).arg(upCreditCode).arg(oldCreditCode). |
| | | // arg(upName).arg(hasChiefDesigner).arg(ChiefDesignerLevel).arg(employmentMode).arg(hasSetIntervalAudit).arg(internalName).arg(leadingOrganization).arg(hasSetSeparateIA).arg(financeDepartment).arg(legalDepartment). |
| | | // arg(internalConDepart).arg(disceplineInDepart).arg(otherDepart).arg(intavalAuditLeval).arg(organazationNum).arg(realNum).arg(professionalNum).arg(CIANum).arg(masterNum).arg(undergraduatesNum). |
| | | // arg(juniorNum).arg(seniorNum).arg(intermediateNum).arg(primaryNum).arg(noTitleNum).arg(upFiftyOldNum).arg(upThirtyOldNum).arg(downThirtyOldNum).arg(auditNum).arg(accountingNum). |
| | | // arg(economyNum).arg(lawNum).arg(managerNum).arg(itNum).arg(engineeringNum).arg(otherNum).arg(statisticalConOfficer).arg(personFilling).arg(officerTel).arg(fillingDateTime); |
| | | |
| | | |
| | | qDebug()<<"sql insert:"<<sql; |
| | | if(query.exec(sql)){ |
| | | qDebug()<<"insert ok"; |
| | | }else{ |
| | | qDebug()<<"insert fail:"<<query.lastError().text(); |
| | | } |
| | | // qDebug()<<"sql insert:"<<sql; |
| | | // if(query.exec(sql)){ |
| | | // qDebug()<<"insert ok"; |
| | | // }else{ |
| | | // qDebug()<<"insert fail:"<<query.lastError().text(); |
| | | // } |
| | | |
| | | }else{ |
| | | // 更新 |
| | | qDebug()<<"存在:"<<name; |
| | | sql = QString("update all_company_info set name='%1',code='%2',机构类型='%3',主要业务活动='%4',行业代码='%5',单位注册地及区域='%6',区域代码='%7',城乡代码='%8',单位规模='%9',从业期末人数=%10\ |
| | | ,法定代表人='%11',执行会记标准类别='%12',长途区号='%13',固定电话='%14',邮政编码='%15',电子邮箱='%16',网址='%17',是否有上一级法人='%18',上一级统信代码='%19',原组织代码='%20'\ |
| | | ,上级单位名称='%21',是否设置总审计师='%22',总审计师职位层级='%23',总审任职方式='%24',是否设置内审机构='%25',内审机构名称='%26',领导机构='%27',是否独立设置内审机构='%28',财务部门=%29,法务部门=%30\ |
| | | ,内部控制部门=%31,纪检部门=%32,其他部门=%33,内审层级='%34',编制数量=%35,实有人数量=%36,专职人员数量=%37,拥有CIA人数=%38,硕士学历以上人数=%39,本科人数=%40\ |
| | | ,专科及以下人数=%41,高级职称人数=%42,中级职称人数=%43,初级职称人数=%44,无职称人数=%45,五十岁以上人数=%46,三十至五十岁岁人数=%47,三十岁以下人数=%48,审计数量=%49,会计数量=%50\ |
| | | ,经济数量=%51,法律数量=%52,管理数量=%53,信息技术数量=%54,工程数量=%55,其他数量=%56,统计负责人='%57',填表人='%58',联系电话='%59',填报日期='%60'"). |
| | | arg(name).arg(creditCode).arg(comType).arg(business).arg(businessCode).arg(addr).arg(areaCode).arg(townCode).arg(scale).arg(people). |
| | | arg(representative).arg(standardType).arg(trunkCode).arg(fixedTel).arg(postCode).arg(email).arg(webSite).arg(hasUpLegal).arg(upCreditCode).arg(oldCreditCode). |
| | | arg(upName).arg(hasChiefDesigner).arg(ChiefDesignerLevel).arg(employmentMode).arg(hasSetIntervalAudit).arg(internalName).arg(leadingOrganization).arg(hasSetSeparateIA).arg(financeDepartment).arg(legalDepartment). |
| | | arg(internalConDepart).arg(disceplineInDepart).arg(otherDepart).arg(intavalAuditLeval).arg(organazationNum).arg(realNum).arg(professionalNum).arg(CIANum).arg(masterNum).arg(undergraduatesNum). |
| | | arg(juniorNum).arg(seniorNum).arg(intermediateNum).arg(primaryNum).arg(noTitleNum).arg(upFiftyOldNum).arg(upThirtyOldNum).arg(downThirtyOldNum).arg(auditNum).arg(accountingNum). |
| | | arg(economyNum).arg(lawNum).arg(managerNum).arg(itNum).arg(engineeringNum).arg(otherNum).arg(statisticalConOfficer).arg(personFilling).arg(officerTel).arg(fillingDateTime); |
| | | // }else{ |
| | | // // 更新 |
| | | // qDebug()<<"存在:"<<name; |
| | | // sql = QString("update all_company_info set name='%1',code='%2',机构类型='%3',主要业务活动='%4',行业代码='%5',单位注册地及区域='%6',区域代码='%7',城乡代码='%8',单位规模='%9',从业期末人数=%10\ |
| | | //,法定代表人='%11',执行会记标准类别='%12',长途区号='%13',固定电话='%14',邮政编码='%15',电子邮箱='%16',网址='%17',是否有上一级法人='%18',上一级统信代码='%19',原组织代码='%20'\ |
| | | //,上级单位名称='%21',是否设置总审计师='%22',总审计师职位层级='%23',总审任职方式='%24',是否设置内审机构='%25',内审机构名称='%26',领导机构='%27',是否独立设置内审机构='%28',财务部门=%29,法务部门=%30\ |
| | | //,内部控制部门=%31,纪检部门=%32,其他部门=%33,内审层级='%34',编制数量=%35,实有人数量=%36,专职人员数量=%37,拥有CIA人数=%38,硕士学历以上人数=%39,本科人数=%40\ |
| | | //,专科及以下人数=%41,高级职称人数=%42,中级职称人数=%43,初级职称人数=%44,无职称人数=%45,五十岁以上人数=%46,三十至五十岁岁人数=%47,三十岁以下人数=%48,审计数量=%49,会计数量=%50\ |
| | | //,经济数量=%51,法律数量=%52,管理数量=%53,信息技术数量=%54,工程数量=%55,其他数量=%56,统计负责人='%57',填表人='%58',联系电话='%59',填报日期='%60'"). |
| | | // arg(name).arg(creditCode).arg(comType).arg(business).arg(businessCode).arg(addr).arg(areaCode).arg(townCode).arg(scale).arg(people). |
| | | // arg(representative).arg(standardType).arg(trunkCode).arg(fixedTel).arg(postCode).arg(email).arg(webSite).arg(hasUpLegal).arg(upCreditCode).arg(oldCreditCode). |
| | | // arg(upName).arg(hasChiefDesigner).arg(ChiefDesignerLevel).arg(employmentMode).arg(hasSetIntervalAudit).arg(internalName).arg(leadingOrganization).arg(hasSetSeparateIA).arg(financeDepartment).arg(legalDepartment). |
| | | // arg(internalConDepart).arg(disceplineInDepart).arg(otherDepart).arg(intavalAuditLeval).arg(organazationNum).arg(realNum).arg(professionalNum).arg(CIANum).arg(masterNum).arg(undergraduatesNum). |
| | | // arg(juniorNum).arg(seniorNum).arg(intermediateNum).arg(primaryNum).arg(noTitleNum).arg(upFiftyOldNum).arg(upThirtyOldNum).arg(downThirtyOldNum).arg(auditNum).arg(accountingNum). |
| | | // arg(economyNum).arg(lawNum).arg(managerNum).arg(itNum).arg(engineeringNum).arg(otherNum).arg(statisticalConOfficer).arg(personFilling).arg(officerTel).arg(fillingDateTime); |
| | | |
| | | qDebug()<<"update sql:"<<sql; |
| | | if(query.exec(sql)){ |
| | | qDebug()<<"update ok"; |
| | | }else{ |
| | | qDebug()<<"update fail:"<<query.lastError().text(); |
| | | } |
| | | } |
| | | // qDebug()<<"update sql:"<<sql; |
| | | // if(query.exec(sql)){ |
| | | // qDebug()<<"update ok"; |
| | | // }else{ |
| | | // qDebug()<<"update fail:"<<query.lastError().text(); |
| | | // } |
| | | // } |
| | | |
| | | // 独立出来一个函数,传一个结构体就ok |
| | | } |
| | | |
| | | void ConverInfo2::readExcelFromPath(QString path) |
| | |
| | | excel.dynamicCall("Quit(void)"); |
| | | |
| | | qDebug()<<"单位信息数量:"<<m_nameAndComInfos.size(); |
| | | emit updateComboListSignal(m_nameAndComInfos); // 更新组合下拉框的单位信息 |
| | | } |
| | | |
| | | void ConverInfo2::createTreeNode(){ |
| | | // 先清除当前树上的所有节点 |
| | | ui->treeWidget->clear(); |
| | | |
| | | qDebug()<<"构建树形列表"<<m_treeNodes.size(); |
| | | for(auto iter=m_treeNodes.begin();iter != m_treeNodes.end();iter++) |
| | | { |
| | |
| | | return QMainWindow::eventFilter(watched,event); |
| | | |
| | | } |
| | | |
| | | void ConverInfo2::saveToSQL(ComInfo &info) |
| | | { |
| | | // 更新到数据库 |
| | | |
| | | // 先判断是不是已经存在公司名了,若已存在,则更新,不存在则插入 |
| | | QString sql = QString("select id,name from all_company_info where name='%1'").arg(QString::fromLocal8Bit(info.name)); |
| | | qDebug()<<"sql:"<<sql; |
| | | QSqlQuery query; |
| | | int rowCnt = 0; |
| | | if(query.exec(sql)){ |
| | | qDebug()<<"size:"<<query.size(); |
| | | |
| | | while (query.next()) { |
| | | rowCnt++; |
| | | } |
| | | qDebug()<<"rowCnt:"<<rowCnt; |
| | | } |
| | | if(rowCnt == 0){ |
| | | // 不存在,则插入一条新数据 |
| | | qDebug()<<"不存在:"<<QString::fromLocal8Bit(info.name); |
| | | sql = QString("insert into all_company_info (name,\ |
| | | code,\ |
| | | 机构类型,\ |
| | | 主要业务活动,\ |
| | | 行业代码,\ |
| | | 单位注册地及区域,\ |
| | | 区域代码,\ |
| | | 城乡代码,\ |
| | | 单位规模,\ |
| | | 从业期末人数,\ |
| | | 法定代表人,\ |
| | | 执行会记标准类别,\ |
| | | 长途区号,\ |
| | | 固定电话,\ |
| | | 邮政编码,\ |
| | | 电子邮箱,\ |
| | | 网址,\ |
| | | 是否有上一级法人,\ |
| | | 上一级统信代码,\ |
| | | 原组织代码,\ |
| | | 上级单位名称,\ |
| | | 是否设置总审计师,\ |
| | | 总审计师职位层级,\ |
| | | 总审任职方式,\ |
| | | 是否设置内审机构,\ |
| | | 内审机构名称,\ |
| | | 领导机构,\ |
| | | 是否独立设置内审机构,\ |
| | | 财务部门,\ |
| | | 法务部门,\ |
| | | 内部控制部门,\ |
| | | 纪检部门,\ |
| | | 其他部门,\ |
| | | 内审层级,\ |
| | | 编制数量,\ |
| | | 实有人数量,\ |
| | | 专职人员数量,\ |
| | | 拥有CIA人数,\ |
| | | 硕士学历以上人数,\ |
| | | 本科人数,\ |
| | | 专科及以下人数,\ |
| | | 高级职称人数,\ |
| | | 中级职称人数,\ |
| | | 初级职称人数,\ |
| | | 无职称人数,\ |
| | | 五十岁以上人数,\ |
| | | 三十至五十岁岁人数,\ |
| | | 三十岁以下人数,\ |
| | | 审计数量,\ |
| | | 会计数量,\ |
| | | 经济数量,\ |
| | | 法律数量,\ |
| | | 管理数量,\ |
| | | 信息技术数量,\ |
| | | 工程数量,\ |
| | | 其他数量,\ |
| | | 统计负责人,\ |
| | | 填表人,\ |
| | | 联系电话,\ |
| | | 填报日期) values ('%1','%2','%3','%4','%5','%6','%7','%8','%9',%10,\ |
| | | '%11','%12','%13','%14','%15','%16','%17','%18','%19','%20',\ |
| | | '%21','%22','%23','%24','%25','%26','%27','%28',%29,%30,\ |
| | | %31,%32,%33,'%34',%35,%36,%37,%38,%39,%40,\ |
| | | %41,%42,%43,%44,%45,%46,%47,%48,%49,%50,\ |
| | | %51,%52,%53,%54,%55,%56,'%57','%58','%59','%60'\ |
| | | )").arg(QString::fromLocal8Bit(info.name)).arg(QString::fromLocal8Bit(info.creditCode)).arg(QString::fromLocal8Bit(info.comType)).arg(QString::fromLocal8Bit(info.business)).arg(QString::fromLocal8Bit(info.businessCode)).arg(QString::fromLocal8Bit(info.addr)).arg(QString::fromLocal8Bit(info.areaCode)).arg(QString::fromLocal8Bit(info.townCode)).arg(QString::fromLocal8Bit(info.scale)).arg(info.people). |
| | | arg(QString::fromLocal8Bit(info.representative)).arg(QString::fromLocal8Bit(info.standardType)).arg(QString::fromLocal8Bit(info.trunkCode)).arg(QString::fromLocal8Bit(info.fixedTel)).arg(info.postCode).arg(QString::fromLocal8Bit(info.email)).arg(QString::fromLocal8Bit(info.webSite)).arg(QString::fromLocal8Bit(info.hasUpLegal)).arg(QString::fromLocal8Bit(info.upCreditCode)).arg(QString::fromLocal8Bit(info.oldCreditCode)). |
| | | arg(QString::fromLocal8Bit(info.upName)).arg(QString::fromLocal8Bit(info.hasChiefDesigner)).arg(QString::fromLocal8Bit(info.ChiefDesignerLevel)).arg(QString::fromLocal8Bit(info.employmentMode)).arg(QString::fromLocal8Bit(info.hasSetIntervalAudit)).arg(QString::fromLocal8Bit(info.internalName)).arg(QString::fromLocal8Bit(info.leadingOrganization)).arg(QString::fromLocal8Bit(info.hasSetSeparateIA)).arg(info.financeDepartment).arg(info.legalDepartment). |
| | | arg(info.internalConDepart).arg(info.disceplineInDepart).arg(info.otherDepart).arg(QString::fromLocal8Bit(info.intavalAuditLeval)).arg(info.organazationNum).arg(info.realNum).arg(info.professionalNum).arg(info.CIANum).arg(info.masterNum).arg(info.undergraduatesNum). |
| | | arg(info.juniorNum).arg(info.seniorNum).arg(info.intermediateNum).arg(info.primaryNum).arg(info.noTitleNum).arg(info.upFiftyOldNum).arg(info.upThirtyOldNum).arg(info.downThirtyOldNum).arg(info.auditNum).arg(info.accountingNum). |
| | | arg(info.economyNum).arg(info.lawNum).arg(info.managerNum).arg(info.itNum).arg(info.engineeringNum).arg(info.otherNum).arg(QString::fromLocal8Bit(info.statisticalConOfficer)).arg(QString::fromLocal8Bit(info.personFilling)).arg(QString::fromLocal8Bit(info.officerTel)).arg(QString::fromLocal8Bit(info.fillingDateTime)); |
| | | |
| | | |
| | | qDebug()<<"sql insert:"<<sql; |
| | | if(query.exec(sql)){ |
| | | qDebug()<<"insert ok"; |
| | | }else{ |
| | | qDebug()<<"insert fail:"<<query.lastError().text(); |
| | | } |
| | | |
| | | }else{ |
| | | // 更新 |
| | | qDebug()<<"存在:"<<QString::fromLocal8Bit(info.name); |
| | | sql = QString("update all_company_info set name='%1',code='%2',机构类型='%3',主要业务活动='%4',行业代码='%5',单位注册地及区域='%6',区域代码='%7',城乡代码='%8',单位规模='%9',从业期末人数=%10\ |
| | | ,法定代表人='%11',执行会记标准类别='%12',长途区号='%13',固定电话='%14',邮政编码='%15',电子邮箱='%16',网址='%17',是否有上一级法人='%18',上一级统信代码='%19',原组织代码='%20'\ |
| | | ,上级单位名称='%21',是否设置总审计师='%22',总审计师职位层级='%23',总审任职方式='%24',是否设置内审机构='%25',内审机构名称='%26',领导机构='%27',是否独立设置内审机构='%28',财务部门=%29,法务部门=%30\ |
| | | ,内部控制部门=%31,纪检部门=%32,其他部门=%33,内审层级='%34',编制数量=%35,实有人数量=%36,专职人员数量=%37,拥有CIA人数=%38,硕士学历以上人数=%39,本科人数=%40\ |
| | | ,专科及以下人数=%41,高级职称人数=%42,中级职称人数=%43,初级职称人数=%44,无职称人数=%45,五十岁以上人数=%46,三十至五十岁岁人数=%47,三十岁以下人数=%48,审计数量=%49,会计数量=%50\ |
| | | ,经济数量=%51,法律数量=%52,管理数量=%53,信息技术数量=%54,工程数量=%55,其他数量=%56,统计负责人='%57',填表人='%58',联系电话='%59',填报日期='%60' where name='%1'").arg(QString::fromLocal8Bit(info.name)).arg(QString::fromLocal8Bit(info.creditCode)).arg(QString::fromLocal8Bit(info.comType)).arg(QString::fromLocal8Bit(info.business)).arg(QString::fromLocal8Bit(info.businessCode)).arg(QString::fromLocal8Bit(info.addr)).arg(QString::fromLocal8Bit(info.areaCode)).arg(QString::fromLocal8Bit(info.townCode)).arg(QString::fromLocal8Bit(info.scale)).arg(info.people). |
| | | arg(QString::fromLocal8Bit(info.representative)).arg(QString::fromLocal8Bit(info.standardType)).arg(QString::fromLocal8Bit(info.trunkCode)).arg(QString::fromLocal8Bit(info.fixedTel)).arg(info.postCode).arg(QString::fromLocal8Bit(info.email)).arg(QString::fromLocal8Bit(info.webSite)).arg(QString::fromLocal8Bit(info.hasUpLegal)).arg(QString::fromLocal8Bit(info.upCreditCode)).arg(QString::fromLocal8Bit(info.oldCreditCode)). |
| | | arg(QString::fromLocal8Bit(info.upName)).arg(QString::fromLocal8Bit(info.hasChiefDesigner)).arg(QString::fromLocal8Bit(info.ChiefDesignerLevel)).arg(QString::fromLocal8Bit(info.employmentMode)).arg(QString::fromLocal8Bit(info.hasSetIntervalAudit)).arg(QString::fromLocal8Bit(info.internalName)).arg(QString::fromLocal8Bit(info.leadingOrganization)).arg(QString::fromLocal8Bit(info.hasSetSeparateIA)).arg(info.financeDepartment).arg(info.legalDepartment). |
| | | arg(info.internalConDepart).arg(info.disceplineInDepart).arg(info.otherDepart).arg(QString::fromLocal8Bit(info.intavalAuditLeval)).arg(info.organazationNum).arg(info.realNum).arg(info.professionalNum).arg(info.CIANum).arg(info.masterNum).arg(info.undergraduatesNum). |
| | | arg(info.juniorNum).arg(info.seniorNum).arg(info.intermediateNum).arg(info.primaryNum).arg(info.noTitleNum).arg(info.upFiftyOldNum).arg(info.upThirtyOldNum).arg(info.downThirtyOldNum).arg(info.auditNum).arg(info.accountingNum). |
| | | arg(info.economyNum).arg(info.lawNum).arg(info.managerNum).arg(info.itNum).arg(info.engineeringNum).arg(info.otherNum).arg(QString::fromLocal8Bit(info.statisticalConOfficer)).arg(QString::fromLocal8Bit(info.personFilling)).arg(QString::fromLocal8Bit(info.officerTel)).arg(QString::fromLocal8Bit(info.fillingDateTime)); |
| | | /*. |
| | | arg(QString::fromLocal8Bit(info.name)).arg(QString::fromLocal8Bit(info.creditCode)).arg(info.comType).arg(info.business).arg(info.businessCode).arg(info.addr).arg(info.areaCode).arg(info.townCode).arg(info.scale).arg(info.people). |
| | | arg(info.representative).arg(info.standardType).arg(info.trunkCode).arg(info.fixedTel).arg(info.postCode).arg(info.email).arg(info.webSite).arg(info.hasUpLegal).arg(info.upCreditCode).arg(info.oldCreditCode). |
| | | arg(info.upName).arg(info.hasChiefDesigner).arg(info.ChiefDesignerLevel).arg(info.employmentMode).arg(info.hasSetIntervalAudit).arg(info.internalName).arg(info.leadingOrganization).arg(info.hasSetSeparateIA).arg(info.financeDepartment).arg(info.legalDepartment). |
| | | arg(info.internalConDepart).arg(info.disceplineInDepart).arg(info.otherDepart).arg(info.intavalAuditLeval).arg(info.organazationNum).arg(info.realNum).arg(info.professionalNum).arg(info.CIANum).arg(info.masterNum).arg(info.undergraduatesNum). |
| | | arg(info.juniorNum).arg(info.seniorNum).arg(info.intermediateNum).arg(info.primaryNum).arg(info.noTitleNum).arg(info.upFiftyOldNum).arg(info.upThirtyOldNum).arg(info.downThirtyOldNum).arg(info.auditNum).arg(info.accountingNum). |
| | | arg(info.economyNum).arg(info.lawNum).arg(info.managerNum).arg(info.itNum).arg(info.engineeringNum).arg(info.otherNum).arg(info.statisticalConOfficer).arg(info.personFilling).arg(info.officerTel).arg(info.fillingDateTime);*/ |
| | | |
| | | qDebug()<<"update sql:"<<sql; |
| | | if(query.exec(sql)){ |
| | | qDebug()<<"update ok"; |
| | | }else{ |
| | | qDebug()<<"update fail:"<<query.lastError().text(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | void ConverInfo2::readAllSQLData() |
| | | { |
| | | QString sql = QString("select * from all_company_info"); |
| | | qDebug()<<"sql:"<<sql; |
| | | QSqlQuery query; |
| | | int rowCnt = 0; |
| | | if(query.exec(sql)){ |
| | | qDebug()<<"size:"<<query.size(); |
| | | |
| | | |
| | | while (query.next()) { |
| | | rowCnt++; |
| | | ComInfo info; // 单位信息结构体 |
| | | // 基本情况 |
| | | strcpy(info.name,query.value(1).toString().toLocal8Bit().data()); |
| | | strcpy(info.creditCode,query.value(2).toString().toLocal8Bit().data()); |
| | | strcpy(info.comType,query.value(3).toString().toLocal8Bit().data()); |
| | | strcpy(info.business,query.value(4).toString().toLocal8Bit().data()); |
| | | strcpy(info.businessCode,query.value(5).toString().toLocal8Bit().data()); |
| | | strcpy(info.addr,query.value(6).toString().toLocal8Bit().data()); |
| | | strcpy(info.areaCode,query.value(7).toString().toLocal8Bit().data()); |
| | | strcpy(info.townCode,query.value(8).toString().toLocal8Bit().data()); |
| | | strcpy(info.scale,query.value(9).toString().toLocal8Bit().data()); |
| | | info.people = query.value(10).toInt(); |
| | | strcpy(info.representative,query.value(11).toString().toLocal8Bit().data()); |
| | | strcpy(info.standardType,query.value(12).toString().toLocal8Bit().data()); |
| | | strcpy(info.trunkCode,query.value(13).toString().toLocal8Bit().data()); |
| | | strcpy(info.fixedTel,query.value(14).toString().toLocal8Bit().data()); |
| | | strcpy(info.postCode,query.value(15).toString().toLocal8Bit().data()); |
| | | strcpy(info.email,query.value(16).toString().toLocal8Bit().data()); |
| | | strcpy(info.webSite,query.value(17).toString().toLocal8Bit().data()); |
| | | // 单位组织结构情况 |
| | | strcpy(info.hasUpLegal,query.value(18).toString().toLocal8Bit().data()); |
| | | strcpy(info.upCreditCode,query.value(19).toString().toLocal8Bit().data()); |
| | | strcpy(info.oldCreditCode,query.value(20).toString().toLocal8Bit().data()); |
| | | strcpy(info.upName,query.value(21).toString().toLocal8Bit().data()); |
| | | |
| | | // 总审计师与内部审计机构基本情况 |
| | | strcpy(info.hasChiefDesigner,query.value(22).toString().toLocal8Bit().data()); |
| | | strcpy(info.ChiefDesignerLevel,query.value(23).toString().toLocal8Bit().data()); |
| | | strcpy(info.employmentMode,query.value(24).toString().toLocal8Bit().data()); |
| | | strcpy(info.hasSetIntervalAudit,query.value(25).toString().toLocal8Bit().data()); |
| | | strcpy(info.internalName,query.value(26).toString().toLocal8Bit().data()); |
| | | strcpy(info.leadingOrganization,query.value(27).toString().toLocal8Bit().data()); |
| | | strcpy(info.hasSetSeparateIA,query.value(28).toString().toLocal8Bit().data()); |
| | | info.financeDepartment = query.value(29).toBool(); |
| | | info.legalDepartment = query.value(30).toBool(); |
| | | info.internalConDepart = query.value(31).toBool(); |
| | | info.disceplineInDepart = query.value(32).toBool(); |
| | | info.otherDepart = query.value(33).toBool(); |
| | | strcpy(info.intavalAuditLeval,query.value(34).toString().toLocal8Bit().data()); |
| | | |
| | | // 内部审计人员配备基本情况 |
| | | info.organazationNum = query.value(35).toInt(); |
| | | info.realNum = query.value(36).toInt(); |
| | | info.professionalNum = query.value(37).toInt(); |
| | | info.CIANum = query.value(38).toInt(); |
| | | info.masterNum = query.value(39).toInt(); |
| | | info.undergraduatesNum = query.value(40).toInt(); |
| | | info.juniorNum = query.value(41).toInt(); |
| | | info.seniorNum = query.value(42).toInt(); |
| | | info.intermediateNum = query.value(43).toInt(); |
| | | info.primaryNum = query.value(44).toInt(); |
| | | info.noTitleNum = query.value(45).toInt(); |
| | | info.upFiftyOldNum = query.value(46).toInt(); |
| | | info.upThirtyOldNum = query.value(47).toInt(); |
| | | info.downThirtyOldNum = query.value(48).toInt(); |
| | | info.auditNum = query.value(49).toInt(); |
| | | info.accountingNum = query.value(50).toInt(); |
| | | info.economyNum = query.value(51).toInt(); |
| | | info.lawNum = query.value(52).toInt(); |
| | | info.managerNum = query.value(53).toInt(); |
| | | info.itNum = query.value(54).toInt(); |
| | | info.engineeringNum = query.value(55).toInt(); |
| | | info.otherNum = query.value(56).toInt(); |
| | | |
| | | // 后面的4个信息 |
| | | strcpy(info.statisticalConOfficer,query.value(57).toString().toLocal8Bit().data()); |
| | | strcpy(info.personFilling,query.value(58).toString().toLocal8Bit().data()); |
| | | strcpy(info.officerTel,query.value(59).toString().toLocal8Bit().data()); |
| | | strcpy(info.fillingDateTime,query.value(60).toString().toLocal8Bit().data()); |
| | | |
| | | // 存信息到map |
| | | QString name = query.value(1).toString(); |
| | | m_nameAndComInfos[query.value(1).toString()] = info; |
| | | // 存名字到单位树map |
| | | QString upName = query.value(21).toString(); |
| | | if(!upName.isEmpty()){ |
| | | //m_treeNodes[upName].push_back(name); |
| | | m_treeNodes[upName].insert(name); |
| | | }else{ |
| | | //m_treeNodes[name].push_back(name); |
| | | //m_treeNodes[upName].insert(name); |
| | | if(!name.isEmpty()){ |
| | | //m_treeNodes[name.toString()].push_back(name.toString()); |
| | | m_treeNodes[name].insert(name); |
| | | } |
| | | } |
| | | qDebug()<<"name"<<name<<"upName"<<upName; |
| | | |
| | | } |
| | | qDebug()<<"rowCnt:"<<rowCnt; |
| | | } |
| | | } |
| | | |
| | | void ConverInfo2::deleteAllByName(QString name) |
| | | { |
| | | // 数据库表有:封面信息表 all_company_info |
| | | // 综合信息表 comprehensive_entry_info |
| | | // 三合一的表 standing_book_info |
| | | |
| | | QString first_sql = QString("delete from all_company_info where name='%1'").arg(name); |
| | | qDebug()<<"first_sql:"<<first_sql; |
| | | |
| | | QString second_sql = QString("delete from comprehensive_entry_info where name='%1'").arg(name); |
| | | qDebug()<<"second_sql:"<<second_sql; |
| | | |
| | | QString three_sql = QString("delete from standing_book_info where 责任主体名称='%1'").arg(name); |
| | | qDebug()<<"three_sql:"<<three_sql; |
| | | |
| | | |
| | | QSqlQuery query; |
| | | if(query.exec(first_sql)) |
| | | { |
| | | qDebug()<<"first_sql run ok"; |
| | | } |
| | | if(query.exec(second_sql)) |
| | | { |
| | | qDebug()<<"second_sql run ok"; |
| | | } |
| | | if(query.exec(three_sql)) |
| | | { |
| | | qDebug()<<"three_sql run ok"; |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | void ConverInfo2::addTreeWidgetNode(QVariant upName,QVariant name){ |
| | | // 添加左边树形图相关 |
| | | // 菜单相关 当上级公司为空上级时,自己当自己的上级,并且罗列进去当 本级 |