oilsuppliercertCheckStatus.go 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. package suppliercertcommon
  2. import (
  3. "dashoo.cn/backend/api/business/oilsupplier/supplier"
  4. "dashoo.cn/backend/api/business/oilsupplier/suppliercert"
  5. "dashoo.cn/backend/api/business/paymentinfo"
  6. . "dashoo.cn/backend/api/mydb"
  7. "dashoo.cn/utils"
  8. "github.com/go-xorm/xorm"
  9. )
  10. type OilSupplierCertCheckStatus struct {
  11. MyServiceBase
  12. }
  13. func GetOilSupplierCertCheckStatusService(xormEngine *xorm.Engine) *OilSupplierCertCheckStatus {
  14. s := new(OilSupplierCertCheckStatus)
  15. s.DBE = xormEngine
  16. return s
  17. }
  18. func (s *OilSupplierCertCheckStatus) CheckOilSupplierCertIsNeedPay(certId string) int {
  19. var supplierCertEntity suppliercert.OilSupplierCert
  20. s.GetEntityById(certId, &supplierCertEntity)
  21. // 2021年05月11日 企管确认:准入申请,级别为1级的不交费且不考虑准入方式;2级的按原准入方式确定是否收费
  22. svcSupplier := supplier.GetOilSupplierService(utils.DBE)
  23. var supplierEntity supplier.OilSupplier
  24. svcSupplier.GetEntityById(supplierCertEntity.SupplierId, &supplierEntity)
  25. if supplierEntity.Id == 0 {
  26. return 1
  27. }
  28. if supplierEntity.Grade == "1" {
  29. return 2
  30. }
  31. var isPayList []string
  32. isPayList = append(isPayList, suppliercert.PINGSHEN)
  33. isPayList = append(isPayList, suppliercert.WAIBUSHICHANG)
  34. var unPayList []string
  35. unPayList = append(unPayList, suppliercert.YIJIWUZI)
  36. unPayList = append(unPayList, suppliercert.ERJIWUZI)
  37. unPayList = append(unPayList, suppliercert.ZHANLUEHEZUO)
  38. unPayList = append(unPayList, suppliercert.NEIBUDUOYUAN)
  39. result := 0
  40. isPay := "false"
  41. unPay := "false"
  42. for _, eachItem := range isPayList {
  43. if eachItem == supplierCertEntity.InStyle {
  44. // 需要付费
  45. isPay = "true"
  46. result = 1
  47. break
  48. }
  49. }
  50. for _, eachItem := range unPayList {
  51. if eachItem == supplierCertEntity.InStyle {
  52. // 不需要付费
  53. unPay = "true"
  54. result = 2
  55. break
  56. }
  57. }
  58. if isPay == unPay {
  59. // 准入类型是否付费有误!请联系管理员
  60. result = 0
  61. }
  62. return result
  63. }
  64. func (s *OilSupplierCertCheckStatus) CheckOilSupplierCertIsNeedConcentrateAudit(certId string) int {
  65. var supplierCertEntity suppliercert.OilSupplierCert
  66. s.GetEntityById(certId, &supplierCertEntity)
  67. // 需要集中评审的准入类型
  68. var concentrateInStyleList []string
  69. concentrateInStyleList = append(concentrateInStyleList, suppliercert.PINGSHEN)
  70. concentrateInStyleList = append(concentrateInStyleList, suppliercert.NEIBUDUOYUAN)
  71. // 不需要集中评审的准入类型
  72. var unConcentrateInStyleList []string
  73. unConcentrateInStyleList = append(unConcentrateInStyleList, suppliercert.YIJIWUZI)
  74. unConcentrateInStyleList = append(unConcentrateInStyleList, suppliercert.ERJIWUZI)
  75. unConcentrateInStyleList = append(unConcentrateInStyleList, suppliercert.ZHANLUEHEZUO)
  76. unConcentrateInStyleList = append(unConcentrateInStyleList, suppliercert.WAIBUSHICHANG)
  77. result := 0
  78. isConcentrateAudit := "false"
  79. unConcentrateAudit := "false"
  80. for _, eachItem := range concentrateInStyleList {
  81. if eachItem == supplierCertEntity.InStyle {
  82. // 需要集中评审
  83. isConcentrateAudit = "true"
  84. result = 1
  85. break
  86. }
  87. }
  88. for _, eachItem := range unConcentrateInStyleList {
  89. if eachItem == supplierCertEntity.InStyle {
  90. // 不需要集中评审
  91. unConcentrateAudit = "true"
  92. result = 2
  93. break
  94. }
  95. }
  96. if isConcentrateAudit == unConcentrateAudit {
  97. // 准入类型评审方式错误!请联系管理员
  98. result = 0
  99. }
  100. return result
  101. }
  102. func (s *OilSupplierCertCheckStatus) CheckOilSupplierCertHavePayed(certId string) bool {
  103. var paymentInfoEntity paymentinfo.OilPaymentInfo
  104. where := " isPay='2' and SrcId='" + certId + "' and SupplierCertId='" + certId + "' "
  105. s.GetEntityByWhere("OilPaymentInfo", where, &paymentInfoEntity)
  106. if paymentInfoEntity.Id > 0 {
  107. return true
  108. } else {
  109. return false
  110. }
  111. }