|
|
@@ -118,17 +118,12 @@ func (this *OilSupplierCertAppendSubController) GetListAppend() {
|
|
|
// @router /addappendsub [post]
|
|
|
func (this *OilSupplierCertAppendSubController) AddAppendSub() {
|
|
|
var model suppliercertsub.OilSupplierCertSub
|
|
|
- var jsonblob = this.Ctx.Input.RequestBody
|
|
|
- var errinfo ErrorDataInfo
|
|
|
var err error
|
|
|
-
|
|
|
+ var jsonblob = this.Ctx.Input.RequestBody
|
|
|
json.Unmarshal(jsonblob, &model)
|
|
|
- model.Type = "2"
|
|
|
- model.CreateOn = time.Now()
|
|
|
model.CreateBy = this.User.Realname
|
|
|
model.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
|
|
|
-
|
|
|
- svc := suppliercertappendsub.GetOilSupplierCertAppendSubService(utils.DBE)
|
|
|
+ svc := suppliercertsub.GetOilSupplierCertSubService(utils.DBE)
|
|
|
var submodel suppliercertsub.OilSupplierCertSub
|
|
|
where_certsub := " SupplierCertId = "+ utils.ToStr(model.SupplierCertId) + " and SupplierTypeCode = 02"
|
|
|
where_certsub += " and SubClassId = '" + utils.ToStr(model.SubClassId) + "'"
|
|
|
@@ -144,8 +139,14 @@ func (this *OilSupplierCertAppendSubController) AddAppendSub() {
|
|
|
svcCert := suppliercert.GetOilSupplierCertService(utils.DBE)
|
|
|
svcCert.GetEntityById(model.SupplierCertId, &supplierCertModel)
|
|
|
|
|
|
+ var supplierModel supplier.OilSupplier
|
|
|
+ svcSupplier := supplier.GetOilSupplierService(utils.DBE)
|
|
|
+ svcSupplier.GetEntityById(model.SupplierId, &supplierModel)
|
|
|
+
|
|
|
+ paramSvc := baseparameter.GetBaseparameterService(utils.DBE)
|
|
|
filesvc := supplierfile.GetSupplierfileService(utils.DBE)
|
|
|
var needList []supplierfile.FileList
|
|
|
+
|
|
|
if model.SupplierTypeCode == "01" {
|
|
|
// needList = filesvc.GetGoodsNeedFileList(model.SubClassId)
|
|
|
} else if model.SupplierTypeCode == "02" {
|
|
|
@@ -156,7 +157,7 @@ func (this *OilSupplierCertAppendSubController) AddAppendSub() {
|
|
|
|
|
|
if supplierCertModel.InStyle == "4" {
|
|
|
var needFile supplierfile.FileList
|
|
|
- needFile.FileName = "战略合作协议扫描件"
|
|
|
+ needFile.FileName = paramSvc.GetBaseparameterMessage("GFGL", "paramset", "CooperationFile")
|
|
|
needList = append(needList, needFile)
|
|
|
}
|
|
|
|
|
|
@@ -165,14 +166,28 @@ func (this *OilSupplierCertAppendSubController) AddAppendSub() {
|
|
|
where := "SupplierId = '" + strconv.Itoa(model.SupplierId) + "'"
|
|
|
svc.GetEntitysByWhere(OilSupplierFileName, where, &list)
|
|
|
|
|
|
- hasField := ""
|
|
|
- for i := 0; i < len(list); i++ {
|
|
|
- hasField += list[i].NeedFileType + ","
|
|
|
- }
|
|
|
- mustField := "营业执照,组织代码,税务登记,开户许可,银行开户许可证,承诺书,企业信息系统截图,战略合作协议扫描件,"
|
|
|
+ //三证合一或五证合一不需要的字段
|
|
|
+ mergerCertSkipField := paramSvc.GetBaseparameterMessage("GFGL", "paramset", "MergerCertSkipFieldName")
|
|
|
+
|
|
|
+ //"营业执照,组织代码,组织机构代码证,税务登记证,税务登记,开户许可,银行开户许可证,承诺书,诚信合规承诺书,企业信息系统截图,战略合作协议扫描件,"
|
|
|
+ mustField := paramSvc.GetBaseparameterMessage("GFGL", "paramset", "MustFieldName")
|
|
|
+
|
|
|
for i := 0; i < len(needList); i++ {
|
|
|
var entity supplierfile.OilSupplierFile
|
|
|
entity.SupplierId = model.SupplierId
|
|
|
+ //加入对应表OilSupplierCert2File
|
|
|
+ var cert2File suppliercertsub.OilSupplierCert2File //创建结构体
|
|
|
+ cert2File.SupplierId = model.SupplierId
|
|
|
+ cert2File.SupplierCertId = model.SupplierCertId
|
|
|
+ cert2File.SupplierTypeCode = model.SupplierTypeCode
|
|
|
+ cert2File.SubClassId= model.SubClassId
|
|
|
+ cert2File.Code = model.Code
|
|
|
+ cert2File.Name = model.Name
|
|
|
+ cert2File.NeedFileType = needList[i].FileName
|
|
|
+ svc.InsertEntityBytbl(OilSupplierCert2FileName, &cert2File)
|
|
|
+ if (supplierModel.CredentialFlag == "1" || supplierModel.CredentialFlag == "2") && strings.Contains(mergerCertSkipField, needList[i].FileName+",") { //三证合一或五证合一了
|
|
|
+ continue
|
|
|
+ }
|
|
|
|
|
|
if strings.Contains(mustField, needList[i].FileName+",") {
|
|
|
entity.SupplierTypeCode = "000"
|
|
|
@@ -184,6 +199,7 @@ func (this *OilSupplierCertAppendSubController) AddAppendSub() {
|
|
|
entity.EffectDate = time.Now()
|
|
|
entity.CreateBy = this.User.Realname
|
|
|
entity.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
|
|
|
+ entity.SupType = 2
|
|
|
|
|
|
isRepeat := false
|
|
|
for j := 0; j < len(list); j++ {
|
|
|
@@ -195,10 +211,11 @@ func (this *OilSupplierCertAppendSubController) AddAppendSub() {
|
|
|
if isRepeat == true {
|
|
|
continue
|
|
|
}
|
|
|
- entity.SupType = 2
|
|
|
svc.InsertEntityBytbl(OilSupplierFileName, &entity)
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
+ var errinfo ErrorDataInfo
|
|
|
if err == nil {
|
|
|
errinfo.Message = "操作成功!"
|
|
|
errinfo.Code = 0
|
|
|
@@ -227,6 +244,10 @@ func (this *OilSupplierCertAppendSubController) AddTechBus() {
|
|
|
svcCert := suppliercert.GetOilSupplierCertService(utils.DBE)
|
|
|
svcCert.GetEntityById(datamain.SupplierCertId, &supplierCertModel)
|
|
|
|
|
|
+ var supplierModel supplier.OilSupplier
|
|
|
+ svcSupplier := supplier.GetOilSupplierService(utils.DBE)
|
|
|
+ svcSupplier.GetEntityById(datamain.SupplierId, &supplierModel)
|
|
|
+
|
|
|
for n := 0; n < len(dataother.CheckList); n++ {
|
|
|
where_sub := "SupplierTypeCode = 03 and SupplierId = '" + strconv.Itoa(dataother.SupplierId) + "'"
|
|
|
where_sub += " and SupplierCertId = '" + strconv.Itoa(dataother.SupplierCertId) + "'"
|
|
|
@@ -236,7 +257,6 @@ func (this *OilSupplierCertAppendSubController) AddTechBus() {
|
|
|
has := svc.GetEntityByWhere(OilSupplierCertSubName, where_sub, &model)
|
|
|
|
|
|
if !has {
|
|
|
- datamain.Type = "2"
|
|
|
datamain.SubClassId = dataother.CheckList[n].Id
|
|
|
datamain.Code = dataother.CheckList[n].Code
|
|
|
datamain.Name = dataother.CheckList[n].Name
|
|
|
@@ -246,38 +266,53 @@ func (this *OilSupplierCertAppendSubController) AddTechBus() {
|
|
|
datamain.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
|
|
|
svc.InsertEntityBytbl(OilSupplierCertSubName, &datamain)
|
|
|
|
|
|
+ paramSvc := baseparameter.GetBaseparameterService(utils.DBE)
|
|
|
filesvc := supplierfile.GetSupplierfileService(utils.DBE)
|
|
|
needList := filesvc.GetTechNeedFileList(dataother.CheckList[n].Id)
|
|
|
|
|
|
if supplierCertModel.InStyle == "4" {
|
|
|
var needFile supplierfile.FileList
|
|
|
- needFile.FileName = "战略合作协议扫描件"
|
|
|
+ needFile.FileName = paramSvc.GetBaseparameterMessage("GFGL", "paramset", "CooperationFile")
|
|
|
needList = append(needList, needFile)
|
|
|
}
|
|
|
|
|
|
var list []supplierfile.OilSupplierFile
|
|
|
where := "SupplierId = '" + strconv.Itoa(dataother.SupplierId) + "'"
|
|
|
svc.GetEntitysByWhere(OilSupplierFileName, where, &list)
|
|
|
- hasField := ""
|
|
|
- for i := 0; i < len(list); i++ {
|
|
|
- hasField += list[i].NeedFileType + ","
|
|
|
- }
|
|
|
- mustField := "营业执照,组织代码,税务登记,开户许可,银行开户许可证,承诺书,企业信息系统截图,战略合作协议扫描件,"
|
|
|
+
|
|
|
+ //三证合一或五证合一不需要的字段
|
|
|
+ mergerCertSkipField := paramSvc.GetBaseparameterMessage("GFGL", "paramset", "MergerCertSkipFieldName")
|
|
|
+
|
|
|
+ //"营业执照,组织代码,组织机构代码证,税务登记证,税务登记,开户许可,银行开户许可证,承诺书,诚信合规承诺书,企业信息系统截图,战略合作协议扫描件,"
|
|
|
+ mustField := paramSvc.GetBaseparameterMessage("GFGL", "paramset", "MustFieldName")
|
|
|
for i := 0; i < len(needList); i++ {
|
|
|
var entity supplierfile.OilSupplierFile
|
|
|
entity.SupplierId = dataother.SupplierId
|
|
|
|
|
|
+ if (supplierModel.CredentialFlag == "1" || supplierModel.CredentialFlag == "2") && strings.Contains(mergerCertSkipField, needList[i].FileName+",") { //三证合一或五证合一了
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ //加入对应表OilSupplierCert2File
|
|
|
+ var cert2File suppliercertsub.OilSupplierCert2File //创建结构体
|
|
|
+ cert2File.SupplierId = dataother.SupplierId
|
|
|
+ cert2File.SupplierCertId = dataother.SupplierCertId
|
|
|
+ cert2File.SupplierTypeCode = dataother.SupplierTypeCode
|
|
|
+ cert2File.SubClassId= dataother.CheckList[n].Id
|
|
|
+ cert2File.Code = dataother.CheckList[n].Code
|
|
|
+ cert2File.Name = dataother.CheckList[n].Name
|
|
|
+ cert2File.NeedFileType = needList[i].FileName
|
|
|
+ svc.InsertEntityBytbl(OilSupplierCert2FileName, &cert2File)
|
|
|
if strings.Contains(mustField, needList[i].FileName+",") {
|
|
|
entity.SupplierTypeCode = "000"
|
|
|
} else {
|
|
|
entity.SupplierTypeCode = dataother.SupplierTypeCode
|
|
|
}
|
|
|
entity.NeedFileType = needList[i].FileName
|
|
|
- entity.SupType = 2
|
|
|
entity.FileType = 1
|
|
|
entity.EffectDate = time.Now()
|
|
|
entity.CreateBy = this.User.Realname
|
|
|
entity.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
|
|
|
+ entity.SupType = 2
|
|
|
|
|
|
isRepeat := false
|
|
|
for j := 0; j < len(list); j++ {
|
|
|
@@ -289,11 +324,13 @@ func (this *OilSupplierCertAppendSubController) AddTechBus() {
|
|
|
if isRepeat == true {
|
|
|
continue
|
|
|
}
|
|
|
+
|
|
|
svc.InsertEntityBytbl(OilSupplierFileName, &entity)
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
var errinfo ErrorDataInfo
|
|
|
errinfo.Message = "操作成功!"
|
|
|
errinfo.Code = 0
|
|
|
@@ -319,7 +356,7 @@ func (this *OilSupplierCertAppendSubController) AddGoodsBus() {
|
|
|
|
|
|
var supplierModel supplier.OilSupplier
|
|
|
svcSupplier := supplier.GetOilSupplierService(utils.DBE)
|
|
|
- svcSupplier.GetEntityById(datamain.SupplierCertId, &supplierModel)
|
|
|
+ svcSupplier.GetEntityById(datamain.SupplierId, &supplierModel)
|
|
|
|
|
|
for n := 0; n < len(dataother.CheckList); n++ {
|
|
|
where_sub := "SupplierTypeCode = 01 and SupplierId = '" + strconv.Itoa(dataother.SupplierId) + "'"
|
|
|
@@ -330,7 +367,6 @@ func (this *OilSupplierCertAppendSubController) AddGoodsBus() {
|
|
|
has := svc.GetEntityByWhere(OilSupplierCertSubName, where_sub, &model)
|
|
|
|
|
|
if !has {
|
|
|
- datamain.Type = "2"
|
|
|
datamain.SubClassId, _ = utils.StrTo(dataother.CheckList[n].Id).Int()
|
|
|
datamain.Code = dataother.CheckList[n].Code
|
|
|
datamain.Name = dataother.CheckList[n].Name
|
|
|
@@ -353,14 +389,12 @@ func (this *OilSupplierCertAppendSubController) AddGoodsBus() {
|
|
|
var list []supplierfile.OilSupplierFile
|
|
|
where := "SupplierId = '" + strconv.Itoa(dataother.SupplierId) + "'"
|
|
|
svc.GetEntitysByWhere(OilSupplierFileName, where, &list)
|
|
|
- hasField := ""
|
|
|
- for i := 0; i < len(list); i++ {
|
|
|
- hasField += list[i].NeedFileType + ","
|
|
|
- }
|
|
|
+
|
|
|
//三证合一或五证合一不需要的字段
|
|
|
mergerCertSkipField := paramSvc.GetBaseparameterMessage("GFGL", "paramset", "MergerCertSkipFieldName")
|
|
|
//"营业执照,组织代码,组织机构代码证,税务登记证,税务登记,开户许可,银行开户许可证,承诺书,诚信合规承诺书,企业信息系统截图,战略合作协议扫描件,"
|
|
|
mustField := paramSvc.GetBaseparameterMessage("GFGL", "paramset", "MustFieldName")
|
|
|
+
|
|
|
for i := 0; i < len(needList); i++ {
|
|
|
var entity supplierfile.OilSupplierFile
|
|
|
entity.SupplierId = dataother.SupplierId
|
|
|
@@ -368,6 +402,16 @@ func (this *OilSupplierCertAppendSubController) AddGoodsBus() {
|
|
|
if (supplierModel.CredentialFlag == "1" || supplierModel.CredentialFlag == "2") && strings.Contains(mergerCertSkipField, needList[i].FileName+",") { //三证合一或五证合一了
|
|
|
continue
|
|
|
}
|
|
|
+ //加入对应表OilSupplierCert2File
|
|
|
+ var cert2File suppliercertsub.OilSupplierCert2File //创建结构体
|
|
|
+ cert2File.SupplierId = dataother.SupplierId
|
|
|
+ cert2File.SupplierCertId = dataother.SupplierCertId
|
|
|
+ cert2File.SupplierTypeCode = dataother.SupplierTypeCode
|
|
|
+ cert2File.SubClassId, _ = utils.StrTo(dataother.CheckList[n].Id).Int()
|
|
|
+ cert2File.Code = dataother.CheckList[n].Code
|
|
|
+ cert2File.Name = dataother.CheckList[n].Name
|
|
|
+ cert2File.NeedFileType = needList[i].FileName
|
|
|
+ svc.InsertEntityBytbl(OilSupplierCert2FileName, &cert2File)
|
|
|
|
|
|
if strings.Contains(mustField, needList[i].FileName+",") {
|
|
|
entity.SupplierTypeCode = "000"
|
|
|
@@ -376,10 +420,10 @@ func (this *OilSupplierCertAppendSubController) AddGoodsBus() {
|
|
|
}
|
|
|
entity.NeedFileType = needList[i].FileName
|
|
|
entity.FileType = 1
|
|
|
- entity.SupType = 2
|
|
|
entity.EffectDate = time.Now()
|
|
|
entity.CreateBy = this.User.Realname
|
|
|
entity.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
|
|
|
+ entity.SupType = 2
|
|
|
|
|
|
isRepeat := false
|
|
|
for j := 0; j < len(list); j++ {
|