|
|
@@ -279,17 +279,17 @@ func (s *TmpzcgtSession) InsertCertSub() error {
|
|
|
total, err = strconv.ParseInt(string(value), 10, 64)
|
|
|
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("SET autocommit=0;")*/
|
|
|
s.DBE.Query("ALTER TABLE `OilSupplierCertSub` DISABLE KEYS;")
|
|
|
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++ {
|
|
|
- start := strconv.Itoa(i * 5000)
|
|
|
- end := strconv.Itoa(5000)
|
|
|
+ start := strconv.Itoa(i * 50000)
|
|
|
+ end := strconv.Itoa(50000)
|
|
|
sql := "INSERT INTO `OilSupplierCertSub` (" +
|
|
|
"OldId," +
|
|
|
"AppendStatus," +
|
|
|
@@ -317,14 +317,17 @@ func (s *TmpzcgtSession) InsertCertSub() error {
|
|
|
ORDER BY t.auto_id +
|
|
|
" limit " + start + "," + end*/
|
|
|
_, err = s.DBE.Query(sql)
|
|
|
+ /*time.Sleep(time.Duration(500)*time.Millisecond)
|
|
|
+ s.DBE.Query("COMMIT;")*/
|
|
|
fmt.Println("循环次数-"+strconv.Itoa(i))
|
|
|
- s.DBE.Query("COMMIT;")
|
|
|
+ //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("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_code ( `Code` );")
|
|
|
+ s.DBE.Query("ALTER TABLE `OilSupplierCertSub` ADD INDEX index_code ( `Code` );")*/
|
|
|
}
|
|
|
return err
|
|
|
}
|
|
|
@@ -340,7 +343,7 @@ func (s *TmpzcgtSession) UpdateCertSub() error {
|
|
|
var err error
|
|
|
|
|
|
s.DBE.Query("ALTER TABLE `OilSupplierCertSub` ADD INDEX index_oldid ( `OldId` );")
|
|
|
- s.DBE.Query("SET autocommit=0;")
|
|
|
+ // s.DBE.Query("SET autocommit=0;")
|
|
|
for _, cert := range certList {
|
|
|
sql := " UPDATE OilSupplierCertSub b SET b.SupplierId = '" + strconv.Itoa(cert.SupplierId) + "'," +
|
|
|
" b.SupplierCertId='"+ strconv.Itoa(cert.Id) + "',"+
|
|
|
@@ -350,9 +353,9 @@ func (s *TmpzcgtSession) UpdateCertSub() error {
|
|
|
// "and b.Type = '1' and b.CreateBy='导入1'"
|
|
|
|
|
|
_, err = s.DBE.Query(sql)
|
|
|
- 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 ;")
|
|
|
return err
|
|
|
}
|
|
|
@@ -379,7 +382,7 @@ func (s *TmpzcgtSession) UpdateCertSubCaseWhen() error {
|
|
|
}
|
|
|
n := math.Ceil(float64(total) / 10)
|
|
|
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++ {
|
|
|
when1 := ""
|
|
|
when2 := ""
|
|
|
@@ -398,9 +401,9 @@ func (s *TmpzcgtSession) UpdateCertSubCaseWhen() error {
|
|
|
" b.SupplierTypeCode = CASE b.OldId " + when3 + " END " +
|
|
|
" where b.OldId <= " + strconv.Itoa(oldId) + " and b.SupplierId = 0 "
|
|
|
_, 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 ;")
|
|
|
}
|
|
|
return err
|
|
|
@@ -472,7 +475,7 @@ func (s *TmpzcgtSession) InsertOilSupplierCertAppend() error {
|
|
|
// " ORDER BY a.`申请日期`, a.`企业名称`, a.`准入类别` "
|
|
|
_, err = s.DBE.Query(sql)
|
|
|
|
|
|
- s.DBE.Query("COMMIT;")
|
|
|
+ // s.DBE.Query("COMMIT;")
|
|
|
s.DBE.Query("SET unique_checks=1;")
|
|
|
|
|
|
// s.DBE.Query("ALTER TABLE `T_增项` drop INDEX index_import;")
|
|
|
@@ -482,7 +485,7 @@ func (s *TmpzcgtSession) InsertOilSupplierCertAppend() error {
|
|
|
|
|
|
func (s *TmpzcgtSession) InsertOilInfoChange() error {
|
|
|
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, " +
|
|
|
"Address,ZipCode,QualitySystemCert,ProductQualityCert,MaunLicense,QualifCert,QualifCertLevel,SafetyLicense,TechServiceLic,TJInNotify, " +
|
|
|
"SpecIndustryCert,LegalPerson,CategoryCode,CategoryName,RegCapital,Currency,ContactName,CompanyType,DepositBank,BankAccount,EMail, " +
|
|
|
@@ -495,9 +498,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 Remark, 审核日期 as CreateOn, 录入员 as CreateBy,ID AS HouseNo from T_变更信息 "
|
|
|
_, err := s.DBE.Query(sql)
|
|
|
- s.DBE.Query("commit;")
|
|
|
+ // s.DBE.Query("commit;")
|
|
|
s.DBE.Query("SET unique_checks=1;")
|
|
|
- s.DBE.Query("SET autocommit=1;")
|
|
|
+ // s.DBE.Query("SET autocommit=1;")
|
|
|
return err
|
|
|
}
|
|
|
|
|
|
@@ -540,17 +543,17 @@ func (s *TmpzcgtSession) UpOilSupplierCertAppend() error {
|
|
|
"b.SupplierId = IFNULL((SELECT a.`SupplierId` FROM OilSupplierCert a WHERE a.`GfId` = b.OldId AND a.SupplierTypeCode = b.AppendType limit 1), 0), " +
|
|
|
"b.SupplierCertId = IFNULL((SELECT a.`Id` FROM OilSupplierCert a WHERE a.`GfId` = b.OldId AND a.SupplierTypeCode = b.AppendType limit 1), 0) " */
|
|
|
s.DBE.Query("SET unique_checks=0;")
|
|
|
- s.DBE.Query("SET autocommit=0;")
|
|
|
+ // s.DBE.Query("SET autocommit=0;")
|
|
|
|
|
|
sql := "UPDATE OilSupplierCertAppend b left join OilSupplierCert a ON (a.`GfId` = b.OldId AND a.SupplierTypeCode = b.AppendType) SET " +
|
|
|
"b.SupplierId = IFNULL(a.`SupplierId`, 0), " +
|
|
|
"b.SupplierCertId = IFNULL(a.`Id`, 0) "
|
|
|
_, err := s.DBE.Query(sql)
|
|
|
|
|
|
- s.DBE.Query("commit;")
|
|
|
+ // s.DBE.Query("commit;")
|
|
|
|
|
|
s.DBE.Query("SET unique_checks=1;")
|
|
|
- s.DBE.Query("SET autocommit=1;")
|
|
|
+ // s.DBE.Query("SET autocommit=1;")
|
|
|
return err
|
|
|
}
|
|
|
|
|
|
@@ -573,7 +576,7 @@ func (s *TmpzcgtSession) UpdateOilSupplierCertAppendSub() error {
|
|
|
svc.GetEntitysByWhere("OilSupplierCertAppend", "", &certAppendList)
|
|
|
var err error
|
|
|
s.DBE.Query("SET unique_checks=0;")
|
|
|
- s.DBE.Query("SET autocommit=0;")
|
|
|
+ // s.DBE.Query("SET autocommit=0;")
|
|
|
for _, certAppend := range certAppendList {
|
|
|
appendCodeList := strings.Split(certAppend.Remark, ",")
|
|
|
appendCodeString := "("
|
|
|
@@ -589,17 +592,17 @@ func (s *TmpzcgtSession) UpdateOilSupplierCertAppendSub() error {
|
|
|
", a.`Type`=3 WHERE a.SupplierCertId=" + strconv.Itoa(certAppend.SupplierCertId) +
|
|
|
" AND" + code + ") and a.SupplierCertAppendId=0"
|
|
|
_, err = s.DBE.Query(sql)
|
|
|
- s.DBE.Query("commit;")
|
|
|
+ // s.DBE.Query("commit;")
|
|
|
}
|
|
|
s.DBE.Query("SET unique_checks=1;")
|
|
|
- s.DBE.Query("SET autocommit=1;")
|
|
|
+ // s.DBE.Query("SET autocommit=1;")
|
|
|
return err
|
|
|
}
|
|
|
|
|
|
// 导入资质名称
|
|
|
func (s *TmpzcgtSession) InsertFileName() error {
|
|
|
s.DBE.Query("SET unique_checks=0;")
|
|
|
- s.DBE.Query("SET autocommit=0;")
|
|
|
+ // 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, " +
|
|
|
@@ -609,9 +612,9 @@ func (s *TmpzcgtSession) InsertFileName() error {
|
|
|
"WHERE z.企业名称 IS NOT NULL"
|
|
|
_, err := s.DBE.Query(sql)
|
|
|
|
|
|
- s.DBE.Query("commit;")
|
|
|
+ // s.DBE.Query("commit;")
|
|
|
s.DBE.Query("SET unique_checks=1;")
|
|
|
- s.DBE.Query("SET autocommit=1;")
|
|
|
+ // s.DBE.Query("SET autocommit=1;")
|
|
|
return err
|
|
|
}
|
|
|
|