• 我的投资 本金和利息算法(公司做的笔记)


    我的投资(以下是针对投资人来算的)
    =========================================================

    本期应收总额 = 本期回收本息(now_amount) - 利息管理费(fee)

    应收本金 = 本期回收本息(now_amount) - 利息(accrual)

    应收利息 = 收益(lucre)

    -----

    名次解释:

    本期回收本息(now_amount) = 应收本金 + 利息(accrual)

    利息(accrual) = 收益(lucre) + 利息管理费(fee)


    正确的查询语句是(然后再根据算法加减就ok了):
    SELECT SUM(now_amount), SUM(accrual), SUM(lucre), SUM(fee)
    FROM `d_repay_list`
    WHERE STATUS = 0
    AND ((uid =13951 AND juid = 0) OR (juid = 13951))


    个人中心 > 投资统计
    ===========================================================

    待收本金算法

    SELECT SUM(now_amount) AS tp_sum FROM `d_repay_list` WHERE (status=0 and uid=13951 ) LIMIT 1
    +
    SELECT SUM(now_amount) AS tp_sum FROM `d_repay_list` WHERE (status=0 and juid=13951 ) LIMIT 1
    -
    SELECT SUM(accrual) AS tp_sum FROM `d_repay_list` WHERE (status=0 and uid=13951 ) LIMIT 1
    -
    SELECT SUM(accrual) AS tp_sum FROM `d_repay_list` WHERE (status=1 and juid=13951 ) LIMIT 1


    status = 状态:0 待还,1 已还

    待收本金 = 待收本息 - 利息(收益 + 管理费)

    待收本息 = 作为投资人的待收本息之和 + 作为承接人的待收本息之和

    利息 = 作为投资人的利息之和 + 作为承接人的利息之和

    ==========================================================================


    待收利息
    SELECT SUM(accrual) AS tp_sum FROM `d_repay_list` WHERE (status=0 and and uid=13951 ) LIMIT 1
    +
    SELECT SUM(accrual) AS tp_sum FROM `d_repay_list` WHERE (status=0 and juid=13951 ) LIMIT 1


    待收次数
    SELECT COUNT(*) AS tp_count FROM `d_invest_list` WHERE ( 1=1 AND status =5 AND (CASE juid WHEN 0 THEN uid =13951 ELSE juid
    =13951 END) ) LIMIT 1

    SELECT * FROM `d_repay_list` WHERE ( STATUS = 0 AND (CASE juid WHEN 0 THEN uid =13951 ELSE juid =13951 END) ) ORDER BY
    repay_date ASC

  • 相关阅读:
    [转]centos sqlite3安装及简单命令
    [转] cmake源码编译安装jsoncpp
    [转]详解Linux(centos7)下安装OpenSSL安装图文方法
    [转]curl 命令模拟 HTTP GET/POST 请求
    [转]白话HTTP短连接中的Session和Token
    [转]浅谈HTTP中GET、POST用法以及它们的区别
    [转][linux][centos]嵌入式 Linux下编译并使用curl静态库
    [转]在CentOS安装CMake (CentOS7 64位适用)
    HTTP/2 资料汇总
    Http 1.x弊端与Http 2.0比较
  • 原文地址:https://www.cnblogs.com/kingfly/p/4106336.html
Copyright © 2020-2023  润新知