Browse Source

后端: 快照记录子申请表信息及年审中的人员结构(准入表)

baichengfei 5 years ago
parent
commit
a4bec99dfb

+ 2 - 0
src/dashoo.cn/backend/api/business/oilsupplier/supplierlog/supplierlog.go

@@ -11,6 +11,8 @@ type OilSupplierLog struct {
 	NewSupplierName   string    `xorm:"VARCHAR(255)"` // 新公司名称
 	NewCommercialNo   string    `xorm:"VARCHAR(255)"` // 新统一社会信用代码
 	OperType          int       `xorm:"INT(10)"`      // 快照类型 1准入 2增项 3年审 4资质信息变更
+	ApplyInfo         string    `xorm:"TEXT"`         // 各申请子表的信息
+	AnnualToCertInfo  string    `xorm:"TEXT"`         // 年审中要用到的准入表中人员结构
 	CertFile          string    `xorm:"TEXT"`         // 企业资质列表
 	CertSub           string    `xorm:"TEXT"`         // 企业资质列表
 	AgencyManufacture string    `xorm:"TEXT"`         // 所代理制造商名称列表

+ 14 - 7
src/dashoo.cn/backend/api/business/oilsupplier/supplierlog/supplierlogService.go

@@ -32,11 +32,6 @@ type SupplierlogService struct {
 	MyServiceBase
 }
 
-//type SupplierBaseInfo struct {
-//	BaseInfo	string	`json:"baseInfo"`	// OilSupplier
-//	ChangeItems	string	`json:"changeItems"`	//OilAppendChangeItem
-//}
-
 type SupplierAppendBaseInfo struct {
 	BaseInfo    supplier.OilSupplier
 	ChangeItems []suppliercertappendsub.OilAppendChangeItem
@@ -109,6 +104,7 @@ func (s *SupplierlogService) SaveSupplierLogForAccess(supplierId int, supplierCe
 
 		// json 化数据
 		supplierBaseInfo, _ := json.Marshal(supplierEntity)
+		accessCertInfo, _ := json.Marshal(supplierCertEntity)
 		agencyManufacture, _ := json.Marshal(manufList)
 		inspectionReport, _ := json.Marshal(sceneFileList)
 		majorEquipment, _ := json.Marshal(majorEquipmentList)
@@ -125,6 +121,7 @@ func (s *SupplierlogService) SaveSupplierLogForAccess(supplierId int, supplierCe
 		model.NewSupplierName = supplierEntity.SupplierName
 		model.NewCommercialNo = supplierEntity.CommercialNo
 		model.OperType = 1
+		model.ApplyInfo = string(accessCertInfo)
 		model.BaseInfo = string(supplierBaseInfo)
 		model.AgencyManufacture = string(agencyManufacture)
 		model.InspectionReport = string(inspectionReport)
@@ -186,6 +183,7 @@ func (s *SupplierlogService) SaveSupplierLogForAppend(supplierId int, supplierCe
 		appendBaseInfo.BaseInfo = supplierEntity
 		appendBaseInfo.ChangeItems = changeInfoItems
 		baseInfo, _ := json.Marshal(appendBaseInfo)
+		appendCertInfo, _ := json.Marshal(appendCertEntity)
 
 		// 插入日志信息
 		var model OilSupplierLog
@@ -194,6 +192,7 @@ func (s *SupplierlogService) SaveSupplierLogForAppend(supplierId int, supplierCe
 		model.NewSupplierName = supplierEntity.SupplierName
 		model.NewCommercialNo = supplierEntity.CommercialNo
 		model.OperType = 2
+		model.ApplyInfo = string(appendCertInfo)
 		model.BaseInfo = string(baseInfo)
 		model.CertFile = string(certFile)
 		model.CertSub = string(certSub)
@@ -222,6 +221,10 @@ func (s *SupplierlogService) SaveSupplierLogForAnnual(supplierId int, annualId i
 		supplierSrv := supplier.GetOilSupplierService(utils.DBE)
 		var supplierEntity supplier.OilSupplier
 		supplierSrv.GetEntityById(annualEntity.SupplierId, &supplierEntity)
+		// 基本准入信息 为获取人员结构信息
+		accessCertSrv := suppliercert.GetOilSupplierCertService(utils.DBE)
+		var accessCertEntity suppliercert.OilSupplierCert
+		accessCertSrv.GetEntityById(annualEntity.CerId, &accessCertEntity)
 		// 企业基本信息 变更项
 		var changeInfoItems []infochange.OilAnnualChangeItem
 		whereAnnual := " InfoId = " + strconv.Itoa(annualId)
@@ -258,14 +261,14 @@ func (s *SupplierlogService) SaveSupplierLogForAnnual(supplierId int, annualId i
 		certSubSrv.GetEntitysByWhere("OilSupplierCertSub", whereSupplier+" and "+whereSupplierCert+" and SupplierTypeCode="+annualEntity.SupplierTypeName, &certSubList)
 
 		// json 化数据
-		//supplierBaseInfo, _ := json.Marshal(supplierEntity)
-		//supplierBaseInfoChangeItem, _ := json.Marshal(changeInfoItems)
+		annualInfo, _ := json.Marshal(annualEntity)
 		majorEquipment, _ := json.Marshal(majorEquipmentList)
 		threeYearsPerformance, _ := json.Marshal(threeYearsPerformanceList)
 		patentTech, _ := json.Marshal(patentTechList)
 		winingPro, _ := json.Marshal(winingProList)
 		certFile, _ := json.Marshal(annualCertFileList)
 		certSub, _ := json.Marshal(certSubList)
+		accessInfo, _ := json.Marshal(accessCertEntity)
 
 		var annualBaseInfo SupplierAnnualBaseInfo
 		annualBaseInfo.BaseInfo = supplierEntity
@@ -280,6 +283,8 @@ func (s *SupplierlogService) SaveSupplierLogForAnnual(supplierId int, annualId i
 		model.NewCommercialNo = supplierEntity.CommercialNo
 		model.OperType = 3 // 年审
 		model.BaseInfo = string(baseInfo)
+		model.ApplyInfo = string(annualInfo)
+		model.AnnualToCertInfo = string(accessInfo)
 		model.Equipment = string(majorEquipment)
 		model.Performance = string(threeYearsPerformance)
 		model.Patent = string(patentTech)
@@ -332,6 +337,7 @@ func (s *SupplierlogService) SaveSupplierLogForInfoChange(supplierId int, infoCh
 		infoChangeBaseInfo.BaseInfo = supplierEntity
 		infoChangeBaseInfo.ChangeItems = changeInfoItems
 		baseInfo, _ := json.Marshal(infoChangeBaseInfo)
+		changeInfo, _ := json.Marshal(infoChangeEntity)
 
 		// 插入日志信息
 		var model OilSupplierLog
@@ -341,6 +347,7 @@ func (s *SupplierlogService) SaveSupplierLogForInfoChange(supplierId int, infoCh
 		model.NewCommercialNo = supplierEntity.CommercialNo
 		model.OperType = 4
 		model.BaseInfo = string(baseInfo)
+		model.ApplyInfo = string(changeInfo)
 		model.CertFile = string(certFile)
 		model.CreateOn = time.Now()
 		_, err := s.InsertEntity(&model)