|
|
@@ -1,6 +1,9 @@
|
|
|
package oilsupplier
|
|
|
|
|
|
import (
|
|
|
+ "dashoo.cn/backend/api/business/oilsupplier/supplier"
|
|
|
+ "dashoo.cn/backend/api/business/oilsupplier/suppliercert"
|
|
|
+ "dashoo.cn/backend/api/business/oilsupplier/suppliercertsub"
|
|
|
"encoding/json"
|
|
|
"fmt"
|
|
|
"github.com/tealeg/xlsx"
|
|
|
@@ -1412,4 +1415,52 @@ func (this *OilGoodsAptitudeController) InsertGoodsAptitude() {
|
|
|
this.Data["json"] = &errinfo
|
|
|
this.ServeJSON()
|
|
|
|
|
|
+}
|
|
|
+
|
|
|
+// @Title 更新企业的准入项及资质
|
|
|
+// @Description get SampleType by token
|
|
|
+// @Success 200 {object} sampletype.SampleType
|
|
|
+// @router /updatasuppiercertsub [get]
|
|
|
+func (this *OilGoodsAptitudeController) UpdataSuppierCertSub() {
|
|
|
+
|
|
|
+ t := time.Now()
|
|
|
+
|
|
|
+ supsvc := supplier.GetOilSupplierService(utils.DBE)
|
|
|
+ var suppliercertList []suppliercert.OilSupplierCert
|
|
|
+ where := "SupplierTypeCode='01' and InFlag != '3' "
|
|
|
+ supsvc.GetEntities(&suppliercertList, where)
|
|
|
+
|
|
|
+ var goodsaptitudeClassList []goodsaptitudeclass.OilGoodsAptitudeClass
|
|
|
+ whereclass := "LENGTH(CODE) = 8 "
|
|
|
+ supsvc.GetEntities(&goodsaptitudeClassList, whereclass)
|
|
|
+
|
|
|
+ var colsname = []string{"Name"}
|
|
|
+ for _, suppliercert := range suppliercertList {
|
|
|
+ log.Println(suppliercert.SupplierId)
|
|
|
+ var supplierCertSubList []suppliercertsub.OilSupplierCertSub
|
|
|
+ wheresup := "SupplierId = " + strconv.Itoa(suppliercert.SupplierId) + " and SupplierTypeCode='01'"
|
|
|
+ supsvc.GetEntities(&supplierCertSubList, wheresup)
|
|
|
+ fmt.Println(len(supplierCertSubList))
|
|
|
+ for _, supplierCertSub := range supplierCertSubList {
|
|
|
+ for _, goodsaptitudeClass := range goodsaptitudeClassList {
|
|
|
+ if supplierCertSub.Code == goodsaptitudeClass.Code {
|
|
|
+ if supplierCertSub.Name != goodsaptitudeClass.Name {
|
|
|
+ var entity suppliercertsub.OilSupplierCertSub
|
|
|
+ entity.Name = goodsaptitudeClass.Name
|
|
|
+ where := "Id = " + strconv.Itoa(supplierCertSub.Id)
|
|
|
+ supsvc.UpdateEntityBywheretbl(OilSupplierCertSubName, &entity, colsname, where)
|
|
|
+ }
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ elapsed := time.Since(t)
|
|
|
+ log.Println(elapsed)
|
|
|
+
|
|
|
+
|
|
|
}
|