lining пре 6 година
родитељ
комит
50fe7c7830

+ 92 - 1
src/dashoo.cn/backend/api/business/tmpzcgf/tmpzcgfSession.go

@@ -114,6 +114,12 @@ func (s *TmpzcgtSession) InsertSupplierCert() error {
 	return err
 }
 
+func (s *TmpzcgtSession) UpdateSupplierCert() error {
+	sql := "UPDATE `OilSupplierCert` b SET b.SupplierId=(SELECT Id FROM OilSupplier a WHERE a.SupplierName = b.OutsideFlog)"
+	_,err := s.Session.Query(sql)
+	return err
+}
+
 func (s *TmpzcgtSession) UpdateSupplierTypeCodeAndInFlag() error {
 	sql1 := "update `OilSupplierCert` set SupplierTypeCode = '01' where SupplierTypeName='物资类'"
 	_,err := s.Session.Query(sql1)
@@ -154,4 +160,89 @@ func (s *TmpzcgtSession) InsterAnnual() error {
 
 	_,err := s.Session.Query(sql)
 	return err
-}
+}
+
+func (s *TmpzcgtSession) InsertOilPaymentInfo() error {
+	sql := "INSERT INTO `OilPaymentInfo` ( " +
+	"ID_GF," +
+	"SupplierName," +
+		"PayDate," +
+		"Amount," +
+		"IsPay," +
+		" PayType," +
+		"Remark," +
+		"PayMode," +
+		"CreateBy" +
+	")" +
+	"SELECT ID_GF, 企业名称 AS SupplierName ,交费日期 AS PayDate, 新准入 AS Amount, '2' AS IsPay,'1' AS PayType , 备注 AS Remark, 交款方式 AS PayMode,收款人 AS CreateBy FROM tmp_jiaofenjl WHERE 新准入 IS NOT NULL" +
+	" UNION" +
+	" SELECT ID_GF, 企业名称 AS SupplierName ,交费日期 AS PayDate, 换证 AS Amount , '2' AS IsPay, '4' AS PayType , 备注 AS Remark, 交款方式 AS PayMode,收款人 AS CreateBy FROM tmp_jiaofenjl WHERE 换证 IS NOT NULL" +
+	" UNION" +
+	" SELECT ID_GF, 企业名称 AS SupplierName ,交费日期 AS PayDate, 增项 AS Amount , '2' AS IsPay, '3' AS PayType , 备注 AS Remark, 交款方式 AS PayMode,收款人 AS CreateBy FROM tmp_jiaofenjl WHERE 增项 IS NOT NULL" +
+	" UNION" +
+	" SELECT ID_GF, 企业名称 AS SupplierName,交费日期 AS PayDate, 年审 AS Amount , '2' AS IsPay, '2' AS PayType , 备注 AS Remark, 交款方式 AS PayMode,收款人 AS CreateBy FROM tmp_jiaofenjl WHERE 年审 IS NOT NULL" +
+	" UNION" +
+	" SELECT ID_GF, 企业名称 AS SupplierName,交费日期 AS PayDate, 罚款 AS Amount , '2' AS IsPay, '5' AS PayType , 备注 AS Remark, 交款方式 AS PayMode,收款人 AS CreateBy FROM tmp_jiaofenjl WHERE 罚款 IS NOT NULL" +
+	" UNION" +
+	" SELECT ID_GF, 企业名称 AS SupplierName,交费日期 AS PayDate, 其它 AS Amount , '2' AS IsPay, '6' AS PayType , 备注 AS Remark, 交款方式 AS PayMode,收款人 AS CreateBy FROM tmp_jiaofenjl WHERE 其它 IS NOT NULL"
+
+	_,err := s.Session.Query(sql)
+	return err
+}
+
+func (s *TmpzcgtSession) UpdateOilPaymentInfo() error {
+	sql := "UPDATE OilPaymentInfo b SET b.SupplierId= (SELECT  DISTINCT(a.SupplierId) FROM `OilSupplierCert` a WHERE  a.GfId = b.ID_GF )"
+	_,err := s.Session.Query(sql)
+	return err
+}
+
+func (s *TmpzcgtSession) InsterBadRecord() error {
+	sql := "INSERT INTO BadRecord (" +
+	"Bak1," +
+		"CreateOn, " +
+		"Record," +
+		"CompanyName, " +
+		"CompanyCode, " +
+		"CategoryName, " +
+		"CategoryCode " +
+	") " +
+	"SELECT " +
+	"gfid AS Bak1 , " +
+		"日期 AS CreateOn, " +
+		"内容 AS Record, " +
+		"'' AS CompanyName, " +
+		"'' AS CompanyCode, " +
+		"'' AS CategoryName, " +
+		"'' AS CategoryCode " +
+	"FROM tmp_buliangjl WHERE 内容 IS NOT NULL"
+	_,err := s.Session.Query(sql)
+	return err
+}
+
+func (s *TmpzcgtSession) UpdateBadRecord() error {
+	sql := "UPDATE BadRecord b SET " +
+	"b.CompanyCode = (SELECT DISTINCT(a.SupplierId) FROM `OilSupplierCert` a WHERE  a.GfId = b.Bak1 AND a.SupplierId IS NOT NULL)," +
+	"b.CompanyName = (SELECT DISTINCT(a.OutsideFlog) FROM `OilSupplierCert` a WHERE  a.GfId = b.Bak1 AND a.OutsideFlog IS NOT NULL) "
+	_,err := s.Session.Query(sql)
+	return err
+}
+
+func (s *TmpzcgtSession) Selectsuo() int {
+	var id int
+	s.Session.Table("BadRecord").Where("Id=64").Find(&id)
+	return id
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+

+ 118 - 29
src/dashoo.cn/backend/api/controllers/tmpzcgf/tmpzcgf.go

@@ -2,14 +2,12 @@ package tmpzcgf
 
 import (
 	"dashoo.cn/backend/api/business/oilsupplier/annualaudit"
-	"dashoo.cn/backend/api/business/oilsupplier/supplier"
 	"dashoo.cn/backend/api/business/oilsupplier/suppliercert"
 	"dashoo.cn/backend/api/business/oilsupplier/suppliercertappend"
 	"dashoo.cn/backend/api/business/tmpzcgf"
 	. "dashoo.cn/backend/api/controllers"
 	"dashoo.cn/utils"
 	"fmt"
-	"strconv"
 	"time"
 )
 
@@ -22,9 +20,13 @@ type TmpzcgfController struct {
 // @Success 200 {object}
 // @router /insertsupplier [get]
 func (this *TmpzcgfController) InsertSupplier(){
+	fmt.Println("======开始导入OilSupplier表======")
 	t := time.Now()
 	session := utils.DBE.NewSession()
-	defer session.Close()
+	defer func() {
+		fmt.Println("======OilSupplier表结束======")
+		session.Close()
+	}()
 	err := session.Begin()
 	svc := tmpzcgf.GetTmpzcgtService(session)
 	err = svc.InsertSupplier()
@@ -42,9 +44,13 @@ func (this *TmpzcgfController) InsertSupplier(){
 // @Success 200 {object}
 // @router /insertsuppliercert [get]
 func (this *TmpzcgfController) InsertSupplierCert(){
+	fmt.Println("=============开始导入Cert表==========")
 	t := time.Now()
 	session := utils.DBE.NewSession()
-	defer session.Close()
+	defer func() {
+		fmt.Println("=============导入Cert表结束==========")
+		session.Close()
+	}()
 	err := session.Begin()
 	svc := tmpzcgf.GetTmpzcgtService(session)
 	err = svc.InsertSupplierCert()
@@ -62,9 +68,13 @@ func (this *TmpzcgfController) InsertSupplierCert(){
 // @Success 200 {object}
 // @router /updatecerttypeandinflag [get]
 func (this *TmpzcgfController) UpdateCertTypeAndInflag(){
+	fmt.Println("=============开始更新Cert==========")
 	t := time.Now()
 	session := utils.DBE.NewSession()
-	defer session.Close()
+	defer func() {
+		fmt.Println("=============开始更新Cert==========")
+		session.Close()
+	}()
 	err := session.Begin()
 	svc := tmpzcgf.GetTmpzcgtService(session)
 	err = svc.UpdateSupplierTypeCodeAndInFlag()
@@ -82,32 +92,37 @@ func (this *TmpzcgfController) UpdateCertTypeAndInflag(){
 // @Success 200 {object}
 // @router /updatesupplierid [get]
 func (this *TmpzcgfController) UpdateSupplierId(){
+	fmt.Println("=============开始更新Cert的SupplierId==========")
 	t := time.Now()
 	session := utils.DBE.NewSession()
-	defer session.Close()
+	defer func() {
+		fmt.Println("=============更新Cert的SupplierId结束==========")
+		session.Close()
+	}()
 	err := session.Begin()
 	svc := tmpzcgf.GetTmpzcgtService(session)
-	var supp []supplier.OilSupplier
-	var certs  []suppliercert.OilSupplierCert
-	var  c  suppliercert.OilSupplierCert
-
-	svc.GetEntitysByWhere("OilSupplier", "CreateBy='导入'" ,&supp )
-	svc.GetEntitysByWhere("OilSupplierCert", "1=1", &certs)
-	for _,cert := range certs {
-		for _,sup := range supp {
-			if cert.OutsideFlog == sup.SupplierName {
-				fmt.Println(cert.OutsideFlog, sup.SupplierName)
-				col := []string{"SupplierId"}
-				c.SupplierId = sup.Id
-				where := "Id=" + strconv.Itoa(cert.Id)
-				err = svc.UpdateEntityBywheretbl("OilSupplierCert",c,col,where)
-				if err != nil {
-					session.Rollback()
-				}
-				break
-			}
-		}
-	}
+	err = svc.UpdateSupplierCert()
+	//var supp []supplier.OilSupplier
+	//var certs  []suppliercert.OilSupplierCert
+	//var  c  suppliercert.OilSupplierCert
+
+	//svc.GetEntitysByWhere("OilSupplier", "CreateBy='导入'" ,&supp )
+	//svc.GetEntitysByWhere("OilSupplierCert", "1=1", &certs)
+	//for _,cert := range certs {
+	//	for _,sup := range supp {
+	//		if cert.OutsideFlog == sup.SupplierName {
+	//			fmt.Println(cert.OutsideFlog, sup.SupplierName)
+	//			col := []string{"SupplierId"}
+	//			c.SupplierId = sup.Id
+	//			where := "Id=" + strconv.Itoa(cert.Id)
+	//			err = svc.UpdateEntityBywheretbl("OilSupplierCert",c,col,where)
+	//			if err != nil {
+	//				session.Rollback()
+	//			}
+	//			break
+	//		}
+	//	}
+	//}
 
 	err = session.Commit()
 	fmt.Println(err)
@@ -217,11 +232,85 @@ func (this *TmpzcgfController) UpdateOilSupplierCertAppend(){
 
 }
 
+// @Title 导入缴费记录
+// @Description get user by token
+// @Success 200 {object}
+// @router /insterOilPaymentInfo [get]
+func (this *TmpzcgfController) InsterOilPaymentInfo(){
+	t := time.Now()
+	session := utils.DBE.NewSession()
+	defer func() {
+		fmt.Println("+++++++++++")
+		session.Close()
+	}()
+	err := session.Begin()
+	svc := tmpzcgf.GetTmpzcgtService(session)
+	err = svc.InsertOilPaymentInfo()
+	if err != nil {
+		session.Rollback()
+	}
+	err = svc.UpdateOilPaymentInfo()
+	if err != nil {
+		session.Rollback()
+	}
+	err = session.Commit()
+	fmt.Println(err)
+	elapsed := time.Since(t)
+	fmt.Println(elapsed)
+}
 
+// @Title 导入不良记录
+// @Description get user by token
+// @Success 200 {object}
+// @router /insterBadRecord [get]
+func (this *TmpzcgfController) InsterBadRecord(){
+	t := time.Now()
+	session := utils.DBE.NewSession()
+	defer func() {
+		session.Close()
+	}()
+	err := session.Begin()
+	svc := tmpzcgf.GetTmpzcgtService(session)
+	ids := svc.Selectsuo()
+	fmt.Println(ids)
+	//err = svc.InsterBadRecord()
 
+	if err != nil {
+		session.Rollback()
+	}
+	err = svc.UpdateBadRecord()
+	if err != nil {
+		session.Rollback()
+	}
+	err = session.Commit()
+	fmt.Println(err)
+	elapsed := time.Since(t)
+	fmt.Println(elapsed)
+}
 
-
-
+// @Title 跟新tmp_zcgf
+// @Description get user by token
+// @Success 200 {object}
+// @router /updatezcgf [get]
+//func (this *TmpzcgfController) Updatezcgf(){
+//
+//	t := time.Now()
+//	session := utils.DBE.NewSession()
+//	defer func() {
+//		session.Close()
+//	}()
+//	var zcgflist []tmpzcgf.Tmpzcgf
+//	svc := tmpzcgf.GetTmpzcgtService(session)
+//	err := session.Begin()
+//	svc.GetEntitysByWhere("tmp_zcgf_l", "", &zcgflist)
+//	for _,zcgf := range zcgflist{
+//		t,err := time.Parse("2006-01-02", zcgf.成立时间)
+//		if err != nil {
+//			fmt.Println(err)
+//		}
+//	}
+//
+//}
 
 
 

+ 98 - 32
src/dashoo.cn/frontend_web/src/pages/system/tmpzcgf.vue

@@ -17,9 +17,12 @@
        <el-button size="mini" type="primary" @click="insertSupplerCert" v-loading.fullscreen.lock="fullscreenLoading">导入OilSupplerCert</el-button>
        <el-button size="mini" type="primary" @click="updateSupplerCert" v-loading.fullscreen.lock="fullscreenLoading">更新SupplierTypeCodeAndInFlag</el-button>
        <el-button size="mini" type="primary" @click="updateSupplerId" v-loading.fullscreen.lock="fullscreenLoading">更新Cert表的SupplierID</el-button>
-       <el-button size="mini" type="primary" @click="insterAnnualAudit" v-loading.fullscreen.lock="fullscreenLoading">导入年审表</el-button>
-       <el-button size="mini" type="primary" @click="updateAnnualAudit" v-loading.fullscreen.lock="fullscreenLoading">跟新年审表的SupplierId和CerId</el-button>
-       <el-button size="mini" type="primary" @click="updateOilSupplierCertAppend" v-loading.fullscreen.lock="fullscreenLoading">跟新OilSupplierCertAppend表的SupplierId和CerId</el-button>
+       <!--<el-button size="mini" type="primary" @click="insterAnnualAudit" v-loading.fullscreen.lock="fullscreenLoading">导入年审表</el-button>-->
+       <!--<el-button size="mini" type="primary" @click="updateAnnualAudit" v-loading.fullscreen.lock="fullscreenLoading">跟新年审表的SupplierId和CerId</el-button>-->
+       <!--<el-button size="mini" type="primary" @click="updateOilSupplierCertAppend" v-loading.fullscreen.lock="fullscreenLoading">跟新OilSupplierCertAppend表的SupplierId和CerId</el-button>-->
+       <!--<el-button size="mini" type="primary" @click="insterOilPaymentInfo" v-loading.fullscreen.lock="fullscreenLoading">导入缴费记录并更新</el-button>-->
+       <!--<el-button size="mini" type="primary" @click="insterBadRecord" v-loading.fullscreen.lock="fullscreenLoading">导入不良记录并更新</el-button>-->
+
     </el-card>
     <el-card class="box-card">
     </el-card>
@@ -46,52 +49,115 @@
     },
     methods: {
       insertsuppler () {
-        this.fullscreenLoading = true
-        this.$axios.get('tmpzcgf/insertsupplier')
-          .then(res => {
-            this.fullscreenLoading = false
+        this.$confirm('是否继续?', '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
+        })
+          .then(() => {
+            this.fullscreenLoading = true
+            this.$axios.get('tmpzcgf/insertsupplier')
+              .then(res => {
+                this.fullscreenLoading = false
+              })
           })
       },
       insertSupplerCert () {
-        this.fullscreenLoading = true
-        this.$axios.get('tmpzcgf/insertsuppliercert')
-          .then(res => {
-            this.fullscreenLoading = false
+        this.$confirm('是否继续?', '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
+        })
+          .then(() => {
+            this.fullscreenLoading = true
+            this.$axios.get('tmpzcgf/insertsuppliercert')
+              .then(res => {
+                this.fullscreenLoading = false
+              })
           })
       },
       updateSupplerCert () {
-        this.fullscreenLoading = true
-        this.$axios.get('tmpzcgf/updatecerttypeandinflag')
-          .then(res => {
-            this.fullscreenLoading = false
+        this.$confirm('是否继续?', '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
+        })
+          .then(() => {
+            this.fullscreenLoading = true
+            this.$axios.get('tmpzcgf/updatecerttypeandinflag')
+              .then(res => {
+                this.fullscreenLoading = false
+              })
           })
       },
       updateSupplerId () {
-        this.fullscreenLoading = true
-        this.$axios.get('tmpzcgf/updatesupplierid')
-          .then(res => {
-            this.fullscreenLoading = false
+        this.$confirm('是否继续?', '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
+        })
+          .then(() => {
+            this.fullscreenLoading = true
+            this.$axios.get('tmpzcgf/updatesupplierid')
+              .then(res => {
+                this.fullscreenLoading = false
+              })
           })
       },
       insterAnnualAudit () {
-        this.fullscreenLoading = true
-        this.$axios.get('tmpzcgf/insterannualaudit')
-          .then(res => {
-            this.fullscreenLoading = false
+        this.$confirm('是否继续?', '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
+        })
+          .then(() => {
+            this.fullscreenLoading = true
+            this.$axios.get('tmpzcgf/insterannualaudit')
+              .then(res => {
+                this.fullscreenLoading = false
+              })
           })
       },
       updateAnnualAudit () {
-        this.fullscreenLoading = true
-        this.$axios.get('tmpzcgf/updateAnnualAudit')
-          .then(res => {
-            this.fullscreenLoading = false
+        this.$confirm('是否继续?', '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
+        })
+          .then(() => {
+            this.fullscreenLoading = true
+            this.$axios.get('tmpzcgf/updateAnnualAudit')
+              .then(res => {
+                this.fullscreenLoading = false
+              })
+          })
+      },
+      insterOilPaymentInfo () {
+        this.$confirm('是否继续?', '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
+        })
+          .then(() => {
+            this.fullscreenLoading = true
+            this.$axios.get('tmpzcgf/insterOilPaymentInfo')
+              .then(res => {
+                this.fullscreenLoading = false
+              })
           })
       },
-      updateOilSupplierCertAppend () {
-        this.fullscreenLoading = true
-        this.$axios.get('tmpzcgf/updateOilSupplierCertAppend')
-          .then(res => {
-            this.fullscreenLoading = false
+      insterBadRecord () {
+        this.$confirm('是否继续?', '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
+        })
+          .then(() => {
+            this.fullscreenLoading = true
+            this.$axios.get('tmpzcgf/insterBadRecord')
+              .then(res => {
+                this.fullscreenLoading = false
+              })
           })
       }
     }