|
@@ -4,6 +4,7 @@ import (
|
|
|
"dashoo.cn/backend/api/business/oilsupplier/suppliercert"
|
|
"dashoo.cn/backend/api/business/oilsupplier/suppliercert"
|
|
|
"dashoo.cn/backend/api/business/oilsupplier/suppliercertappend"
|
|
"dashoo.cn/backend/api/business/oilsupplier/suppliercertappend"
|
|
|
. "dashoo.cn/backend/api/mydb"
|
|
. "dashoo.cn/backend/api/mydb"
|
|
|
|
|
+ "fmt"
|
|
|
"github.com/go-xorm/xorm"
|
|
"github.com/go-xorm/xorm"
|
|
|
"math"
|
|
"math"
|
|
|
"strconv"
|
|
"strconv"
|
|
@@ -278,17 +279,22 @@ func (s *TmpzcgtSession) InsertCertSub() error {
|
|
|
total, err = strconv.ParseInt(string(value), 10, 64)
|
|
total, err = strconv.ParseInt(string(value), 10, 64)
|
|
|
break
|
|
break
|
|
|
}
|
|
}
|
|
|
- n := math.Ceil(float64(total) / 5000)
|
|
|
|
|
|
|
+ n := math.Ceil(float64(total) / 50000)
|
|
|
|
|
|
|
|
- s.DBE.Query("ALTER TABLE `OilSupplierCertSub` drop INDEX index_typecode;")
|
|
|
|
|
|
|
+ /*s.DBE.Query("ALTER TABLE `OilSupplierCertSub` drop INDEX index_typecode;")
|
|
|
s.DBE.Query("ALTER TABLE `OilSupplierCertSub` drop INDEX index_code;")
|
|
s.DBE.Query("ALTER TABLE `OilSupplierCertSub` drop INDEX index_code;")
|
|
|
|
|
+ s.DBE.Query("SET autocommit=0;")*/
|
|
|
|
|
+ s.DBE.Query("ALTER TABLE `OilSupplierCertSub` drop INDEX index_code ;")
|
|
|
|
|
+ s.DBE.Query("ALTER TABLE `OilSupplierCertSub` drop INDEX index_supplierid ;")
|
|
|
|
|
+ s.DBE.Query("ALTER TABLE `OilSupplierCertSub` drop INDEX index_suppliercertid ;")
|
|
|
|
|
+ s.DBE.Query("ALTER TABLE `OilSupplierCertSub` drop INDEX index_name ;")
|
|
|
|
|
+ s.DBE.Query("ALTER TABLE `OilSupplierCertSub` drop INDEX index_supplierappendid ;")
|
|
|
s.DBE.Query("ALTER TABLE `OilSupplierCertSub` DISABLE KEYS;")
|
|
s.DBE.Query("ALTER TABLE `OilSupplierCertSub` DISABLE KEYS;")
|
|
|
s.DBE.Query("SET unique_checks=0;")
|
|
s.DBE.Query("SET unique_checks=0;")
|
|
|
- s.DBE.Query("SET autocommit=0;")
|
|
|
|
|
-
|
|
|
|
|
|
|
+ fmt.Println("循环总数-"+strconv.Itoa(int(n)))
|
|
|
for i:=0; i < int(n); i++ {
|
|
for i:=0; i < int(n); i++ {
|
|
|
- start := strconv.Itoa(i * 5000)
|
|
|
|
|
- end := strconv.Itoa(5000)
|
|
|
|
|
|
|
+ start := strconv.Itoa(i * 50000)
|
|
|
|
|
+ end := strconv.Itoa(50000)
|
|
|
sql := "INSERT INTO `OilSupplierCertSub` (" +
|
|
sql := "INSERT INTO `OilSupplierCertSub` (" +
|
|
|
"OldId," +
|
|
"OldId," +
|
|
|
"AppendStatus," +
|
|
"AppendStatus," +
|
|
@@ -316,13 +322,17 @@ func (s *TmpzcgtSession) InsertCertSub() error {
|
|
|
ORDER BY t.auto_id +
|
|
ORDER BY t.auto_id +
|
|
|
" limit " + start + "," + end*/
|
|
" limit " + start + "," + end*/
|
|
|
_, err = s.DBE.Query(sql)
|
|
_, err = s.DBE.Query(sql)
|
|
|
- s.DBE.Query("COMMIT;")
|
|
|
|
|
|
|
+ /*time.Sleep(time.Duration(500)*time.Millisecond)
|
|
|
|
|
+ s.DBE.Query("COMMIT;")*/
|
|
|
|
|
+ fmt.Println("循环次数-"+strconv.Itoa(i))
|
|
|
|
|
+ //time.Sleep(time.Duration(500)*time.Millisecond)
|
|
|
}
|
|
}
|
|
|
- s.DBE.Query("SET autocommit=1;")
|
|
|
|
|
|
|
+ // s.DBE.Query("SET autocommit=1;")
|
|
|
s.DBE.Query("SET unique_checks=1;")
|
|
s.DBE.Query("SET unique_checks=1;")
|
|
|
s.DBE.Query("ALTER TABLE `OilSupplierCertSub` ENABLE KEYS;")
|
|
s.DBE.Query("ALTER TABLE `OilSupplierCertSub` ENABLE KEYS;")
|
|
|
|
|
+ /*
|
|
|
//s.DBE.Query("ALTER TABLE `OilSupplierCertSub` ADD INDEX index_typecode ( `SupplierTypeCode` );")
|
|
//s.DBE.Query("ALTER TABLE `OilSupplierCertSub` ADD INDEX index_typecode ( `SupplierTypeCode` );")
|
|
|
- s.DBE.Query("ALTER TABLE `OilSupplierCertSub` ADD INDEX index_code ( `Code` );")
|
|
|
|
|
|
|
+ s.DBE.Query("ALTER TABLE `OilSupplierCertSub` ADD INDEX index_code ( `Code` );")*/
|
|
|
}
|
|
}
|
|
|
return err
|
|
return err
|
|
|
}
|
|
}
|
|
@@ -352,6 +362,10 @@ func (s *TmpzcgtSession) UpdateCertSub() error {
|
|
|
}
|
|
}
|
|
|
s.DBE.Query("SET autocommit=1;")
|
|
s.DBE.Query("SET autocommit=1;")
|
|
|
s.DBE.Query("alter table OilSupplierCertSub drop index index_oldid ;")
|
|
s.DBE.Query("alter table OilSupplierCertSub drop index index_oldid ;")
|
|
|
|
|
+ s.DBE.Query("ALTER TABLE `OilSupplierCertSub` ADD INDEX index_code ( `Code` );")
|
|
|
|
|
+ s.DBE.Query("ALTER TABLE `OilSupplierCertSub` ADD INDEX index_supplierid ( `SupplierId` );")
|
|
|
|
|
+ s.DBE.Query("ALTER TABLE `OilSupplierCertSub` ADD INDEX index_suppliercertid ( `SupplierCertId` );")
|
|
|
|
|
+ s.DBE.Query("ALTER TABLE `OilSupplierCertSub` ADD INDEX index_name ( `Name` );")
|
|
|
return err
|
|
return err
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -377,7 +391,7 @@ func (s *TmpzcgtSession) UpdateCertSubCaseWhen() error {
|
|
|
}
|
|
}
|
|
|
n := math.Ceil(float64(total) / 10)
|
|
n := math.Ceil(float64(total) / 10)
|
|
|
s.DBE.Query("ALTER TABLE `OilSupplierCertSub` ADD INDEX index_oldid ( `OldId` );")
|
|
s.DBE.Query("ALTER TABLE `OilSupplierCertSub` ADD INDEX index_oldid ( `OldId` );")
|
|
|
- s.DBE.Query("SET autocommit=0;")
|
|
|
|
|
|
|
+ // s.DBE.Query("SET autocommit=0;")
|
|
|
for i:=0; i < int(n); i++ {
|
|
for i:=0; i < int(n); i++ {
|
|
|
when1 := ""
|
|
when1 := ""
|
|
|
when2 := ""
|
|
when2 := ""
|
|
@@ -396,9 +410,9 @@ func (s *TmpzcgtSession) UpdateCertSubCaseWhen() error {
|
|
|
" b.SupplierTypeCode = CASE b.OldId " + when3 + " END " +
|
|
" b.SupplierTypeCode = CASE b.OldId " + when3 + " END " +
|
|
|
" where b.OldId <= " + strconv.Itoa(oldId) + " and b.SupplierId = 0 "
|
|
" where b.OldId <= " + strconv.Itoa(oldId) + " and b.SupplierId = 0 "
|
|
|
_, err = s.DBE.Query(sql1)
|
|
_, err = s.DBE.Query(sql1)
|
|
|
- s.DBE.Query("COMMIT;")
|
|
|
|
|
|
|
+ // s.DBE.Query("COMMIT;")
|
|
|
}
|
|
}
|
|
|
- s.DBE.Query("SET autocommit=1;")
|
|
|
|
|
|
|
+ // s.DBE.Query("SET autocommit=1;")
|
|
|
s.DBE.Query("alter table OilSupplierCertSub drop index index_oldid ;")
|
|
s.DBE.Query("alter table OilSupplierCertSub drop index index_oldid ;")
|
|
|
}
|
|
}
|
|
|
return err
|
|
return err
|
|
@@ -470,7 +484,7 @@ func (s *TmpzcgtSession) InsertOilSupplierCertAppend() error {
|
|
|
// " ORDER BY a.`申请日期`, a.`企业名称`, a.`准入类别` "
|
|
// " ORDER BY a.`申请日期`, a.`企业名称`, a.`准入类别` "
|
|
|
_, err = s.DBE.Query(sql)
|
|
_, err = s.DBE.Query(sql)
|
|
|
|
|
|
|
|
- s.DBE.Query("COMMIT;")
|
|
|
|
|
|
|
+ // s.DBE.Query("COMMIT;")
|
|
|
s.DBE.Query("SET unique_checks=1;")
|
|
s.DBE.Query("SET unique_checks=1;")
|
|
|
|
|
|
|
|
// s.DBE.Query("ALTER TABLE `T_增项` drop INDEX index_import;")
|
|
// s.DBE.Query("ALTER TABLE `T_增项` drop INDEX index_import;")
|
|
@@ -480,7 +494,7 @@ func (s *TmpzcgtSession) InsertOilSupplierCertAppend() error {
|
|
|
|
|
|
|
|
func (s *TmpzcgtSession) InsertOilInfoChange() error {
|
|
func (s *TmpzcgtSession) InsertOilInfoChange() error {
|
|
|
s.DBE.Query("SET unique_checks=0;")
|
|
s.DBE.Query("SET unique_checks=0;")
|
|
|
- s.DBE.Query("SET autocommit=0;")
|
|
|
|
|
|
|
+ // s.DBE.Query("SET autocommit=0;")
|
|
|
sql := "INSERT INTO OilInfoChange (Status,AccessCardNo,SupplierName,OldSupplierName,SupplierTypeName,SupplierTypeCode,OilCertificateNo,Grade,OperType,Country,MaunAgent,ConstructTeam,CommercialNo,OrganCode,CountryTaxNo,LocalTaxNo, " +
|
|
sql := "INSERT INTO OilInfoChange (Status,AccessCardNo,SupplierName,OldSupplierName,SupplierTypeName,SupplierTypeCode,OilCertificateNo,Grade,OperType,Country,MaunAgent,ConstructTeam,CommercialNo,OrganCode,CountryTaxNo,LocalTaxNo, " +
|
|
|
"Address,ZipCode,QualitySystemCert,ProductQualityCert,MaunLicense,QualifCert,QualifCertLevel,SafetyLicense,TechServiceLic,TJInNotify, " +
|
|
"Address,ZipCode,QualitySystemCert,ProductQualityCert,MaunLicense,QualifCert,QualifCertLevel,SafetyLicense,TechServiceLic,TJInNotify, " +
|
|
|
"SpecIndustryCert,LegalPerson,CategoryCode,CategoryName,RegCapital,Currency,ContactName,CompanyType,DepositBank,BankAccount,EMail, " +
|
|
"SpecIndustryCert,LegalPerson,CategoryCode,CategoryName,RegCapital,Currency,ContactName,CompanyType,DepositBank,BankAccount,EMail, " +
|
|
@@ -493,9 +507,9 @@ func (s *TmpzcgtSession) InsertOilInfoChange() error {
|
|
|
"开户银行 AS DepositBank, 银行账号 AS BankAccount, 电子邮箱 AS EMail, 银行信用等级 AS BankCreditRating, 移动电话 AS Mobile, 固定电话 AS Telphone, 传真 AS Fax, 公司电话 AS CompanyTel, QQ号码 AS QQ, 公司网址 AS CompanyUrl, " +
|
|
"开户银行 AS DepositBank, 银行账号 AS BankAccount, 电子邮箱 AS EMail, 银行信用等级 AS BankCreditRating, 移动电话 AS Mobile, 固定电话 AS Telphone, 传真 AS Fax, 公司电话 AS CompanyTel, QQ号码 AS QQ, 公司网址 AS CompanyUrl, " +
|
|
|
"申请变更原因及内容 AS Remark, 审核日期 as CreateOn, 录入员 as CreateBy,ID AS HouseNo from T_变更信息 "
|
|
"申请变更原因及内容 AS Remark, 审核日期 as CreateOn, 录入员 as CreateBy,ID AS HouseNo from T_变更信息 "
|
|
|
_, err := s.DBE.Query(sql)
|
|
_, err := s.DBE.Query(sql)
|
|
|
- s.DBE.Query("commit;")
|
|
|
|
|
|
|
+ // s.DBE.Query("commit;")
|
|
|
s.DBE.Query("SET unique_checks=1;")
|
|
s.DBE.Query("SET unique_checks=1;")
|
|
|
- s.DBE.Query("SET autocommit=1;")
|
|
|
|
|
|
|
+ // s.DBE.Query("SET autocommit=1;")
|
|
|
return err
|
|
return err
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -565,7 +579,6 @@ func (s *TmpzcgtSession) UpdateOilSupplierCertAppendSub() error {
|
|
|
"b.SupplierCertId = IFNULL(a.`SupplierCertId`, 0), " +
|
|
"b.SupplierCertId = IFNULL(a.`SupplierCertId`, 0), " +
|
|
|
"b.SupplierCertAppendId = IFNULL(a.`Id`, 0) " +
|
|
"b.SupplierCertAppendId = IFNULL(a.`Id`, 0) " +
|
|
|
"where b.Type = '3' and (b.SupplierId is null or b.SupplierId = 0)"*/
|
|
"where b.Type = '3' and (b.SupplierId is null or b.SupplierId = 0)"*/
|
|
|
-
|
|
|
|
|
svc := suppliercertappend.GetOilSupplierCertAppendService(s.DBE)
|
|
svc := suppliercertappend.GetOilSupplierCertAppendService(s.DBE)
|
|
|
var certAppendList []suppliercertappend.OilSupplierCertAppend
|
|
var certAppendList []suppliercertappend.OilSupplierCertAppend
|
|
|
svc.GetEntitysByWhere("OilSupplierCertAppend", "", &certAppendList)
|
|
svc.GetEntitysByWhere("OilSupplierCertAppend", "", &certAppendList)
|
|
@@ -583,12 +596,13 @@ func (s *TmpzcgtSession) UpdateOilSupplierCertAppendSub() error {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
code := strings.TrimRight(appendCodeString, "or")
|
|
code := strings.TrimRight(appendCodeString, "or")
|
|
|
- sql := "UPDATE OilSupplierCertSub a SET a.ModifiedOn = '2020-12-11 18:07:07', a.SupplierCertAppendId=" + strconv.Itoa(certAppend.Id) +
|
|
|
|
|
|
|
+ sql := "UPDATE OilSupplierCertSub a SET a.SupplierCertAppendId=" + strconv.Itoa(certAppend.Id) +
|
|
|
", a.`Type`=3 WHERE a.SupplierCertId=" + strconv.Itoa(certAppend.SupplierCertId) +
|
|
", a.`Type`=3 WHERE a.SupplierCertId=" + strconv.Itoa(certAppend.SupplierCertId) +
|
|
|
" AND" + code + ") and a.SupplierCertAppendId=0"
|
|
" AND" + code + ") and a.SupplierCertAppendId=0"
|
|
|
_, err = s.DBE.Query(sql)
|
|
_, err = s.DBE.Query(sql)
|
|
|
s.DBE.Query("commit;")
|
|
s.DBE.Query("commit;")
|
|
|
}
|
|
}
|
|
|
|
|
+ s.DBE.Query("ALTER TABLE `OilSupplierCertSub` ADD INDEX index_supplierappendid ( `SupplierAppendId` );")
|
|
|
s.DBE.Query("SET unique_checks=1;")
|
|
s.DBE.Query("SET unique_checks=1;")
|
|
|
s.DBE.Query("SET autocommit=1;")
|
|
s.DBE.Query("SET autocommit=1;")
|
|
|
return err
|
|
return err
|
|
@@ -597,19 +611,19 @@ func (s *TmpzcgtSession) UpdateOilSupplierCertAppendSub() error {
|
|
|
// 导入资质名称
|
|
// 导入资质名称
|
|
|
func (s *TmpzcgtSession) InsertFileName() error {
|
|
func (s *TmpzcgtSession) InsertFileName() error {
|
|
|
s.DBE.Query("SET unique_checks=0;")
|
|
s.DBE.Query("SET unique_checks=0;")
|
|
|
- s.DBE.Query("SET autocommit=0;")
|
|
|
|
|
- sql := "INSERT INTO `OilSupplierFile` (SupplierId, SupplierCertSubId, Remark, NeedFileType, OtherRemark, SupplierTypeCode,CreateBy) " +
|
|
|
|
|
- "SELECT 0 AS SupplierId, 0 AS SupplierCertSubId, z.企业名称 AS Remark ,f.类别 AS NeedFileType, f.说明 AS OtherRemark, " +
|
|
|
|
|
- "( CASE 准入类别 WHEN '物资类' THEN '01' WHEN '基建类' THEN '02' WHEN '服务类' THEN '03' WHEN '技术服务类' THEN '03' else '000' END ) SupplierTypeCode, " +
|
|
|
|
|
|
|
+ // s.DBE.Query("SET autocommit=0;")
|
|
|
|
|
+ sql := "INSERT INTO `OilSupplierFile` (SupplierId, SupplierCertSubId, FileUrl, Remark, NeedFileType, OtherRemark, SupplierTypeCode,CreateBy) " +
|
|
|
|
|
+ "SELECT 0 AS SupplierId, 0 AS SupplierCertSubId, concat('/upfile/gfzl_2014/', f.ID_GF, '-' , f.类别编号, IFNULL(f.文件类型, ''), '|', f.类别, IFNULL(f.文件类型, '')) AS FileUrl, z.企业名称 AS Remark ,f.类别 AS NeedFileType, f.说明 AS OtherRemark, " +
|
|
|
|
|
+ "( CASE z.准入类别 WHEN '物资类' THEN '01' WHEN '基建类' THEN '02' WHEN '服务类' THEN '03' WHEN '技术服务类' THEN '03' else '000' END ) SupplierTypeCode, " +
|
|
|
"'导入' AS CreateBy " +
|
|
"'导入' AS CreateBy " +
|
|
|
"FROM `T_供方资料_V2014` f " +
|
|
"FROM `T_供方资料_V2014` f " +
|
|
|
"LEFT JOIN `T_资格预审表` z ON (f.ID_GF = z.ID) " +
|
|
"LEFT JOIN `T_资格预审表` z ON (f.ID_GF = z.ID) " +
|
|
|
- "WHERE z.企业名称 IS NOT NULL "
|
|
|
|
|
|
|
+ "WHERE z.企业名称 IS NOT NULL"
|
|
|
_, err := s.DBE.Query(sql)
|
|
_, err := s.DBE.Query(sql)
|
|
|
|
|
|
|
|
- s.DBE.Query("commit;")
|
|
|
|
|
|
|
+ // s.DBE.Query("commit;")
|
|
|
s.DBE.Query("SET unique_checks=1;")
|
|
s.DBE.Query("SET unique_checks=1;")
|
|
|
- s.DBE.Query("SET autocommit=1;")
|
|
|
|
|
|
|
+ // s.DBE.Query("SET autocommit=1;")
|
|
|
return err
|
|
return err
|
|
|
}
|
|
}
|
|
|
|
|
|