Răsfoiți Sursa

bug

Signed-off-by: lijunqing <lijunqing@dashoo.cn>
lijunqing 6 ani în urmă
părinte
comite
129344d73d

+ 5 - 6
src/dashoo.cn/backend/api/business/oilsupplier/suppliercert/oilsuppliercertService.go

@@ -116,17 +116,16 @@ func (s *OilSupplierCertService) SubmitOrgAudit(certId, wfName, wfNodeCode, user
 }
 
 //查询已经申请的准入记录
-func (s *OilSupplierCertService) IsCanApplyByExtOrganizeUser(applyType, departmentId, userId string, isCompanyUser int) bool {
+func (s *OilSupplierCertService) IsCanApplyByExtOrganizeUser(applyType, commercialNo, userId string, isCompanyUser int) bool {
 
 	/*parameterSvc := baseparameter.GetBaseparameterService(s.DBE) //取出外部门ID
 	extOrganizeId := parameterSvc.GetBaseparameterMessage("GFGL", "paramset", "ExtOrganizeId")
 	if extOrganizeId == departmentId {*/
 	if isCompanyUser == 1 {
-		where := " SupplierTypeCode = '" + applyType + "'"
-		where += " and CreateUserId = '" + userId + "'"
-		var model OilSupplierCert
-		count, _ := s.GetCount(&model, where)
-		if count > 0 {
+		var tempMap []map[string]string
+		sql:= "select 1 from OilSupplier a left join OilSupplierCert b on a.Id=b.SupplierId where b.SupplierTypeCode = '" + applyType + "' and (b.CreateUserId = '" + userId + "' or a.CommercialNo='"+commercialNo+"')"
+		tempMap,_=s.DBE.QueryString(sql)
+		if tempMap!=nil && tempMap[0]["1"] !="" {
 			return false
 		}
 	}

+ 4 - 1
src/dashoo.cn/backend/api/controllers/oilsupplier/supplier.go

@@ -1800,7 +1800,10 @@ func (this *OilSupplierController) IsCanApply() {
 	}
 
 	svc := suppliercert.GetOilSupplierCertService(utils.DBE)
-	canApply := svc.IsCanApplyByExtOrganizeUser(Type, this.User.DepartmentId, this.User.Id, this.User.IsCompanyUser)
+	var registerUser register.OilCorporateInfo
+	sql := " UserName='" + this.User.Username + "'"
+	svc.GetEntity(&registerUser,sql)
+	canApply := svc.IsCanApplyByExtOrganizeUser(Type, registerUser.CommercialNo, this.User.Id, this.User.IsCompanyUser)
 
 	if canApply {
 		errinfo.Message = "无申请记录,可以申请"