anderx лет назад: 2
Родитель
Сommit
0a85a45770

+ 9 - 0
src/main/java/com/goafanti/admin/bo/OutFinanceCount.java

@@ -6,6 +6,7 @@ import java.math.BigDecimal;
 
 public class OutFinanceCount extends FinanceCount {
 
+    private Integer publicCount;
     private Integer rangePublicCount;
 
     private BigDecimal receivables;
@@ -13,6 +14,14 @@ public class OutFinanceCount extends FinanceCount {
     private Integer changeCount;
     private Integer changeInvoiceCount;
 
+    public Integer getPublicCount() {
+        return publicCount;
+    }
+
+    public void setPublicCount(Integer publicCount) {
+        this.publicCount = publicCount;
+    }
+
     public Integer getChangeCount() {
         return changeCount;
     }

+ 2 - 1
src/main/java/com/goafanti/admin/service/impl/AdminStatisticsServiceImpl.java

@@ -200,7 +200,8 @@ public class AdminStatisticsServiceImpl implements AdminStatisticsService {
         OutFinanceCount financeCount=adminMapper.financeInfo(aid, startTime, endTime);
         Integer rangePublicCount = publicReleaseMapper.selectByaidAndDate(aid, startTime, endTime);
         financeCount.setRangePublicCount(rangePublicCount);
-        BigDecimal rangeReceivables=adminMapper.addAdminContactsRangeReceivables(aid,startTime,endTime);
+        BigDecimal rangeReceivables=adminMapper.selectFinanceReceivablesCount(aid,startTime,endTime);
+        if (rangeReceivables==null)rangeReceivables=new BigDecimal(0);
         financeCount.setRangeReceivables(rangeReceivables);
         OutFinanceCount outFinanceCount = adminMapper.selectFinanceChangeCount(aid);
         if (outFinanceCount.getChangeCount()==null)outFinanceCount.setChangeCount(0);

+ 2 - 0
src/main/java/com/goafanti/common/dao/AdminMapper.java

@@ -202,4 +202,6 @@ public interface AdminMapper {
     OutFinanceCount financeInfo(@Param("aid") String aid, @Param("startTime") String startTime, @Param("endTime") String endTime);
 
     OutFinanceCount selectFinanceChangeCount(String aid);
+
+    BigDecimal selectFinanceReceivablesCount(@Param("aid") String aid, @Param("startTime") String startTime, @Param("endTime") String endTime);
 }

+ 26 - 16
src/main/java/com/goafanti/common/mapper/AdminMapper.xml

@@ -1402,24 +1402,26 @@
     </foreach>
   </select>
     <select id="financeInfo" resultType="com.goafanti.admin.bo.OutFinanceCount">
-      select x.aid,x.orderCount,x.expenseCount,x.invoiceCount,x.memberCount,x.paymentCount,x.publicCount,y.orderUnauditedCount,
-             y.expenseUnauditedCount,y.invoiceUnauditedCount,y.memberUnauditedCount,y.paymentUnauditedCount
+      select x.aid,x.orderCount,x.expenseCount,x.invoiceCount,x.memberCount,x.paymentCount,b.counts publicCount,y.orderUnauditedCount,
+             c.counts receivables,y.expenseUnauditedCount,y.invoiceUnauditedCount,y.memberUnauditedCount,y.paymentUnauditedCount
       from ( select a.aid,sum(a.order_count)orderCount ,sum(a.expense_count)expenseCount ,SUM(a.invoice_count) invoiceCount,
-                sum(a.member_count) memberCount ,sum(a.payment_count)paymentCount,sum(ifnull(counts,0))publicCount,
-                sum(ifnull(c.counts))
-             from finance_count a left join (select aid,sum(if(a.`type` in (0,1,2),1,0)) counts
-               from public_release a left join public_release_details b on a.id=b.prid
-               where aid= #{aid})b on a.aid=b.aid left join (SELECT c.finance_id aid,sum(a.money) counts
-                   from new_order_dun a left join t_order_new b on a.order_no =b.order_no
-                                        left join department c on b.order_dep =c.id
-                   where a.status =1   and b.delete_sign in (0,2,3)
-                     and c.finance_id = #{aid})c on a.aid=c.aid
-      where a.aid= #{aid} group by a.aid)x,
+                    sum(a.member_count) memberCount ,sum(a.payment_count)paymentCount
+             from finance_count a
+             where a.aid= #{aid} )x,
+           (select aid,sum(if(a.`type` in (0,1,2),1,0)) counts
+            from public_release a left join public_release_details b on a.id=b.prid
+
+            where a.status=2 and  a.aid= #{aid} )b ,
+           (SELECT c.finance_id aid,sum(a.money) counts
+            from new_order_dun a left join t_order_new b on a.order_no =b.order_no
+                                 left join department c on b.order_dep =c.id
+            where a.status =1   and b.delete_sign in (0,2,3)
+              and c.finance_id = #{aid} )c ,
            (select a.aid,sum(a.order_unaudited_count)orderUnauditedCount ,sum(a.expense_unaudited_count)expenseUnauditedCount ,
-                SUM(a.invoice_unaudited_count) invoiceUnauditedCount,sum(a.member_unaudited_count) memberUnauditedCount ,
-                sum(a.payment_unaudited_count)paymentUnauditedCount
-             from finance_count a where a.aid= #{aid} and a.date_time BETWEEN #{startTime}  and #{endTime}
-             group by a.aid)y
+                   SUM(a.invoice_unaudited_count) invoiceUnauditedCount,sum(a.member_unaudited_count) memberUnauditedCount ,
+                   sum(a.payment_unaudited_count)paymentUnauditedCount
+            from finance_count a where a.aid= #{aid} and a.date_time BETWEEN #{startTime}  and #{endTime}
+            group by a.aid)y
     </select>
   <select id="financeCountRangeReceivables" resultType="java.math.BigDecimal">
     SELECT  ifnull(sum(a.money),0)  receivables
@@ -1436,4 +1438,12 @@
     where c.finance_id = #{aid}
       and a.process_state in (6,8,9) and a.status in(1,2) and b.delete_sign in (0,2,3)
   </select>
+  <select id="selectFinanceReceivablesCount" resultType="java.math.BigDecimal">
+    SELECT  sum(a.money)  receivables
+    from new_order_dun a left join t_order_new b on a.order_no =b.order_no
+                         left join department c on b.order_dep =c.id
+    where a.status =1   and b.delete_sign in (0,2,3)
+      and  c.finance_id = #{aid}
+      and a.start_time  between #{startTime} and #{endTime}
+  </select>
 </mapper>