|
@@ -1496,7 +1496,7 @@ func (this *OilGoodsAptitudeController) ImportExcel() {
|
|
|
this.ServeJSON()
|
|
this.ServeJSON()
|
|
|
}
|
|
}
|
|
|
// 外网不用 go func()
|
|
// 外网不用 go func()
|
|
|
- //go func() {
|
|
|
|
|
|
|
+ go func() {
|
|
|
_dir := utils.Cfg.MustValue("file", "tmplateDir") + "xlsx"
|
|
_dir := utils.Cfg.MustValue("file", "tmplateDir") + "xlsx"
|
|
|
filename := strconv.Itoa(int(time.Now().Unix())) + ".xlsx"
|
|
filename := strconv.Itoa(int(time.Now().Unix())) + ".xlsx"
|
|
|
utils.DownloadFile(url, filename, _dir)
|
|
utils.DownloadFile(url, filename, _dir)
|
|
@@ -1529,7 +1529,7 @@ func (this *OilGoodsAptitudeController) ImportExcel() {
|
|
|
log.Println(elapsed)
|
|
log.Println(elapsed)
|
|
|
this.CreateContrast()
|
|
this.CreateContrast()
|
|
|
}
|
|
}
|
|
|
- //}()
|
|
|
|
|
|
|
+ }()
|
|
|
errorinfo.Code = 0
|
|
errorinfo.Code = 0
|
|
|
errorinfo.Message = "导入中,请等待!"
|
|
errorinfo.Message = "导入中,请等待!"
|
|
|
this.Data["json"] = &errorinfo
|
|
this.Data["json"] = &errorinfo
|
|
@@ -1692,46 +1692,48 @@ func (this *OilGoodsAptitudeController) TruncateImport() {
|
|
|
// @Success 200 {object} sampletype.SampleType
|
|
// @Success 200 {object} sampletype.SampleType
|
|
|
// @router /create-contrast [get]
|
|
// @router /create-contrast [get]
|
|
|
func (this *OilGoodsAptitudeController) CreateContrast() {
|
|
func (this *OilGoodsAptitudeController) CreateContrast() {
|
|
|
- svc := goodsaptitude.GetOilGoodsAptitudeService(utils.DBE)
|
|
|
|
|
- svc.TruncateTable("OilSupplierContrast")
|
|
|
|
|
- // 插入对比列表
|
|
|
|
|
- var list1 []supplier.OilSupplier
|
|
|
|
|
- svc.GetMyPagingEntitiesWithOrderBytbl(OilSupplierName, 0, 0, "Id", false, &list1, " 1=1")
|
|
|
|
|
- svc.DBE.Query("SET unique_checks=0;")
|
|
|
|
|
- svc.DBE.Query("SET autocommit=0;")
|
|
|
|
|
- for _, item := range list1 {
|
|
|
|
|
- var list []supplier.OilSupplierContrast
|
|
|
|
|
- where := " b.SupplierTypeCode='01' and a.Id = " + strconv.Itoa(item.Id)
|
|
|
|
|
- svc.GetPagingTmpCheckedEntities(&list, where)
|
|
|
|
|
- if list != nil {
|
|
|
|
|
- var supplierCertSubList []suppliercertsub.OilSupplierCertSub
|
|
|
|
|
- total := svc.GetTableTotal(" SupplierTypeCode = '01' AND SupplierId = " + strconv.Itoa(item.Id), &supplierCertSubList)
|
|
|
|
|
- total1 := svc.GetNoSubCntTotal("a.SupplierTypeCode = '01' and b.`Name` is null and a.SupplierId = " + strconv.Itoa(item.Id))
|
|
|
|
|
- list[0].SubCnt = int(total)
|
|
|
|
|
- //list[0].MinClassId = "0"
|
|
|
|
|
- list[0].NoSubCnt = int(total1)
|
|
|
|
|
- //for _, sub := range supplierCertSubList {
|
|
|
|
|
- // var goodsList goodsaptitudeclass.OilGoodsAptitudeClass
|
|
|
|
|
- // where2 := "Code = '"+ sub.Code + "'"
|
|
|
|
|
- // svc.GetEntityByWhere(Tmp_OilGoodsAptitudeClassName, where2, &goodsList)
|
|
|
|
|
- // if goodsList.Id > 0{
|
|
|
|
|
- // list[0].MinClassId = strconv.Itoa(goodsList.Id)
|
|
|
|
|
- // } else {
|
|
|
|
|
- // list[0].MinClassId = "0"
|
|
|
|
|
- // break
|
|
|
|
|
- // }
|
|
|
|
|
- //}
|
|
|
|
|
- list[0].SetupTime = time.Now()
|
|
|
|
|
- var oneTwo supplier.OilSupplierContrast
|
|
|
|
|
- svc.GetEntityByCode("SupplierTypeCode = '01' and SupplierId = "+ strconv.Itoa(list[0].Id), &oneTwo)
|
|
|
|
|
- list[0].OneTwoCount = oneTwo.OneTwoCount
|
|
|
|
|
- list[0].TwoOneCount = oneTwo.TwoOneCount
|
|
|
|
|
- svc.InsertEntityBytbl("OilSupplierContrast", list[0])
|
|
|
|
|
- svc.DBE.Query("commit;")
|
|
|
|
|
|
|
+ go func() {
|
|
|
|
|
+ svc := goodsaptitude.GetOilGoodsAptitudeService(utils.DBE)
|
|
|
|
|
+ svc.TruncateTable("OilSupplierContrast")
|
|
|
|
|
+ // 插入对比列表
|
|
|
|
|
+ var list1 []supplier.OilSupplier
|
|
|
|
|
+ svc.GetMyPagingEntitiesWithOrderBytbl(OilSupplierName, 0, 0, "Id", false, &list1, " 1=1")
|
|
|
|
|
+ svc.DBE.Query("SET unique_checks=0;")
|
|
|
|
|
+ svc.DBE.Query("SET autocommit=0;")
|
|
|
|
|
+ for _, item := range list1 {
|
|
|
|
|
+ var list []supplier.OilSupplierContrast
|
|
|
|
|
+ where := " b.SupplierTypeCode='01' and a.Id = " + strconv.Itoa(item.Id)
|
|
|
|
|
+ svc.GetPagingTmpCheckedEntities(&list, where)
|
|
|
|
|
+ if list != nil {
|
|
|
|
|
+ var supplierCertSubList []suppliercertsub.OilSupplierCertSub
|
|
|
|
|
+ total := svc.GetTableTotal(" SupplierTypeCode = '01' AND SupplierId = "+strconv.Itoa(item.Id), &supplierCertSubList)
|
|
|
|
|
+ total1 := svc.GetNoSubCntTotal("a.SupplierTypeCode = '01' and b.`Name` is null and a.SupplierId = " + strconv.Itoa(item.Id))
|
|
|
|
|
+ list[0].SubCnt = int(total)
|
|
|
|
|
+ //list[0].MinClassId = "0"
|
|
|
|
|
+ list[0].NoSubCnt = int(total1)
|
|
|
|
|
+ //for _, sub := range supplierCertSubList {
|
|
|
|
|
+ // var goodsList goodsaptitudeclass.OilGoodsAptitudeClass
|
|
|
|
|
+ // where2 := "Code = '"+ sub.Code + "'"
|
|
|
|
|
+ // svc.GetEntityByWhere(Tmp_OilGoodsAptitudeClassName, where2, &goodsList)
|
|
|
|
|
+ // if goodsList.Id > 0{
|
|
|
|
|
+ // list[0].MinClassId = strconv.Itoa(goodsList.Id)
|
|
|
|
|
+ // } else {
|
|
|
|
|
+ // list[0].MinClassId = "0"
|
|
|
|
|
+ // break
|
|
|
|
|
+ // }
|
|
|
|
|
+ //}
|
|
|
|
|
+ list[0].SetupTime = time.Now()
|
|
|
|
|
+ var oneTwo supplier.OilSupplierContrast
|
|
|
|
|
+ svc.GetEntityByCode("SupplierTypeCode = '01' and SupplierId = "+strconv.Itoa(list[0].Id), &oneTwo)
|
|
|
|
|
+ list[0].OneTwoCount = oneTwo.OneTwoCount
|
|
|
|
|
+ list[0].TwoOneCount = oneTwo.TwoOneCount
|
|
|
|
|
+ svc.InsertEntityBytbl("OilSupplierContrast", list[0])
|
|
|
|
|
+ svc.DBE.Query("commit;")
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
- svc.DBE.Query("SET unique_checks=1;")
|
|
|
|
|
- svc.DBE.Query("SET autocommit=1;")
|
|
|
|
|
|
|
+ svc.DBE.Query("SET unique_checks=1;")
|
|
|
|
|
+ svc.DBE.Query("SET autocommit=1;")
|
|
|
|
|
+ }()
|
|
|
var errorinfo ErrorInfo
|
|
var errorinfo ErrorInfo
|
|
|
errorinfo.Code = 0
|
|
errorinfo.Code = 0
|
|
|
errorinfo.Message = "成功!"
|
|
errorinfo.Message = "成功!"
|