|
|
@@ -0,0 +1,101 @@
|
|
|
+package suppliercert
|
|
|
+
|
|
|
+import (
|
|
|
+ . "dashoo.cn/backend/api/mydb"
|
|
|
+ "github.com/go-xorm/xorm"
|
|
|
+ "supplier_system/src/dashoo.cn/backend/api/business/oilsupplier/suppliercert"
|
|
|
+)
|
|
|
+
|
|
|
+type OilSupplierCertCheckStatus struct {
|
|
|
+ MyServiceBase
|
|
|
+}
|
|
|
+
|
|
|
+func GetOilSupplierCertCheckStatusService(xormEngine *xorm.Engine) *OilSupplierCertCheckStatus {
|
|
|
+ s := new(OilSupplierCertCheckStatus)
|
|
|
+ s.DBE = xormEngine
|
|
|
+ return s
|
|
|
+}
|
|
|
+
|
|
|
+func (s *OilSupplierCertCheckStatus) CheckOilSupplierCertIsNeedPay(certId string) int {
|
|
|
+ var supplierCertEntity suppliercert.OilSupplierCert
|
|
|
+ s.GetEntityById(certId, &supplierCertEntity)
|
|
|
+
|
|
|
+ var isPayList []string
|
|
|
+ isPayList = append(isPayList, suppliercert.PINGSHEN)
|
|
|
+ isPayList = append(isPayList, suppliercert.WAIBUSHICHANG)
|
|
|
+ var unPayList []string
|
|
|
+ unPayList = append(unPayList, suppliercert.YIJIWUZI)
|
|
|
+ unPayList = append(unPayList, suppliercert.ERJIWUZI)
|
|
|
+ unPayList = append(unPayList, suppliercert.ZHANLUEHEZUO)
|
|
|
+ unPayList = append(unPayList, suppliercert.NEIBUDUOYUAN)
|
|
|
+
|
|
|
+ result := 0
|
|
|
+ isPay := "false"
|
|
|
+ unPay := "false"
|
|
|
+ for _, eachItem := range isPayList {
|
|
|
+ if eachItem == supplierCertEntity.InStyle {
|
|
|
+ // 需要付费
|
|
|
+ isPay = "true"
|
|
|
+ result = 1
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for _, eachItem := range unPayList {
|
|
|
+ if eachItem == supplierCertEntity.InStyle {
|
|
|
+ // 不需要付费
|
|
|
+ unPay = "true"
|
|
|
+ result = 2
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if isPay == unPay {
|
|
|
+ // 准入类型是否付费有误!请联系管理员
|
|
|
+ result = 0
|
|
|
+ }
|
|
|
+
|
|
|
+ return result
|
|
|
+}
|
|
|
+
|
|
|
+func (s *OilSupplierCertCheckStatus) CheckOilSupplierCertIsNeedConcentrateAudit(certId string) int {
|
|
|
+ var supplierCertEntity suppliercert.OilSupplierCert
|
|
|
+ s.GetEntityById(certId, &supplierCertEntity)
|
|
|
+
|
|
|
+ // 需要集中评审的准入类型
|
|
|
+ var concentrateInStyleList []string
|
|
|
+ concentrateInStyleList = append(concentrateInStyleList, suppliercert.PINGSHEN)
|
|
|
+ concentrateInStyleList = append(concentrateInStyleList, suppliercert.NEIBUDUOYUAN)
|
|
|
+ // 不需要集中评审的准入类型
|
|
|
+ var unConcentrateInStyleList []string
|
|
|
+ unConcentrateInStyleList = append(unConcentrateInStyleList, suppliercert.YIJIWUZI)
|
|
|
+ unConcentrateInStyleList = append(unConcentrateInStyleList, suppliercert.ERJIWUZI)
|
|
|
+ unConcentrateInStyleList = append(unConcentrateInStyleList, suppliercert.ZHANLUEHEZUO)
|
|
|
+ unConcentrateInStyleList = append(unConcentrateInStyleList, suppliercert.WAIBUSHICHANG)
|
|
|
+
|
|
|
+ result := 0
|
|
|
+ isConcentrateAudit := "false"
|
|
|
+ unConcentrateAudit := "false"
|
|
|
+ for _, eachItem := range concentrateInStyleList {
|
|
|
+ if eachItem == supplierCertEntity.InStyle {
|
|
|
+ // 需要集中评审
|
|
|
+ isConcentrateAudit = "true"
|
|
|
+ result = 1
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for _, eachItem := range unConcentrateInStyleList {
|
|
|
+ if eachItem == supplierCertEntity.InStyle {
|
|
|
+ // 不需要集中评审
|
|
|
+ unConcentrateAudit = "true"
|
|
|
+ result = 2
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if isConcentrateAudit == unConcentrateAudit {
|
|
|
+ // 准入类型评审方式错误!请联系管理员
|
|
|
+ result = 0
|
|
|
+ }
|
|
|
+
|
|
|
+ return result
|
|
|
+}
|
|
|
+
|