孙镇亮 5 年之前
父节点
当前提交
f594869294

+ 3 - 1
src/main/java/com/ym/mec/collectfee/controller/UserController.java

@@ -109,8 +109,10 @@ public class UserController extends BaseController {
         MecUser user = null;
         MecUser user = null;
         if(mecUser != null){
         if(mecUser != null){
         	user = applyInfoService.findMecUser(mecUser.getUserId());
         	user = applyInfoService.findMecUser(mecUser.getUserId());
+        	return succeed(user);
+        }else{
+        	return failed("该用户不存在");
         }
         }
-        return succeed(user);
     }
     }
 
 
     /**
     /**

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

@@ -695,7 +695,29 @@ public class YqPayController extends BaseController {
         if (mecUser == null) {
         if (mecUser == null) {
             return failed("续费用户不存在");
             return failed("续费用户不存在");
         }
         }
-
+        int promotionCount = orderService.getPromotionCount(mecUser.getBranchId());
+        if(mecUser.getBranchId()==1012){
+        	if(promotionCount >=99){
+        		return failed("对不起,本次名额已满,请您下次再来!");
+        	}
+        }else if(mecUser.getBranchId()==1020){
+        	if(promotionCount >=176){
+        		return failed("对不起,本次名额已满,请您下次再来!");
+        	}
+        }else if(mecUser.getBranchId()==1025){
+        	if(promotionCount >= 154){
+        		return failed("对不起,本次名额已满,请您下次再来!");
+        	}
+        }else{
+        	if(promotionCount >=77){
+        		return failed("对不起,本次名额已满,请您下次再来!");
+        	}
+        }
+        
+        if(orderService.getUserPromotionCount(mecUser.getUserId())>=2){
+        	return failed("对不起,您本次机会已使用完,感谢您的关注!");
+        }
+        
         ClassPathResource classPathResource = new ClassPathResource("branchRule.json"); //规则json
         ClassPathResource classPathResource = new ClassPathResource("branchRule.json"); //规则json
         String branchRuleJson = IOUtils.toString(new InputStreamReader(classPathResource.getInputStream(), "UTF-8"));
         String branchRuleJson = IOUtils.toString(new InputStreamReader(classPathResource.getInputStream(), "UTF-8"));
         List<BranchRule> branchRules = JSONObject.parseArray(branchRuleJson, BranchRule.class);
         List<BranchRule> branchRules = JSONObject.parseArray(branchRuleJson, BranchRule.class);
@@ -714,9 +736,17 @@ public class YqPayController extends BaseController {
         BigDecimal courseTimes = new BigDecimal("20");
         BigDecimal courseTimes = new BigDecimal("20");
 
 
         if (price.compareTo(new BigDecimal("220")) >= 0) {
         if (price.compareTo(new BigDecimal("220")) >= 0) {
-            courseAmount = price.multiply(courseTimes).subtract(new BigDecimal("1111")).add(new BigDecimal("111"));
+        	if(mecUser.getBranchId()==1012){
+        		courseAmount = price.multiply(courseTimes).subtract(new BigDecimal("500")).add(new BigDecimal("11.11"));
+        	}else{
+        		courseAmount = price.multiply(courseTimes).subtract(new BigDecimal("1111")).add(new BigDecimal("111"));
+        	}
         } else {
         } else {
-            courseAmount = price.multiply(courseTimes).subtract(new BigDecimal("777")).add(new BigDecimal("11.11"));
+        	if(mecUser.getBranchId()==1018 || mecUser.getBranchId()==1028 || mecUser.getBranchId() == 1024){
+        		courseAmount = price.multiply(courseTimes).subtract(new BigDecimal("777")).add(new BigDecimal("111"));
+        	}else{
+        		courseAmount = price.multiply(courseTimes).subtract(new BigDecimal("777")).add(new BigDecimal("11.11"));
+        	}
         }
         }
 
 
         if (!courseAmount.equals(amount)) {
         if (!courseAmount.equals(amount)) {

+ 4 - 0
src/main/java/com/ym/mec/collectfee/dao/OrderDao.java

@@ -22,6 +22,8 @@ public interface OrderDao extends BaseDAO<Integer, Order> {
     Order getOrderByOrderNo(@Param("orderNo") String orderNo);
     Order getOrderByOrderNo(@Param("orderNo") String orderNo);
 
 
     Order findOrderByStatus(@Param("userId") Integer userId, @Param("status") Integer status);
     Order findOrderByStatus(@Param("userId") Integer userId, @Param("status") Integer status);
+    
+    int getPromotionCount(@Param("branchId") Integer branchId);
 
 
     int getPayOrderNums();
     int getPayOrderNums();
 
 
@@ -42,4 +44,6 @@ public interface OrderDao extends BaseDAO<Integer, Order> {
     Map queryFeeAmount(Map<String, Object> params);
     Map queryFeeAmount(Map<String, Object> params);
 
 
     Order getOrderStatusByOrderNo(@Param("orderNo") String orderNo);
     Order getOrderStatusByOrderNo(@Param("orderNo") String orderNo);
+
+	int getUserPromotionCount(@Param("userId") Integer userId);
 }
 }

+ 9 - 0
src/main/java/com/ym/mec/collectfee/service/OrderService.java

@@ -20,6 +20,15 @@ public interface OrderService extends BaseService<Integer, Order> {
      * @return
      * @return
      */
      */
     List<Order> getOrderByUserId(Integer userId);
     List<Order> getOrderByUserId(Integer userId);
