广告平台(站长使用)
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 
 
 

238 rindas
8.2 KiB

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