Explorar o código

修改订单统计

周箭河 %!s(int64=5) %!d(string=hai) anos
pai
achega
c4fe9397d9

+ 22 - 15
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/SysUserCashAccountDao.java

@@ -4,25 +4,32 @@ import com.ym.mec.biz.dal.entity.SysUserCashAccount;
 import com.ym.mec.common.dal.BaseDAO;
 import org.apache.ibatis.annotations.Param;
 
+import java.math.BigDecimal;
 import java.util.List;
 import java.util.Set;
 
 public interface SysUserCashAccountDao extends BaseDAO<Integer, SysUserCashAccount> {
-	
-	/**
-	 * 获取行级锁
-	 * @param userId
-	 * @return
-	 */
-	SysUserCashAccount getLocked(Integer userId);
 
-	/**
-	 * @describe 根据用户编号获取现金账户信息
-	 * @author Joburgess
-	 * @date 2019/11/17
-	 * @param userIds: 用户编号列表
-	 * @return java.util.List<com.ym.mec.biz.dal.entity.SysUserCashAccount>
-	 */
-	List<SysUserCashAccount> findByUserIds(@Param("userIds") Set<Integer> userIds);
+    /**
+     * 获取行级锁
+     *
+     * @param userId
+     * @return
+     */
+    SysUserCashAccount getLocked(Integer userId);
 
+    /**
+     * @param userIds: 用户编号列表
+     * @return java.util.List<com.ym.mec.biz.dal.entity.SysUserCashAccount>
+     * @describe 根据用户编号获取现金账户信息
+     * @author Joburgess
+     * @date 2019/11/17
+     */
+    List<SysUserCashAccount> findByUserIds(@Param("userIds") Set<Integer> userIds);
+
+    /**
+     * 获取预收余额
+     * @return
+     */
+    BigDecimal getTotalUserBalance();
 }

+ 9 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/PageInfoOrder.java

@@ -10,6 +10,7 @@ public class PageInfoOrder<T> extends PageInfo<T> {
     private BigDecimal totalActualAmount =BigDecimal.ZERO;
     private BigDecimal totalAdvanceAmount = BigDecimal.ZERO;
     private BigDecimal totalRevenueAmount = BigDecimal.ZERO;
+    private BigDecimal totalUserBalance = BigDecimal.ZERO;
 
     public PageInfoOrder() {
     }
@@ -53,4 +54,12 @@ public class PageInfoOrder<T> extends PageInfo<T> {
     public void setTotalRevenueAmount(BigDecimal totalRevenueAmount) {
         this.totalRevenueAmount = totalRevenueAmount;
     }
+
+    public BigDecimal getTotalUserBalance() {
+        return totalUserBalance;
+    }
+
+    public void setTotalUserBalance(BigDecimal totalUserBalance) {
+        this.totalUserBalance = totalUserBalance;
+    }
 }

+ 5 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentPaymentOrderServiceImpl.java

@@ -3,6 +3,7 @@ package com.ym.mec.biz.service.impl;
 import com.alibaba.fastjson.JSON;
 import com.huifu.adapay.model.payment.Payment;
 import com.ym.mec.biz.dal.dao.StudentPaymentOrderDao;
+import com.ym.mec.biz.dal.dao.SysUserCashAccountDao;
 import com.ym.mec.biz.dal.dto.PageInfoOrder;
 import com.ym.mec.biz.dal.dto.SporadicChargeInfoDto;
 import com.ym.mec.biz.dal.dto.StudentPaymentOrderExportDto;
@@ -50,6 +51,8 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
     private SporadicChargeInfoService sporadicChargeInfoService;
     @Autowired
     private PracticeGroupService practiceGroupService;
+    @Autowired
+    private SysUserCashAccountDao sysUserCashAccountDao;
 
     @Override
     public BaseDAO<Long, StudentPaymentOrder> getDAO() {
@@ -282,6 +285,8 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
 
         List<StudentPaymentOrder> dataList = new ArrayList<>();
         int count = this.findCount(params);
+        BigDecimal totalUserBalance = sysUserCashAccountDao.getTotalUserBalance();
+        pageInfo.setTotalUserBalance(totalUserBalance);
         if (count > 0) {
             pageInfo.setTotal(count);
             params.put("offset", pageInfo.getOffset());

+ 4 - 0
mec-biz/src/main/resources/config/mybatis/SysUserCashAccountMapper.xml

@@ -94,4 +94,8 @@
         </foreach>
     </select>
 
+    <select id="getTotalUserBalance" resultType="java.math.BigDecimal">
+        SELECT SUM(balance_) FROM sys_user_cash_account
+    </select>
+
 </mapper>