瀏覽代碼

增加导出报名缴费中乐团缴费情况

周箭河 5 年之前
父節點
當前提交
3394432d0c

+ 6 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentPaymentRouteOrderDao.java

@@ -8,6 +8,7 @@ import com.ym.mec.common.dal.BaseDAO;
 import org.apache.ibatis.annotations.Param;
 
 import java.math.BigDecimal;
+import java.util.Date;
 import java.util.List;
 import java.util.Map;
 
@@ -31,9 +32,13 @@ public interface StudentPaymentRouteOrderDao extends BaseDAO<Long, StudentPaymen
 
     /**
      * 获取分部分润金额
+     *
      * @param routeOrganId
      * @param paymentChannelEnumList
      * @return
      */
-    BigDecimal getRouteOrderAmount(@Param("routeOrganId") Integer routeOrganId, @Param("paymentChannelEnumList") List<PaymentChannelEnum> paymentChannelEnumList);
+    BigDecimal getRouteOrderAmount(@Param("routeOrganId") Integer routeOrganId,
+                                   @Param("paymentChannelEnumList") List<PaymentChannelEnum> paymentChannelEnumList,
+                                   @Param("startTime") Date startTime
+    );
 }

+ 19 - 4
mec-biz/src/main/java/com/ym/mec/biz/service/impl/PayServiceImpl.java

@@ -17,6 +17,7 @@ import com.ym.mec.thirdparty.adapay.Payment;
 import com.ym.mec.thirdparty.union.UnionPay;
 import com.ym.mec.thirdparty.union.UnionPayFeignService;
 import com.ym.mec.thirdparty.yqpay.YqPayUtil;
+import com.ym.mec.util.date.DateUtil;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.redis.core.RedisTemplate;
@@ -370,19 +371,33 @@ public class PayServiceImpl implements PayService {
         }
 
         Map<String, String> channel = (Map<String, String>) JSON.parseObject(SporadicChannel, Map.class);
+
+        BigDecimal minReceiptMoney = new BigDecimal(channel.get("minReceiptMoney")); //最小接收的金额(不包含)
+        if (amount.compareTo(minReceiptMoney) <= 0) {
+            return null;
+        }
+
         Integer organId = Integer.parseInt(channel.get("organId"));
-        BigDecimal maxReceipt = new BigDecimal(channel.get("maxReceipt"));
+        BigDecimal monthMaxReceipt = new BigDecimal(channel.get("maxReceipt")); //每月限定金额
+        BigDecimal totalMaxReceipt = new BigDecimal(channel.get("totalMaxReceipt")); //总限定金额(500W)
+
+        Date monthStartTime = DateUtil.getFirstDayOfMonth(new Date());
+
 
         //已收金额
         List<PaymentChannelEnum> paymentChannelList = new ArrayList<>();
         paymentChannelList.add(PaymentChannelEnum.YQPAY);
         paymentChannelList.add(PaymentChannelEnum.ADAPAY);
 
-        BigDecimal hasReceipt = studentPaymentRouteOrderDao.getRouteOrderAmount(organId, paymentChannelList);
-        if (hasReceipt.compareTo(maxReceipt) >= 0) {
+        BigDecimal monthHasReceipt = studentPaymentRouteOrderDao.getRouteOrderAmount(organId, paymentChannelList, monthStartTime);
+        if (monthHasReceipt.compareTo(monthMaxReceipt) >= 0) {
             return null;
         }
-
+        BigDecimal totalHasReceipt = studentPaymentRouteOrderDao.getRouteOrderAmount(organId, paymentChannelList, null);
+        if (totalHasReceipt.compareTo(totalMaxReceipt) >= 0) {
+            return null;
+        }
+        
         SysPaymentConfig paymentConfig = sysPaymentConfigService.findPaymentConfigByOrganId(organId);
 
         RouteScaleDto routeScaleDto = new RouteScaleDto();

+ 3 - 0
mec-biz/src/main/resources/config/mybatis/StudentPaymentRouteOrderMapper.xml

@@ -178,6 +178,9 @@
         <foreach collection="paymentChannelEnumList" item="paymentChannel" open="(" close=")" separator=",">
             #{paymentChannel,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
         </foreach>
+        <if test="startTime != null">
+            AND spo.create_time_ >= #{startTime,jdbcType=DATE}
+        </if>
     </select>
 
 </mapper>