瀏覽代碼

Merge branch 'master' of http://git.dayaedu.com/yonge/collect_fee

孙镇亮 5 年之前
父節點
當前提交
0f99560498

+ 2 - 2
src/main/java/com/ym/mec/collectfee/controller/YqPayController.java

@@ -154,7 +154,7 @@ public class YqPayController extends BaseController {
 
         //获取分佣账户
         Integer branchId = 1001;//order.getBranchId();
-        Account routingAccount = accountService.getRoutingAccount(branchId);
+        Account routingAccount = accountService.getRoutingAccount(branchId,amount);
 
         order.setAccount(routingAccount.getSellerNo());
         order.setUAccount(routingAccount.getId().toString());
@@ -228,7 +228,7 @@ public class YqPayController extends BaseController {
         String orderNo = GenerateNum.getInstance().GenerateOrderNo(); //自己系统订单号
         //获取分佣账户
         Integer branchId = 1001;//order.getBranchId();
-        Account routingAccount = accountService.getRoutingAccount(branchId);
+        Account routingAccount = accountService.getRoutingAccount(branchId,amount);
 
         Order order = renewalsService.addRenewalsOrder(renewals, amount, orderNo, pickCourses, routingAccount, remark);
 

+ 3 - 1
src/main/java/com/ym/mec/collectfee/dao/AccountDao.java

@@ -6,10 +6,12 @@ import org.apache.ibatis.annotations.Param;
 import org.springframework.context.annotation.Bean;
 import org.springframework.stereotype.Component;
 
+import java.math.BigDecimal;
+
 @Component
 public interface AccountDao extends BaseDAO<Integer, Account> {
 
-    Account getAccountByBranchId(@Param("branchId") Integer branchId);
+    Account getAccountByBranchId(@Param("branchId") Integer branchId, @Param("money") BigDecimal money);
 
     int upByIdAndVersion(Account account);
 

+ 4 - 2
src/main/java/com/ym/mec/collectfee/service/AccountService.java

@@ -4,6 +4,8 @@ import com.ym.mec.collectfee.common.service.BaseService;
 import com.ym.mec.collectfee.entity.Account;
 import com.ym.mec.collectfee.entity.Order;
 
+import java.math.BigDecimal;
+
 public interface AccountService extends BaseService<Integer, Account> {
 
     /**
@@ -12,7 +14,7 @@ public interface AccountService extends BaseService<Integer, Account> {
      * @param branchId 分部id
      * @return
      */
-    Account getAccountByBranchId(Integer branchId);
+    Account getAccountByBranchId(Integer branchId,BigDecimal money);
 
     /**
      * 根据id和version更新已收款
@@ -28,6 +30,6 @@ public interface AccountService extends BaseService<Integer, Account> {
      * @param accountId 默认收款账户
      * @return
      */
-    Account getRoutingAccount(int accountId);
+    Account getRoutingAccount(int accountId, BigDecimal money);
 
 }

+ 4 - 4
src/main/java/com/ym/mec/collectfee/service/impl/AccountServiceImpl.java

@@ -30,8 +30,8 @@ public class AccountServiceImpl extends BaseServiceImpl<Integer, Account> implem
     }
 
     @Override
-    public Account getAccountByBranchId(Integer branchId) {
-        return accountDao.getAccountByBranchId(branchId);
+    public Account getAccountByBranchId(Integer branchId, BigDecimal money) {
+        return accountDao.getAccountByBranchId(branchId, money);
     }
 
     @Override
@@ -46,13 +46,13 @@ public class AccountServiceImpl extends BaseServiceImpl<Integer, Account> implem
      * @return
      */
     @Override
-    public Account getRoutingAccount(int branchId) {
+    public Account getRoutingAccount(int branchId, BigDecimal money) {
         int payOrderNums = orderService.getPayOrderNums(); //获取支付中和成功的订单数
         //分佣账户(1、每10笔,前四笔收入私户 2、私户每个商户最多收款400万)
         if ((payOrderNums + 1) % 10 <= 4) { //私人账户
             branchId = 0;
         }
-        return this.getAccountByBranchId(branchId);
+        return this.getAccountByBranchId(branchId, money);
     }
 
 

+ 11 - 11
src/main/resources/config/mybatis/AccountMapper.xml

@@ -5,7 +5,7 @@
 不要修改此文件。所有改动将在下次重新自动生成时丢失。
 -->
 <mapper namespace="com.ym.mec.collectfee.dao.AccountDao">
-	
+
 	<resultMap type="com.ym.mec.collectfee.entity.Account" id="Account">
 		<result column="id" property="id" />
 		<result column="branch_id" property="branchId" />
@@ -14,27 +14,27 @@
 		<result column="has_routing" property="hasRouting" />
 		<result column="version" property="version" />
 	</resultMap>
-	
+
 	<!-- 根据主键查询一条记录 -->
 	<select id="get" resultMap="Account" >
 		SELECT * FROM `account` WHERE id = #{id} 
 	</select>
-	
+
 	<!-- 全查询 -->
 	<select id="findAll" resultMap="Account">
 		SELECT * FROM `account` ORDER BY id
 	</select>
-	
+
 	<!-- 向数据库增加一条记录 -->
 	<insert id="insert" parameterType="com.ym.mec.collectfee.entity.Account" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
 		<!--
-		<selectKey resultClass="int" keyProperty="id" > 
-		SELECT SEQ_WSDEFINITION_ID.nextval AS ID FROM DUAL 
+		<selectKey resultClass="int" keyProperty="id" >
+		SELECT SEQ_WSDEFINITION_ID.nextval AS ID FROM DUAL
 		</selectKey>
 		-->
 		INSERT INTO `account` (id,branch_id,seller_no,max_routing,has_routing) VALUES(#{id},#{branchId},#{sellerNo},#{maxRouting},#{hasRouting})
 	</insert>
-	
+
 	<!-- 根据主键查询一条记录 -->
 	<update id="update" parameterType="com.ym.mec.collectfee.entity.Account">
 		UPDATE `account`
@@ -54,17 +54,17 @@
 		</set>
 		 WHERE id = #{id}
 	</update>
-	
+
 	<!-- 根据主键删除一条记录 -->
 	<delete id="delete" >
 		DELETE FROM `account` WHERE id = #{id} 
 	</delete>
-	
+
 	<!-- 分页查询 -->
 	<select id="queryPage" resultMap="Account" parameterType="map">
 		SELECT * FROM `account` ORDER BY id <include refid="global.limit"/>
 	</select>
-	
+
 	<!-- 查询当前表的总记录数 -->
 	<select id="queryCount" resultType="int">
 		SELECT COUNT(*) FROM `account`
@@ -72,7 +72,7 @@
 
 	<!-- 根据分部id获取分部收款账户 -->
 	<select id="getAccountByBranchId" resultMap="Account" >
-		SELECT * FROM `account` WHERE branch_id = #{branchId} AND `max_routing` > `has_routing` ORDER BY `id` ASC LIMIT 1
+		SELECT * FROM `account` WHERE branch_id = #{branchId} AND `max_routing` > `has_routing`+ #{money} ORDER BY `id` ASC LIMIT 1
 	</select>
 
 	<!-- 根据id和version更新已收金额 -->