+    
+    /**
+     * 获取参与活动的数量
+     * @param branchId
+     * @return
+     */
+    int getPromotionCount(int branchId);
+    
+    int getUserPromotionCount(int userId);
 
 
     /**
     /**
      * 根据乐团编号,获取订单列表
      * 根据乐团编号,获取订单列表

+ 11 - 1
src/main/java/com/ym/mec/collectfee/service/impl/OrderServiceImpl.java

@@ -151,7 +151,7 @@ public class OrderServiceImpl extends BaseServiceImpl<Integer, Order> implements
         if (school != null) {
         if (school != null) {
             returnUrl = this.returnHost + "/#/login?schoolId=" + school.getSchoolId() + "&cityId=" + school.getCityId();//支付后返回页面
             returnUrl = this.returnHost + "/#/login?schoolId=" + school.getSchoolId() + "&cityId=" + school.getCityId();//支付后返回页面
         }
         }
-        if(order.getPromotionType().equals(1)){
+        if(order.getPromotionType() != null && order.getPromotionType().equals(1)){
             returnUrl = this.returnHost+ "/#/paymentResult?orderNo="+order.getOrderNo();
             returnUrl = this.returnHost+ "/#/paymentResult?orderNo="+order.getOrderNo();
         }
         }
         String payUrl = "https://qyfapi.95epay.com/api/api/hPay/toPayHtml";//支付跳转页
         String payUrl = "https://qyfapi.95epay.com/api/api/hPay/toPayHtml";//支付跳转页
@@ -273,5 +273,15 @@ public class OrderServiceImpl extends BaseServiceImpl<Integer, Order> implements
         return orderDao.getOrderStatusByOrderNo(orderNo);
         return orderDao.getOrderStatusByOrderNo(orderNo);
     }
     }
 
 
+	@Override
+	public int getPromotionCount(int branchId) {
+		return orderDao.getPromotionCount(branchId);
+	}
+
+	@Override
+	public int getUserPromotionCount(int userId) {
+		return orderDao.getUserPromotionCount(userId);
+	}
+
 
 
 }
 }

+ 8 - 0
src/main/resources/config/mybatis/OrderMapper.xml

@@ -183,6 +183,14 @@
         SELECT COUNT(DISTINCT user_id) num FROM `order` WHERE `po_name` = #{poName} AND `voicy_part` = #{voicePort} AND
         SELECT COUNT(DISTINCT user_id) num FROM `order` WHERE `po_name` = #{poName} AND `voicy_part` = #{voicePort} AND
         `status` >= 1
         `status` >= 1
     </select>
     </select>
+    
+    <select id="getPromotionCount" resultType="java.lang.Integer">
+        SELECT count(DISTINCT user_id) num FROM `order` WHERE `branch_id` = #{branchId} AND `promotion_type` = 1 and `status` =2
+    </select>
+    
+    <select id="getUserPromotionCount" resultType="java.lang.Integer">
+        SELECT count(id) num FROM `order` WHERE `user_id` = #{userId} AND `promotion_type` = 1 and `status` =2
+    </select>
 
 
     <select id="getOrderByOrderNo" resultMap="Order">
     <select id="getOrderByOrderNo" resultMap="Order">
         SELECT * FROM `order` WHERE `order_no` = #{orderNo} AND `status` = 1
         SELECT * FROM `order` WHERE `order_no` = #{orderNo} AND `status` = 1