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

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
4 weeks 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
4 weeks 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
4 weeks 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
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  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 QualificationSelectBase(c *gin.Context) {
  14. countryDb := implement.NewCountryDb(db.Db)
  15. country := countryDb.FindAll()
  16. IdcardTypeListDb := implement.NewIdcardTypeListDb(db.Db)
  17. IdcardTypeList := IdcardTypeListDb.FindAll()
  18. res := map[string]interface{}{
  19. "register_area": country,
  20. "idcard_type": IdcardTypeList,
  21. "country": md.Country,
  22. "user_type": []map[string]interface{}{
  23. {
  24. "value": "1", "name": "企业",
  25. },
  26. },
  27. "currency_conf": md.CurrencyConf,
  28. }
  29. e.OutSuc(c, res, nil)
  30. return
  31. }
  32. func AgentQualificationEnterprise(c *gin.Context, minState int, req md.AgentQualificationEnterpriseReq) md.AgentQualificationEnterpriseRes {
  33. engine := db.Db
  34. agentListDb := implement.NewAgentListDb(engine)
  35. user := GetUser(c)
  36. appIds := GetAgentIdStr(c, user.AdmId, req.Name, "")
  37. agentList, total, _ := agentListDb.FindAgentList(c.GetString("mid"), "", appIds, req.State, minState, utils.StrToInt(req.Page), utils.StrToInt(req.Limit))
  38. data := make([]md.AgentQualificationEnterpriseData, 0)
  39. if len(agentList) > 0 {
  40. NewAgentDb := implement2.NewAgentDb(MasterDb(c))
  41. for _, v := range agentList {
  42. var tmp md.AgentQualificationEnterpriseData
  43. copier.Copy(&tmp, &v)
  44. tmp.Id = utils.IntToStr(v.Id)
  45. tmp.Uuid = utils.IntToStr(v.Uuid)
  46. tmp.AgentId = utils.IntToStr(v.AgentId)
  47. tmp.Kind = utils.IntToStr(v.Kind)
  48. tmp.CertificateType = utils.IntToStr(v.CertificateType)
  49. tmp.CertificateFirstType = utils.IntToStr(v.CertificateFirstType)
  50. tmp.CountryRegionId = utils.IntToStr(v.CountryRegionId)
  51. tmp.RegisteredAddressCountryId = utils.IntToStr(v.RegisteredAddressCountryId)
  52. tmp.RegisteredAddressProvinceId = utils.IntToStr(v.RegisteredAddressProvinceId)
  53. tmp.RegisteredAddressCityId = utils.IntToStr(v.RegisteredAddressCityId)
  54. tmp.RegisteredAddressCountyId = utils.IntToStr(v.RegisteredAddressCountyId)
  55. tmp.State = utils.IntToStr(v.State)
  56. agent := NewAgentDb.GetSuperAdmin(v.AgentId)
  57. if agent != nil {
  58. tmp.Account = agent.Username
  59. }
  60. data = append(data, tmp)
  61. }
  62. }
  63. res := md.AgentQualificationEnterpriseRes{
  64. List: data,
  65. Total: total,
  66. State: []md.SelectData{
  67. {
  68. Name: enum.QualificationState(enum.QualificationStateForWait).String(),
  69. Value: utils.IntToStr(enum.QualificationStateForWait),
  70. },
  71. {
  72. Name: enum.QualificationState(enum.QualificationStateForNormal).String(),
  73. Value: utils.IntToStr(enum.QualificationStateForNormal),
  74. },
  75. {
  76. Name: enum.QualificationState(enum.QualificationStateForFail).String(),
  77. Value: utils.IntToStr(enum.QualificationStateForFail),
  78. },
  79. },
  80. Type: []md.SelectData{
  81. {
  82. Name: enum.QualificationType(enum.QualificationTypeCompany).String(),
  83. Value: utils.IntToStr(enum.QualificationTypeCompany),
  84. },
  85. {
  86. Name: enum.QualificationType(enum.QualificationTypeOwn).String(),
  87. Value: utils.IntToStr(enum.QualificationTypeOwn),
  88. },
  89. },
  90. }
  91. return res
  92. }
  93. func AgentQualificationEnterpriseAudit(c *gin.Context, req md.AgentQualificationEnterpriseAuditReq) error {
  94. engine := db.Db
  95. agentListDb := implement.NewAgentListDb(engine)
  96. data, _ := agentListDb.GetAgentList(utils.StrToInt(req.AgentId))
  97. if data == nil {
  98. return e.NewErr(400, "记录不存在")
  99. }
  100. if data.State == 2 {
  101. return e.NewErr(400, "记录已审核过")
  102. }
  103. data.State = utils.StrToInt(req.State)
  104. data.Memo = req.Memo
  105. engine.Where("agent_id=?", data.AgentId).Cols("state,memo").Update(data)
  106. return nil
  107. }
  108. func AgentQualificationBank(c *gin.Context, req md.AgentQualificationEnterpriseReq) md.AgentQualificationBankRes {
  109. engine := db.Db
  110. agentListDb := implement.NewAgentBankInfoDb(engine)
  111. user := GetUser(c)
  112. appIds := GetAgentIdStr(c, user.AdmId, req.Name, "")
  113. agentList, total, _ := agentListDb.FindAgentBankInfoList(c.GetString("mid"), "", appIds, req.State, utils.StrToInt(req.Page), utils.StrToInt(req.Limit))
  114. list := make([]md.AgentQualificationBankData, 0)
  115. if agentList != nil {
  116. NewAgentDb := implement2.NewAgentDb(MasterDb(c))
  117. for _, v := range agentList {
  118. tmp := md.AgentQualificationBankData{
  119. Id: utils.IntToStr(v.AgentBankInfo.Id),
  120. AgentId: utils.IntToStr(v.AgentBankInfo.AgentId),
  121. CompanyName: v.CompanyName,
  122. UnifiedSocialCreditCode: v.UnifiedSocialCreditCode,
  123. Kind: utils.IntToStr(v.Kind),
  124. State: utils.IntToStr(v.AgentBankInfo.State),
  125. Memo: v.AgentBankInfo.Memo,
  126. CurrencyConf: utils.IntToStr(v.CurrencyConf),
  127. Bank: v.Bank,
  128. BankBranch: v.BankBranch,
  129. BankNo: v.BankNo,
  130. Licence: v.Licence,
  131. }
  132. agent := NewAgentDb.GetSuperAdmin(v.AgentBankInfo.AgentId)
  133. if agent != nil {
  134. tmp.Account = agent.Username
  135. }
  136. list = append(list, tmp)
  137. }
  138. }
  139. res := md.AgentQualificationBankRes{
  140. List: list,
  141. Total: total,
  142. CurrencyConf: []md.SelectData{
  143. {
  144. Value: "0", Name: "人民币",
  145. },
  146. },
  147. State: []md.SelectData{
  148. {
  149. Name: enum.QualificationState(enum.QualificationStateForWait).String(),
  150. Value: utils.IntToStr(enum.QualificationStateForWait),
  151. },
  152. {
  153. Name: enum.QualificationState(enum.QualificationStateForNormal).String(),
  154. Value: utils.IntToStr(enum.QualificationStateForNormal),
  155. },
  156. {
  157. Name: enum.QualificationState(enum.QualificationStateForFail).String(),
  158. Value: utils.IntToStr(enum.QualificationStateForFail),
  159. },
  160. },
  161. Type: []md.SelectData{
  162. {
  163. Name: enum.QualificationType(enum.QualificationTypeCompany).String(),
  164. Value: utils.IntToStr(enum.QualificationTypeCompany),
  165. },
  166. {
  167. Name: enum.QualificationType(enum.QualificationTypeOwn).String(),
  168. Value: utils.IntToStr(enum.QualificationTypeOwn),
  169. },
  170. },
  171. }
  172. return res
  173. }
  174. func AgentQualificationBankAudit(c *gin.Context, req md.AgentQualificationEnterpriseAuditReq) error {
  175. engine := db.Db
  176. agentListDb := implement.NewAgentBankInfoDb(engine)
  177. data, _ := agentListDb.GetAgentBankInfoList(utils.StrToInt(req.AgentId))
  178. if data == nil {
  179. return e.NewErr(400, "记录不存在")
  180. }
  181. if data.State == 2 {
  182. return e.NewErr(400, "记录已审核过")
  183. }
  184. data.State = utils.StrToInt(req.State)
  185. data.Memo = req.Memo
  186. engine.Where("agent_id=?", data.AgentId).Cols("state,memo").Update(data)
  187. return nil
  188. }
  189. func AgentQualificationContactInfo(c *gin.Context, req md.AgentQualificationEnterpriseReq) md.AgentQualificationContactRes {
  190. engine := db.Db
  191. agentListDb := implement.NewAgentContactInfoDb(engine)
  192. user := GetUser(c)
  193. appIds := GetAgentIdStr(c, user.AdmId, req.Name, "")
  194. agentList, total, _ := agentListDb.FindAgentContactInfoList(c.GetString("mid"), "", appIds, req.State, utils.StrToInt(req.Page), utils.StrToInt(req.Limit))
  195. list := make([]md.AgentQualificationContactData, 0)
  196. if agentList != nil {
  197. NewAgentDb := implement2.NewAgentDb(MasterDb(c))
  198. for _, v := range agentList {
  199. tmp := md.AgentQualificationContactData{
  200. Id: utils.IntToStr(v.AgentContactInfo.Id),
  201. AgentId: utils.IntToStr(v.AgentContactInfo.AgentId),
  202. CompanyName: v.CompanyName,
  203. Kind: utils.IntToStr(v.Kind),
  204. State: utils.IntToStr(v.AgentContactInfo.State),
  205. Memo: v.AgentContactInfo.Memo,
  206. Name: v.AgentContactInfo.Name,
  207. Email: v.AgentContactInfo.Email,
  208. Phone: v.AgentContactInfo.Phone,
  209. Address: v.AgentContactInfo.Address,
  210. }
  211. agent := NewAgentDb.GetSuperAdmin(v.AgentContactInfo.AgentId)
  212. if agent != nil {
  213. tmp.Account = agent.Username
  214. }
  215. list = append(list, tmp)
  216. }
  217. }
  218. res := md.AgentQualificationContactRes{
  219. List: list,
  220. Total: total,
  221. State: []md.SelectData{
  222. {
  223. Name: enum.QualificationState(enum.QualificationStateForWait).String(),
  224. Value: utils.IntToStr(enum.QualificationStateForWait),
  225. },
  226. {
  227. Name: enum.QualificationState(enum.QualificationStateForNormal).String(),
  228. Value: utils.IntToStr(enum.QualificationStateForNormal),
  229. },
  230. {
  231. Name: enum.QualificationState(enum.QualificationStateForFail).String(),
  232. Value: utils.IntToStr(enum.QualificationStateForFail),
  233. },
  234. },
  235. }
  236. return res
  237. }
  238. func AgentQualificationContactInfoAudit(c *gin.Context, req md.AgentQualificationEnterpriseAuditReq) error {
  239. engine := db.Db
  240. agentListDb := implement.NewAgentContactInfoDb(engine)
  241. data, _ := agentListDb.GetAgentContactInfoList(utils.StrToInt(req.AgentId))
  242. if data == nil {
  243. return e.NewErr(400, "记录不存在")
  244. }
  245. if data.State == 2 {
  246. return e.NewErr(400, "记录已审核过")
  247. }
  248. data.State = utils.StrToInt(req.State)
  249. data.Memo = req.Memo
  250. engine.Where("agent_id=?", data.AgentId).Cols("state,memo").Update(data)
  251. return nil
  252. }