广告平台(站长使用)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

svc_medium_qualification.go 8.4 KiB

3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
1 month ago
1 month ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
2 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
1 month ago
1 month ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
2 months ago
3 months ago
3 months ago
3 months ago
1 month ago
1 month ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
2 months ago
3 months ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. package svc
  2. import (
  3. "applet/app/e"
  4. "applet/app/enum"
  5. "applet/app/md"
  6. "applet/app/utils"
  7. db "code.fnuoos.com/zhimeng/model.git/src"
  8. implement2 "code.fnuoos.com/zhimeng/model.git/src/implement"
  9. "code.fnuoos.com/zhimeng/model.git/src/super/implement"
  10. "github.com/gin-gonic/gin"
  11. "github.com/jinzhu/copier"
  12. )
  13. func MediumQualificationEnterprise(c *gin.Context, minState int, req md.MediumQualificationEnterpriseReq) md.MediumQualificationEnterpriseRes {
  14. engine := db.Db
  15. MediumListDb := implement.NewMediumListDb(engine)
  16. user := GetUser(c)
  17. appIds := GetMediumIdStr(c, user.AdmId, req.Name, "")
  18. MediumList, total, _ := MediumListDb.FindMediumList(c.GetString("mid"), "", appIds, req.State, minState, utils.StrToInt(req.Page), utils.StrToInt(req.Limit))
  19. data := make([]md.MediumQualificationEnterpriseData, 0)
  20. if len(MediumList) > 0 {
  21. NewMediumDb := implement2.NewMediumDb(MasterDb(c))
  22. for _, v := range MediumList {
  23. var tmp md.MediumQualificationEnterpriseData
  24. copier.Copy(&tmp, &v)
  25. tmp.Id = utils.IntToStr(v.Id)
  26. tmp.Uuid = utils.IntToStr(v.Uuid)
  27. tmp.MediumId = utils.IntToStr(v.MediumId)
  28. tmp.Kind = utils.IntToStr(v.Kind)
  29. tmp.CertificateType = utils.IntToStr(v.CertificateType)
  30. tmp.CertificateFirstType = utils.IntToStr(v.CertificateFirstType)
  31. tmp.CountryRegionId = utils.IntToStr(v.CountryRegionId)
  32. tmp.RegisteredAddressCountryId = utils.IntToStr(v.RegisteredAddressCountryId)
  33. tmp.RegisteredAddressProvinceId = utils.IntToStr(v.RegisteredAddressProvinceId)
  34. tmp.RegisteredAddressCityId = utils.IntToStr(v.RegisteredAddressCityId)
  35. tmp.RegisteredAddressCountyId = utils.IntToStr(v.RegisteredAddressCountyId)
  36. tmp.State = utils.IntToStr(v.State)
  37. medium := NewMediumDb.GetSuperAdmin(v.MediumId)
  38. if medium != nil {
  39. tmp.Account = medium.Username
  40. }
  41. data = append(data, tmp)
  42. }
  43. }
  44. res := md.MediumQualificationEnterpriseRes{
  45. List: data,
  46. Total: total,
  47. State: []md.SelectData{
  48. {
  49. Name: enum.QualificationState(enum.QualificationStateForWait).String(),
  50. Value: utils.IntToStr(enum.QualificationStateForWait),
  51. },
  52. {
  53. Name: enum.QualificationState(enum.QualificationStateForNormal).String(),
  54. Value: utils.IntToStr(enum.QualificationStateForNormal),
  55. },
  56. {
  57. Name: enum.QualificationState(enum.QualificationStateForFail).String(),
  58. Value: utils.IntToStr(enum.QualificationStateForFail),
  59. },
  60. },
  61. Type: []md.SelectData{
  62. {
  63. Name: enum.QualificationType(enum.QualificationTypeCompany).String(),
  64. Value: utils.IntToStr(enum.QualificationTypeCompany),
  65. },
  66. {
  67. Name: enum.QualificationType(enum.QualificationTypeOwn).String(),
  68. Value: utils.IntToStr(enum.QualificationTypeOwn),
  69. },
  70. },
  71. }
  72. return res
  73. }
  74. func MediumQualificationEnterpriseAudit(c *gin.Context, req md.MediumQualificationEnterpriseAuditReq) error {
  75. engine := db.Db
  76. MediumListDb := implement.NewMediumListDb(engine)
  77. data, _ := MediumListDb.GetMediumList(utils.StrToInt(req.MediumId))
  78. if data == nil {
  79. return e.NewErr(400, "记录不存在")
  80. }
  81. if data.State == 2 {
  82. return e.NewErr(400, "记录已审核过")
  83. }
  84. data.State = utils.StrToInt(req.State)
  85. data.Memo = req.Memo
  86. engine.Where("medium_id=?", data.MediumId).Cols("state,memo").Update(data)
  87. return nil
  88. }
  89. func MediumQualificationBank(c *gin.Context, req md.MediumQualificationEnterpriseReq) md.MediumQualificationBankRes {
  90. engine := db.Db
  91. MediumListDb := implement.NewMediumBankInfoDb(engine)
  92. user := GetUser(c)
  93. appIds := GetMediumIdStr(c, user.AdmId, req.Name, "")
  94. MediumList, total, _ := MediumListDb.FindMediumBankInfoList(c.GetString("mid"), "", appIds, req.State, utils.StrToInt(req.Page), utils.StrToInt(req.Limit))
  95. list := make([]md.MediumQualificationBankData, 0)
  96. if MediumList != nil {
  97. NewMediumDb := implement2.NewMediumDb(MasterDb(c))
  98. for _, v := range MediumList {
  99. tmp := md.MediumQualificationBankData{
  100. Id: utils.IntToStr(v.MediumBankInfo.Id),
  101. MediumId: utils.IntToStr(v.MediumBankInfo.MediumId),
  102. CompanyName: v.CompanyName,
  103. UnifiedSocialCreditCode: v.UnifiedSocialCreditCode,
  104. Kind: utils.IntToStr(v.Kind),
  105. State: utils.IntToStr(v.MediumBankInfo.State),
  106. Memo: v.MediumBankInfo.Memo,
  107. CurrencyConf: utils.IntToStr(v.CurrencyConf),
  108. Bank: v.Bank,
  109. BankBranch: v.BankBranch,
  110. BankNo: v.BankNo,
  111. Licence: v.Licence,
  112. }
  113. medium := NewMediumDb.GetSuperAdmin(v.MediumBankInfo.MediumId)
  114. if medium != nil {
  115. tmp.Account = medium.Username
  116. }
  117. list = append(list, tmp)
  118. }
  119. }
  120. res := md.MediumQualificationBankRes{
  121. List: list,
  122. Total: total,
  123. CurrencyConf: []md.SelectData{
  124. {
  125. Value: "0", Name: "人民币",
  126. },
  127. },
  128. State: []md.SelectData{
  129. {
  130. Name: enum.QualificationState(enum.QualificationStateForWait).String(),
  131. Value: utils.IntToStr(enum.QualificationStateForWait),
  132. },
  133. {
  134. Name: enum.QualificationState(enum.QualificationStateForNormal).String(),
  135. Value: utils.IntToStr(enum.QualificationStateForNormal),
  136. },
  137. {
  138. Name: enum.QualificationState(enum.QualificationStateForFail).String(),
  139. Value: utils.IntToStr(enum.QualificationStateForFail),
  140. },
  141. },
  142. Type: []md.SelectData{
  143. {
  144. Name: enum.QualificationType(enum.QualificationTypeCompany).String(),
  145. Value: utils.IntToStr(enum.QualificationTypeCompany),
  146. },
  147. {
  148. Name: enum.QualificationType(enum.QualificationTypeOwn).String(),
  149. Value: utils.IntToStr(enum.QualificationTypeOwn),
  150. },
  151. },
  152. }
  153. return res
  154. }
  155. func MediumQualificationBankAudit(c *gin.Context, req md.MediumQualificationEnterpriseAuditReq) error {
  156. engine := db.Db
  157. MediumListDb := implement.NewMediumBankInfoDb(engine)
  158. data, _ := MediumListDb.GetMediumBankInfoList(utils.StrToInt(req.MediumId))
  159. if data == nil {
  160. return e.NewErr(400, "记录不存在")
  161. }
  162. if data.State == 2 {
  163. return e.NewErr(400, "记录已审核过")
  164. }
  165. data.State = utils.StrToInt(req.State)
  166. data.Memo = req.Memo
  167. engine.Where("medium_id=?", data.MediumId).Cols("state,memo").Update(data)
  168. return nil
  169. }
  170. func MediumQualificationContactInfo(c *gin.Context, req md.MediumQualificationEnterpriseReq) md.MediumQualificationContactRes {
  171. engine := db.Db
  172. MediumListDb := implement.NewMediumContactInfoDb(engine)
  173. user := GetUser(c)
  174. appIds := GetMediumIdStr(c, user.AdmId, req.Name, "")
  175. MediumList, total, _ := MediumListDb.FindMediumContactInfoList(c.GetString("mid"), "", appIds, req.State, utils.StrToInt(req.Page), utils.StrToInt(req.Limit))
  176. list := make([]md.MediumQualificationContactData, 0)
  177. if MediumList != nil {
  178. NewMediumDb := implement2.NewMediumDb(MasterDb(c))
  179. for _, v := range MediumList {
  180. tmp := md.MediumQualificationContactData{
  181. Id: utils.IntToStr(v.MediumContactInfo.Id),
  182. MediumId: utils.IntToStr(v.MediumContactInfo.MediumId),
  183. CompanyName: v.CompanyName,
  184. Kind: utils.IntToStr(v.Kind),
  185. State: utils.IntToStr(v.MediumContactInfo.State),
  186. Memo: v.MediumContactInfo.Memo,
  187. Name: v.MediumContactInfo.Name,
  188. Email: v.MediumContactInfo.Email,
  189. Phone: v.MediumContactInfo.Phone,
  190. Address: v.MediumContactInfo.Address,
  191. }
  192. medium := NewMediumDb.GetSuperAdmin(v.MediumContactInfo.MediumId)
  193. if medium != nil {
  194. tmp.Account = medium.Username
  195. }
  196. list = append(list, tmp)
  197. }
  198. }
  199. res := md.MediumQualificationContactRes{
  200. List: list,
  201. Total: total,
  202. State: []md.SelectData{
  203. {
  204. Name: enum.QualificationState(enum.QualificationStateForWait).String(),
  205. Value: utils.IntToStr(enum.QualificationStateForWait),
  206. },
  207. {
  208. Name: enum.QualificationState(enum.QualificationStateForNormal).String(),
  209. Value: utils.IntToStr(enum.QualificationStateForNormal),
  210. },
  211. {
  212. Name: enum.QualificationState(enum.QualificationStateForFail).String(),
  213. Value: utils.IntToStr(enum.QualificationStateForFail),
  214. },
  215. },
  216. }
  217. return res
  218. }
  219. func MediumQualificationContactInfoAudit(c *gin.Context, req md.MediumQualificationEnterpriseAuditReq) error {
  220. engine := db.Db
  221. MediumListDb := implement.NewMediumContactInfoDb(engine)
  222. data, _ := MediumListDb.GetMediumContactInfoList(utils.StrToInt(req.MediumId))
  223. if data == nil {
  224. return e.NewErr(400, "记录不存在")
  225. }
  226. if data.State == 2 {
  227. return e.NewErr(400, "记录已审核过")
  228. }
  229. data.State = utils.StrToInt(req.State)
  230. data.Memo = req.Memo
  231. engine.Where("medium_id=?", data.MediumId).Cols("state,memo").Update(data)
  232. return nil
  233. }