|
|
@@ -1001,6 +1001,24 @@ func (r *QhjBankInfo) GetDataEx() (interface{}, error) {
|
|
|
return r.GetData()
|
|
|
}
|
|
|
|
|
|
+func (r *QhjBankInfo) buildSql2(cusbankid string) string {
|
|
|
+ var sqlId utils.SQLVal = "SELECT t.BANKID,t.BANKNAME,t.CLEARBANKNO,t.STATUS,t.ORDERINDEX FROM BANK_BANKINFO t WHERE 1=1" +
|
|
|
+ " and t.status=0 and t.bankid in (select bankid from bank_cusbanksignbank b where b.cusbankid='%v'" +
|
|
|
+ " order by t.orderindex"
|
|
|
+ sqlId.FormatParam(cusbankid)
|
|
|
+ return sqlId.String()
|
|
|
+}
|
|
|
+
|
|
|
+// GetDataByID 获取银行信息列表By渠道ID
|
|
|
+func (r *QhjBankInfo) GetDataByID(cusbankid string) ([]QhjBankInfo, error) {
|
|
|
+ sData := make([]QhjBankInfo, 0)
|
|
|
+ err := db.GetEngine().SQL(r.buildSql2(cusbankid)).Find(&sData)
|
|
|
+ for i := range sData {
|
|
|
+ sData[i].calc()
|
|
|
+ }
|
|
|
+ return sData, err
|
|
|
+}
|
|
|
+
|
|
|
// QhjReckonPriceLog 结算价(定投价)
|
|
|
type QhjReckonPriceLog struct {
|
|
|
LASTRECKONPRICE float64 `json:"lastreckonprice" xorm:"LASTRECKONPRICE"` // 上日结算价
|
|
|
@@ -1386,6 +1404,64 @@ func (r *QhjCusBankInfo) GetDataEx() (interface{}, error) {
|
|
|
return r.GetData()
|
|
|
}
|
|
|
|
|
|
+func (r *QhjCusBankInfo) buildSql2(areauserid int, configtype int) string {
|
|
|
+ var sqlId utils.SQLVal = "with tmp as" +
|
|
|
+ " (select *" +
|
|
|
+ " from (select row_number() over(partition by t.cusbankid order by t.tradedate desc) cn," +
|
|
|
+ " t.CUSBANKID id2," +
|
|
|
+ " t.TRADEDATE," +
|
|
|
+ " t.SIGNSTATUS," +
|
|
|
+ " to_char(t.UPDATETIME, 'yyyy-mm-dd hh24:mi:ss') UPDATETIME," +
|
|
|
+ " to_char(t.LASTSIGNINTIME, 'yyyy-mm-dd hh24:mi:ss') LASTSIGNINTIME," +
|
|
|
+ " to_char(t.LASTSIGNOUTTIME, 'yyyy-mm-dd hh24:mi:ss') LASTSIGNOUTTIME," +
|
|
|
+ " to_char(t.LASTCHECKTIME, 'yyyy-mm-dd hh24:mi:ss') LASTCHECKTIME," +
|
|
|
+ " t.LASTCHECKSTATUS," +
|
|
|
+ " to_char(t.LASTCLEARTIME, 'yyyy-mm-dd hh24:mi:ss') LASTCLEARTIME," +
|
|
|
+ " t.LASTCLEARSTATUS" +
|
|
|
+ " from bank_cusbankstatus t)" +
|
|
|
+ " where cn = 1)" +
|
|
|
+ "SELECT t.CUSBANKID," +
|
|
|
+ " t.CUSBANKNAME," +
|
|
|
+ " t.CUSBANKSHORTNAME," +
|
|
|
+ " t.EXCHBANKID," +
|
|
|
+ " t.EXCHPAYBANKACCNO," +
|
|
|
+ " t.EXCHPAYBANKACCNAME," +
|
|
|
+ " t.CURRENCY," +
|
|
|
+ " t.CANSIGN," +
|
|
|
+ " t.CANRELEASE," +
|
|
|
+ " t.CANINAMOUNT," +
|
|
|
+ " t.CANOUTAMOUNT," +
|
|
|
+ " to_char(t.RISKINFO) RISKINFO," +
|
|
|
+ " t.CANSIGN2," +
|
|
|
+ " t.CANRELEASE2," +
|
|
|
+ " t.CANINAMOUNT2," +
|
|
|
+ " t.CANOUTAMOUNT2," +
|
|
|
+ " t.CANBINDCARD," +
|
|
|
+ " t.ISNEEDCLEAR," +
|
|
|
+ " t.CANMODIFYPHONE," +
|
|
|
+ " t.CANMODIFYSIGNINFO," +
|
|
|
+ " t.ISNEEDCHECK," +
|
|
|
+ " t.CANMODIFYBANKCARD," +
|
|
|
+ " t.CANALLOT," +
|
|
|
+ " t.CANALLOTQUERY," +
|
|
|
+ " tmp.*" +
|
|
|
+ " FROM BANK_CUSBANKINFO t" +
|
|
|
+ " LEFT JOIN tmp on t.cusbankid = tmp.id2" +
|
|
|
+ " INNER JOIN tce_areacusbankconfig ta on t.cusbankid = ta.cusbankid" +
|
|
|
+ " WHERE 1 = 1"
|
|
|
+ sqlId.And("ta.areauserid", areauserid)
|
|
|
+ sqlId.And("ta.configtype", configtype)
|
|
|
+ return sqlId.String()
|
|
|
+}
|
|
|
+
|
|
|
+// GetAreaData 获取机构托管银行信息
|
|
|
+func (r *QhjCusBankInfo) GetAreaData(areauserid int, configtype int) ([]QhjCusBankInfo, error) {
|
|
|
+ sData := make([]QhjCusBankInfo, 0)
|
|
|
+ err := db.GetEngine().SQL(r.buildSql2(areauserid, configtype)).Find(&sData)
|
|
|
+
|
|
|
+ return sData, err
|
|
|
+}
|
|
|
+
|
|
|
// QhjCusBankSignBank 托管银行签约关系
|
|
|
type QhjCusBankSignBank struct {
|
|
|
CUSBANKID string `json:"cusbankid" xorm:"CUSBANKID"` // 托管银行ID
|
|
|
@@ -1454,6 +1530,38 @@ func (r *QhjCusBankSignBankEx) GetDataEx() (interface{}, error) {
|
|
|
return sData, nil
|
|
|
}
|
|
|
|
|
|
+// MemberCusBankInfos 机构托管银行签约银行详细
|
|
|
+type MemberCusBankInfos struct {
|
|
|
+ QhjCusBankInfo
|
|
|
+ Banklst []QhjBankInfo // 银行列表
|
|
|
+
|
|
|
+ userid int `json:"-"` // 用户ID
|
|
|
+ memberuserid int `json:"-"` // 所属机构ID
|
|
|
+}
|
|
|
+
|
|
|
+// GetDataEx 获取机构托管银行签约银行详细
|
|
|
+func (r *MemberCusBankInfos) GetDataEx() (interface{}, error) {
|
|
|
+ sData := make([]MemberCusBankInfos, 0)
|
|
|
+ var configtype = 2
|
|
|
+ if r.userid == r.memberuserid {
|
|
|
+ // 用户ID和所属机构ID相等则为自营会员
|
|
|
+ configtype = 1
|
|
|
+ }
|
|
|
+ // 获取机构渠道配置
|
|
|
+ b := QhjCusBankInfo{}
|
|
|
+ bData, _ := b.GetAreaData(r.memberuserid, configtype)
|
|
|
+ for _, vb := range bData {
|
|
|
+ // 托管银行
|
|
|
+ v := MemberCusBankInfos{QhjCusBankInfo: vb}
|
|
|
+ // 获取渠道对应银行
|
|
|
+ c := QhjBankInfo{}
|
|
|
+ cData, _ := c.GetDataByID(vb.CUSBANKID)
|
|
|
+ v.Banklst = cData
|
|
|
+ sData = append(sData, v)
|
|
|
+ }
|
|
|
+ return sData, nil
|
|
|
+}
|
|
|
+
|
|
|
// QhjSiteColumnDetail 资讯
|
|
|
type QhjSiteColumnDetail struct {
|
|
|
ID int64 `json:"id" xorm:"ID"` // ID(SEQ_SITE_COLUMNDETAIL)
|