2
3
Quellcode durchsuchen

前后:基建对比;老数据导入加上目录

dubch vor 5 Jahren
Ursprung
Commit
f843e5a6ab

+ 1 - 1
src/dashoo.cn/backend/api/business/oilsupplier/basisbuild/oilbasisbuildService.go

@@ -109,7 +109,7 @@ func (s *OilBasisBuildService) GetTableTotal(where string, entitiesPtr interface
 
 func (s *OilBasisBuildService) GetNoSubCntTotal(where string) (total int64) {
 
-	sqlCount := "select count(a.`Name`) as total from OilSupplierCertSub a left join Tmp_OilTechnologyServiceClass b on b.`Name` = a.`Name` LEFT JOIN Tmp_OilTechnologyService c ON c.ClassId = b.Id where (" + where + ")"
+	sqlCount := "select count(a.`Name`) as total from OilSupplierCertSub a left join Tmp_OilBasisBuild b on b.`Name` = a.`Name` where (" + where + ")"
 
 	var totalResult TotalResult
 	s.DBE.SQL(sqlCount).Get(&totalResult)

+ 2 - 0
src/dashoo.cn/backend/api/business/oilsupplier/goodsaptitude/oilgoodsaptitude.go

@@ -291,12 +291,14 @@ type GoodsBusiness struct {
 }
 
 type GoodsBusiness1 struct {
+	Id        		  int
 	Code              string
 	Name              string
 	GoodsLevel		  string
 }
 
 type GoodsBusiness2 struct {
+	Id        		  int
 	Code              string
 	Name              string
 }

+ 33 - 0
src/dashoo.cn/backend/api/business/tmpzcgf/tmpzcgfSession.go

@@ -633,3 +633,36 @@ func (s *TmpzcgtSession) UpdateSupplierFileSId() error {
 	return err
 }
 
+// 导入目录
+func (s *TmpzcgtSession) InsertOilCatalog() error {
+	s.DBE.Query("SET unique_checks=0;")
+	// s.DBE.Query("SET autocommit=0;")
+	sql := "insert into `OilCatalog` (`CompanyName`, `CatalogType`, `RecordScope`, `ValidityTo`) select `名称`, "+
+		"CASE `类别` WHEN '多经企业' THEN 2 WHEN '战略合作' THEN 4 WHEN '特别业务' THEN 5 WHEN '外部市场' THEN 6 ELSE 0 END as `类别`, `合作范围`, `有效期` "+
+		"from `T_可不招标供方名录` b order by b.ID"
+	_, err := s.DBE.Query(sql)
+
+	// s.DBE.Query("commit;")
+	s.DBE.Query("SET unique_checks=1;")
+	// s.DBE.Query("SET autocommit=1;")
+	return err
+}
+
+func (s *TmpzcgtSession) InsertOilCatalogSub() error {
+	s.DBE.Query("SET unique_checks=0;")
+	// s.DBE.Query("SET autocommit=0;")
+	sql := "insert into `OilCatalogSub` (`Type`, `Dept`, `DutyDept`) select a.`类别`, `申请单位`, `责任部门` from `T_可不招标供方名录` a left join `OilCatalog` b on b.`CompanyName` = a.`名称` and b.`RecordScope` = a.`合作范围` order by a.ID"
+	_, err := s.DBE.Query(sql)
+
+	// s.DBE.Query("commit;")
+	s.DBE.Query("SET unique_checks=1;")
+	// s.DBE.Query("SET autocommit=1;")
+	return err
+}
+
+func (s *TmpzcgtSession) UpdateOilCatalog() error {
+	sql := "update `OilCatalog` set `SubId` = `Id`"
+	_, err := s.DBE.Query(sql)
+	return err
+}
+

+ 3 - 7
src/dashoo.cn/backend/api/controllers/oilsupplier/basisbuild.go

@@ -1519,7 +1519,7 @@ func (this *OilBasisBuildController) CreateContrast() {
 			if list != nil {
 				var supplierCertSubList []suppliercertsub.OilSupplierCertSub
 				total := svc.GetTableTotal(" SupplierTypeCode='02' AND SupplierId = "+strconv.Itoa(item.Id), &supplierCertSubList)
-				total1 := svc.GetNoSubCntTotal("a.SupplierTypeCode = '02' and c.ClassId is null and a.SupplierId = " + strconv.Itoa(item.Id))
+				total1 := svc.GetNoSubCntTotal("a.SupplierTypeCode = '02' and b.Id is null and a.SupplierId = " + strconv.Itoa(item.Id))
 				list[0].SubCnt = int(total)
 				list[0].NoSubCnt = int(total1)
 				list[0].SetupTime = time.Now()
@@ -1633,11 +1633,6 @@ func (this *OilBasisBuildController) GetDelCertSubList() {
 	where = where + " and a.Type in (1, 3)"
 	svc := basisbuild.GetOilBasisBuildService(utils.DBE)
 	var list []suppliercertsub.OilSupplierCertSub1
-	var co supplier.OilSupplierContrast
-	svc.GetEntityById(SupplierId, &co)
-	if co.IsDelete == 1 {
-		where += " and a.IsQuestion = 1"
-	}
 	total := svc.GetPagingTmpSubEntities(page.CurrentPage, page.Size, orderby, asc, &list, where)
 	a := 0
 	for _, item := range list {
@@ -1701,8 +1696,9 @@ func (this *OilBasisBuildController) DeleteUpdate() {
 		svc.GetEntitysByWhere(OilBasisBuildName, "1=1", &list1)
 		for _,item := range list1{
 			var subDelete suppliercertsub.OilSupplierCertSub1
-			cols := []string{"Code"}
+			cols := []string{"SubClassId", "Code"}
 			subDelete.Code = item.Code
+			subDelete.SubClassId = item.Id
 			err = svc.UpdateEntityBywheretbl(OilSupplierCertSubName, &subDelete, cols, "SupplierTypeCode = '02' and Name = '" + item.Name + "'")
 		}
 		var list []goodsaptitude.Ids

+ 2 - 1
src/dashoo.cn/backend/api/controllers/oilsupplier/goodsaptitude.go

@@ -3028,9 +3028,10 @@ func (this *OilGoodsAptitudeController) DeleteUpdate() {
 		svc.GetEntityJoin(OilGoodsAptitudeName, OilGoodsAptitudeClassName, &list1)
 		for _,item := range list1{
 			var subDelete suppliercertsub.OilSupplierCertSub1
-			cols := []string{"GoodsLevel", "Name"}
+			cols := []string{"SubClassId", "GoodsLevel", "Name"}
 			subDelete.GoodsLevel = item.GoodsLevel
 			subDelete.Name = item.Name
+			subDelete.SubClassId = item.Id
 			if item.GoodsLevel == "2" {
 				// 1降2修改
 				err = svc.UpdateEntityBywheretbl(OilSupplierCertSubName, &subDelete, cols, "SupplierTypeCode = '01' and Code = '" + item.Code + "'")

+ 2 - 6
src/dashoo.cn/backend/api/controllers/oilsupplier/technologyservice.go

@@ -2070,11 +2070,6 @@ func (this *OilTechnologyServiceController) GetDelCertSubList() {
 	where = where + " and a.Type in (1, 3)"
 	svc := technologyservice.GetOilTechnologyServiceService(utils.DBE)
 	var list []suppliercertsub.OilSupplierCertSub1
-	var co supplier.OilSupplierContrast
-	svc.GetEntityById(SupplierId, &co)
-	if co.IsDelete == 1 {
-		where += " and a.IsQuestion = 1"
-	}
 	total := svc.GetPagingTmpSubEntities(page.CurrentPage, page.Size, orderby, asc, &list, where)
 	a := 0
 	for _, item := range list {
@@ -2138,8 +2133,9 @@ func (this *OilTechnologyServiceController) DeleteUpdate() {
 		svc.GetEntityJoin(OilTechnologyServiceName, OilTechnologyServiceClassName, &list1)
 		for _,item := range list1{
 			var subDelete suppliercertsub.OilSupplierCertSub1
-			cols := []string{"Code"}
+			cols := []string{"SubClassId", "Code"}
 			subDelete.Code = item.Code
+			subDelete.SubClassId = item.Id
 			err = svc.UpdateEntityBywheretbl(OilSupplierCertSubName, &subDelete, cols, "SupplierTypeCode = '03' and Name = '" + item.Name + "'")
 		}
 		var list []goodsaptitude.Ids

+ 44 - 0
src/dashoo.cn/backend/api/controllers/tmpzcgf/tmpzcgf.go

@@ -748,6 +748,43 @@ func (this *TmpzcgfController) InsertFileName() {
 	fmt.Println(elapsed)
 }
 
+// @Title 导入/修改目录
+// @Description get user by token
+// @Success 200 {object}
+// @router /insertFileName [get]
+func (this *TmpzcgfController) InsertUpdateOilCatalog() {
+	fmt.Println("==========导入目录开始=========")
+	t := time.Now()
+	// session := utils.DBE.NewSession()
+	defer func() {
+		fmt.Println("==========导入目录结束=========")
+		// session.Close()
+	}()
+	// err := session.Begin()
+	svc := tmpzcgf.GetTmpzcgtService(utils.DBE)
+	err := svc.InsertOilCatalog()
+	if err != nil {
+		// session.Rollback()
+		fmt.Println(err)
+	}
+
+	err = svc.InsertOilCatalogSub()
+	if err != nil {
+		// session.Rollback()
+		fmt.Println(err)
+	}
+
+	err = svc.UpdateOilCatalog()
+	if err != nil {
+		// session.Rollback()
+		fmt.Println(err)
+	}
+	// err = session.Commit()
+	// fmt.Println(err)
+	elapsed := time.Since(t)
+	fmt.Println(elapsed)
+}
+
 // @Title 清空所有资质
 // @Description get user by token
 // @Success 200 {object}
@@ -864,6 +901,12 @@ func (this *TmpzcgfController) ClearAll() {
 	sql = "truncate table OilSupplierSceneFile"
 	svc.DBE.Query(sql)
 
+	sql = "truncate table OilCatalog"
+	svc.DBE.Query(sql)
+
+	sql = "truncate table OilCatalogSub"
+	svc.DBE.Query(sql)
+
 	// 设置环境变量
 	svc.DBE.Query("set session bulk_insert_buffer_size = 120 * 1024 * 1024;")
 
@@ -899,6 +942,7 @@ func (this *TmpzcgfController) InsertAll() {
 		this.InsertOilInfoChange()
 		this.UpdateOilInfoChange()
 		this.DelBadRecord()
+		this.InsertUpdateOilCatalog()
 
 		this.ClearTmpData()
 	}()

+ 1 - 1
src/dashoo.cn/backend/api/mydb/myServiceBase.go

@@ -824,7 +824,7 @@ func (s *MyServiceBase) DeleteTableBySelect(tableName, tableName2, where string,
 }
 
 func (s *MyServiceBase) GetEntityJoin(tableName string, tableName2 string,entityPtr interface{}) (has bool) {
-	sql := "SELECT a.GoodsLevel, class.Code, class.Name FROM " + tableName + " a LEFT JOIN " + tableName2 + " class ON a.ClassId = class.Id "
+	sql := "SELECT a.GoodsLevel, class.Id, class.Code, class.Name FROM " + tableName + " a LEFT JOIN " + tableName2 + " class ON a.ClassId = class.Id "
 	s.DBE.SQL(sql).Find(entityPtr)
 	return
 }

+ 3 - 3
src/dashoo.cn/frontend_web/src/pages/oilsupplier/basisbuild/index.vue

@@ -640,9 +640,9 @@
         this.initImportDatas()
       },
       importhandleSearch () {
-        // this.importcurrentPage = 1
-        // this.importDialogVisible = false
-        // this.initImportDatas()
+        this.importcurrentPage = 1
+        this.importDialogVisible = false
+        this.initImportDatas()
       },
       importhandleSizeChange (value) {
         this.importsize = value