| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 |
- package suppliercertcommon
- import (
- "dashoo.cn/backend/api/business/oilsupplier/supplier"
- "dashoo.cn/backend/api/business/oilsupplier/suppliercert"
- "dashoo.cn/backend/api/business/paymentinfo"
- . "dashoo.cn/backend/api/mydb"
- "dashoo.cn/utils"
- "github.com/go-xorm/xorm"
- )
- 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)
- // 2021年05月11日 企管确认:准入申请,级别为1级的不交费且不考虑准入方式;2级的按原准入方式确定是否收费
- svcSupplier := supplier.GetOilSupplierService(utils.DBE)
- var supplierEntity supplier.OilSupplier
- svcSupplier.GetEntityById(supplierCertEntity.SupplierId, &supplierEntity)
- if supplierEntity.Id == 0 {
- return 1
- }
- if supplierEntity.Grade == "1" {
- return 2
- }
- 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
- }
- func (s *OilSupplierCertCheckStatus) CheckOilSupplierCertHavePayed(certId string) bool {
- var paymentInfoEntity paymentinfo.OilPaymentInfo
- where := " isPay='2' and SrcId='" + certId + "' and SupplierCertId='" + certId + "' "
- s.GetEntityByWhere("OilPaymentInfo", where, &paymentInfoEntity)
- if paymentInfoEntity.Id > 0 {
- return true
- } else {
- return false
- }
- }
|