Pārlūkot izejas kodu

申请只有创建人才能提交

wd 4 gadi atpakaļ
vecāks
revīzija
f3c89ea027

+ 13 - 6
src/dashoo.cn/backend/api/controllers/oilsupplier/annualaudit.go

@@ -826,6 +826,10 @@ func (this *AnnualAuditController) CompanyAuditEntity() {
 	srv.GetEntityById(annualId, &annualEntity)
 	//srv.IsSupplierCertCanSubmit(strconv.Itoa(supplierCertEntity.Id), certId) TODO 参数检查
 
+	if this.User.Realname != annualEntity.CreateBy {
+		panic("只有申请创建人才能提交,当前申请创建人是 " + annualEntity.CreateBy)
+	}
+
 	//取出企业主表
 	supplierSvc := supplier.GetOilSupplierService(utils.DBE)
 	var supplierEntity supplier.OilSupplier
@@ -937,6 +941,10 @@ func (this *AnnualAuditController) SeparateUnitSubmitAuditEntity() {
 	var supplierEntity supplier.OilSupplier
 	svc.GetEntityById(auditEntity.SupplierId, &supplierEntity)
 
+	if this.User.Realname != auditEntity.CreateBy {
+		panic("只有申请创建人才能提交,当前申请创建人是 " + auditEntity.CreateBy)
+	}
+
 	svcActiviti := workflow.GetActivitiService(utils.DBE)
 	//启动工作流
 	businessKey := auditEntity.BusinessKey
@@ -1794,8 +1802,7 @@ func (this *AnnualAuditController) EditQualChange() {
 	supplierfile.ModifiedUserId, _ = strconv.Atoi(this.User.Id)
 	supplierfile.ModifiedBy = this.User.Realname
 	supplierfile.OtherRemark = model.Remark
-	svc.UpdateEntityBywheretbl(OilSupplierFileName, &supplierfile, []string{"EffectDate", "FileUrl", "FileName", "ModifiedOn", "ModifiedUserId", "ModifiedBy", "OtherRemark"}, "Id = " + strconv.Itoa(model.Id))
-
+	svc.UpdateEntityBywheretbl(OilSupplierFileName, &supplierfile, []string{"EffectDate", "FileUrl", "FileName", "ModifiedOn", "ModifiedUserId", "ModifiedBy", "OtherRemark"}, "Id = "+strconv.Itoa(model.Id))
 
 	var err error
 	var entity annualaudit.OilAnnualChangeDetail
@@ -1889,7 +1896,7 @@ func (this *AnnualAuditController) DeleteAddFile() {
 	svc := infochange.GetInfoChangeService(utils.DBE)
 
 	var file supplierfile.OilSupplierFile
-	has1 := svc.GetEntity(&file, "Id=" + Id)
+	has1 := svc.GetEntity(&file, "Id="+Id)
 	if !has1 {
 		errinfo.Message = "删除失败"
 		errinfo.Code = -1
@@ -1899,11 +1906,11 @@ func (this *AnnualAuditController) DeleteAddFile() {
 	}
 	// 如果有正在进行中的流程,不允许删除任何资质
 	var certList []suppliercert.OilSupplierCert
-	svc.GetEntitysByWhere(OilSupplierCertName, "Status > 0 and Status < 8 and SupplierId = " + strconv.Itoa(file.SupplierId), &certList)
+	svc.GetEntitysByWhere(OilSupplierCertName, "Status > 0 and Status < 8 and SupplierId = "+strconv.Itoa(file.SupplierId), &certList)
 	var appendList suppliercertappend.OilSupplierCertAppend
-	svc.GetEntityByWhere(OilSupplierCertAppendName, "Status > 0 and Status < 8 and SupplierId = " + strconv.Itoa(file.SupplierId), &appendList)
+	svc.GetEntityByWhere(OilSupplierCertAppendName, "Status > 0 and Status < 8 and SupplierId = "+strconv.Itoa(file.SupplierId), &appendList)
 	var infoList infochange.OilInfoChange
-	svc.GetEntityByWhere(OilInfoChangeName, "Status > 0 and Status < 8 and SupplierId = " + strconv.Itoa(file.SupplierId), &infoList)
+	svc.GetEntityByWhere(OilInfoChangeName, "Status > 0 and Status < 8 and SupplierId = "+strconv.Itoa(file.SupplierId), &infoList)
 	if len(certList) > 0 || appendList.Id > 0 || infoList.Id > 0 {
 		errinfo.Message = "有正在审核中的流程,不允许删除任何资质"
 		errinfo.Code = -1

+ 13 - 3
src/dashoo.cn/backend/api/controllers/oilsupplier/infochange.go

@@ -828,11 +828,11 @@ func (this *InfoChangeController) DelFile() {
 	}
 	// 如果有正在进行中的流程,不允许删除任何资质
 	var certList []suppliercert.OilSupplierCert
-	svc.GetEntitysByWhere(OilSupplierCertName, "Status > 0 and Status < 8 and SupplierId = " + strconv.Itoa(file.SupplierId), &certList)
+	svc.GetEntitysByWhere(OilSupplierCertName, "Status > 0 and Status < 8 and SupplierId = "+strconv.Itoa(file.SupplierId), &certList)
 	var appendList suppliercertappend.OilSupplierCertAppend
-	svc.GetEntityByWhere(OilSupplierCertAppendName, "Status > 0 and Status < 8 and SupplierId = " + strconv.Itoa(file.SupplierId), &appendList)
+	svc.GetEntityByWhere(OilSupplierCertAppendName, "Status > 0 and Status < 8 and SupplierId = "+strconv.Itoa(file.SupplierId), &appendList)
 	var annualList annualaudit.OilAnnualAudit
-	svc.GetEntityByWhere(OilAnnualAuditName, "Status > 0 and Status < 8 and SupplierId = " + strconv.Itoa(file.SupplierId), &annualList)
+	svc.GetEntityByWhere(OilAnnualAuditName, "Status > 0 and Status < 8 and SupplierId = "+strconv.Itoa(file.SupplierId), &annualList)
 	if len(certList) > 0 || appendList.Id > 0 || annualList.Id > 0 {
 		errinfo.Message = "有正在审核中的流程,不允许删除任何资质"
 		errinfo.Code = -1
@@ -1622,6 +1622,11 @@ func (this *InfoChangeController) CompanyAuditEntity() {
 	infoSrv := infochange.GetInfoChangeService(utils.DBE)
 	var infoChangeEntity infochange.OilInfoChange
 	infoSrv.GetEntityById(infoId, &infoChangeEntity)
+
+	if this.User.Realname != infoChangeEntity.CreateBy {
+		panic("只有申请创建人才能提交,当前申请创建人是 " + infoChangeEntity.CreateBy)
+	}
+
 	// TODO 检查是否可以提交
 	//infoSrv.IsSupplierCertCanSubmit(strconv.Itoa(supplierCertEntity.Id), certId)
 
@@ -1731,6 +1736,11 @@ func (this *InfoChangeController) UnitAuditEntity() {
 	svc := infochange.GetInfoChangeService(utils.DBE)
 	var infoChangeEntity infochange.OilInfoChange
 	svc.GetEntityById(infoId, &infoChangeEntity)
+
+	if this.User.Realname != infoChangeEntity.CreateBy {
+		panic("只有申请创建人才能提交,当前申请创建人是 " + infoChangeEntity.CreateBy)
+	}
+
 	// TODO 检查是否可提交
 	//svc.IsSupplierCertCanSubmit(strconv.Itoa(supplierCertEntity.Id), certId)
 	//取出企业主表

+ 9 - 0
src/dashoo.cn/backend/api/controllers/oilsupplier/suppliercert.go

@@ -672,6 +672,10 @@ func (this *OilSupplierCertController) CompanyAuditEntity() {
 	certSrv.GetEntityById(certId, &supplierCertEntity)
 	certSrv.IsSupplierCertCanSubmit(strconv.Itoa(supplierCertEntity.SupplierId), certId)
 
+	if this.User.Realname != supplierCertEntity.CreateBy {
+		panic("只有申请创建人才能提交,当前申请创建人是 " + supplierCertEntity.CreateBy)
+	}
+
 	stepCode := workflow.GetWorkFlowStepCode(supplierCertEntity.SupplierTypeCode)
 	auditSettingService := auditsetting.GetOilAuditSettingService(utils.DBE)
 	approverIds := auditSettingService.GetApproverIdsByStepCodeAndUnitId(stepCode, unitId)
@@ -786,6 +790,11 @@ func (this *OilSupplierCertController) UnitAuditEntity() {
 	certSrv := suppliercert.GetOilSupplierCertService(utils.DBE)
 	var supplierCertEntity suppliercert.OilSupplierCert
 	certSrv.GetEntityById(certId, &supplierCertEntity)
+
+	if this.User.Realname != supplierCertEntity.CreateBy {
+		panic("只有申请创建人才能提交,当前申请创建人是 " + supplierCertEntity.CreateBy)
+	}
+
 	//检查是否可提交
 	certSrv.IsSupplierCertCanSubmit(strconv.Itoa(supplierCertEntity.SupplierId), certId)
 	//取出企业主表

+ 13 - 4
src/dashoo.cn/backend/api/controllers/oilsupplier/suppliercertappend.go

@@ -732,6 +732,11 @@ func (this *OilSupplierCertAppendController) CompanySubmitAuditEntity() {
 	certSrv := suppliercertappend.GetOilSupplierCertAppendService(utils.DBE)
 	var supplierCertAppendEntity suppliercertappend.OilSupplierCertAppend
 	certSrv.GetEntityById(certAppendId, &supplierCertAppendEntity)
+
+	if this.User.Realname != supplierCertAppendEntity.CreateBy {
+		panic("只有申请创建人才能提交,当前申请创建人是 " + supplierCertAppendEntity.CreateBy)
+	}
+
 	// 检查是否允许提交
 	certSrv.IsSupplierCertAppendCanSubmit(strconv.Itoa(supplierCertAppendEntity.SupplierId), certAppendId)
 
@@ -845,6 +850,10 @@ func (this *OilSupplierCertAppendController) SeparateUnitSubmitAuditEntity() {
 	var supplierEntity supplier.OilSupplier
 	certSrv.GetEntityById(supplierCertAppendEntity.SupplierId, &supplierEntity)
 
+	if this.User.Realname != supplierCertAppendEntity.CreateBy {
+		panic("只有申请创建人才能提交,当前申请创建人是 " + supplierCertAppendEntity.CreateBy)
+	}
+
 	svcActiviti := workflow.GetActivitiService(utils.DBE)
 	//启动工作流
 	businessKey := supplierCertAppendEntity.BusinessKey
@@ -1878,7 +1887,7 @@ func (this *OilSupplierCertAppendController) DeleteNewFile() {
 	svc := infochange.GetInfoChangeService(utils.DBE)
 
 	var file supplierfile.OilSupplierFile
-	has1 := svc.GetEntity(&file, "Id=" + Id)
+	has1 := svc.GetEntity(&file, "Id="+Id)
 	if !has1 {
 		errinfo.Message = "删除失败"
 		errinfo.Code = -1
@@ -1888,11 +1897,11 @@ func (this *OilSupplierCertAppendController) DeleteNewFile() {
 	}
 	// 如果有正在进行中的流程,不允许删除任何资质
 	var certList []suppliercert.OilSupplierCert
-	svc.GetEntitysByWhere(OilSupplierCertName, "Status > 0 and Status < 8 and SupplierId = " + strconv.Itoa(file.SupplierId), &certList)
+	svc.GetEntitysByWhere(OilSupplierCertName, "Status > 0 and Status < 8 and SupplierId = "+strconv.Itoa(file.SupplierId), &certList)
 	var annualList annualaudit.OilAnnualAudit
-	svc.GetEntityByWhere(OilAnnualAuditName, "Status > 0 and Status < 8 and SupplierId = " + strconv.Itoa(file.SupplierId), &annualList)
+	svc.GetEntityByWhere(OilAnnualAuditName, "Status > 0 and Status < 8 and SupplierId = "+strconv.Itoa(file.SupplierId), &annualList)
 	var infoList infochange.OilInfoChange
-	svc.GetEntityByWhere(OilInfoChangeName, "Status > 0 and Status < 8 and SupplierId = " + strconv.Itoa(file.SupplierId), &infoList)
+	svc.GetEntityByWhere(OilInfoChangeName, "Status > 0 and Status < 8 and SupplierId = "+strconv.Itoa(file.SupplierId), &infoList)
 	if len(certList) > 0 || annualList.Id > 0 || infoList.Id > 0 {
 		errinfo.Message = "有正在审核中的流程,不允许删除任何资质"
 		errinfo.Code = -1