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

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