广告平台(站长使用)
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_agent_qualification.go 8.1 KiB

2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  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 AgentQualificationEnterprise(c *gin.Context, minState int, req md.AgentQualificationEnterpriseReq) md.AgentQualificationEnterpriseRes {
  14. engine := db.Db
  15. agentListDb := implement.NewAgentListDb(engine)
  16. agentList, total, _ := agentListDb.FindAgentList(c.GetString("mid"), req.Name, req.State, minState, utils.StrToInt(req.Page), utils.StrToInt(req.Limit))
  17. data := make([]md.AgentQualificationEnterpriseData, 0)
  18. if len(agentList) > 0 {
  19. NewAgentDb := implement2.NewAgentDb(MasterDb(c))
  20. for _, v := range agentList {
  21. var tmp md.AgentQualificationEnterpriseData
  22. copier.Copy(&tmp, &v)
  23. tmp.Id = utils.IntToStr(v.Id)
  24. tmp.Uuid = utils.IntToStr(v.Uuid)
  25. tmp.AgentId = utils.IntToStr(v.AgentId)
  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. agent := NewAgentDb.GetSuperAdmin(v.AgentId)
  36. if agent != nil {
  37. tmp.Account = agent.Username
  38. }
  39. data = append(data, tmp)
  40. }
  41. }
  42. res := md.AgentQualificationEnterpriseRes{
  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 AgentQualificationEnterpriseAudit(c *gin.Context, req md.AgentQualificationEnterpriseAuditReq) error {
  73. engine := db.Db
  74. agentListDb := implement.NewAgentListDb(engine)
  75. data, _ := agentListDb.GetAgentList(utils.StrToInt(req.AgentId))
  76. if data == nil {
  77. return e.NewErr(400, "记录不存在")
  78. }
  79. if data.State == 1 {
  80. return e.NewErr(400, "记录已审核过")
  81. }
  82. data.State = utils.StrToInt(req.State)
  83. data.Memo = req.Memo
  84. engine.Where("agent_id=?", data.AgentId).Cols("state,memo").Update(data)
  85. return nil
  86. }
  87. func AgentQualificationBank(c *gin.Context, req md.AgentQualificationEnterpriseReq) md.AgentQualificationBankRes {
  88. engine := db.Db
  89. agentListDb := implement.NewAgentBankInfoDb(engine)
  90. agentList, total, _ := agentListDb.FindAgentBankInfoList(c.GetString("mid"), req.Name, req.State, utils.StrToInt(req.Page), utils.StrToInt(req.Limit))
  91. list := make([]md.AgentQualificationBankData, 0)
  92. if agentList != nil {
  93. NewAgentDb := implement2.NewAgentDb(MasterDb(c))
  94. for _, v := range agentList {
  95. tmp := md.AgentQualificationBankData{
  96. Id: utils.IntToStr(v.AgentBankInfo.Id),
  97. AgentId: utils.IntToStr(v.AgentBankInfo.AgentId),
  98. CompanyName: v.CompanyName,
  99. UnifiedSocialCreditCode: v.UnifiedSocialCreditCode,
  100. Kind: utils.IntToStr(v.Kind),
  101. State: utils.IntToStr(v.AgentBankInfo.State),
  102. Memo: v.AgentBankInfo.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. agent := NewAgentDb.GetSuperAdmin(v.AgentBankInfo.AgentId)
  110. if agent != nil {
  111. tmp.Account = agent.Username
  112. }
  113. list = append(list, tmp)
  114. }
  115. }
  116. res := md.AgentQualificationBankRes{
  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 AgentQualificationBankAudit(c *gin.Context, req md.AgentQualificationEnterpriseAuditReq) error {
  152. engine := db.Db
  153. agentListDb := implement.NewAgentBankInfoDb(engine)
  154. data, _ := agentListDb.GetAgentBankInfoList(utils.StrToInt(req.AgentId))
  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("agent_id=?", data.AgentId).Cols("state,memo").Update(data)
  164. return nil
  165. }
  166. func AgentQualificationContactInfo(c *gin.Context, req md.AgentQualificationEnterpriseReq) md.AgentQualificationContactRes {
  167. engine := db.Db
  168. agentListDb := implement.NewAgentContactInfoDb(engine)
  169. agentList, total, _ := agentListDb.FindAgentContactInfoList(c.GetString("mid"), req.Name, req.State, utils.StrToInt(req.Page), utils.StrToInt(req.Limit))
  170. list := make([]md.AgentQualificationContactData, 0)
  171. if agentList != nil {
  172. NewAgentDb := implement2.NewAgentDb(MasterDb(c))
  173. for _, v := range agentList {
  174. tmp := md.AgentQualificationContactData{
  175. Id: utils.IntToStr(v.AgentContactInfo.Id),
  176. AgentId: utils.IntToStr(v.AgentContactInfo.AgentId),
  177. CompanyName: v.CompanyName,
  178. Kind: utils.IntToStr(v.Kind),
  179. State: utils.IntToStr(v.AgentContactInfo.State),
  180. Memo: v.AgentContactInfo.Memo,
  181. Name: v.AgentContactInfo.Name,
  182. Email: v.AgentContactInfo.Email,
  183. Phone: v.AgentContactInfo.Phone,
  184. Address: v.AgentContactInfo.Address,
  185. }
  186. agent := NewAgentDb.GetSuperAdmin(v.AgentContactInfo.AgentId)
  187. if agent != nil {
  188. tmp.Account = agent.Username
  189. }
  190. list = append(list, tmp)
  191. }
  192. }
  193. res := md.AgentQualificationContactRes{
  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 AgentQualificationContactInfoAudit(c *gin.Context, req md.AgentQualificationEnterpriseAuditReq) error {
  214. engine := db.Db
  215. agentListDb := implement.NewAgentContactInfoDb(engine)
  216. data, _ := agentListDb.GetAgentContactInfoList(utils.StrToInt(req.AgentId))
  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("agent_id=?", data.AgentId).Cols("state,memo").Update(data)
  226. return nil
  227. }