|
|
@@ -3,6 +3,7 @@ package oilsupplier
|
|
|
import (
|
|
|
"dashoo.cn/backend/api/business/oilsupplier/suppliercert"
|
|
|
"dashoo.cn/backend/api/business/oilsupplier/supplierdataentry"
|
|
|
+ "dashoo.cn/backend/api/business/oilsupplier/supplierpausereason"
|
|
|
"dashoo.cn/backend/api/business/oilsupplier/tableheader"
|
|
|
"dashoo.cn/backend/api/business/oilsupplier/technologyserviceclass"
|
|
|
"dashoo.cn/backend/api/business/workflow"
|
|
|
@@ -1126,9 +1127,10 @@ func (this *OilTechnologyServiceController) ImportExcel() {
|
|
|
}()
|
|
|
|
|
|
codemap := make(map[string]int)
|
|
|
+ arrLength := len(sheet.Rows[1].Cells)
|
|
|
for i := 1; i < len(sheet.Rows); i++ {
|
|
|
lineNo := strconv.Itoa(i + 1)
|
|
|
- this.OperationCell(svc, lineNo, columnArr, codemap, sheet.Rows[i].Cells, &errLineNum)
|
|
|
+ this.OperationCell(svc, lineNo, columnArr, codemap, sheet.Rows[i].Cells, &errLineNum, arrLength)
|
|
|
}
|
|
|
os.Remove(filePath)
|
|
|
|
|
|
@@ -1149,7 +1151,7 @@ func (this *OilTechnologyServiceController) ImportExcel() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-func (this *OilTechnologyServiceController) OperationCell(svc *technologyservice.OilTechnologySession, lineNo string, columnArr []string, codemap map[string]int, cellsArr []*xlsx.Cell, errLineNum *string) {
|
|
|
+func (this *OilTechnologyServiceController) OperationCell(svc *technologyservice.OilTechnologySession, lineNo string, columnArr []string, codemap map[string]int, cellsArr []*xlsx.Cell, errLineNum *string, arrLength int) {
|
|
|
|
|
|
defer func() {
|
|
|
if err := recover(); err != nil {
|
|
|
@@ -1159,20 +1161,24 @@ func (this *OilTechnologyServiceController) OperationCell(svc *technologyservice
|
|
|
}()
|
|
|
parentId := 0
|
|
|
classId := 0
|
|
|
- cellsArrLen := len(cellsArr)
|
|
|
+ //cellsArrLen := len(cellsArr)
|
|
|
+ cellsArrLen := arrLength
|
|
|
var valstr = ""
|
|
|
|
|
|
- for i := 2; i < cellsArrLen; {
|
|
|
- if i < 10 {
|
|
|
+ for i := 0; i < cellsArrLen; {
|
|
|
+ if i < 8 {
|
|
|
var entity technologyserviceclass.Tmp_OilTechnologyServiceClass
|
|
|
cellval := strings.TrimSpace(cellsArr[i].String())
|
|
|
fmt.Println(cellval)
|
|
|
if cellval != "" {
|
|
|
_, has := codemap[cellval]
|
|
|
if !has {
|
|
|
- if i != 2 {
|
|
|
+ if i > 2 {
|
|
|
upcode := cellsArr[i-2].String()
|
|
|
parentId = codemap[upcode]
|
|
|
+ } else {
|
|
|
+ upcode := cellsArr[0].String()
|
|
|
+ parentId = codemap[upcode]
|
|
|
}
|
|
|
entity.Code = cellval
|
|
|
entity.Name = strings.TrimSpace(cellsArr[i+1].String())
|
|
|
@@ -1193,8 +1199,8 @@ func (this *OilTechnologyServiceController) OperationCell(svc *technologyservice
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- if i >= 10 {
|
|
|
- valstr += "'" + cellsArr[i].String() + "',"
|
|
|
+ if i >= 8 {
|
|
|
+ valstr += "'" + strings.TrimLeft(cellsArr[i].String(), " ") + "',"
|
|
|
i++
|
|
|
} else {
|
|
|
i += 2
|
|
|
@@ -1204,12 +1210,15 @@ func (this *OilTechnologyServiceController) OperationCell(svc *technologyservice
|
|
|
valstr = strings.Replace(valstr, "是", "1", -1)
|
|
|
log.Println(cellsArr[0].String() + "==" + valstr)
|
|
|
var columnstr = ""
|
|
|
- for l := 0; l < cellsArrLen-9; l++ {
|
|
|
+ for l := 0; l < cellsArrLen-7; l++ {
|
|
|
columnstr += columnArr[l] + ","
|
|
|
}
|
|
|
columnstr = strings.Trim(columnstr, ",")
|
|
|
valstr = strconv.Itoa(classId) + "," + valstr
|
|
|
- err := svc.InsertTmpTechnology(columnstr, valstr)
|
|
|
+ var err error
|
|
|
+ if classId > 0 {
|
|
|
+ err = svc.InsertTmpTechnology(columnstr, valstr)
|
|
|
+ }
|
|
|
if err != nil {
|
|
|
panic(err)
|
|
|
}
|
|
|
@@ -1660,3 +1669,555 @@ func (this *OilTechnologyServiceController) TruncateImport() {
|
|
|
|
|
|
}
|
|
|
|
|
|
+// @Title 导出到execl
|
|
|
+// @Description 导出到execl
|
|
|
+// @Success 200 {object} controllers.Request
|
|
|
+// @router /exportexecl [post]
|
|
|
+func (this *OilTechnologyServiceController) ExeclExport() {
|
|
|
+ // 填物资类信息表首页信息
|
|
|
+ svcActiviti := workflow.GetActivitiService(utils.DBE)
|
|
|
+ svc := technologyservice.GetOilTechnologyServiceService(utils.DBE)
|
|
|
+ var list2 []supplier.OilSupplierContrast
|
|
|
+ where := " 1=1"
|
|
|
+ svc.GetMyPagingEntitiesWithOrderBytbl("OilSupplierTecContrast", 0,0, "Id", false, &list2, where)
|
|
|
+
|
|
|
+ fileName := "资质导入对比表.xlsx"
|
|
|
+ Url := utils.Cfg.MustValue("workflow", "ContrastExcel")
|
|
|
+
|
|
|
+ var datamap = make(map[string]interface{})
|
|
|
+ datamap["data"] = list2
|
|
|
+ retDocUrl := svcActiviti.ContrastExcel(datamap, Url, fileName)
|
|
|
+ var datainfo ErrorDataInfo
|
|
|
+ datainfo.Code = 0
|
|
|
+ datainfo.Item = retDocUrl
|
|
|
+ datainfo.Message = "打印成功"
|
|
|
+ this.Data["json"] = &datainfo
|
|
|
+ this.ServeJSON()
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+// @Title 新导入资质后,比对不合格的准入用户
|
|
|
+// @Description 对比列表
|
|
|
+// @Success 200 {object} []supplier.OilSupplierSelect
|
|
|
+// @router /get-compare-tmp-supplier [get]
|
|
|
+func (this *OilTechnologyServiceController) GetCompareTmpSupplier() {
|
|
|
+ //获取分页信息
|
|
|
+ page := this.GetPageInfoForm()
|
|
|
+ where := " 1=1 "
|
|
|
+ orderby := "Id"
|
|
|
+ asc := false
|
|
|
+ Order := this.GetString("Order")
|
|
|
+ Prop := this.GetString("Prop")
|
|
|
+ if Order != "" && Prop != "" {
|
|
|
+ orderby = Prop
|
|
|
+ if Order == "asc" {
|
|
|
+ asc = true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Id := this.GetString("Id")
|
|
|
+ SupplierId := this.GetString("SupplierId")
|
|
|
+ SupplierCertId := this.GetString("SupplierCertId")
|
|
|
+ SupplierTypeCode := this.GetString("SupplierTypeCode")
|
|
|
+ Code := this.GetString("Code")
|
|
|
+ Name := this.GetString("Name")
|
|
|
+ Remark := this.GetString("Remark")
|
|
|
+ IsDelete := this.GetString("IsDelete")
|
|
|
+ CreateOn := this.GetString("CreateOn")
|
|
|
+ CreateUserId := this.GetString("CreateUserId")
|
|
|
+ CreateBy := this.GetString("CreateBy")
|
|
|
+ ModifiedOn := this.GetString("ModifiedOn")
|
|
|
+ ModifiedUserId := this.GetString("ModifiedUserId")
|
|
|
+ ModifiedBy := this.GetString("ModifiedBy")
|
|
|
+
|
|
|
+ if Id != "" {
|
|
|
+ where = where + " and Id like '%" + Id + "%'"
|
|
|
+ }
|
|
|
+
|
|
|
+ if SupplierId != "" {
|
|
|
+ where = where + " and SupplierId like '%" + SupplierId + "%'"
|
|
|
+ }
|
|
|
+
|
|
|
+ if SupplierCertId != "" {
|
|
|
+ where = where + " and SupplierCertId = '" + SupplierCertId + "'"
|
|
|
+ }
|
|
|
+
|
|
|
+ if SupplierTypeCode != "" {
|
|
|
+ where = where + " and SupplierTypeCode = '" + SupplierTypeCode + "'"
|
|
|
+ }
|
|
|
+
|
|
|
+ if Code != "" {
|
|
|
+ where = where + " and Code like '%" + Code + "%'"
|
|
|
+ }
|
|
|
+
|
|
|
+ if Name != "" {
|
|
|
+ where = where + " and Name like '%" + Name + "%'"
|
|
|
+ }
|
|
|
+
|
|
|
+ if Remark != "" {
|
|
|
+ where = where + " and Remark like '%" + Remark + "%'"
|
|
|
+ }
|
|
|
+
|
|
|
+ if IsDelete != "" {
|
|
|
+ where = where + " and IsDelete like '%" + IsDelete + "%'"
|
|
|
+ }
|
|
|
+
|
|
|
+ if CreateUserId != "" {
|
|
|
+ where = where + " and CreateUserId like '%" + CreateUserId + "%'"
|
|
|
+ }
|
|
|
+
|
|
|
+ if CreateBy != "" {
|
|
|
+ where = where + " and CreateBy like '%" + CreateBy + "%'"
|
|
|
+ }
|
|
|
+
|
|
|
+ if ModifiedOn != "" {
|
|
|
+ where = where + " and ModifiedOn like '%" + ModifiedOn + "%'"
|
|
|
+ }
|
|
|
+
|
|
|
+ if ModifiedUserId != "" {
|
|
|
+ where = where + " and ModifiedUserId like '%" + ModifiedUserId + "%'"
|
|
|
+ }
|
|
|
+
|
|
|
+ if ModifiedBy != "" {
|
|
|
+ where = where + " and ModifiedBy like '%" + ModifiedBy + "%'"
|
|
|
+ }
|
|
|
+
|
|
|
+ if CreateOn != "" {
|
|
|
+ dates := strings.Split(CreateOn, ",")
|
|
|
+ if len(dates) == 2 {
|
|
|
+ minDate := dates[0]
|
|
|
+ maxDate := dates[1]
|
|
|
+ where = where + " and CreateOn>='" + minDate + "' and CreateOn<='" + maxDate + "'"
|
|
|
+ }
|
|
|
+ }
|
|
|
+ svc := technologyservice.GetOilTechnologyServiceService(utils.DBE)
|
|
|
+ var list2 []supplier.OilSupplierContrast
|
|
|
+
|
|
|
+ total := svc.GetMyPagingEntitiesWithOrderBytbl("OilSupplierTecContrast", page.CurrentPage, page.Size, orderby, asc, &list2, where)
|
|
|
+ var datainfo DataInfo
|
|
|
+ datainfo.Items = list2
|
|
|
+ datainfo.CurrentItemCount = total
|
|
|
+ datainfo.PageIndex = page.CurrentPage
|
|
|
+ datainfo.ItemsPerPage = page.Size
|
|
|
+ this.Data["json"] = &datainfo
|
|
|
+ this.ServeJSON()
|
|
|
+}
|
|
|
+
|
|
|
+// @Title 获取列表
|
|
|
+// @Description get user by token
|
|
|
+// @Success 200 {object} []goodsaptitude.OilGoodsAptitude
|
|
|
+// @router /comparelist [get]
|
|
|
+func (this *OilTechnologyServiceController) GetCompareList() {
|
|
|
+
|
|
|
+ //获取分页信息
|
|
|
+ page := this.GetPageInfoForm()
|
|
|
+ where := " 1=1 "
|
|
|
+ orderby := "Code"
|
|
|
+ asc := true
|
|
|
+ Order := this.GetString("Order")
|
|
|
+ Prop := this.GetString("Prop")
|
|
|
+ Conditions := this.GetString("Conditions")
|
|
|
+ if Conditions == "1" {
|
|
|
+ // 匹配上
|
|
|
+ where += " and b.Name = tmpb.Name"
|
|
|
+ } else if Conditions == "4" {
|
|
|
+ // 旧表有新表没
|
|
|
+ where += " and tmpb.Name is null"
|
|
|
+ } else if Conditions == "5" {
|
|
|
+ // 新表有,旧表没
|
|
|
+ where += " and tmpb.Name is null"
|
|
|
+ } else if Conditions == "6" {
|
|
|
+ // 资质+级别匹配
|
|
|
+ where += " and b.Name = tmpb.Name and (a.F01 = tmpa.F01 or (tmpa.F01 = '' && a.F01 is null)) and (a.F02 = tmpa.F02 or (tmpa.F02 = '' && a.F02 is null)) and (a.F03 = tmpa.F03 or (tmpa.F03 = '' && a.F03 is null)) and (a.F04 = tmpa.F04 or (tmpa.F04 = '' && a.F04 is null)) and (a.F05 = tmpa.F05 or (tmpa.F05 = '' && a.F05 is null)) and (a.F06 = tmpa.F06 or (tmpa.F06 = '' && a.F06 is null)) and (a.F07 = tmpa.F07 or (tmpa.F07 = '' && a.F07 is null)) and (a.F08 = tmpa.F08 or (tmpa.F08 = '' && a.F08 is null)) and (a.F09 = tmpa.F09 or (tmpa.F09 = '' && a.F09 is null)) and (a.F10 = tmpa.F10 or (tmpa.F10 = '' && a.F10 is null))" +
|
|
|
+ " and (a.F11 = tmpa.F11 or (tmpa.F11 = '' && a.F11 is null)) and (a.F12 = tmpa.F12 or (tmpa.F12 = '' && a.F12 is null)) and (a.F13 = tmpa.F13 or (tmpa.F13 = '' && a.F13 is null)) and (a.F14 = tmpa.F14 or (tmpa.F14 = '' && a.F14 is null)) and (a.F15 = tmpa.F15 or (tmpa.F15 = '' && a.F15 is null)) and (a.F16 = tmpa.F16 or (tmpa.F16 = '' && a.F16 is null)) and (a.F17 = tmpa.F17 or (tmpa.F17 = '' && a.F17 is null)) and (a.F18 = tmpa.F18 or (tmpa.F18 = '' && a.F18 is null)) and (a.F19 = tmpa.F19 or (tmpa.F19 = '' && a.F19 is null)) and (a.F20 = tmpa.F20 or (tmpa.F20 = '' && a.F20 is null))" +
|
|
|
+ " and (a.F21 = tmpa.F21 or (tmpa.F21 = '' && a.F21 is null)) and (a.F22 = tmpa.F22 or (tmpa.F22 = '' && a.F22 is null)) and (a.F23 = tmpa.F23 or (tmpa.F23 = '' && a.F23 is null)) and (a.F24 = tmpa.F24 or (tmpa.F24 = '' && a.F24 is null)) and (a.F25 = tmpa.F25 or (tmpa.F25 = '' && a.F25 is null)) and (a.F26 = tmpa.F26 or (tmpa.F26 = '' && a.F26 is null)) and (a.F27 = tmpa.F27 or (tmpa.F27 = '' && a.F27 is null)) and (a.F28 = tmpa.F28 or (tmpa.F28 = '' && a.F28 is null)) and (a.F29 = tmpa.F29 or (tmpa.F29 = '' && a.F29 is null)) and (a.F30 = tmpa.F30 or (tmpa.F30 = '' && a.F30 is null))" +
|
|
|
+ " and (a.F31 = tmpa.F31 or (tmpa.F31 = '' && a.F31 is null)) and (a.F32 = tmpa.F32 or (tmpa.F32 = '' && a.F32 is null)) and (a.F33 = tmpa.F33 or (tmpa.F33 = '' && a.F33 is null)) and (a.F34 = tmpa.F34 or (tmpa.F34 = '' && a.F34 is null)) and (a.F35 = tmpa.F35 or (tmpa.F35 = '' && a.F35 is null)) and (a.F36 = tmpa.F36 or (tmpa.F36 = '' && a.F36 is null)) and (a.F37 = tmpa.F37 or (tmpa.F37 = '' && a.F37 is null)) and (a.F38 = tmpa.F38 or (tmpa.F38 = '' && a.F38 is null)) and (a.F39 = tmpa.F39 or (tmpa.F39 = '' && a.F39 is null)) and (a.F40 = tmpa.F40 or (tmpa.F40 = '' && a.F40 is null))" +
|
|
|
+ " and (a.F41 = tmpa.F41 or (tmpa.F41 = '' && a.F41 is null)) and (a.F42 = tmpa.F42 or (tmpa.F42 = '' && a.F42 is null)) and (a.F43 = tmpa.F43 or (tmpa.F43 = '' && a.F43 is null)) and (a.F44 = tmpa.F44 or (tmpa.F44 = '' && a.F44 is null)) and (a.F45 = tmpa.F45 or (tmpa.F45 = '' && a.F45 is null)) and (a.F46 = tmpa.F46 or (tmpa.F46 = '' && a.F46 is null)) and (a.F47 = tmpa.F47 or (tmpa.F47 = '' && a.F47 is null)) and (a.F48 = tmpa.F48 or (tmpa.F48 = '' && a.F48 is null)) and (a.F49 = tmpa.F49 or (tmpa.F49 = '' && a.F49 is null)) and (a.F50 = tmpa.F50 or (tmpa.F50 = '' && a.F50 is null))" +
|
|
|
+ " and (a.F51 = tmpa.F51 or (tmpa.F51 = '' && a.F51 is null)) and (a.F52 = tmpa.F52 or (tmpa.F52 = '' && a.F52 is null))"
|
|
|
+ }
|
|
|
+ if Order != "" && Prop != "" {
|
|
|
+ orderby = Prop
|
|
|
+ if Order == "asc" {
|
|
|
+ asc = true
|
|
|
+ } else {
|
|
|
+ asc = false
|
|
|
+ }
|
|
|
+ }
|
|
|
+ CreateOn := this.GetString("CreateOn")
|
|
|
+ Code := this.GetString("Code")
|
|
|
+ Name := this.GetString("Name")
|
|
|
+ BigClassName := this.GetString("BigClassName")
|
|
|
+ BigClassCode := this.GetString("BigClassCode")
|
|
|
+ MiddleClassName := this.GetString("MiddleClassName")
|
|
|
+ SmallClassName := this.GetString("SmallClassName")
|
|
|
+ GoodsName := this.GetString("GoodsName")
|
|
|
+ GoodsLevel := this.GetString("GoodsLevel")
|
|
|
+ GoodsDesc := this.GetString("GoodsDesc")
|
|
|
+ Standard := this.GetString("Standard")
|
|
|
+ CompanyType := this.GetString("CompanyType")
|
|
|
+
|
|
|
+ if Code != "" {
|
|
|
+ where = where + " and b.Code like '%" + Code + "%'"
|
|
|
+ }
|
|
|
+
|
|
|
+ if Name != "" {
|
|
|
+ where = where + " and b.Name like '%" + Name + "%'"
|
|
|
+ }
|
|
|
+
|
|
|
+ if BigClassName != "" {
|
|
|
+ where = where + " and Name1 like '%" + BigClassName + "%'"
|
|
|
+ }
|
|
|
+
|
|
|
+ if BigClassCode != "" {
|
|
|
+ where = where + " and Code1 like '%" + BigClassCode + "%'"
|
|
|
+ }
|
|
|
+
|
|
|
+ if MiddleClassName != "" {
|
|
|
+ where = where + " and Name2 like '%" + MiddleClassName + "%'"
|
|
|
+ }
|
|
|
+
|
|
|
+ if SmallClassName != "" {
|
|
|
+ where = where + " and Name3 like '%" + SmallClassName + "%'"
|
|
|
+ }
|
|
|
+
|
|
|
+ if GoodsName != "" {
|
|
|
+ where = where + " and Name4 like '%" + GoodsName + "%'"
|
|
|
+ }
|
|
|
+
|
|
|
+ if GoodsLevel != "" {
|
|
|
+ where = where + " and GoodsLevel like '%" + GoodsLevel + "%'"
|
|
|
+ }
|
|
|
+
|
|
|
+ if GoodsDesc != "" {
|
|
|
+ where = where + " and GoodsDesc like '%" + GoodsDesc + "%'"
|
|
|
+ }
|
|
|
+
|
|
|
+ if Standard != "" {
|
|
|
+ where = where + " and Standard '%" + Standard + "%'"
|
|
|
+ }
|
|
|
+
|
|
|
+ if CompanyType != "" {
|
|
|
+ where = where + " and CompanyType '%" + CompanyType + "%'"
|
|
|
+ }
|
|
|
+
|
|
|
+ if CreateOn != "" {
|
|
|
+ dates := strings.Split(CreateOn, ",")
|
|
|
+ if len(dates) == 2 {
|
|
|
+ minDate := dates[0]
|
|
|
+ maxDate := dates[1]
|
|
|
+ where = where + " and CreateOn>='" + minDate + "' and CreateOn<='" + maxDate + "'"
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ svc := technologyservice.GetOilTechnologyServiceService(utils.DBE)
|
|
|
+ var list []technologyservice.OilTechnologyServiceTmp
|
|
|
+ total := svc.GetPClassEntities(page.CurrentPage, page.Size, orderby, asc, &list, where, Conditions)
|
|
|
+ var datainfo DataInfo
|
|
|
+ datainfo.Items = list
|
|
|
+ datainfo.CurrentItemCount = total
|
|
|
+ datainfo.PageIndex = page.CurrentPage
|
|
|
+ datainfo.ItemsPerPage = page.Size
|
|
|
+ this.Data["json"] = &datainfo
|
|
|
+ this.ServeJSON()
|
|
|
+}
|
|
|
+
|
|
|
+// @Title get 生成对比列表
|
|
|
+// @Description get SampleType by token
|
|
|
+// @Success 200 {object} sampletype.SampleType
|
|
|
+// @router /create-contrast [get]
|
|
|
+func (this *OilTechnologyServiceController) CreateContrast() {
|
|
|
+ svc := technologyservice.GetOilTechnologyServiceService(utils.DBE)
|
|
|
+ svc.TruncateTable("OilSupplierTecContrast")
|
|
|
+ // 插入对比列表
|
|
|
+ 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='03' and a.Id = " + strconv.Itoa(item.Id)
|
|
|
+ svc.GetPagingTmpCheckedEntities(&list, where)
|
|
|
+ if list != nil {
|
|
|
+ var supplierCertSubList []suppliercertsub.OilSupplierCertSub
|
|
|
+ total := svc.GetTableTotal(" SupplierTypeCode='03' AND SupplierId = " + strconv.Itoa(item.Id), &supplierCertSubList)
|
|
|
+ total1 := svc.GetNoSubCntTotal("a.SupplierTypeCode = '03' and c.ClassId 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 technologyClassList technologyserviceclass.OilTechnologyServiceClass
|
|
|
+ where2 := "Name = '"+ sub.Name + "'"
|
|
|
+ svc.GetEntityByWhere(Tmp_TechnologyClassName, where2, &technologyClassList)
|
|
|
+ if technologyClassList.Id > 0{
|
|
|
+ list[0].MinClassId = strconv.Itoa(technologyClassList.Id)
|
|
|
+ } else {
|
|
|
+ list[0].MinClassId = "0"
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+ list[0].SetupTime = time.Now()
|
|
|
+ svc.InsertEntityBytbl("OilSupplierTecContrast", list[0])
|
|
|
+ svc.DBE.Query("commit;")
|
|
|
+ }
|
|
|
+ }
|
|
|
+ svc.DBE.Query("SET unique_checks=1;")
|
|
|
+ svc.DBE.Query("SET autocommit=1;")
|
|
|
+ var errorinfo ErrorInfo
|
|
|
+ errorinfo.Code = 0
|
|
|
+ errorinfo.Message = "成功!"
|
|
|
+ this.Data["json"] = &errorinfo
|
|
|
+ this.ServeJSON()
|
|
|
+}
|
|
|
+
|
|
|
+// @Title 查看对比列表的准入范围 2020-12-18
|
|
|
+// @Description get user by token
|
|
|
+// @Success 200 {object} []suppliercertsub.OilSupplierCertSub
|
|
|
+// @router /delcertsublist [get]
|
|
|
+func (this *OilTechnologyServiceController) GetDelCertSubList() {
|
|
|
+ //获取分页信息
|
|
|
+ page := this.GetPageInfoForm()
|
|
|
+ where := " 1=1 "
|
|
|
+ orderby := "a.Id"
|
|
|
+ asc := false
|
|
|
+ Order := this.GetString("Order")
|
|
|
+ Prop := this.GetString("Prop")
|
|
|
+ if Order != "" && Prop != "" {
|
|
|
+ orderby = Prop
|
|
|
+ if Order == "asc" {
|
|
|
+ asc = true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Id := this.GetString("Id")
|
|
|
+ SupplierId := this.GetString("SupplierId")
|
|
|
+ SupplierCertId := this.GetString("SupplierCertId")
|
|
|
+ SupplierTypeCode := this.GetString("SupplierTypeCode")
|
|
|
+ Code := this.GetString("Code")
|
|
|
+ Name := this.GetString("Name")
|
|
|
+ Remark := this.GetString("Remark")
|
|
|
+ IsDelete := this.GetString("IsDelete")
|
|
|
+ CreateOn := this.GetString("CreateOn")
|
|
|
+ CreateUserId := this.GetString("CreateUserId")
|
|
|
+ CreateBy := this.GetString("CreateBy")
|
|
|
+ ModifiedOn := this.GetString("ModifiedOn")
|
|
|
+ ModifiedUserId := this.GetString("ModifiedUserId")
|
|
|
+ ModifiedBy := this.GetString("ModifiedBy")
|
|
|
+
|
|
|
+ if Id != "" {
|
|
|
+ where = where + " and a.Id like '%" + Id + "%'"
|
|
|
+ }
|
|
|
+
|
|
|
+ if SupplierId != "" {
|
|
|
+ where = where + " and a.SupplierId like '%" + SupplierId + "%'"
|
|
|
+ }
|
|
|
+
|
|
|
+ if SupplierCertId != "" {
|
|
|
+ where = where + " and a.SupplierCertId = '" + SupplierCertId + "'"
|
|
|
+ }
|
|
|
+
|
|
|
+ if SupplierTypeCode != "" {
|
|
|
+ where = where + " and a.SupplierTypeCode = '" + SupplierTypeCode + "'"
|
|
|
+ }
|
|
|
+
|
|
|
+ if Code != "" {
|
|
|
+ where = where + " and a.Code like '%" + Code + "%'"
|
|
|
+ }
|
|
|
+
|
|
|
+ if Name != "" {
|
|
|
+ where = where + " and a.Name like '%" + Name + "%'"
|
|
|
+ }
|
|
|
+
|
|
|
+ if Remark != "" {
|
|
|
+ where = where + " and a.Remark like '%" + Remark + "%'"
|
|
|
+ }
|
|
|
+
|
|
|
+ if IsDelete != "" {
|
|
|
+ where = where + " and a.IsDelete like '%" + IsDelete + "%'"
|
|
|
+ }
|
|
|
+
|
|
|
+ if CreateUserId != "" {
|
|
|
+ where = where + " and a.CreateUserId like '%" + CreateUserId + "%'"
|
|
|
+ }
|
|
|
+
|
|
|
+ if CreateBy != "" {
|
|
|
+ where = where + " and a.CreateBy like '%" + CreateBy + "%'"
|
|
|
+ }
|
|
|
+
|
|
|
+ if ModifiedOn != "" {
|
|
|
+ where = where + " and a.ModifiedOn like '%" + ModifiedOn + "%'"
|
|
|
+ }
|
|
|
+
|
|
|
+ if ModifiedUserId != "" {
|
|
|
+ where = where + " and a.ModifiedUserId like '%" + ModifiedUserId + "%'"
|
|
|
+ }
|
|
|
+
|
|
|
+ if ModifiedBy != "" {
|
|
|
+ where = where + " and a.ModifiedBy like '%" + ModifiedBy + "%'"
|
|
|
+ }
|
|
|
+
|
|
|
+ if CreateOn != "" {
|
|
|
+ dates := strings.Split(CreateOn, ",")
|
|
|
+ if len(dates) == 2 {
|
|
|
+ minDate := dates[0]
|
|
|
+ maxDate := dates[1]
|
|
|
+ where = where + " and a.CreateOn>='" + minDate + "' and a.CreateOn<='" + maxDate + "'"
|
|
|
+ }
|
|
|
+ }
|
|
|
+ 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 {
|
|
|
+ sql := "SELECT CONCAT_WS(',',IF(ifnull(F01, '') = '', '', F01),IF(ifnull(F02, '') = '', '', F02),IF(ifnull(F03, '') = '', '', F03),IF(ifnull(F04, '') = '', '', F04),IF(ifnull(F05, '') = '', '', F05),IF(ifnull(F06, '') = '', '', F06),IF(ifnull(F07, '') = '', '', F07),IF(ifnull(F08, '') = '', '', F08),IF(ifnull(F09, '') = '', '', F09),IF(ifnull(F10, '') = '', '', F10),IF(ifnull(F11, '') = '', '', F11),IF(ifnull(F12, '') = '', '', F12),IF(ifnull(F13, '') = '', '', F13),IF(ifnull(F14, '') = '', '', F14),IF(ifnull(F15, '') = '', '', F15),IF(ifnull(F16, '') = '', '', F16),IF(ifnull(F17, '') = '', '', F17),IF(ifnull(F18, '') = '', '', F18),IF(ifnull(F19, '') = '', '', F19),IF(ifnull(F20, '') = '', '', F20),IF(ifnull(F21, '') = '', '', F21),IF(ifnull(F22, '') = '', '', F22),IF(ifnull(F23, '') = '', '', F23),IF(ifnull(F24, '') = '', '', F24),IF(ifnull(F25, '') = '', '', F25),IF(ifnull(F26, '') = '', '', F26),IF(ifnull(F27, '') = '', '', F27),IF(ifnull(F28, '') = '', '', F28),IF(ifnull(F29, '') = '', '', F29),IF(ifnull(F30, '') = '', '', F30),IF(ifnull(F31, '') = '', '', F31),IF(ifnull(F32, '') = '', '', F32),IF(ifnull(F33, '') = '', '', F33),IF(ifnull(F34, '') = '', '', F34),IF(ifnull(F35, '') = '', '', F35),IF(ifnull(F36, '') = '', '', F36),IF(ifnull(F37, '') = '', '', F37),IF(ifnull(F38, '') = '', '', F38),IF(ifnull(F39, '') = '', '', F39),IF(ifnull(F40, '') = '', '', F40),IF(ifnull(F41, '') = '', '', F41),IF(ifnull(F42, '') = '', '', F42),IF(ifnull(F43, '') = '', '', F43),IF(ifnull(F44, '') = '', '', F44),IF(ifnull(F45, '') = '', '', F45),IF(ifnull(F46, '') = '', '', F46),IF(ifnull(F47, '') = '', '', F47),IF(ifnull(F48, '') = '', '', F48),IF(ifnull(F49, '') = '', '', F49),IF(ifnull(F50, '') = '', '', F50),IF(ifnull(F51, '') = '', '', F51),IF(ifnull(F52, '') = '', '', F52)) AS Codes FROM Tmp_OilTechnologyService a LEFT JOIN Tmp_OilTechnologyServiceClass class ON a.ClassId = class.Id"
|
|
|
+ sql += " where class.Name = '"+ item.Name + "'"
|
|
|
+ model, _ := svc.DBE.QueryString(sql)
|
|
|
+ if model != nil {
|
|
|
+ code := strings.Split(model[0]["Codes"], ",")
|
|
|
+ i := 1
|
|
|
+ for _, value := range code {
|
|
|
+ if i == 41 || i == 42 || i == 1 {
|
|
|
+ if (code[0] == "1" && strings.Index(item.HeaderCodes, "F01") < 0) && (code[40] == "1" && strings.Index(item.HeaderCodes, "F41") < 0) && (code[41] == "1" && strings.Index(item.HeaderCodes, "F42") < 0) {
|
|
|
+ list[a].Checked = 1
|
|
|
+ sql1 := "select Name from Base_TableHeader where Code = 'F01' and CategoryCode = '03'"
|
|
|
+ model1, _ := svc.DBE.QueryString(sql1)
|
|
|
+ if strings.Index(list[a].HeaderName, model1[0]["Name"]) == -1 {
|
|
|
+ list[a].HeaderName += model1[0]["Name"] + " "
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if i > 10 {
|
|
|
+ if value == "1" && strings.Index(item.HeaderCodes, "F"+strconv.Itoa(i)) < 0 {
|
|
|
+ list[a].Checked = 1
|
|
|
+ sql1 := "select Name from Base_TableHeader where Code = 'F"+strconv.Itoa(i)+"' and CategoryCode = '03'"
|
|
|
+ model1, _ := svc.DBE.QueryString(sql1)
|
|
|
+ list[a].HeaderName += model1[0]["Name"]+ " "
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if value == "1" && strings.Index(item.HeaderCodes, "F0"+strconv.Itoa(i)) < 0 {
|
|
|
+ list[a].Checked = 1
|
|
|
+ sql1 := "select Name from Base_TableHeader where Code = 'F0"+strconv.Itoa(i)+"' and CategoryCode = '03'"
|
|
|
+ model1, _ := svc.DBE.QueryString(sql1)
|
|
|
+ list[a].HeaderName += model1[0]["Name"]+ " "
|
|
|
+ }
|
|
|
+ }
|
|
|
+ i += 1
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ list[a].MinClassId = "0"
|
|
|
+ }
|
|
|
+ a += 1
|
|
|
+ }
|
|
|
+ var datainfo DataInfo
|
|
|
+ datainfo.Items = list
|
|
|
+ datainfo.CurrentItemCount = total
|
|
|
+ datainfo.PageIndex = page.CurrentPage
|
|
|
+ datainfo.ItemsPerPage = page.Size
|
|
|
+ this.Data["json"] = &datainfo
|
|
|
+ this.ServeJSON()
|
|
|
+}
|
|
|
+
|
|
|
+// @Title 确认更新后的删除/暂停企业准入范围 2020-12-18
|
|
|
+// @Description 修改实体
|
|
|
+// @Success 200 {object} controllers.Request
|
|
|
+// @router /delete-suspend [post]
|
|
|
+func (this *OilTechnologyServiceController) DeleteSuspend() {
|
|
|
+ var errinfo ErrorInfo
|
|
|
+ var err error
|
|
|
+ var list []supplier.OilSupplierContrast
|
|
|
+ svc := goodsaptitude.GetOilGoodsAptitudeService(utils.DBE)
|
|
|
+ //svc.GetEntitysByWhere("OilSupplierContrast", "TwoOneCount = 0", &list)
|
|
|
+ svc.GetEntitysByWhere("OilSupplierTecContrast", "1=1", &list)
|
|
|
+ for _,item := range list{
|
|
|
+ var sub []suppliercertsub.OilSupplierCertSub
|
|
|
+ svc.GetEntitysByWhere("OilSupplierCertSub", "SupplierTypeCode = '03' and SupplierId = " + strconv.Itoa(item.Id), &sub)
|
|
|
+ for _, itemSub := range sub {
|
|
|
+ sql := "SELECT CONCAT_WS(',',IF(ifnull(F01, '') = '', '', F01),IF(ifnull(F02, '') = '', '', F02),IF(ifnull(F03, '') = '', '', F03),IF(ifnull(F04, '') = '', '', F04),IF(ifnull(F05, '') = '', '', F05),IF(ifnull(F06, '') = '', '', F06),IF(ifnull(F07, '') = '', '', F07),IF(ifnull(F08, '') = '', '', F08),IF(ifnull(F09, '') = '', '', F09),IF(ifnull(F10, '') = '', '', F10),IF(ifnull(F11, '') = '', '', F11),IF(ifnull(F12, '') = '', '', F12),IF(ifnull(F13, '') = '', '', F13),IF(ifnull(F14, '') = '', '', F14),IF(ifnull(F15, '') = '', '', F15),IF(ifnull(F16, '') = '', '', F16),IF(ifnull(F17, '') = '', '', F17),IF(ifnull(F18, '') = '', '', F18),IF(ifnull(F19, '') = '', '', F19),IF(ifnull(F20, '') = '', '', F20),IF(ifnull(F21, '') = '', '', F21),IF(ifnull(F22, '') = '', '', F22),IF(ifnull(F23, '') = '', '', F23),IF(ifnull(F24, '') = '', '', F24),IF(ifnull(F25, '') = '', '', F25),IF(ifnull(F26, '') = '', '', F26),IF(ifnull(F27, '') = '', '', F27),IF(ifnull(F28, '') = '', '', F28),IF(ifnull(F29, '') = '', '', F29),IF(ifnull(F30, '') = '', '', F30),IF(ifnull(F31, '') = '', '', F31),IF(ifnull(F32, '') = '', '', F32),IF(ifnull(F33, '') = '', '', F33),IF(ifnull(F34, '') = '', '', F34),IF(ifnull(F35, '') = '', '', F35),IF(ifnull(F36, '') = '', '', F36),IF(ifnull(F37, '') = '', '', F37),IF(ifnull(F38, '') = '', '', F38),IF(ifnull(F39, '') = '', '', F39),IF(ifnull(F40, '') = '', '', F40),IF(ifnull(F41, '') = '', '', F41),IF(ifnull(F42, '') = '', '', F42),IF(ifnull(F43, '') = '', '', F43),IF(ifnull(F44, '') = '', '', F44),IF(ifnull(F45, '') = '', '', F45),IF(ifnull(F46, '') = '', '', F46),IF(ifnull(F47, '') = '', '', F47),IF(ifnull(F48, '') = '', '', F48),IF(ifnull(F49, '') = '', '', F49),IF(ifnull(F50, '') = '', '', F50),IF(ifnull(F51, '') = '', '', F51),IF(ifnull(F52, '') = '', '', F52)) AS Codes,Code FROM Tmp_OilTechnologyService a LEFT JOIN Tmp_OilTechnologyServiceClass class ON a.ClassId = class.Id"
|
|
|
+ sql += " where class.Name = '"+ itemSub.Name + "'"
|
|
|
+ model, _ := svc.DBE.QueryString(sql)
|
|
|
+ var subDelete suppliercertsub.OilSupplierCertSub
|
|
|
+ if model != nil {
|
|
|
+ code := strings.Split(model[0]["Codes"], ",")
|
|
|
+ cols := []string{"Code"}
|
|
|
+ subDelete.Code = model[0]["Code"]
|
|
|
+
|
|
|
+ // 修改
|
|
|
+ err = svc.UpdateEntityBywheretbl(OilSupplierCertSubName, &subDelete, cols, "Id = "+strconv.Itoa(itemSub.Id))
|
|
|
+ cols = append(cols, "DueTime")
|
|
|
+ cols = append(cols, "CertSubStatus")
|
|
|
+ subDelete.CertSubStatus = "2"
|
|
|
+ //subDelete.DueTime = "2021-06-06 00:00:00"
|
|
|
+ paramSvc := baseparameter.GetBaseparameterService(utils.DBE)
|
|
|
+ subDelete.DueTime = paramSvc.GetBaseparameterMessage("GFZT", "paramset", "Suspend")
|
|
|
+ i := 1
|
|
|
+ //暂停
|
|
|
+ for _, value := range code {
|
|
|
+ if i == 41 || i == 42 || i == 1 {
|
|
|
+ if (code[0] == "1" && strings.Index(item.HeaderCodes, "F01") < 0) && (code[40] == "1" && strings.Index(item.HeaderCodes, "F41") < 0) && (code[41] == "1" && strings.Index(item.HeaderCodes, "F42") < 0) {
|
|
|
+ err = svc.UpdateEntityBywheretbl(OilSupplierCertSubName, &subDelete, cols, "Id = " + strconv.Itoa(itemSub.Id))
|
|
|
+ var model1 supplierpausereason.OilSupplierPauseReason
|
|
|
+ model1.SupplierId = item.Id
|
|
|
+ model1.CertSubId = itemSub.Id
|
|
|
+ model1.CertSubStatus = "2"
|
|
|
+ model1.SupplierCertId = itemSub.SupplierCertId
|
|
|
+ model1.BackReason = "老数据导入缺资质"
|
|
|
+ model1.CreateOn = time.Now()
|
|
|
+ model1.CreateBy = this.User.Realname
|
|
|
+ model1.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
|
|
|
+ svc.InsertEntityBytbl(OilSupplierPauseReasonName, &model1)
|
|
|
+ break
|
|
|
+ }
|
|
|
+ } else if i > 10 {
|
|
|
+ if value == "1" && strings.Index(item.HeaderCodes, "F"+strconv.Itoa(i)) < 0 {
|
|
|
+ err = svc.UpdateEntityBywheretbl(OilSupplierCertSubName, &subDelete, cols, "Id = " + strconv.Itoa(itemSub.Id))
|
|
|
+ var model1 supplierpausereason.OilSupplierPauseReason
|
|
|
+ model1.SupplierId = item.Id
|
|
|
+ model1.CertSubId = itemSub.Id
|
|
|
+ model1.CertSubStatus = "2"
|
|
|
+ model1.SupplierCertId = itemSub.SupplierCertId
|
|
|
+ model1.BackReason = "老数据导入缺资质"
|
|
|
+ model1.CreateOn = time.Now()
|
|
|
+ model1.CreateBy = this.User.Realname
|
|
|
+ model1.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
|
|
|
+ svc.InsertEntityBytbl(OilSupplierPauseReasonName, &model1)
|
|
|
+ break
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if value == "1" && strings.Index(item.HeaderCodes, "F0"+strconv.Itoa(i)) < 0 {
|
|
|
+ err = svc.UpdateEntityBywheretbl(OilSupplierCertSubName, &subDelete, cols, "Id = " + strconv.Itoa(itemSub.Id))
|
|
|
+ var model1 supplierpausereason.OilSupplierPauseReason
|
|
|
+ model1.SupplierId = item.Id
|
|
|
+ model1.CertSubId = itemSub.Id
|
|
|
+ model1.CertSubStatus = "2"
|
|
|
+ model1.SupplierCertId = itemSub.SupplierCertId
|
|
|
+ model1.BackReason = "老数据导入缺资质"
|
|
|
+ model1.CreateOn = time.Now()
|
|
|
+ model1.CreateBy = this.User.Realname
|
|
|
+ model1.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
|
|
|
+ svc.InsertEntityBytbl(OilSupplierPauseReasonName, &model1)
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+ i += 1
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // 删除
|
|
|
+ err = svc.DeleteEntityById(itemSub.Id, &subDelete)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //err = svc.DeleteTable("OilSupplierTecContrast", "Id = " + strconv.Itoa(item.Id))
|
|
|
+ }
|
|
|
+ if err == nil {
|
|
|
+ errinfo.Message = "修改成功!"
|
|
|
+ errinfo.Code = 0
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
+ this.ServeJSON()
|
|
|
+ } else {
|
|
|
+ errinfo.Message = "修改失败!"
|
|
|
+ errinfo.Code = -1
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
+ this.ServeJSON()
|
|
|
+ }
|
|
|
+}
|