|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237 |
- package svc
-
- import (
- "applet/app/e"
- "applet/app/enum"
- "applet/app/md"
- "applet/app/utils"
- db "code.fnuoos.com/zhimeng/model.git/src"
- implement2 "code.fnuoos.com/zhimeng/model.git/src/implement"
- "code.fnuoos.com/zhimeng/model.git/src/super/implement"
- "github.com/gin-gonic/gin"
- "github.com/jinzhu/copier"
- )
-
- func MediumQualificationEnterprise(c *gin.Context, minState int, req md.MediumQualificationEnterpriseReq) md.MediumQualificationEnterpriseRes {
-
- engine := db.Db
- MediumListDb := implement.NewMediumListDb(engine)
- MediumList, total, _ := MediumListDb.FindMediumList(c.GetString("mid"), req.Name, req.State, minState, utils.StrToInt(req.Page), utils.StrToInt(req.Limit))
- data := make([]md.MediumQualificationEnterpriseData, 0)
- if len(MediumList) > 0 {
- NewMediumDb := implement2.NewMediumDb(MasterDb(c))
- for _, v := range MediumList {
- var tmp md.MediumQualificationEnterpriseData
- copier.Copy(&tmp, &v)
- tmp.Id = utils.IntToStr(v.Id)
- tmp.Uuid = utils.IntToStr(v.Uuid)
- tmp.MediumId = utils.IntToStr(v.MediumId)
- tmp.Kind = utils.IntToStr(v.Kind)
- tmp.CertificateType = utils.IntToStr(v.CertificateType)
- tmp.CertificateFirstType = utils.IntToStr(v.CertificateFirstType)
- tmp.CountryRegionId = utils.IntToStr(v.CountryRegionId)
- tmp.RegisteredAddressCountryId = utils.IntToStr(v.RegisteredAddressCountryId)
- tmp.RegisteredAddressProvinceId = utils.IntToStr(v.RegisteredAddressProvinceId)
- tmp.RegisteredAddressCityId = utils.IntToStr(v.RegisteredAddressCityId)
- tmp.RegisteredAddressCountyId = utils.IntToStr(v.RegisteredAddressCountyId)
- tmp.State = utils.IntToStr(v.State)
- medium := NewMediumDb.GetSuperAdmin(v.MediumId)
- if medium != nil {
- tmp.Account = medium.Username
- }
- data = append(data, tmp)
- }
- }
- res := md.MediumQualificationEnterpriseRes{
- List: data,
- Total: total,
- State: []md.SelectData{
- {
- Name: enum.QualificationState(enum.QualificationStateForWait).String(),
- Value: utils.IntToStr(enum.QualificationStateForWait),
- },
- {
- Name: enum.QualificationState(enum.QualificationStateForNormal).String(),
- Value: utils.IntToStr(enum.QualificationStateForNormal),
- },
- {
- Name: enum.QualificationState(enum.QualificationStateForFail).String(),
- Value: utils.IntToStr(enum.QualificationStateForFail),
- },
- },
- Type: []md.SelectData{
- {
- Name: enum.QualificationType(enum.QualificationTypeCompany).String(),
- Value: utils.IntToStr(enum.QualificationTypeCompany),
- },
- {
- Name: enum.QualificationType(enum.QualificationTypeOwn).String(),
- Value: utils.IntToStr(enum.QualificationTypeOwn),
- },
- },
- }
- return res
- }
-
- func MediumQualificationEnterpriseAudit(c *gin.Context, req md.MediumQualificationEnterpriseAuditReq) error {
- engine := db.Db
- MediumListDb := implement.NewMediumListDb(engine)
- data, _ := MediumListDb.GetMediumList(utils.StrToInt(req.MediumId))
- if data == nil {
- return e.NewErr(400, "记录不存在")
- }
- if data.State == 1 {
- return e.NewErr(400, "记录已审核过")
- }
- data.State = utils.StrToInt(req.State)
- data.Memo = req.Memo
- engine.Where("medium_id=?", data.MediumId).Cols("state,memo").Update(data)
- return nil
- }
-
- func MediumQualificationBank(c *gin.Context, req md.MediumQualificationEnterpriseReq) md.MediumQualificationBankRes {
- engine := db.Db
- MediumListDb := implement.NewMediumBankInfoDb(engine)
- MediumList, total, _ := MediumListDb.FindMediumBankInfoList(c.GetString("mid"), req.Name, req.State, utils.StrToInt(req.Page), utils.StrToInt(req.Limit))
-
- list := make([]md.MediumQualificationBankData, 0)
- if MediumList != nil {
- NewMediumDb := implement2.NewMediumDb(MasterDb(c))
- for _, v := range MediumList {
- tmp := md.MediumQualificationBankData{
- Id: utils.IntToStr(v.MediumBankInfo.Id),
- MediumId: utils.IntToStr(v.MediumBankInfo.MediumId),
- CompanyName: v.CompanyName,
- UnifiedSocialCreditCode: v.UnifiedSocialCreditCode,
- Kind: utils.IntToStr(v.Kind),
- State: utils.IntToStr(v.MediumBankInfo.State),
- Memo: v.MediumBankInfo.Memo,
- CurrencyConf: utils.IntToStr(v.CurrencyConf),
- Bank: v.Bank,
- BankBranch: v.BankBranch,
- BankNo: v.BankNo,
- Licence: v.Licence,
- }
-
- medium := NewMediumDb.GetSuperAdmin(v.MediumBankInfo.MediumId)
- if medium != nil {
- tmp.Account = medium.Username
- }
- list = append(list, tmp)
- }
- }
- res := md.MediumQualificationBankRes{
- List: list,
- Total: total,
- CurrencyConf: []md.SelectData{
- {
- Value: "0", Name: "人民币",
- },
- },
- State: []md.SelectData{
- {
- Name: enum.QualificationState(enum.QualificationStateForWait).String(),
- Value: utils.IntToStr(enum.QualificationStateForWait),
- },
- {
- Name: enum.QualificationState(enum.QualificationStateForNormal).String(),
- Value: utils.IntToStr(enum.QualificationStateForNormal),
- },
- {
- Name: enum.QualificationState(enum.QualificationStateForFail).String(),
- Value: utils.IntToStr(enum.QualificationStateForFail),
- },
- },
- Type: []md.SelectData{
- {
- Name: enum.QualificationType(enum.QualificationTypeCompany).String(),
- Value: utils.IntToStr(enum.QualificationTypeCompany),
- },
- {
- Name: enum.QualificationType(enum.QualificationTypeOwn).String(),
- Value: utils.IntToStr(enum.QualificationTypeOwn),
- },
- },
- }
- return res
- }
- func MediumQualificationBankAudit(c *gin.Context, req md.MediumQualificationEnterpriseAuditReq) error {
- engine := db.Db
- MediumListDb := implement.NewMediumBankInfoDb(engine)
- data, _ := MediumListDb.GetMediumBankInfoList(utils.StrToInt(req.MediumId))
- if data == nil {
- return e.NewErr(400, "记录不存在")
- }
- if data.State == 1 {
- return e.NewErr(400, "记录已审核过")
- }
- data.State = utils.StrToInt(req.State)
- data.Memo = req.Memo
- engine.Where("medium_id=?", data.MediumId).Cols("state,memo").Update(data)
- return nil
- }
-
- func MediumQualificationContactInfo(c *gin.Context, req md.MediumQualificationEnterpriseReq) md.MediumQualificationContactRes {
-
- engine := db.Db
- MediumListDb := implement.NewMediumContactInfoDb(engine)
- MediumList, total, _ := MediumListDb.FindMediumContactInfoList(c.GetString("mid"), req.Name, req.State, utils.StrToInt(req.Page), utils.StrToInt(req.Limit))
-
- list := make([]md.MediumQualificationContactData, 0)
- if MediumList != nil {
- NewMediumDb := implement2.NewMediumDb(MasterDb(c))
- for _, v := range MediumList {
- tmp := md.MediumQualificationContactData{
- Id: utils.IntToStr(v.MediumContactInfo.Id),
- MediumId: utils.IntToStr(v.MediumContactInfo.MediumId),
- CompanyName: v.CompanyName,
- Kind: utils.IntToStr(v.Kind),
- State: utils.IntToStr(v.MediumContactInfo.State),
- Memo: v.MediumContactInfo.Memo,
- Name: v.MediumContactInfo.Name,
- Email: v.MediumContactInfo.Email,
- Phone: v.MediumContactInfo.Phone,
- Address: v.MediumContactInfo.Address,
- }
- medium := NewMediumDb.GetSuperAdmin(v.MediumContactInfo.MediumId)
- if medium != nil {
- tmp.Account = medium.Username
- }
- list = append(list, tmp)
- }
- }
- res := md.MediumQualificationContactRes{
- List: list,
- Total: total,
- State: []md.SelectData{
- {
- Name: enum.QualificationState(enum.QualificationStateForWait).String(),
- Value: utils.IntToStr(enum.QualificationStateForWait),
- },
- {
- Name: enum.QualificationState(enum.QualificationStateForNormal).String(),
- Value: utils.IntToStr(enum.QualificationStateForNormal),
- },
- {
- Name: enum.QualificationState(enum.QualificationStateForFail).String(),
- Value: utils.IntToStr(enum.QualificationStateForFail),
- },
- },
- }
- return res
- }
- func MediumQualificationContactInfoAudit(c *gin.Context, req md.MediumQualificationEnterpriseAuditReq) error {
- engine := db.Db
- MediumListDb := implement.NewMediumContactInfoDb(engine)
- data, _ := MediumListDb.GetMediumContactInfoList(utils.StrToInt(req.MediumId))
- if data == nil {
- return e.NewErr(400, "记录不存在")
- }
- if data.State == 1 {
- return e.NewErr(400, "记录已审核过")
- }
- data.State = utils.StrToInt(req.State)
- data.Memo = req.Memo
- engine.Where("medium_id=?", data.MediumId).Cols("state,memo").Update(data)
- return nil
- }
|