Переглянути джерело

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

孙镇亮 5 роки тому
батько
коміт
96d1d1876e

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

@@ -651,7 +651,7 @@ public class YqPayController extends BaseController {
             return;
         }
         Calendar beforeTime = Calendar.getInstance();
-        beforeTime.add(Calendar.MINUTE, -15);// 5分钟之前的时间
+        beforeTime.add(Calendar.MINUTE, -30);// 30分钟之前的时间
         Date beforeDate = beforeTime.getTime();
         Map<String, Object> rqMap = new HashMap<>();
         rqMap.put("orderNoList", orderNoList);
@@ -687,29 +687,39 @@ public class YqPayController extends BaseController {
      * @return String
      * @throws Exception
      */
-//    @ApiOperation(value = "续费支付", notes = "续费支付")
+//    @ApiOperation(value = "双11活动小课续费支付", notes = "双11活动小课续费支付")
     @PostMapping("/promotionPay")
-    public Object promotionPay(@ModelAttribute @Validated Renewals renewals) throws Exception {
-        MecUser mecUser = applyInfoService.findMecUser(renewals.getUserId());
+    public Object promotionPay(Integer userId,Integer BranchId,BigDecimal amount) throws Exception {
+        MecUser mecUser = applyInfoService.findMecUser(userId);
         if (mecUser == null) {
             return failed("续费用户不存在");
         }
 
         ClassPathResource classPathResource = new ClassPathResource("branchRule.json"); //规则json
         String branchRuleJson = IOUtils.toString(new InputStreamReader(classPathResource.getInputStream(), "UTF-8"));
-        List<BranchRule> branchRules = JSONArray.parseObject(branchRuleJson, List.class);
+        List<BranchRule> branchRules = JSONObject.parseArray(branchRuleJson, BranchRule.class);
 
-        BigDecimal amount = new BigDecimal("0");
+        BigDecimal price = new BigDecimal("0");
         for (BranchRule branchRule : branchRules) {
             if (!branchRule.getBranchId().equals(mecUser.getBranchId())) continue;
-            amount = branchRule.getBranchPrice();
+            price = branchRule.getBranchPrice();
         }
 
-        if (!amount.equals(renewals.getPay())) {
-            return failed("金额有误!请勿非法请求");
+        if (price.equals(new BigDecimal(0))) {
+            price = new BigDecimal("180");
+        }
+
+        BigDecimal courseAmount;
+        BigDecimal courseTimes = new BigDecimal("20");
+
+        if (price.compareTo(new BigDecimal("220")) >= 0) {
+            courseAmount = price.multiply(courseTimes).subtract(new BigDecimal("1111")).add(new BigDecimal("111"));
+        } else {
+            courseAmount = price.multiply(courseTimes).subtract(new BigDecimal("777")).add(new BigDecimal("11.11"));
         }
-        if (amount.equals(new BigDecimal(0))) {
-            return failed("分部没有相应的活动");
+
+        if (!courseAmount.equals(amount)) {
+            return failed("金额有误!请勿非法请求");
         }
 
         String orderNo = GenerateNum.getInstance().GenerateOrderNo(); //自己系统订单号
@@ -727,13 +737,13 @@ public class YqPayController extends BaseController {
     @RequestMapping("/getPayStatus")
     public Object getPayStatus(String orderNo) throws Exception {
         Order order = orderService.getOrderStatusByOrderNo(orderNo);
-        if(order == null){
+        if (order == null) {
             return failed("订单信息不存在");
         }
-        if(order.getStatus().equals(2)){
+        if (order.getStatus().equals(2)) {
             return succeed("SUCCESS");
         }
-        if(order.getStatus().equals(1)){
+        if (order.getStatus().equals(1)) {
             return succeed("ING");
         }
         return succeed("FAIL");

+ 9 - 0
src/main/java/com/ym/mec/collectfee/entity/OrderQueryInfo.java

@@ -11,6 +11,7 @@ public class OrderQueryInfo extends QueryInfo {
     private String startTime;
     private String endTime;
     private Integer branchId;
+    private Integer promotionType;
 
     public Integer getClassId() {
         return classId;
@@ -67,4 +68,12 @@ public class OrderQueryInfo extends QueryInfo {
     public void setAccount(String account) {
         this.account = account;
     }
+
+    public Integer getPromotionType() {
+        return promotionType;
+    }
+
+    public void setPromotionType(Integer promotionType) {
+        this.promotionType = promotionType;
+    }
 }

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

@@ -265,6 +265,9 @@
         <if test="endTime != null and endTime != ''">
             <![CDATA[ and pay_time <= ]]>#{endTime}
         </if>
+        <if test="promotionType != null and promotionType!=0">
+            and promotion_type = #{promotionType}
+        </if>
     </sql>
 
     <!-- 查询当前表的总记录数 -->