qhjPCWeb.go 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395
  1. /**
  2. * @Author: zou.yingbin
  3. * @Create : 2021/6/24 10:07
  4. * @Modify : 2021/6/24 10:07
  5. */
  6. package models
  7. import (
  8. "fmt"
  9. "mtp2_if/db"
  10. "mtp2_if/mtpcache"
  11. "mtp2_if/utils"
  12. )
  13. // QhjMgrSubArea 子机构列表
  14. type QhjMgrSubArea struct {
  15. PARENTTOPUSER string `json:"parenttopuser" xorm:"PARENTTOPUSER"` // 上级顶级机构 [092=0,1时,默认为1, 092=2时若自已为顶级,则填入自己,自己不为顶级,填入ParentUserID的"ParentTopUser"]
  16. SUBACCOUNTLEVEL int32 `json:"subaccountlevel" xorm:"SUBACCOUNTLEVEL"` // 子账户层数
  17. ROOTUSERID string `json:"rootuserid" xorm:"ROOTUSERID"` // 根用户ID
  18. USERID int64 `json:"userid" xorm:"USERID"` // 用户ID
  19. USERTYPE int32 `json:"usertype" xorm:"USERTYPE"` // 账户类型 - 1:交易所 2:机构 3:会员子机构 4:经纪人 5:投资者 6:客户 7:企业成员(云平台)
  20. ACCOUNTNAME string `json:"accountname" xorm:"ACCOUNTNAME"` // 账户名称(机构名称)
  21. PARENTUSERID int64 `json:"parentuserid" xorm:"PARENTUSERID"` // 所属机构ID
  22. SUBAREALEVELPATH string `json:"subarealevelpath" xorm:"SUBAREALEVELPATH"` // 子机构层级路径(逗号分隔,首尾加逗号)
  23. MEMBERUSERID int64 `json:"memberuserid" xorm:"MEMBERUSERID"` // 所属会员ID
  24. }
  25. func (r *QhjMgrSubArea) calc() {
  26. }
  27. func (r *QhjMgrSubArea) buildSql() string {
  28. var sqlId utils.SQLVal = "select t.userid," +
  29. " t.accountname," +
  30. " t.parentuserid," +
  31. " t.rootuserid," +
  32. " t.memberuserid," +
  33. " t.parenttopuser," +
  34. " t.subarealevelpath," +
  35. " t.subaccountlevel," +
  36. " t.usertype" +
  37. " from useraccount t" +
  38. " where 1 = 1"
  39. sqlId.And("t.usertype", 2)
  40. sqlId.Join(fmt.Sprintf("and t.userid != %v", r.USERID))
  41. sqlId.Join(fmt.Sprintf(" and t.subarealevelpath like ',%%%v%%,'", r.USERID))
  42. return sqlId.String()
  43. }
  44. // GetDataEx 获取子机构列表
  45. func (r *QhjMgrSubArea) GetDataEx() (interface{}, error) {
  46. sData := make([]QhjMgrSubArea, 0)
  47. err := db.GetEngine().SQL(r.buildSql()).Find(&sData)
  48. for i := range sData {
  49. sData[i].calc()
  50. }
  51. return sData, err
  52. }
  53. // QhjMgrCustomer 客户资料
  54. type QhjMgrCustomer struct {
  55. USERID int64 `json:"userid" xorm:"'USERID'"` // 用户ID
  56. MEMBERUSERID int64 `json:"memberuserid" xorm:"'MEMBERUSERID'"` // 所属机构ID(所属会员)
  57. PARENTUSERID int64 `json:"parentuserid" xorm:"'PARENTUSERID'"` // 上级机构(所属机构)
  58. USERINFOTYPE int32 `json:"userinfotype" xorm:"'USERINFOTYPE'"` // 客户类型 1-个人 2-企业
  59. CUSTOMERNAME string `json:"customername" xorm:"'CUSTOMERNAME'"` // 客户名称
  60. CARDTYPE int32 `json:"cardtype" xorm:"'CARDTYPE'"` // 证件类型
  61. CARDNUM string `json:"cardnum" xorm:"'CARDNUM'"` // 证件号码
  62. MOBILE string `json:"mobile" xorm:"'MOBILE'"` // 手机号码
  63. TELPHONE string `json:"telphone" xorm:"'TELPHONE'"` // 联系电话
  64. ADDRESS string `json:"address" xorm:"'ADDRESS'"` // 通讯地址
  65. REMARK string `json:"remark" xorm:"'REMARK'"` // 备注
  66. STATUS int32 `json:"status" xorm:"'STATUS'"` // 账户状态 - 1:待激活 2:待审核 3:待复审 4:正常 5:审核拒绝 6:注销
  67. STATUSDESC string `json:"statusdesc"` // 账户状态中文描述
  68. ATTACHMENT1 string `json:"attachment1" xorm:"'ATTACHMENT1'"` // 附件1
  69. CARDFRONTPHOTOURL string `json:"cardfrontphotourl" xorm:"'CARDFRONTPHOTOURL'"` // 证件正面图片地址
  70. CARDBACKPHOTOURL string `json:"cardbackphotourl" xorm:"'CARDBACKPHOTOURL'"` // 证件反面图片地址
  71. COUNTRYID int32 `json:"countryid" xorm:"'COUNTRYID'"` // 国家
  72. PROVINCEID int32 `json:"provinceid" xorm:"'PROVINCEID'"` // 省
  73. CITYID int32 `json:"cityid" xorm:"'CITYID'"` // 市
  74. DISTRICTID int32 `json:"districtid" xorm:"'DISTRICTID'"` // 区域
  75. CREATETIME string `json:"createtime" xorm:"'CREATETIME'"` // 创建时间
  76. MODIFYTIME string `json:"modifytime" xorm:"'MODIFYTIME'"` // 修改时间
  77. AUDITTIME string `json:"audittime" xorm:"'AUDITTIME'"` // 审核时间
  78. NICKNAME string `json:"nickname" xorm:"'NICKNAME'"` // 昵称
  79. TAXPAYERNUM string `json:"taxpayernum" xorm:"'taxpayernum'"` // 纳税人识别号
  80. LEGALPERSONNAME string `json:"legalpersonname" xorm:"'legalpersonname'"` // 法人姓名(企业)
  81. CONTACTNAME string `json:"contactname" xorm:"'contactname'"` // 联系人
  82. EMAIL string `json:"email" xorm:"'EMAIL'"` // 邮件
  83. USERNAME string `json:"username" xorm:"'USERNAME'"` // 用户名称
  84. LOGINCODE string `json:"logincode" xorm:"'LOGINCODE'"` // 登录账号(代码)
  85. COUNTRYNAME string `json:"countryname"` // 国家名称
  86. CITYNAME string `json:"cityname"` // 城市名称
  87. PROVINCENAME string `json:"provincename"` // 省名称
  88. DISTRICTNAME string `json:"districtname"` // 地区名称
  89. CARDTYPENAME string `json:"cardtypename"` // 证件类型名称
  90. MEMBERUSERNAME string `json:"memberusername"` // 所属会员名称
  91. PARENTUSERNAME string `json:"parentusername"` //所属机构名称
  92. QUERYTYPE int32 `json:"-"` // 查询类型(1:未提交(网上开户表) 2:待审核(网上开户表) 3:正常 4:停用)
  93. IncludeSub int32 `json:"-"` // 包子机构客户 1-包含
  94. }
  95. func (r *QhjMgrCustomer) calc() {
  96. r.MEMBERUSERNAME = mtpcache.GetUserNameByUserId(r.MEMBERUSERID)
  97. if len(r.USERNAME) == 0 {
  98. r.USERNAME = mtpcache.GetUserNameByUserId(r.USERID)
  99. }
  100. r.PARENTUSERNAME = mtpcache.GetUserNameByUserId(r.PARENTUSERID)
  101. r.COUNTRYNAME = mtpcache.GetDivisionName(r.COUNTRYID)
  102. r.CITYNAME = mtpcache.GetDivisionName(r.CITYID)
  103. r.PROVINCENAME = mtpcache.GetDivisionName(r.PROVINCEID)
  104. r.DISTRICTNAME = mtpcache.GetDivisionName(r.DISTRICTID)
  105. switch r.QUERYTYPE {
  106. case 1, 2: // 网上开户表
  107. r.ADDRESS = DecryptField(r.ADDRESS)
  108. r.TELPHONE = DecryptField(r.TELPHONE)
  109. case 3, 4: // 正式表
  110. r.TELPHONE = DecryptField(r.TELPHONE)
  111. }
  112. r.CARDNUM = DecryptField(r.CARDNUM)
  113. r.MOBILE = DecryptField(r.MOBILE)
  114. r.EMAIL = DecryptField(r.EMAIL)
  115. }
  116. func (r *QhjMgrCustomer) level() int32 {
  117. if r.IncludeSub > 0 {
  118. // 层级, 最多20层
  119. return 20
  120. }
  121. return 1
  122. }
  123. func (r *QhjMgrCustomer) buildSql() string {
  124. if r.QUERYTYPE == 1 || r.QUERYTYPE == 2 {
  125. return r.buildSqlWskh()
  126. }
  127. return r.buildSqlNormal()
  128. }
  129. func (r *QhjMgrCustomer) buildSqlWskh() string {
  130. var sqlId utils.SQLVal = "select *" +
  131. " from (select t.userid," +
  132. " t.memberareaid MEMBERUSERID," +
  133. " t.USERINFOTYPE," +
  134. " t.username," +
  135. " t.CUSTOMERNAME," +
  136. " t.NICKNAME," +
  137. " t.CARDTYPE," +
  138. " t.CARDNUM," +
  139. " t.mobilephone MOBILE," +
  140. " t.TELPHONE," +
  141. " t.cardaddress ADDRESS," +
  142. " t.REMARK," +
  143. " t.ATTACHMENT1," +
  144. " t.CARDFRONTPHOTOURL," +
  145. " t.CARDBACKPHOTOURL," +
  146. " t.userstate status," +
  147. " t.countryid," +
  148. " t.provinceid," +
  149. " t.districtid," +
  150. " to_char(t.createtime, 'yyyy-mm-dd hh24:mi:ss') createtime," +
  151. " t.cityid," +
  152. " to_char(t.modifiedtime, 'yyyy-mm-dd hh24:mi:ss') modifytime," +
  153. " to_char(t.auditime, 'yyyy-mm-dd hh24:mi:ss') audittime," +
  154. " t.taxpayernum," +
  155. " t.legalpersonname," +
  156. " t.contactname," +
  157. " t.email," +
  158. " t.areaid parentuserid," +
  159. " t.logincode," +
  160. " t.usertype" +
  161. " from wskh_userinfo t" +
  162. " start with t.areaid = %v" +
  163. " connect by prior t.userid = t.areaid" +
  164. " and t.usertype in (2, 6)" +
  165. " and level = %v) a" +
  166. " where 1 = 1" +
  167. " and a.usertype != 2" +
  168. " and a.status in (%v)"
  169. status := DecodeStr(r.QUERYTYPE == 1, "1", "2,4,5")
  170. sqlId.FormatParam(r.USERID, r.level(), status)
  171. sqlId.AndEx("a.USERINFOTYPE", r.USERINFOTYPE, r.USERINFOTYPE > 0)
  172. sqlId.JoinEx(len(r.CUSTOMERNAME) > 0, fmt.Sprintf(` and a.customername like '%%%v%%'`, r.CUSTOMERNAME))
  173. sqlId.JoinEx(len(r.NICKNAME) > 0, fmt.Sprintf(` and a.nickname like '%%%v%%'`, r.NICKNAME))
  174. return sqlId.String()
  175. }
  176. func (r *QhjMgrCustomer) buildSqlNormal() string {
  177. var sqlId utils.SQLVal = "with tmp as" +
  178. " (select t.userid, wm_concat(t.logincode) logincode" +
  179. " from loginaccount t" +
  180. " group by t.userid)" +
  181. "select a.*," +
  182. " k.logincode," +
  183. " u.USERINFOTYPE," +
  184. " u.CUSTOMERNAME," +
  185. " u.NICKNAME," +
  186. " u.CARDTYPEID CARDTYPE," +
  187. " u.CARDNUM," +
  188. " u.MOBILE," +
  189. " u.TELPHONE," +
  190. " u.ADDRESS," +
  191. " u.REMARK," +
  192. " u.ATTACHMENT1," +
  193. " u.CARDFRONTPHOTOURL," +
  194. " u.CARDBACKPHOTOURL," +
  195. " u.countryid," +
  196. " u.provinceid," +
  197. " u.districtid," +
  198. " u.taxpayernum," +
  199. " u.legalpersonname," +
  200. " u.contactname," +
  201. " u.email," +
  202. " u.cityid" +
  203. " from (select t.userid," +
  204. " t.usertype," +
  205. " t.parentuserid," +
  206. " t.memberuserid," +
  207. " t.accountstatus status," +
  208. " to_char(t.createtime, 'yyyy-mm-dd hh24:mi:ss') createtime," +
  209. " to_char(t.modifytime, 'yyyy-mm-dd hh24:mi:ss') modifytime," +
  210. " to_char(t.audittime, 'yyyy-mm-dd hh24:mi:ss') audittime" +
  211. " from useraccount t where 1=1 and t.usertype = 6 %v" +
  212. " ) a" +
  213. " left join tmp k" +
  214. " on a.userid = k.userid" +
  215. " left join userinfo u" +
  216. " on a.userid = u.userid" +
  217. " where 1 = 1"
  218. status := DecodeStr(r.QUERYTYPE == 3, "4", "6")
  219. var sqlParam utils.SQLVal
  220. sqlParam.And("t.accountstatus", status)
  221. if r.IncludeSub == 1 {
  222. sqlParam.Join(fmt.Sprintf(" and t.subarealevelpath like '%%,%v,%%'", r.USERID))
  223. } else {
  224. sqlParam.And("t.parentuserid", r.USERID)
  225. }
  226. sqlId.FormatParam(sqlParam.String())
  227. sqlId.AndEx("u.USERINFOTYPE", r.USERINFOTYPE, r.USERINFOTYPE > 0)
  228. sqlId.JoinEx(len(r.CUSTOMERNAME) > 0, fmt.Sprintf(` and u.customername like '%%%v%%'`, r.CUSTOMERNAME))
  229. sqlId.JoinEx(len(r.NICKNAME) > 0, fmt.Sprintf(` and u.nickname like '%%%v%%'`, r.NICKNAME))
  230. return sqlId.String()
  231. }
  232. // GetDataEx 获取客户资料
  233. func (r *QhjMgrCustomer) GetDataEx() (interface{}, error) {
  234. sData := make([]QhjMgrCustomer, 0)
  235. err := db.GetEngine().SQL(r.buildSql()).Find(&sData)
  236. for i := range sData {
  237. sData[i].QUERYTYPE = r.QUERYTYPE
  238. sData[i].calc()
  239. }
  240. return sData, err
  241. }
  242. // QhjMgrAccountOutInApply 充值提现(出入金)
  243. type QhjMgrAccountOutInApply struct {
  244. EXECUTETYPE int32 `json:"executetype" xorm:"EXECUTETYPE"` // 申请类型 - 1:出金 2:入金 3: 单边账调整:入金; 4:单边账调整:出金 5:外部母账户调整:入金 6:外部母账户调整:出金 7:外部子账户:入金 8:外部子账户:出金
  245. AMOUNT float64 `json:"amount" xorm:"AMOUNT"` // 金额
  246. CURRENCY string `json:"currency" xorm:"CURRENCY"` // 币种
  247. CHARGE float64 `json:"charge" xorm:"CHARGE"` // 手续费
  248. ACCOUNTPWD string `json:"accountpwd" xorm:"ACCOUNTPWD"` // 资金密码
  249. UPDATETIME string `json:"updatetime" xorm:"UPDATETIME"` // 更新时间(申请时间)
  250. BANKID string `json:"bankid" xorm:"BANKID"` // 银行编号
  251. BRANCHBANKID string `json:"branchbankid" xorm:"BRANCHBANKID"` // 银行支行号
  252. BRANCHBANKNAME string `json:"branchbankname" xorm:"BRANCHBANKNAME"` // 银行支行名称
  253. BANKACCOUNTNO string `json:"bankaccountno" xorm:"BANKACCOUNTNO"` // 银行卡号
  254. BANKACCOUNTNAME string `json:"bankaccountname" xorm:"BANKACCOUNTNAME"` // 银行账户名
  255. EXTENDINFO string `json:"extendinfo" xorm:"EXTENDINFO"` // 扩展信息
  256. AUDITID int64 `json:"auditid" xorm:"AUDITID"` // 审核人
  257. AUDITTIME string `json:"audittime" xorm:"AUDITTIME"` // 审核时间
  258. REMARK string `json:"remark" xorm:"REMARK"` // 备注
  259. NETADDR string `json:"netaddr" xorm:"NETADDR"` // 调转网址
  260. ACCOUNTTICKET string `json:"accountticket" xorm:"ACCOUNTTICKET"` // 最新账户服务流水号
  261. CHECKERRORFLAG int32 `json:"checkerrorflag" xorm:"CHECKERRORFLAG"` // 对账差错标志 - 1:为单边账;其它为正常出入金
  262. REMARK2 string `json:"remark2" xorm:"REMARK2"` // 备注(失败原因)
  263. REAUDITID int64 `json:"reauditid" xorm:"REAUDITID"` // 复审人
  264. REAUDITTIME string `json:"reaudittime" xorm:"REAUDITTIME"` // 复审时间
  265. REAUDITREMARK string `json:"reauditremark" xorm:"REAUDITREMARK"` // 复审备注
  266. APPLYREMARK string `json:"applyremark" xorm:"APPLYREMARK"` // 申请备注
  267. RELATEDORDERID string `json:"relatedorderid" xorm:"RELATEDORDERID"` // 三方关联ID
  268. CAPAMOUNTOUT float64 `json:"capamountout" xorm:"CAPAMOUNTOUT"` // 出金(劣后本金) - 外部子账户
  269. INFAMOUNT float64 `json:"infamount" xorm:"INFAMOUNT"` // 劣后金额(自有)
  270. PRIAMOUNT float64 `json:"priamount" xorm:"PRIAMOUNT"` // 优先金额(授信)
  271. BANK_APPLY_TICKET string `json:"bank_apply_ticket" xorm:"BANK_APPLY_TICKET"` // 银行申请流水
  272. CERTIFICATEPHOTOURL string `json:"certificatephotourl" xorm:"CERTIFICATEPHOTOURL"` // 凭证地址
  273. SOUCREAMOUNT float64 `json:"soucreamount" xorm:"SOUCREAMOUNT"` // 原始出入金金额
  274. SOUCRECURRENCYID int64 `json:"soucrecurrencyid" xorm:"SOUCRECURRENCYID"` // 原始出入金币种
  275. ACCOUNTCODE string `json:"accountcode" xorm:"ACCOUNTCODE"` // 资金账号
  276. CUSBANKID string `json:"cusbankid" xorm:"CUSBANKID"` // 托管银行编号
  277. TRADEDATE string `json:"tradedate" xorm:"TRADEDATE"` // 交易日(yyyyMMdd)
  278. EXCHTICKET string `json:"exchticket" xorm:"EXCHTICKET"` // 银行服务流水号
  279. EXTOPERATEID int64 `json:"extoperateid" xorm:"EXTOPERATEID"` // 交易服务流水号
  280. BANKTICKET string `json:"bankticket" xorm:"BANKTICKET"` // 银行流水
  281. APPLYSTATUS int32 `json:"applystatus" xorm:"APPLYSTATUS"` // 申请状态 - 1:待审核 2:待复审 3:初审拒绝 4:交易冻结中 5:交易解冻中 6:交易解冻扣款中 7:交易入金中 8:交易冻结/解冻/扣款中(银行发起出金时用) 9:银行出金中 10:银行入金中 11:成功 12:失败 13:银行审核中 14:账户服务入金失败; 15:账户服务解冻失败; 16:账户服务解冻扣款失败; 17:账户服务出金失败 18:复审通过 19:复审拒绝 20:提交审核,账户冻结中 21:审核拒绝,账户解冻中;22: 待审核,账户服务解冻回滚中; 23:待复审,账户服务解冻回滚中; 24: 审核通过,账户冻结金额检查中;25: 复审通过,账户冻结金额检查中;
  282. USERID int64 `json:"userid" xorm:"'USERID'"` // 用户id
  283. LOGINCODE string `json:"logincode" xorm:"'LOGINCODE'"` // 登录账号(账号)
  284. USERINFOTYPE int32 `json:"userinfotype" xorm:"'USERINFOTYPE'"` // 账户类型 1-个人 2-企业
  285. ACCOUNTNAME string `json:"accountname" xorm:"'ACCOUNTNAME'"` // 用户名称(名称)
  286. QUERYTYPE int32 `json:"-"` // 查询类型 1-提现 2-充值
  287. STATUS int32 `json:"-"` // 查询状态 1-待审核 2-审核通过 3-审核拒绝
  288. BeginDate string `json:"-"` // 开始日期(yyyymmdd)
  289. EndDate string `json:"-"` // 结束日期(yyyymmdd)
  290. FilterName string `json:"-"` // 账户(模糊匹配)
  291. }
  292. func (r *QhjMgrAccountOutInApply) calc() {
  293. }
  294. func (r *QhjMgrAccountOutInApply) buildSql() string {
  295. var sqlId utils.SQLVal = "with tmp as(select t.userid, wm_concat(t.logincode) logincode from loginaccount t group by t.userid)" +
  296. "SELECT t.EXECUTETYPE," +
  297. " t.AMOUNT," +
  298. " t.CURRENCY," +
  299. " t.CHARGE," +
  300. " t.ACCOUNTPWD," +
  301. " to_char(t.UPDATETIME, 'yyyy-mm-dd hh24:mi:ss') UPDATETIME," +
  302. " t.BANKID," +
  303. " t.BRANCHBANKID," +
  304. " t.BRANCHBANKNAME," +
  305. " t.BANKACCOUNTNO," +
  306. " t.BANKACCOUNTNAME," +
  307. " t.EXTENDINFO," +
  308. " t.AUDITID," +
  309. " to_char(t.AUDITTIME, 'yyyy-mm-dd hh24:mi:ss') AUDITTIME," +
  310. " t.REMARK," +
  311. " t.NETADDR," +
  312. " t.ACCOUNTTICKET," +
  313. " t.CHECKERRORFLAG," +
  314. " t.REMARK2," +
  315. " t.REAUDITID," +
  316. " to_char(t.REAUDITTIME, 'yyyy-mm-dd hh24:mi:ss') REAUDITTIME," +
  317. " t.REAUDITREMARK," +
  318. " t.APPLYREMARK," +
  319. " t.RELATEDORDERID," +
  320. " t.CAPAMOUNTOUT," +
  321. " t.INFAMOUNT," +
  322. " t.PRIAMOUNT," +
  323. " t.BANK_APPLY_TICKET," +
  324. " to_char(t.CERTIFICATEPHOTOURL) CERTIFICATEPHOTOURL," +
  325. " t.SOUCREAMOUNT," +
  326. " t.SOUCRECURRENCYID," +
  327. " t.ACCOUNTCODE," +
  328. " t.CUSBANKID," +
  329. " t.TRADEDATE," +
  330. " t.EXCHTICKET," +
  331. " t.EXTOPERATEID," +
  332. " t.BANKTICKET," +
  333. " t.APPLYSTATUS," +
  334. " ta.userid," +
  335. " u.accountname," +
  336. " ui.userinfotype," +
  337. " tmp.logincode" +
  338. " FROM BANK_ACCOUNTOUTINAPPLY t" +
  339. " INNER JOIN TAACCOUNT ta on t.accountcode=to_char(ta.accountid)" +
  340. " INNER JOIN USERACCOUNT u on ta.relateduserid=u.userid" +
  341. " INNER JOIN USERINFO ui on u.userid=ui.userid" +
  342. " LEFT JOIN tmp on u.userid=tmp.userid" +
  343. " WHERE 1 = 1"
  344. sqlId.And("EXECUTETYPE", r.QUERYTYPE)
  345. switch r.STATUS {
  346. case 1:
  347. sqlId.JoinFormat(" and t.APPLYSTATUS in(%v)", InStr(1, 2))
  348. case 2:
  349. sqlId.JoinFormat(" and t.APPLYSTATUS in(%v)", InStr(11, 18, 24, 25))
  350. case 3:
  351. sqlId.JoinFormat(" and t.APPLYSTATUS in(%v)", InStr(3, 12, 21))
  352. }
  353. if len(r.BeginDate) > 0 {
  354. sqlId.Join(fmt.Sprintf(" and t.TRADEDATE >= %v", r.BeginDate))
  355. }
  356. if len(r.EndDate) > 0 {
  357. sqlId.Join(fmt.Sprintf(" and t.TRADEDATE <= %v", r.EndDate))
  358. }
  359. if len(r.FilterName) > 0 {
  360. sqlId.Join(fmt.Sprintf(" and (tmp.logincode like '%%%v%%' or u.accountname like '%%%v%%')", r.FilterName, r.FilterName))
  361. }
  362. return sqlId.String()
  363. }
  364. // GetDataEx 获取充值提现(出入金)
  365. func (r *QhjMgrAccountOutInApply) GetDataEx() (interface{}, error) {
  366. sData := make([]QhjMgrAccountOutInApply, 0)
  367. err := db.GetEngine().SQL(r.buildSql()).Find(&sData)
  368. for i := range sData {
  369. sData[i].calc()
  370. }
  371. return sData, err
  372. }