|
|
@@ -23,8 +23,8 @@ import (
|
|
|
"dashoo.cn/backend/api/business/baseUser"
|
|
|
"dashoo.cn/backend/api/business/oilsupplier/goodsaptitude"
|
|
|
. "dashoo.cn/backend/api/controllers"
|
|
|
- "dashoo.cn/business2/userRole"
|
|
|
"dashoo.cn/business2/parameter"
|
|
|
+ "dashoo.cn/business2/userRole"
|
|
|
"dashoo.cn/utils"
|
|
|
. "github.com/linxGnu/goseaweedfs"
|
|
|
)
|
|
|
@@ -1191,7 +1191,6 @@ func (this *OilGoodsAptitudeController) ExportExcelAll2019() {
|
|
|
// @router /importexcel [get]
|
|
|
func (this *OilGoodsAptitudeController) ImportExcel() {
|
|
|
|
|
|
-
|
|
|
url := this.GetString("ExcelUrl")
|
|
|
var errorinfo ErrorInfo
|
|
|
if url == "" {
|
|
|
@@ -1274,7 +1273,7 @@ func (this *OilGoodsAptitudeController) OperationCell(svc *goodsaptitude.OilGood
|
|
|
|
|
|
defer func() {
|
|
|
if err := recover(); err != nil {
|
|
|
- log.Println("err" + lineNo, err)
|
|
|
+ log.Println("err"+lineNo, err)
|
|
|
*errLineNum += lineNo + ","
|
|
|
}
|
|
|
}()
|
|
|
@@ -1298,7 +1297,7 @@ func (this *OilGoodsAptitudeController) OperationCell(svc *goodsaptitude.OilGood
|
|
|
_, has := codemap[cellArr[0]]
|
|
|
if !has {
|
|
|
if idx != 0 {
|
|
|
- upcellstr := cellsArr[idx -1].String()
|
|
|
+ upcellstr := cellsArr[idx-1].String()
|
|
|
upcellArr := strings.Fields(upcellstr)
|
|
|
parentId = codemap[upcellArr[0]]
|
|
|
}
|
|
|
@@ -1330,7 +1329,7 @@ func (this *OilGoodsAptitudeController) OperationCell(svc *goodsaptitude.OilGood
|
|
|
valstr = strings.Replace(valstr, "是", "1", -1)
|
|
|
log.Println(cellsArr[3].String() + "==" + valstr)
|
|
|
var columnstr = ""
|
|
|
- for l := 0; l < cellsArrLen - 4; l++ {
|
|
|
+ for l := 0; l < cellsArrLen-4; l++ {
|
|
|
columnstr += columnArr[l] + ","
|
|
|
}
|
|
|
columnstr = strings.Trim(columnstr, ",")
|
|
|
@@ -1355,7 +1354,7 @@ func (this *OilGoodsAptitudeController) TruncateImport() {
|
|
|
err = svc.TruncateTable(Tmp_OilGoodsAptitudeName)
|
|
|
|
|
|
var errorinfo ErrorInfo
|
|
|
- if err != nil{
|
|
|
+ if err != nil {
|
|
|
session.Rollback()
|
|
|
errorinfo.Code = -1
|
|
|
errorinfo.Message = "删除失败!"
|
|
|
@@ -1364,7 +1363,7 @@ func (this *OilGoodsAptitudeController) TruncateImport() {
|
|
|
}
|
|
|
|
|
|
err = svc.TruncateTable(Tmp_OilGoodsAptitudeClassName)
|
|
|
- if err != nil{
|
|
|
+ if err != nil {
|
|
|
session.Rollback()
|
|
|
errorinfo.Code = -1
|
|
|
errorinfo.Message = "删除失败!"
|
|
|
@@ -1437,7 +1436,7 @@ func (this *OilGoodsAptitudeController) UpdataSuppierCertSub() {
|
|
|
|
|
|
supsvc := supplier.GetOilSupplierService(utils.DBE)
|
|
|
var suppliercertList []suppliercert.OilSupplierCert
|
|
|
- where := "AccessCardNo='2018WZ272'"//"SupplierTypeCode='01' AND OutsideFlog = '' AND (InFlag IN ('1','2')) "
|
|
|
+ where := "AccessCardNo='2018WZ272'" //"SupplierTypeCode='01' AND OutsideFlog = '' AND (InFlag IN ('1','2')) "
|
|
|
supsvc.GetEntities(&suppliercertList, where)
|
|
|
|
|
|
var goodsaptitudeClassList []goodsaptitudeclass.OilGoodsAptitudeClass
|
|
|
@@ -1446,7 +1445,7 @@ func (this *OilGoodsAptitudeController) UpdataSuppierCertSub() {
|
|
|
|
|
|
var colsname = []string{"Name"}
|
|
|
var colsLevel = []string{"GoodsLevel"}
|
|
|
- for _, suppliercert := range suppliercertList {
|
|
|
+ for _, suppliercert := range suppliercertList {
|
|
|
//row := sheet.AddRow()
|
|
|
//cell := row.AddCell()
|
|
|
//cell.Value = strconv.Itoa(suppliercert.SupplierId)
|
|
|
@@ -1458,7 +1457,7 @@ func (this *OilGoodsAptitudeController) UpdataSuppierCertSub() {
|
|
|
// 准入项
|
|
|
//for idx, supplierCertSub := range supplierCertSubList {
|
|
|
|
|
|
- for idx :=0; idx < len(supplierCertSubList); idx++{
|
|
|
+ for idx := 0; idx < len(supplierCertSubList); idx++ {
|
|
|
//row := sheet.AddRow()
|
|
|
//cell := row.AddCell()
|
|
|
//cell.Value = "删除"
|
|
|
@@ -1484,11 +1483,11 @@ func (this *OilGoodsAptitudeController) UpdataSuppierCertSub() {
|
|
|
supsvc.InsertEntityBytbl(TmpOilSupplierCertSubName, supplierCertSub)
|
|
|
break
|
|
|
}
|
|
|
- if supplierCertSub.Name != goodsaptitudeClass.Name {
|
|
|
+ if supplierCertSub.Name != goodsaptitudeClass.Name {
|
|
|
//row := sheet.AddRow()
|
|
|
//cell := row.AddCell()
|
|
|
//cell.Value = supplierCertSub.Code + ":" + supplierCertSub.Name + "==" + goodsaptitudeClass.Name
|
|
|
- var entity suppliercertsub.OilSupplierCertSub
|
|
|
+ var entity suppliercertsub.OilSupplierCertSub
|
|
|
entity.Name = goodsaptitudeClass.Name
|
|
|
where := "Id = " + strconv.Itoa(supplierCertSub.Id)
|
|
|
supsvc.UpdateEntityBywheretbl(OilSupplierCertSubName, &entity, colsname, where)
|
|
|
@@ -1497,7 +1496,7 @@ func (this *OilGoodsAptitudeController) UpdataSuppierCertSub() {
|
|
|
whereg := "ClassId = " + strconv.Itoa(goodsaptitudeClass.Id)
|
|
|
supsvc.GetEntity(&goodsAptitude, whereg)
|
|
|
if goodsAptitude.GoodsLevel != supplierCertSub.GoodsLevel {
|
|
|
- var entity suppliercertsub.OilSupplierCertSub
|
|
|
+ var entity suppliercertsub.OilSupplierCertSub
|
|
|
entity.GoodsLevel = goodsAptitude.GoodsLevel
|
|
|
where := "Id = " + strconv.Itoa(supplierCertSub.Id)
|
|
|
supsvc.UpdateEntityBywheretbl(OilSupplierCertSubName, &entity, colsLevel, where)
|
|
|
@@ -1560,8 +1559,8 @@ func (this *OilGoodsAptitudeController) GetGoodsAptitudeName(classId, IsManuf st
|
|
|
// @router /getcompanylist [post]
|
|
|
func (this *OilGoodsAptitudeController) GetTList() {
|
|
|
|
|
|
- var model supplier.OilSupplierSelect
|
|
|
- var model1 supplier.RegCapitalRange //注册资金范围
|
|
|
+ var model supplier.OilSupplierSelect
|
|
|
+ var model1 supplier.RegCapitalRange //注册资金范围
|
|
|
//var model2 supplier.NeedFileTypeStruct //资质结构体
|
|
|
|
|
|
var jsonBlob = this.Ctx.Input.RequestBody
|
|
|
@@ -1691,32 +1690,32 @@ func (this *OilGoodsAptitudeController) GetTList() {
|
|
|
fmt.Println(a)
|
|
|
//准入方式
|
|
|
if model.InStyle != "" {
|
|
|
- if model.InStyle == "0"{
|
|
|
+ if model.InStyle == "0" {
|
|
|
where = where + " and b.InStyle in ('2','3','4','5')"
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
where = where + " and b.InStyle ='" + model.InStyle + "'"
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- having:=""
|
|
|
+ having := ""
|
|
|
//准入范围
|
|
|
- if model.CerSubName!="" {
|
|
|
- having = " having CerSubName like '%"+model.CerSubName+"%' "
|
|
|
- leftjoin = "left join "+ OilSupplierCertSubName + " d on d.SupplierCertId = b.Id "
|
|
|
+ if model.CerSubName != "" {
|
|
|
+ having = " having CerSubName like '%" + model.CerSubName + "%' "
|
|
|
+ leftjoin = "left join " + OilSupplierCertSubName + " d on d.SupplierCertId = b.Id "
|
|
|
}
|
|
|
//资质
|
|
|
- if model.NeedFileType!="" {
|
|
|
- having = " having NeedFileType like '%"+model.NeedFileType+"%' "
|
|
|
+ if model.NeedFileType != "" {
|
|
|
+ having = " having NeedFileType like '%" + model.NeedFileType + "%' "
|
|
|
}
|
|
|
- if model.CerSubName!=""&& model.NeedFileType!=""{
|
|
|
- having = " having CerSubName like '%"+model.CerSubName+"%' and NeedFileType like '%"+model.NeedFileType+"%' "
|
|
|
- leftjoin = "left join "+ OilSupplierCertSubName + " d on d.SupplierCertId = b.Id "
|
|
|
+ if model.CerSubName != "" && model.NeedFileType != "" {
|
|
|
+ having = " having CerSubName like '%" + model.CerSubName + "%' and NeedFileType like '%" + model.NeedFileType + "%' "
|
|
|
+ leftjoin = "left join " + OilSupplierCertSubName + " d on d.SupplierCertId = b.Id "
|
|
|
}
|
|
|
svc := goodsaptitude.GetOilGoodsAptitudeService(utils.DBE)
|
|
|
var list []supplier.OilSupplierSelect
|
|
|
|
|
|
- total := svc.GetMyPagingDelEntitiesWithOrderBytbl(OilSupplierName, OilSupplierCertName, OilInfoChangeName,OilCorporateInfoName,OilSupplierCertSubName,
|
|
|
- OilSupplierFileName, page.CurrentPage, page.Size, orderby, asc, &list, where,having, leftjoin)
|
|
|
+ total := svc.GetMyPagingDelEntitiesWithOrderBytbl(OilSupplierName, OilSupplierCertName, OilInfoChangeName, OilCorporateInfoName, OilSupplierCertSubName,
|
|
|
+ OilSupplierFileName, page.CurrentPage, page.Size, orderby, asc, &list, where, having, leftjoin)
|
|
|
|
|
|
var datainfo DataInfo
|
|
|
datainfo.Items = list
|
|
|
@@ -1851,7 +1850,7 @@ func (this *OilGoodsAptitudeController) DelTmpSupplierCertSub() {
|
|
|
svc.GetEntitysByWhere(TmpOilSupplierCertSubName, wheredel, &supplierCertSubList)
|
|
|
|
|
|
var errinfo ErrorInfo
|
|
|
- for _,item := range supplierCertSubList {
|
|
|
+ for _, item := range supplierCertSubList {
|
|
|
where := "Id = " + strconv.Itoa(item.Id)
|
|
|
err = svc.DeleteEntityBytbl(OilSupplierCertSubName, where)
|
|
|
if err != nil {
|
|
|
@@ -1863,7 +1862,7 @@ func (this *OilGoodsAptitudeController) DelTmpSupplierCertSub() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- for _,item := range supplierCertSubList {
|
|
|
+ for _, item := range supplierCertSubList {
|
|
|
where := "Id = " + strconv.Itoa(item.Id)
|
|
|
err = svc.DeleteEntityBytbl(TmpOilSupplierCertSubName, where)
|
|
|
}
|
|
|
@@ -1882,6 +1881,7 @@ func (this *OilGoodsAptitudeController) DelTmpSupplierCertSub() {
|
|
|
this.ServeJSON()
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
// @Title 修改资质后找出不符合的准入
|
|
|
// @Description 修改实体
|
|
|
// @Success 200 {object} controllers.Request
|
|
|
@@ -1905,75 +1905,80 @@ func (this *OilGoodsAptitudeController) FindInconformity() {
|
|
|
var jsonBlob = this.Ctx.Input.RequestBody
|
|
|
json.Unmarshal(jsonBlob, &model)
|
|
|
Code := model.Code
|
|
|
- where := " Code ='"+Code+"' and Type in ('1','3') and SupplierTypeCode = '01'"
|
|
|
- svc.FindGoodsByCode("OilSupplierCertSub",where,&companygoodslist)
|
|
|
+ where := " Code ='" + Code + "' and Type in ('1','3') and SupplierTypeCode = '01'"
|
|
|
+ svc.FindGoodsByCode("OilSupplierCertSub", where, &companygoodslist)
|
|
|
|
|
|
SurplusList1 = filesvc.GetGoodsNeedFileList(strconv.Itoa(model.ClassId), "1")
|
|
|
SurplusList2 = filesvc.GetGoodsNeedFileList(strconv.Itoa(model.ClassId), "2")
|
|
|
|
|
|
for _, CertSub := range companygoodslist {
|
|
|
companygood = CertSub
|
|
|
- wherecompany := " SupplierId ="+strconv.Itoa(CertSub.SupplierId)
|
|
|
- svc.FindFileByCompany("OilSupplierFile",wherecompany,&supfilemodel)
|
|
|
- if len(supfilemodel)<1 {
|
|
|
- _,err = svc.InsertEntityBytbl(""+TmpOilSupplierCertSubName, &companygood)
|
|
|
- }else {
|
|
|
- var tmplist1 []suppliercertsub.Tmp_OilSupplierCertSub
|
|
|
- wherecompany = " Id ="+strconv.Itoa(CertSub.Id)
|
|
|
- svc.FindFileByCompany("tmp_OilSupplierCertSub",wherecompany,&tmplist1)
|
|
|
- if len(tmplist1)<1{
|
|
|
- wherecompany = " SupplierId ='" + strconv.Itoa(CertSub.SupplierId) + "' and IsManuf in ('0','1')"
|
|
|
- svc.FindFileByCompany("OilSupplierFile", wherecompany, &supfilemodel01)
|
|
|
- var File01 string
|
|
|
- for _, Filesub := range supfilemodel01 {
|
|
|
- File01 = File01 + Filesub.NeedFileType + ","
|
|
|
+ wherecompany := " SupplierId =" + strconv.Itoa(CertSub.SupplierId)
|
|
|
+ svc.FindFileByCompany("OilSupplierFile", wherecompany, &supfilemodel)
|
|
|
+ if len(supfilemodel) < 1 {
|
|
|
+ _, err = svc.InsertEntityBytbl(""+TmpOilSupplierCertSubName, &companygood)
|
|
|
+ } else {
|
|
|
+ var tmplist1 []suppliercertsub.Tmp_OilSupplierCertSub
|
|
|
+ wherecompany = " Id =" + strconv.Itoa(CertSub.Id)
|
|
|
+ svc.FindFileByCompany("tmp_OilSupplierCertSub", wherecompany, &tmplist1)
|
|
|
+ if len(tmplist1) < 1 {
|
|
|
+ wherecompany = " SupplierId ='" + strconv.Itoa(CertSub.SupplierId) + "' and IsManuf in ('0','1')"
|
|
|
+ svc.FindFileByCompany("OilSupplierFile", wherecompany, &supfilemodel01)
|
|
|
+ var File01 string
|
|
|
+ for _, Filesub := range supfilemodel01 {
|
|
|
+ File01 = File01 + Filesub.NeedFileType + ","
|
|
|
+ }
|
|
|
+ for _, Filesub := range SurplusList1 {
|
|
|
+ var supplierModel supplier.OilSupplier
|
|
|
+ svcSupplier := supplier.GetOilSupplierService(utils.DBE)
|
|
|
+ svcSupplier.GetEntityById(strconv.Itoa(CertSub.SupplierId), &supplierModel)
|
|
|
+ //三证合一或五证合一不需要的字段
|
|
|
+ mergerCertSkipField := paramSvc.GetBaseparameterMessage("GFGL", "paramset", "MergerCertSkipFieldName")
|
|
|
+ File01 = mergerCertSkipField + File01
|
|
|
+ if (supplierModel.CredentialFlag == "1" || supplierModel.CredentialFlag == "2") && strings.Contains(File01, Filesub.FileName+",") { //三证合一或五证合一了
|
|
|
+ continue
|
|
|
}
|
|
|
- for _, Filesub := range SurplusList1 {
|
|
|
- var supplierModel supplier.OilSupplier
|
|
|
- svcSupplier := supplier.GetOilSupplierService(utils.DBE)
|
|
|
- svcSupplier.GetEntityById(strconv.Itoa(CertSub.SupplierId), &supplierModel)
|
|
|
- //三证合一或五证合一不需要的字段
|
|
|
- mergerCertSkipField := paramSvc.GetBaseparameterMessage("GFGL", "paramset", "MergerCertSkipFieldName")
|
|
|
- File01 = mergerCertSkipField + File01
|
|
|
- if (supplierModel.CredentialFlag == "1" || supplierModel.CredentialFlag == "2") && strings.Contains(File01, Filesub.FileName+",") { //三证合一或五证合一了
|
|
|
- continue
|
|
|
- }
|
|
|
- if strings.Contains(File01, Filesub.FileName+",") {
|
|
|
- continue
|
|
|
- }
|
|
|
- _, err = svc.InsertEntityBytbl(""+TmpOilSupplierCertSubName, &companygood)
|
|
|
- break
|
|
|
+ if strings.Contains(File01, Filesub.FileName+",") {
|
|
|
+ continue
|
|
|
}
|
|
|
+ _, err = svc.InsertEntityBytbl(""+TmpOilSupplierCertSubName, &companygood)
|
|
|
+ break
|
|
|
}
|
|
|
+ }
|
|
|
var tmplist2 []suppliercertsub.Tmp_OilSupplierCertSub
|
|
|
- wherecompany = " Id ="+strconv.Itoa(CertSub.Id)
|
|
|
- svc.FindFileByCompany("tmp_OilSupplierCertSub",wherecompany,&tmplist2)
|
|
|
- if len(tmplist2)<1{
|
|
|
- wherecompany = " SupplierId ='" + strconv.Itoa(CertSub.SupplierId) + "' and IsManuf in ('0','2')"
|
|
|
- svc.FindFileByCompany("OilSupplierFile", wherecompany, &supfilemodel02)
|
|
|
- var File02 string
|
|
|
- for _, Filesub := range supfilemodel02 {
|
|
|
- File02 = File02 + Filesub.NeedFileType + ","
|
|
|
+ wherecompany = " Id =" + strconv.Itoa(CertSub.Id)
|
|
|
+ svc.FindFileByCompany("tmp_OilSupplierCertSub", wherecompany, &tmplist2)
|
|
|
+ if len(tmplist2) < 1 {
|
|
|
+ wherecompany = " SupplierId ='" + strconv.Itoa(CertSub.SupplierId) + "' and IsManuf in ('0','2')"
|
|
|
+ svc.FindFileByCompany("OilSupplierFile", wherecompany, &supfilemodel02)
|
|
|
+ var File02 string
|
|
|
+ for _, Filesub := range supfilemodel02 {
|
|
|
+ File02 = File02 + Filesub.NeedFileType + ","
|
|
|
+ }
|
|
|
+ for _, Filesub := range SurplusList2 {
|
|
|
+ var supplierModel supplier.OilSupplier
|
|
|
+ svcSupplier := supplier.GetOilSupplierService(utils.DBE)
|
|
|
+ svcSupplier.GetEntityById(strconv.Itoa(CertSub.SupplierId), &supplierModel)
|
|
|
+ //三证合一或五证合一不需要的字段
|
|
|
+ mergerCertSkipField := paramSvc.GetBaseparameterMessage("GFGL", "paramset", "MergerCertSkipFieldName")
|
|
|
+ File02 = mergerCertSkipField + File02
|
|
|
+ if (supplierModel.CredentialFlag == "1" || supplierModel.CredentialFlag == "2") && strings.Contains(File02, Filesub.FileName+",") { //三证合一或五证合一了
|
|
|
+ continue
|
|
|
}
|
|
|
- for _, Filesub := range SurplusList2 {
|
|
|
- var supplierModel supplier.OilSupplier
|
|
|
- svcSupplier := supplier.GetOilSupplierService(utils.DBE)
|
|
|
- svcSupplier.GetEntityById(strconv.Itoa(CertSub.SupplierId), &supplierModel)
|
|
|
- //三证合一或五证合一不需要的字段
|
|
|
- mergerCertSkipField := paramSvc.GetBaseparameterMessage("GFGL", "paramset", "MergerCertSkipFieldName")
|
|
|
- File02 = mergerCertSkipField + File02
|
|
|
- if (supplierModel.CredentialFlag == "1" || supplierModel.CredentialFlag == "2") && strings.Contains(File02, Filesub.FileName+",") { //三证合一或五证合一了
|
|
|
- continue
|
|
|
- }
|
|
|
- if strings.Contains(File02, Filesub.FileName+",") {
|
|
|
- continue
|
|
|
- }
|
|
|
- _, err = svc.InsertEntityBytbl(""+TmpOilSupplierCertSubName, &companygood)
|
|
|
- break
|
|
|
+ if strings.Contains(File02, Filesub.FileName+",") {
|
|
|
+ continue
|
|
|
}
|
|
|
+ _, err = svc.InsertEntityBytbl(""+TmpOilSupplierCertSubName, &companygood)
|
|
|
+ break
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ var certsub suppliercertsub.OilSupplierCertSub
|
|
|
+ certsub.GoodsLevel = model.GoodsLevel
|
|
|
+ cols := []string{"GoodsLevel"}
|
|
|
+ where := "Id=" + strconv.Itoa(CertSub.Id)
|
|
|
+ svc.UpdateEntityBywheretbl(OilSupplierCertSubName, &certsub, cols, where)
|
|
|
+ }
|
|
|
|
|
|
if err == nil {
|
|
|
errinfo.Message = "已拉取缺失资质列表!"
|
|
|
@@ -1986,4 +1991,4 @@ func (this *OilGoodsAptitudeController) FindInconformity() {
|
|
|
this.Data["json"] = &errinfo
|
|
|
this.ServeJSON()
|
|
|
}
|
|
|
-}
|
|
|
+}
|