|
|
@@ -426,32 +426,32 @@ func (this *InfoChangeController) GetAllEntityList() {
|
|
|
//获取分页信息
|
|
|
page := this.GetPageInfoForm()
|
|
|
where := " 1=1"
|
|
|
- orderby := "a.Id"
|
|
|
+ orderby := "Id"
|
|
|
asc := false
|
|
|
Order := this.GetString("Order")
|
|
|
Prop := this.GetString("Prop")
|
|
|
SupplierId := this.GetString("SupplierId")
|
|
|
if Order != "" && Prop != "" {
|
|
|
- orderby = "a." + Prop
|
|
|
+ orderby = Prop
|
|
|
if Order == "asc" {
|
|
|
asc = true
|
|
|
}
|
|
|
}
|
|
|
|
|
|
SupplierName := this.GetString("SupplierName")
|
|
|
- if SupplierId != "" {
|
|
|
- var model supplier.OilSupplier
|
|
|
- sv := supplier.GetOilSupplierService(utils.DBE)
|
|
|
- sv.GetEntityByIdBytbl(OilSupplierName, SupplierId, &model)
|
|
|
- SupplierName = model.SupplierName
|
|
|
- }
|
|
|
+ //if SupplierId != "" {
|
|
|
+ // var model supplier.OilSupplier
|
|
|
+ // sv := supplier.GetOilSupplierService(utils.DBE)
|
|
|
+ // sv.GetEntityByIdBytbl(OilSupplierName, SupplierId, &model)
|
|
|
+ // SupplierName = model.SupplierName
|
|
|
+ //}
|
|
|
CreateOn := this.GetString("CreateOn")
|
|
|
|
|
|
if SupplierName != "" {
|
|
|
- where = where + " and a.SupplierName like '%" + SupplierName + "%'"
|
|
|
+ where = where + " and Name like '%" + SupplierName + "%'"
|
|
|
}
|
|
|
if SupplierId != "" {
|
|
|
- where = where + " and b.SupplierId = '" + SupplierId + "'"
|
|
|
+ where = where + " and SupplierId = '" + SupplierId + "'"
|
|
|
}
|
|
|
|
|
|
if CreateOn != "" {
|
|
|
@@ -459,13 +459,14 @@ func (this *InfoChangeController) GetAllEntityList() {
|
|
|
if len(dates) == 2 {
|
|
|
minDate := dates[0]
|
|
|
maxDate := dates[1]
|
|
|
- where = where + " and b.CreateOn>='" + minDate + "' and b.CreateOn<='" + maxDate + "'"
|
|
|
+ where = where + " and CreateOn>='" + minDate + "' and CreateOn<='" + maxDate + "'"
|
|
|
}
|
|
|
}
|
|
|
|
|
|
svc := infochange.GetInfoChangeService(utils.DBE)
|
|
|
var list []infochange.OilUsedName
|
|
|
- total := svc.GetUsedNameWithOrderBytbl(OilSupplierName, OilInfoChangeItemName, page.CurrentPage, page.Size, orderby, asc, &list, where)
|
|
|
+ //total := svc.GetUsedNameWithOrderBytbl(OilSupplierName, OilInfoChangeItemName, page.CurrentPage, page.Size, orderby, asc, &list, where)
|
|
|
+ total := svc.GetOldNameWithOrderBytbl(page.CurrentPage, page.Size, orderby, asc, &list, where)
|
|
|
var datainfo DataInfo
|
|
|
datainfo.Items = list
|
|
|
datainfo.CurrentItemCount = total
|
|
|
@@ -1834,6 +1835,25 @@ func (this *InfoChangeController) CommonAuditEntity() {
|
|
|
infoSrv.GetEntityById(infoId, &infoChangeEntityAfterUpdate)
|
|
|
if infoChangeEntityAfterUpdate.Status == suppliercert.STORE_STATUS {
|
|
|
fmt.Println("资质变更入库完成, 开始实际变更信息: supplierId" + strconv.Itoa(infoChangeEntityAfterUpdate.SupplierId) + "变更信息表ID: " + infoId)
|
|
|
+ var oilSupplier supplier.OilSupplier
|
|
|
+ var oldName supplier.OilSupplierOldName
|
|
|
+ var info infochange.OilInfoChangeItem
|
|
|
+ svc := supplier.GetOilSupplierService(utils.DBE)
|
|
|
+ svc.GetEntityByWhere(OilInfoChangeItemName, "SelectItem = 'SupplierName' and InfoId = " + infoId, &info)
|
|
|
+ // 曾用名存到主表
|
|
|
+ oilSupplier.OldSupplierName = info.BeChangeInfo
|
|
|
+ svc.UpdateEntityBywheretbl(OilSupplierName, &oilSupplier, []string{"OldSupplierName"}, "Id = " + strconv.Itoa(infoChangeEntityAfterUpdate.SupplierId))
|
|
|
+
|
|
|
+ oldName.OldName = info.BeChangeInfo
|
|
|
+ oldName.Name = info.ChangeInfo
|
|
|
+ oldName.SupplierId = infoChangeEntityAfterUpdate.SupplierId
|
|
|
+ oldName.GfId = 0
|
|
|
+ oldName.CreateOn = info.CreateOn
|
|
|
+ oldName.CreateBy = info.CreateBy
|
|
|
+ oldName.CreateUserId = info.CreateUserId
|
|
|
+ // 曾用名存到子表
|
|
|
+ svc.InsertEntityBytbl("OilSupplierOldName", &oldName)
|
|
|
+
|
|
|
this.updateChangeInfo(infoChangeEntityAfterUpdate.SupplierId, infoId)
|
|
|
}
|
|
|
}
|
|
|
@@ -1916,128 +1936,129 @@ func (this *InfoChangeController) updatesupplier(supname string, suppid int, inf
|
|
|
}
|
|
|
|
|
|
func (this *InfoChangeController) BusinessDelete(SupplierId string) {
|
|
|
- SupplierTypeCode := "01"
|
|
|
- var IsManufacturer string
|
|
|
+ //SupplierTypeCode := "01"
|
|
|
+ //var IsManufacturer string
|
|
|
|
|
|
//根据Id查出OilSupplierCertSub的SubClassId
|
|
|
svc := suppliercertsub.GetOilSupplierCertSubService(utils.DBE) //获得数据库引擎
|
|
|
- filesvc := supplierfile.GetSupplierfileService(utils.DBE)
|
|
|
- paramSvc := baseparameter.GetBaseparameterService(utils.DBE)
|
|
|
+ //filesvc := supplierfile.GetSupplierfileService(utils.DBE)
|
|
|
+ //paramSvc := baseparameter.GetBaseparameterService(utils.DBE)
|
|
|
|
|
|
- var DelCertSublList []suppliercertsub.OilSupplierCertSub
|
|
|
+ //var DelCertSublList []suppliercertsub.OilSupplierCertSub
|
|
|
// 级别 一级变二级 把物资类一级的删掉
|
|
|
whereDel := "SupplierId=" + SupplierId + " and SupplierTypeCode='01' and GoodsLevel='1'"
|
|
|
- svc.GetEntities(&DelCertSublList, whereDel)
|
|
|
-
|
|
|
- Id := ""
|
|
|
- for _, item := range DelCertSublList {
|
|
|
- Id = Id + "," + strconv.Itoa(item.Id)
|
|
|
- }
|
|
|
- Id = strings.Trim(Id, ",")
|
|
|
- if Id != "" {
|
|
|
- Ids := strings.Split(Id, ",")
|
|
|
-
|
|
|
- //
|
|
|
- var CertSublList []suppliercertsub.OilSupplierCertSub
|
|
|
- where := "SupplierId=" + SupplierId + " and Id not in (" + Id + ") and SupplierTypeCode =" + SupplierTypeCode // 没有删除的准入范围
|
|
|
- svc.GetEntities(&CertSublList, where)
|
|
|
- SubClassIds := ""
|
|
|
- for _, CertSub := range CertSublList {
|
|
|
+ //svc.GetEntities(&DelCertSublList, whereDel)
|
|
|
+ svc.DeleteEntityBytbl(OilSupplierCertSubName, whereDel)
|
|
|
|
|
|
- SubClassIds += strconv.Itoa(CertSub.SubClassId) + ","
|
|
|
- }
|
|
|
- var SurplusList []supplierfile.FileList
|
|
|
- SubClassIds = strings.Trim(SubClassIds, ",")
|
|
|
- if SubClassIds != "" {
|
|
|
- if SupplierTypeCode == "01" {
|
|
|
- //SurplusList = filesvc.GetGoodsNeedFileList(SubClassIds, IsManufacturer)
|
|
|
- } else if SupplierTypeCode == "02" {
|
|
|
- SurplusList = filesvc.GetBasicNeedFileList(SubClassIds)
|
|
|
- } else if SupplierTypeCode == "03" {
|
|
|
- SurplusList = filesvc.GetTechNeedFileList(SubClassIds)
|
|
|
- }
|
|
|
- }
|
|
|
- fileNames := ""
|
|
|
- for _, CertSub := range SurplusList {
|
|
|
- fileNames += CertSub.FileName + ","
|
|
|
- }
|
|
|
-
|
|
|
- for i := 0; i < len(Ids); i++ {
|
|
|
- IsManufacturer = filesvc.CheckIsManuf(Ids[i])
|
|
|
- if SubClassIds != "" {
|
|
|
- if SupplierTypeCode == "01" {
|
|
|
- var CertSublList2 []suppliercertsub.OilSupplierCertSub
|
|
|
- wheregood := "SupplierId=" + SupplierId + " and Id not in (" + Id + ") and SupplierTypeCode =" + SupplierTypeCode + " and IsManufacturer =" + IsManufacturer // 没有删除的准入范围
|
|
|
- svc.GetEntities(&CertSublList2, wheregood)
|
|
|
- SubClassIds2 := ""
|
|
|
- for _, CertSub := range CertSublList2 {
|
|
|
- SubClassIds2 += strconv.Itoa(CertSub.SubClassId) + ","
|
|
|
- }
|
|
|
- SubClassIds2 = strings.Trim(SubClassIds2, ",")
|
|
|
- SurplusList = filesvc.GetGoodsNeedFileList(SubClassIds2, IsManufacturer)
|
|
|
- }
|
|
|
- }
|
|
|
- if fileNames == "" {
|
|
|
- for _, CertSub := range SurplusList {
|
|
|
- fileNames += CertSub.FileName + ","
|
|
|
- }
|
|
|
- }
|
|
|
- var datamain suppliercertsub.OilSupplierCertSub //创建OilSupplierCertSub结构体(映射用)
|
|
|
- var datamain2 []suppliercertsub.OilSupplierCertSub //空的查询用
|
|
|
-
|
|
|
- where := " Id= " + Ids[i]
|
|
|
- svc.GetEntity(&datamain, where) //根据Id查找,映射结构体
|
|
|
-
|
|
|
- //再根据企业id查找这个企业有几个准入范围(如果只有一个准入范围了,基本资质也删除)
|
|
|
-
|
|
|
- supplierId := datamain.SupplierId
|
|
|
- where = "SupplierId=" + strconv.Itoa(supplierId)
|
|
|
- svc.GetEntities(&datamain2, where)
|
|
|
- flag := 0
|
|
|
- if len(datamain2) == 1 {
|
|
|
- flag = 1
|
|
|
- }
|
|
|
- subClassId := datamain.SubClassId //4.拿到结构体中的准入范围SubClassId
|
|
|
- //根据SubClassId查出此准入范围所拥有的资质名称
|
|
|
- var needList []supplierfile.FileList //定义存储所拥有资质名称的数组
|
|
|
- if datamain.SupplierTypeCode == "01" {
|
|
|
- needList = filesvc.GetGoodsNeedFileList(strconv.Itoa(subClassId), IsManufacturer) //通过准入范围Id获得资质名称并填充数组
|
|
|
- } else if datamain.SupplierTypeCode == "02" {
|
|
|
- needList = filesvc.GetBasicNeedFileList(strconv.Itoa(subClassId))
|
|
|
- } else {
|
|
|
- needList = filesvc.GetTechNeedFileList(strconv.Itoa(subClassId))
|
|
|
- }
|
|
|
-
|
|
|
- var mustField string
|
|
|
- mustField = paramSvc.GetBaseparameterMessage("GFGL", "paramset", "MustFieldName") //必需的资质
|
|
|
-
|
|
|
- //根据企业ID(SupplierId)和此准入范围所拥有的资质名称删除OilSupplierFile表中对应的资质
|
|
|
- for j := 0; j < len(needList); j++ { //循环遍历资质名称数组,逐条删除
|
|
|
-
|
|
|
- if flag == 0 && strings.Contains(mustField, needList[j].FileName+",") {
|
|
|
- continue
|
|
|
- }
|
|
|
- if flag == 0 && strings.Contains(fileNames, needList[j].FileName+",") {
|
|
|
- continue
|
|
|
- }
|
|
|
- if datamain.SupplierTypeCode == "01" {
|
|
|
- where = " SupplierId= '" + strconv.Itoa(datamain.SupplierId) + "' and SupplierTypeCode =" + SupplierTypeCode + " and IsManuf='" + IsManufacturer + "' and NeedFileType='" + needList[j].FileName + "'" //拼接删除sql
|
|
|
- } else {
|
|
|
- where = " SupplierId= '" + strconv.Itoa(datamain.SupplierId) + "' and SupplierTypeCode =" + SupplierTypeCode + " and NeedFileType='" + needList[j].FileName + "'" //拼接删除sql
|
|
|
- }
|
|
|
- svc.DeleteEntityBytbl(OilSupplierFileName, where) //删除第j条资质数据
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- // TODO: 删除准入范围和资质对应关系表
|
|
|
- /*where = " SupplierId=" + strconv.Itoa(datamain.SupplierId) + " and SupplierTypeCode =" + SupplierTypeCode + " and SubClassId=" + strconv.Itoa(subClassId)
|
|
|
- svc.DeleteEntityBytbl(OilSupplierCert2FileName, where)*/
|
|
|
-
|
|
|
- where = " Id= " + Ids[i] + " and SupplierTypeCode =" + SupplierTypeCode
|
|
|
- svc.DeleteEntityBytbl(OilSupplierCertSubName, where) //删除OilSupplierCertSub单条准入范围
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
+ //Id := ""
|
|
|
+ //for _, item := range DelCertSublList {
|
|
|
+ // Id = Id + "," + strconv.Itoa(item.Id)
|
|
|
+ //}
|
|
|
+ //Id = strings.Trim(Id, ",")
|
|
|
+ //if Id != "" {
|
|
|
+ // Ids := strings.Split(Id, ",")
|
|
|
+ //
|
|
|
+ // //
|
|
|
+ // var CertSublList []suppliercertsub.OilSupplierCertSub
|
|
|
+ // where := "SupplierId=" + SupplierId + " and Id not in (" + Id + ") and SupplierTypeCode =" + SupplierTypeCode // 没有删除的准入范围
|
|
|
+ // svc.GetEntities(&CertSublList, where)
|
|
|
+ // SubClassIds := ""
|
|
|
+ // for _, CertSub := range CertSublList {
|
|
|
+ //
|
|
|
+ // SubClassIds += strconv.Itoa(CertSub.SubClassId) + ","
|
|
|
+ // }
|
|
|
+ // var SurplusList []supplierfile.FileList
|
|
|
+ // SubClassIds = strings.Trim(SubClassIds, ",")
|
|
|
+ // if SubClassIds != "" {
|
|
|
+ // if SupplierTypeCode == "01" {
|
|
|
+ // //SurplusList = filesvc.GetGoodsNeedFileList(SubClassIds, IsManufacturer)
|
|
|
+ // } else if SupplierTypeCode == "02" {
|
|
|
+ // SurplusList = filesvc.GetBasicNeedFileList(SubClassIds)
|
|
|
+ // } else if SupplierTypeCode == "03" {
|
|
|
+ // SurplusList = filesvc.GetTechNeedFileList(SubClassIds)
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // fileNames := ""
|
|
|
+ // for _, CertSub := range SurplusList {
|
|
|
+ // fileNames += CertSub.FileName + ","
|
|
|
+ // }
|
|
|
+ //
|
|
|
+ // for i := 0; i < len(Ids); i++ {
|
|
|
+ // IsManufacturer = filesvc.CheckIsManuf(Ids[i])
|
|
|
+ // if SubClassIds != "" {
|
|
|
+ // if SupplierTypeCode == "01" {
|
|
|
+ // var CertSublList2 []suppliercertsub.OilSupplierCertSub
|
|
|
+ // wheregood := "SupplierId=" + SupplierId + " and Id not in (" + Id + ") and SupplierTypeCode =" + SupplierTypeCode + " and IsManufacturer =" + IsManufacturer // 没有删除的准入范围
|
|
|
+ // svc.GetEntities(&CertSublList2, wheregood)
|
|
|
+ // SubClassIds2 := ""
|
|
|
+ // for _, CertSub := range CertSublList2 {
|
|
|
+ // SubClassIds2 += strconv.Itoa(CertSub.SubClassId) + ","
|
|
|
+ // }
|
|
|
+ // SubClassIds2 = strings.Trim(SubClassIds2, ",")
|
|
|
+ // SurplusList = filesvc.GetGoodsNeedFileList(SubClassIds2, IsManufacturer)
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // if fileNames == "" {
|
|
|
+ // for _, CertSub := range SurplusList {
|
|
|
+ // fileNames += CertSub.FileName + ","
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // var datamain suppliercertsub.OilSupplierCertSub //创建OilSupplierCertSub结构体(映射用)
|
|
|
+ // var datamain2 []suppliercertsub.OilSupplierCertSub //空的查询用
|
|
|
+ //
|
|
|
+ // where := " Id= " + Ids[i]
|
|
|
+ // svc.GetEntity(&datamain, where) //根据Id查找,映射结构体
|
|
|
+ //
|
|
|
+ // //再根据企业id查找这个企业有几个准入范围(如果只有一个准入范围了,基本资质也删除)
|
|
|
+ //
|
|
|
+ // supplierId := datamain.SupplierId
|
|
|
+ // where = "SupplierId=" + strconv.Itoa(supplierId)
|
|
|
+ // svc.GetEntities(&datamain2, where)
|
|
|
+ // flag := 0
|
|
|
+ // if len(datamain2) == 1 {
|
|
|
+ // flag = 1
|
|
|
+ // }
|
|
|
+ // subClassId := datamain.SubClassId //4.拿到结构体中的准入范围SubClassId
|
|
|
+ // //根据SubClassId查出此准入范围所拥有的资质名称
|
|
|
+ // var needList []supplierfile.FileList //定义存储所拥有资质名称的数组
|
|
|
+ // if datamain.SupplierTypeCode == "01" {
|
|
|
+ // needList = filesvc.GetGoodsNeedFileList(strconv.Itoa(subClassId), IsManufacturer) //通过准入范围Id获得资质名称并填充数组
|
|
|
+ // } else if datamain.SupplierTypeCode == "02" {
|
|
|
+ // needList = filesvc.GetBasicNeedFileList(strconv.Itoa(subClassId))
|
|
|
+ // } else {
|
|
|
+ // needList = filesvc.GetTechNeedFileList(strconv.Itoa(subClassId))
|
|
|
+ // }
|
|
|
+ //
|
|
|
+ // var mustField string
|
|
|
+ // mustField = paramSvc.GetBaseparameterMessage("GFGL", "paramset", "MustFieldName") //必需的资质
|
|
|
+ //
|
|
|
+ // //根据企业ID(SupplierId)和此准入范围所拥有的资质名称删除OilSupplierFile表中对应的资质
|
|
|
+ // for j := 0; j < len(needList); j++ { //循环遍历资质名称数组,逐条删除
|
|
|
+ //
|
|
|
+ // if flag == 0 && strings.Contains(mustField, needList[j].FileName+",") {
|
|
|
+ // continue
|
|
|
+ // }
|
|
|
+ // if flag == 0 && strings.Contains(fileNames, needList[j].FileName+",") {
|
|
|
+ // continue
|
|
|
+ // }
|
|
|
+ // if datamain.SupplierTypeCode == "01" {
|
|
|
+ // where = " SupplierId= '" + strconv.Itoa(datamain.SupplierId) + "' and SupplierTypeCode =" + SupplierTypeCode + " and IsManuf='" + IsManufacturer + "' and NeedFileType='" + needList[j].FileName + "'" //拼接删除sql
|
|
|
+ // } else {
|
|
|
+ // where = " SupplierId= '" + strconv.Itoa(datamain.SupplierId) + "' and SupplierTypeCode =" + SupplierTypeCode + " and NeedFileType='" + needList[j].FileName + "'" //拼接删除sql
|
|
|
+ // }
|
|
|
+ // svc.DeleteEntityBytbl(OilSupplierFileName, where) //删除第j条资质数据
|
|
|
+ //
|
|
|
+ // }
|
|
|
+ //
|
|
|
+ // // TODO: 删除准入范围和资质对应关系表
|
|
|
+ // /*where = " SupplierId=" + strconv.Itoa(datamain.SupplierId) + " and SupplierTypeCode =" + SupplierTypeCode + " and SubClassId=" + strconv.Itoa(subClassId)
|
|
|
+ // svc.DeleteEntityBytbl(OilSupplierCert2FileName, where)*/
|
|
|
+ //
|
|
|
+ // where = " Id= " + Ids[i] + " and SupplierTypeCode =" + SupplierTypeCode
|
|
|
+ // svc.DeleteEntityBytbl(OilSupplierCertSubName, where) //删除OilSupplierCertSub单条准入范围
|
|
|
+ //
|
|
|
+ // }
|
|
|
+ //}
|
|
|
}
|
|
|
|
|
|
func (this *InfoChangeController) FileDelete(supplierId string) {
|
|
|
@@ -2076,24 +2097,29 @@ func (this *InfoChangeController) updateChangeInfo(supplierId int, infoId string
|
|
|
where = where + " and ChangeStatus = 0"
|
|
|
|
|
|
var supModel supplier.OilSupplier
|
|
|
+ svc := supplier.GetOilSupplierService(utils.DBE)
|
|
|
+ svc.GetEntitysByWhere(OilInfoChangeItemName, where, &infoItems)
|
|
|
+ //修改主表信息
|
|
|
this.updatesupplier(OilSupplierName, supplierId, infoItems, supModel)
|
|
|
|
|
|
- // 级别 一级变二级 删除不符合的准入项和资质
|
|
|
+ // 级别 一级变二级 删除不符合的准入项
|
|
|
for _, item := range infoItems {
|
|
|
- if item.SelectItem == "Grade" && (item.BeChangeInfo == "1" && item.ChangeInfo == "2") {
|
|
|
- this.BusinessDelete(utils.ToStr(supplierId))
|
|
|
+ if item.SelectItem == "Grade" {
|
|
|
+ if item.BeChangeInfo == "1" && item.ChangeInfo == "2" {
|
|
|
+ this.BusinessDelete(utils.ToStr(supplierId))
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // 删除资质及准入项
|
|
|
this.FileDelete(strconv.Itoa(supplierId))
|
|
|
t := time.Now()
|
|
|
s := time.Since(t)
|
|
|
log.Println(s, "============================")
|
|
|
var qualDetail []qualchange.OilQualChangeDetail
|
|
|
where1 := "SupplierId = " + utils.ToStr(supplierId) + " and ParentId=" + infoId
|
|
|
- svc := infochange.GetInfoChangeService(utils.DBE)
|
|
|
- svc.GetEntities(&qualDetail, where1)
|
|
|
+ svc1 := infochange.GetInfoChangeService(utils.DBE)
|
|
|
+ svc1.GetEntities(&qualDetail, where1)
|
|
|
+ //更新 变更的资质
|
|
|
if len(qualDetail) > 0 {
|
|
|
for i := 0; i < len(qualDetail); i++ {
|
|
|
var supFileModel supplierfile.OilSupplierFile
|