Browse Source

fixed 交易金额去除优惠金额、积分金额、运费

fushengqian 8 months ago
parent
commit
5ede1c8806

+ 5 - 5
fuint-application/src/main/java/com/fuint/common/service/impl/OrderServiceImpl.java

@@ -1803,7 +1803,7 @@ public class OrderServiceImpl extends ServiceImpl<MtOrderMapper, MtOrder> implem
      * */
     @Override
     public BigDecimal getOrderCount(Integer merchantId, Integer storeId) {
-        if (storeId > 0) {
+        if (storeId != null && storeId > 0) {
             return mtOrderMapper.getStoreOrderCount(storeId);
         } else {
             return mtOrderMapper.getOrderCount(merchantId);
@@ -1821,7 +1821,7 @@ public class OrderServiceImpl extends ServiceImpl<MtOrderMapper, MtOrder> implem
      * */
     @Override
     public BigDecimal getOrderCount(Integer merchantId, Integer storeId, Date beginTime, Date endTime) {
-        if (storeId > 0) {
+        if (storeId != null && storeId > 0) {
             return mtOrderMapper.getStoreOrderCountByTime(storeId, beginTime, endTime);
         } else {
             return mtOrderMapper.getOrderCountByTime(merchantId, beginTime, endTime);
@@ -1840,7 +1840,7 @@ public class OrderServiceImpl extends ServiceImpl<MtOrderMapper, MtOrder> implem
     @Override
     public BigDecimal getPayMoney(Integer merchantId, Integer storeId, Date beginTime, Date endTime) {
         BigDecimal payMoney;
-        if (storeId > 0) {
+        if (storeId != null && storeId > 0) {
             payMoney = mtOrderMapper.getStorePayMoneyByTime(storeId, beginTime, endTime);
         } else {
             payMoney = mtOrderMapper.getPayMoneyByTime(merchantId, beginTime, endTime);
@@ -1860,7 +1860,7 @@ public class OrderServiceImpl extends ServiceImpl<MtOrderMapper, MtOrder> implem
      * */
     @Override
     public Integer getPayUserCount(Integer merchantId, Integer storeId) {
-        if (storeId > 0) {
+        if (storeId != null && storeId > 0) {
             return mtOrderMapper.getStorePayUserCount(storeId);
         } else {
             return mtOrderMapper.getPayUserCount(merchantId);
@@ -1876,7 +1876,7 @@ public class OrderServiceImpl extends ServiceImpl<MtOrderMapper, MtOrder> implem
      * */
     @Override
     public BigDecimal getPayMoney(Integer merchantId, Integer storeId) {
-        if (storeId > 0) {
+        if (storeId != null && storeId > 0) {
             return mtOrderMapper.getStorePayMoney(storeId);
         } else {
             return mtOrderMapper.getPayMoney(merchantId);

+ 4 - 4
fuint-repository/src/main/resources/mapper/MtOrderMapper.xml

@@ -28,25 +28,25 @@
     </select>
 
     <select id="getPayMoney" resultType="java.math.BigDecimal">
-        SELECT sum(t.AMOUNT) as num FROM mt_order t where t.PAY_STATUS='B' and t.STATUS not in('C', 'G', 'H')
+        SELECT sum(t.PAY_AMOUNT) as num FROM mt_order t where t.PAY_STATUS='B' and t.STATUS not in('C', 'G', 'H')
         <if test="merchantId != null and merchantId > 0">
             AND t.MERCHANT_ID = #{merchantId}
         </if>
     </select>
 
     <select id="getPayMoneyByTime" resultType="java.math.BigDecimal">
-        SELECT sum(t.AMOUNT) as num FROM mt_order t where t.PAY_STATUS='B' and t.CREATE_TIME &lt; #{endTime} and t.CREATE_TIME &gt;= #{beginTime} and t.STATUS not in('C', 'G', 'H')
+        SELECT sum(t.PAY_AMOUNT) as num FROM mt_order t where t.PAY_STATUS='B' and t.CREATE_TIME &lt; #{endTime} and t.CREATE_TIME &gt;= #{beginTime} and t.STATUS not in('C', 'G', 'H')
         <if test="merchantId != null and merchantId > 0">
             AND t.MERCHANT_ID = #{merchantId}
         </if>
     </select>
 
     <select id="getStorePayMoneyByTime" resultType="java.math.BigDecimal">
-        SELECT sum(t.AMOUNT) as num FROM mt_order t where t.STORE_ID = #{storeId} and t.PAY_STATUS='B' and t.CREATE_TIME &lt; #{endTime} and t.CREATE_TIME &gt;= #{beginTime} and t.STATUS not in('C', 'G', 'H')
+        SELECT sum(t.PAY_AMOUNT) as num FROM mt_order t where t.STORE_ID = #{storeId} and t.PAY_STATUS='B' and t.CREATE_TIME &lt; #{endTime} and t.CREATE_TIME &gt;= #{beginTime} and t.STATUS not in('C', 'G', 'H')
     </select>
 
     <select id="getStorePayMoney" resultType="java.math.BigDecimal">
-        SELECT sum(t.AMOUNT) as num FROM mt_order t where t.STORE_ID = #{storeId} and t.PAY_STATUS='B' and t.STATUS not in('C', 'G', 'H')
+        SELECT sum(t.PAY_AMOUNT) as num FROM mt_order t where t.STORE_ID = #{storeId} and t.PAY_STATUS='B' and t.STATUS not in('C', 'G', 'H')
     </select>
 
     <select id="getPayUserCount" resultType="java.lang.Integer">