Explorar o código

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

孙镇亮 %!s(int64=6) %!d(string=hai) anos
pai
achega
da6d66c698

+ 23 - 7
src/main/java/com/ym/mec/collectfee/controller/UserController.java

@@ -1,8 +1,6 @@
 package com.ym.mec.collectfee.controller;
 package com.ym.mec.collectfee.controller;
 
 
 
 
-import com.ym.mec.collectfee.common.page.PageInfo;
-import com.ym.mec.collectfee.common.page.QueryInfo;
 import com.ym.mec.collectfee.common.web.BaseController;
 import com.ym.mec.collectfee.common.web.BaseController;
 import com.ym.mec.collectfee.entity.*;
 import com.ym.mec.collectfee.entity.*;
 import com.ym.mec.collectfee.service.ApplyInfoService;
 import com.ym.mec.collectfee.service.ApplyInfoService;
@@ -15,6 +13,7 @@ import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiOperation;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.dao.DuplicateKeyException;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -66,11 +65,19 @@ public class UserController extends BaseController {
     @PostMapping("/userApply")
     @PostMapping("/userApply")
     public Object userApply(ApplyInfo applyInfo){
     public Object userApply(ApplyInfo applyInfo){
         if(applyInfo != null){
         if(applyInfo != null){
-            Date date = new Date();
-            applyInfo.setCreateTime(date);
-            applyInfo.setUpdateTime(date);
-            applyInfoService.insert(applyInfo);
-            return succeed(applyInfo.getId());
+            try {
+                Date date = new Date();
+                applyInfo.setCreateTime(date);
+                applyInfo.setUpdateTime(date);
+                applyInfoService.insert(applyInfo);
+                return succeed(applyInfo.getId());
+            }catch (Exception e){
+                e.printStackTrace();
+                if(e instanceof DuplicateKeyException){
+                    return failed("该用户已存在");
+                }
+                return failed("报名失败");
+            }
         }
         }
         return failed();
         return failed();
     }
     }
@@ -197,4 +204,13 @@ public class UserController extends BaseController {
         applyInfoService.pushRenew(renewBean);
         applyInfoService.pushRenew(renewBean);
         return succeed();
         return succeed();
     }
     }
+
+    /**
+     * 查询mec用户信息
+     * @return
+     */
+    @PostMapping("/findMecUser")
+    public Object findMecUser(Integer userId){
+        return succeed(applyInfoService.findMecUser(userId));
+    }
 }
 }

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

@@ -2,6 +2,7 @@ package com.ym.mec.collectfee.controller;
 
 
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
+import com.alibaba.fastjson.parser.Feature;
 import com.ym.mec.collectfee.common.web.BaseController;
 import com.ym.mec.collectfee.common.web.BaseController;
 import com.ym.mec.collectfee.entity.*;
 import com.ym.mec.collectfee.entity.*;
 import com.ym.mec.collectfee.service.*;
 import com.ym.mec.collectfee.service.*;
@@ -11,6 +12,7 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.io.IOUtils;
 import org.apache.commons.io.IOUtils;
+import org.apache.ibatis.session.defaults.DefaultSqlSession;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.core.io.ClassPathResource;
 import org.springframework.core.io.ClassPathResource;
@@ -50,6 +52,9 @@ public class YqPayController extends BaseController {
     @Autowired
     @Autowired
     private ApplyInfoService applyInfoService;
     private ApplyInfoService applyInfoService;
 
 
+    @Autowired
+    private RenewalsService renewalsService;
+
 
 
     /**
     /**
      * 统一下单(乐团缴费)
      * 统一下单(乐团缴费)
@@ -89,7 +94,7 @@ public class YqPayController extends BaseController {
         }
         }
 
 
         //2 版本为3.0( 26),不收乐器费用,收押金800放乐器费用
         //2 版本为3.0( 26),不收乐器费用,收押金800放乐器费用
-        if (courseGroupInfo.getFeeType().equals("26")) {
+        if (courseGroupInfo.getFeeType().equals(26)) {
             instrumentPrice = new BigDecimal("800");
             instrumentPrice = new BigDecimal("800");
         }
         }
         amount = amount.add(instrumentPrice);
         amount = amount.add(instrumentPrice);
@@ -118,7 +123,7 @@ public class YqPayController extends BaseController {
         String notifyUrl = "http://47.99.212.176:9000/yqpay/notify"; //异步通知地址
         String notifyUrl = "http://47.99.212.176:9000/yqpay/notify"; //异步通知地址
         String returnUrl = "http://dev.dayaedu.com";//支付后返回页面
         String returnUrl = "http://dev.dayaedu.com";//支付后返回页面
         String payUrl = "https://qyfapi.95epay.com/api/api/hPay/toPayHtml";//支付跳转页
         String payUrl = "https://qyfapi.95epay.com/api/api/hPay/toPayHtml";//支付跳转页
-        String payChannels = "{\"fastpayXy\":true,\"weChatPay\":true,\"weChatPayMobile\":false,\"aliPay\":true,\"aliPayMobile\":false,\"balancePay\":false}";//支付方式配置
+        String payChannels = "{\"weChatPay\":true,\"weChatPayMobile\":false,\"aliPay\":true,\"fastpayXy\":true,\"aliPayMobile\":false,\"balancePay\":false}";//支付方式配置
 
 
         String orderNo = GenerateNum.getInstance().GenerateOrderNo(); //自己系统订单号
         String orderNo = GenerateNum.getInstance().GenerateOrderNo(); //自己系统订单号
         order.setOrderNo(orderNo);
         order.setOrderNo(orderNo);
@@ -135,6 +140,9 @@ public class YqPayController extends BaseController {
 
 
         //获取分佣账户
         //获取分佣账户
         Account account = accountService.getAccountByBranchId(branchId);
         Account account = accountService.getAccountByBranchId(branchId);
+        if (account == null) {
+            return failed("机构没有设置收款账户");
+        }
         String routingMerNo = account.getSellerNo();
         String routingMerNo = account.getSellerNo();
         BigDecimal HasRouting = account.getHasRouting().add(order.getAmount());
         BigDecimal HasRouting = account.getHasRouting().add(order.getAmount());
         account.setHasRouting(HasRouting);
         account.setHasRouting(HasRouting);
@@ -162,6 +170,8 @@ public class YqPayController extends BaseController {
         String orderSubject = "培训订单";
         String orderSubject = "培训订单";
 
 
 
 
+        order.setAmount(new BigDecimal("2")); //测试设置金额
+
         Map<String, Object> resultMap = new LinkedHashMap<String, Object>();
         Map<String, Object> resultMap = new LinkedHashMap<String, Object>();
         resultMap.put("sellerNo", "0021677"); //收款商户号
         resultMap.put("sellerNo", "0021677"); //收款商户号
         resultMap.put("payChannels", payChannels); //支付方式
         resultMap.put("payChannels", payChannels); //支付方式
@@ -186,123 +196,90 @@ public class YqPayController extends BaseController {
      * @return String
      * @return String
      * @throws Exception
      * @throws Exception
      */
      */
-    @ApiOperation(value = "续费支付", notes = "易乾支付统一下单")
+    @ApiOperation(value = "续费支付", notes = "续费支付")
     @PostMapping("/renewalsPay")
     @PostMapping("/renewalsPay")
-    @Transactional
-    //applyInfoService.queryUserCourse(userId) //获取续费课程
-//    public Object renewalsPay(@ModelAttribute @Validated Renewals renewals) throws Exception {
-//        BigDecimal amount = new BigDecimal("0");
-//
-//        //课程组价格
-//        BigDecimal courseFee = courseGroupInfo.getFeeAmount();
-//        amount = amount.add(courseFee);
-//
-//        ClassPathResource classPathResource = new ClassPathResource("instruments.json");
-//
-//        BigDecimal instrumentPrice = new BigDecimal("0");//乐器价格
-//        String instrumentName = "";//乐器名称
-//
-//        //获取乐器的价格
-//        String instrumentId = order.getInstrument();
-//        String jsonString = IOUtils.toString(new InputStreamReader(classPathResource.getInputStream(), "UTF-8"));
-//        Instrument instrument = JSONObject.parseObject(jsonString, Instrument.class);
-//
-//        if (order.getInstrument() != null && !order.getInstrument().isEmpty()) {
-//            instrumentPrice = new BigDecimal(instrument.getInstruments().get(instrumentId).get("referencePrice"));
-//            instrumentName = (String) instrument.getInstruments().get(instrumentId).get("index") + "-" +
-//                    (String) instrument.getInstruments().get(instrumentId).get("name");
-//        }
-//
-//        //2 版本为3.0( 26),不收乐器费用,收押金800放乐器费用
-//        if (courseGroupInfo.getFeeType().equals("26")) {
-//            instrumentPrice = new BigDecimal("800");
-//        }
-//        amount = amount.add(instrumentPrice);
-//
-//        //辅件价格
-//        String adjunctIds = order.getAdjunct();
-//        BigDecimal adjunctPrice = new BigDecimal("0");//辅件价格
-//        String adjunctName = "";//辅件名称
-//        if (adjunctIds != null && !adjunctIds.isEmpty()) {
-//            String[] adjunctIdArr = adjunctIds.split(",");
-//            for (String adjunctId : adjunctIdArr) {
-//                adjunctPrice = adjunctPrice.add(new BigDecimal(instrument.getAuxiliaries().get(adjunctId).get("referencePrice")));
-//                adjunctName += (String) instrument.getAuxiliaries().get(adjunctId).get("name") + "|";
-//            }
-//        }
-//
-//        amount = amount.add(adjunctPrice);
-//        order.setAmount(amount);
-//        order.setRemark(instrumentName);
-//        order.setTuiFee(courseFee);
-//        order.setGoodsFee(instrumentPrice);
-//        order.setSdName(adjunctName + "教材|琴谱");
-//        order.setSdFee(adjunctPrice);
-//
-//
-//        String notifyUrl = "http://47.99.212.176:9000/yqpay/notify"; //异步通知地址
-//        String returnUrl = "http://dev.dayaedu.com";//支付后返回页面
-//        String payUrl = "https://qyfapi.95epay.com/api/api/hPay/toPayHtml";//支付跳转页
-//        String payChannels = "{\"fastpayXy\":true,\"weChatPay\":true,\"weChatPayMobile\":false,\"aliPay\":true,\"aliPayMobile\":true,\"balancePay\":false}";//支付方式配置
-//
-//        String orderNo = GenerateNum.getInstance().GenerateOrderNo(); //自己系统订单号
-//        order.setOrderNo(orderNo);
-//        order.setCreateTime(new Date()); //订单提交时间
-//        order.setStatus(1); //订单状态
-//
-//        //获取支付成功跟支付中的订单数
-//        int branchId = order.getBranchId();
-//        int payOrderNums = orderService.getPayOrderNums();
-//        //分佣账户(1、每10笔,前四笔收入私户 2、私户每个商户最多收款400万)
-//        if ((payOrderNums + 1) % 10 <= 4) { //私人账户
-//            branchId = 0;
-//        }
-//
-//        //获取分佣账户
-//        Account account = accountService.getAccountByBranchId(branchId);
-//        String routingMerNo = account.getSellerNo();
-//        BigDecimal HasRouting = account.getHasRouting().add(order.getAmount());
-//        account.setHasRouting(HasRouting);
-//
-//        Map<String, Object> routingList = new LinkedHashMap<String, Object>();
-//        routingList.put("routingMerNo", routingMerNo);//分佣账户
-//        routingList.put("routingFee", order.getAmount()); //分佣金额
-//        List<Map> tempRoutingList = new ArrayList();
-//        tempRoutingList.add(routingList);
-//
-//        order.setAccount(routingMerNo);
-//
-//        //1、插入订单
-//        orderService.insert(order);
-//        //2、修改已报名人数
-//        courseGroupInfo.setRegNum(courseGroupInfo.getRegNum() + 1);
-//        CourseGroupInfoService.upByIdAndVersion(courseGroupInfo);
-//        //3、修改分佣账户已收金额
-//        accountService.upByIdAndVersion(account);
-//
-//
-//        /*订单信息*/
-//        String orderBody = "大雅乐盟培训课程";
-//        /*订单标题*/
-//        String orderSubject = "培训订单";
-//
-//
-//        Map<String, Object> resultMap = new LinkedHashMap<String, Object>();
-//        resultMap.put("sellerNo", "0021677"); //收款商户号
-//        resultMap.put("payChannels", payChannels); //支付方式
-//        resultMap.put("orderBody", orderBody); //订单信息
-//        resultMap.put("payAmount", order.getAmount()); //支付金额
-//        resultMap.put("apiPayType", "1"); //*API支付类型1-即时支付,2-担保支付,3-预授权支付*/
-//        resultMap.put("tradeType", "0"); //*交易类型1—充值,0—收款*
-//        resultMap.put("merMerOrderNo", orderNo); //商户订单号
-//        resultMap.put("orderSubject", orderSubject); //订单标题
-//        resultMap.put("returnUrl", returnUrl); //前台页面地址
-//        resultMap.put("tempRoutingList", JSON.toJSONString(tempRoutingList));//分账设置
-//        Map rqMap = new YqPayUtil(notifyUrl, resultMap).getRequestMap();
-//        rqMap.put("host", payUrl);
-//
-//        return succeed(rqMap);
-//    }
+
+    public Object renewalsPay(@ModelAttribute @Validated Renewals renewals) throws Exception {
+        MecUser mecUser = applyInfoService.findMecUser(renewals.getUserId());
+        renewals.setBranchId(mecUser.getBranchId());
+
+        //课程组价格
+        ArrayList<MecCourse> courses = (ArrayList<MecCourse>) applyInfoService.queryUserCourse(renewals.getUserId());//获取续费课程
+        MecCourse mecCourse4json = JSON.parseObject(renewals.getCourses(), MecCourse.class);
+        if (mecCourse4json == null) {
+            return failed("请选择续费课程");
+        }
+
+        //classType 小课1 大课2
+        Integer buyCount = mecCourse4json.getBuyCount();
+        BigDecimal amount = new BigDecimal("0"); //课程总价
+        String remark = "";
+        for (int i = 0; i < courses.size(); i++) {
+            MecCourse course = courses.get(i);
+            if (mecCourse4json.getCourseId().equals(course.getCourseId())) {
+                BigDecimal price = course.getClassType() == 1 ? course.getPrice().multiply(BigDecimal.valueOf(buyCount)) : mecCourse4json.getPrice();
+                amount = amount.add(price);
+                remark += course.getClassName();
+            } else {
+                courses.remove(i);
+            }
+        }
+        if (courses.size() == 0) {
+            return failed("请选择续费课程");
+        }
+
+        String notifyUrl = "http://47.99.212.176:9000/yqpay/notify"; //异步通知地址
+        String returnUrl = "http://dev.dayaedu.com";//支付后返回页面
+        String payUrl = "https://qyfapi.95epay.com/api/api/hPay/toPayHtml";//支付跳转页
+        String payChannels = "{\"weChatPay\":true,\"weChatPayMobile\":false,\"aliPay\":true,\"fastpayXy\":true,\"aliPayMobile\":false,\"balancePay\":false}";//支付方式配置
+
+        String orderNo = GenerateNum.getInstance().GenerateOrderNo(); //自己系统订单号
+
+        //获取支付成功跟支付中的订单数
+        int branchId = renewals.getBranchId();
+        int payOrderNums = orderService.getPayOrderNums();
+        //分佣账户(1、每10笔,前四笔收入私户 2、私户每个商户最多收款400万)
+        if ((payOrderNums + 1) % 10 <= 4) { //私人账户
+            branchId = 0;
+        }
+
+        //获取分佣账户
+        Account account = accountService.getAccountByBranchId(branchId);
+        if (account == null) {
+            return failed("机构没有设置收款账户");
+        }
+        String routingMerNo = account.getSellerNo();
+        BigDecimal HasRouting = account.getHasRouting().add(amount);
+        account.setHasRouting(HasRouting);
+
+        Map<String, Object> routingList = new LinkedHashMap<String, Object>();
+        routingList.put("routingMerNo", routingMerNo);//分佣账户
+        routingList.put("routingFee", amount); //分佣金额
+        List<Map> tempRoutingList = new ArrayList();
+        tempRoutingList.add(routingList);
+
+        renewalsService.addRenewalsOrder(renewals, amount, orderNo, courses, routingMerNo, remark);
+
+        /*订单信息*/
+        String orderBody = "大雅乐盟培训课程";
+        /*订单标题*/
+        String orderSubject = "培训订单";
+
+        Map<String, Object> resultMap = new LinkedHashMap<String, Object>();
+        resultMap.put("sellerNo", "0021677"); //收款商户号
+        resultMap.put("payChannels", payChannels); //支付方式
+        resultMap.put("orderBody", orderBody); //订单信息
+        resultMap.put("payAmount", amount); //支付金额
+        resultMap.put("apiPayType", "1"); //*API支付类型1-即时支付,2-担保支付,3-预授权支付*/
+        resultMap.put("tradeType", "0"); //*交易类型1—充值,0—收款*
+        resultMap.put("merMerOrderNo", orderNo); //商户订单号
+        resultMap.put("orderSubject", orderSubject); //订单标题
+        resultMap.put("returnUrl", returnUrl); //前台页面地址
+        resultMap.put("tempRoutingList", JSON.toJSONString(tempRoutingList));//分账设置
+        Map rqMap = new YqPayUtil(notifyUrl, resultMap).getRequestMap();
+        rqMap.put("host", payUrl);
+        return succeed(rqMap);
+    }
 
 
     /**
     /**
      * 交易查询
      * 交易查询
@@ -447,12 +424,12 @@ public class YqPayController extends BaseController {
         //支付中订单存在,更新状态
         //支付中订单存在,更新状态
         if (order != null && msg.getResponseType().equals("1")) {
         if (order != null && msg.getResponseType().equals("1")) {
             //更新订单状态
             //更新订单状态
-            int status = msg.getCode().equals("88") ? 0 : 2;
+            int status = msg.getCode().equals("88") ? 2 : 0;
             order.setStatus(status);
             order.setStatus(status);
             if (order.getOrderNo().isEmpty()) {
             if (order.getOrderNo().isEmpty()) {
                 order.setPayId(notifyMsg.getOrderNo()); //更新易乾付订单号
                 order.setPayId(notifyMsg.getOrderNo()); //更新易乾付订单号
             }
             }
-            if (status == 0) {
+            if (status == 2) {
                 order.setPay(notifyMsg.getPayAmount());
                 order.setPay(notifyMsg.getPayAmount());
                 order.setPayTime(new Date());
                 order.setPayTime(new Date());
             }
             }

+ 5 - 1
src/main/java/com/ym/mec/collectfee/dao/RenewalsDao.java

@@ -3,10 +3,14 @@ package com.ym.mec.collectfee.dao;
 
 
 import com.ym.mec.collectfee.common.dao.BaseDAO;
 import com.ym.mec.collectfee.common.dao.BaseDAO;
 import com.ym.mec.collectfee.entity.Renewals;
 import com.ym.mec.collectfee.entity.Renewals;
+import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Component;
 import org.springframework.stereotype.Component;
 
 
+import java.util.ArrayList;
+
 @Component
 @Component
 public interface RenewalsDao extends BaseDAO<Integer, Renewals> {
 public interface RenewalsDao extends BaseDAO<Integer, Renewals> {
 
 
-	
+    public void renewalsInsert(@Param("renewalses") ArrayList<Renewals> renewalsArrayList);
+
 }
 }

+ 8 - 8
src/main/java/com/ym/mec/collectfee/entity/MecCourse.java

@@ -25,7 +25,7 @@ public class MecCourse {
 	private Integer courseId;
 	private Integer courseId;
 	
 	
 	/**  */
 	/**  */
-	private String subName;
+	private String subNames;
 	
 	
 	/**  */
 	/**  */
 	private Integer studentId;
 	private Integer studentId;
@@ -105,15 +105,15 @@ public class MecCourse {
 	public Integer getCourseId(){
 	public Integer getCourseId(){
 		return this.courseId;
 		return this.courseId;
 	}
 	}
-			
-	public void setSubName(String subName){
-		this.subName = subName;
+
+	public String getSubNames() {
+		return subNames;
 	}
 	}
-	
-	public String getSubName(){
-		return this.subName;
+
+	public void setSubNames(String subNames) {
+		this.subNames = subNames;
 	}
 	}
-			
+
 	public void setStudentId(Integer studentId){
 	public void setStudentId(Integer studentId){
 		this.studentId = studentId;
 		this.studentId = studentId;
 	}
 	}

+ 10 - 0
src/main/java/com/ym/mec/collectfee/entity/RenewBean.java

@@ -20,6 +20,16 @@ public class RenewBean {
 
 
     private String remark;
     private String remark;
 
 
+    private BigDecimal price;
+
+    public BigDecimal getPrice() {
+        return price;
+    }
+
+    public void setPrice(BigDecimal price) {
+        this.price = price;
+    }
+
     public Integer getUserId() {
     public Integer getUserId() {
         return userId;
         return userId;
     }
     }

+ 32 - 9
src/main/java/com/ym/mec/collectfee/entity/Renewals.java

@@ -17,36 +17,44 @@ public class Renewals {
 	private Integer userId;
 	private Integer userId;
 	
 	
 	/** 乐团id */
 	/** 乐团id */
-	@ApiModelProperty(name = "classId", value = "乐团id",required = true)
+	@ApiModelProperty(name = "classId", value = "乐团id",hidden = true)
 	private Integer classId;
 	private Integer classId;
 
 
 	/** 分部id */
 	/** 分部id */
-	@ApiModelProperty(name = "branchId", value = "分部id",required = true)
+	@ApiModelProperty(name = "branchId", value = "分部id",hidden = true)
 	private Integer branchId;
 	private Integer branchId;
 	
 	
 	/** 支付方式 */
 	/** 支付方式 */
-	@ApiModelProperty(name = "way", value = "支付方式",required = true)
+	@ApiModelProperty(name = "way", value = "支付方式",hidden = true)
 	private Integer way;
 	private Integer way;
 	
 	
 	/** 支付金额 */
 	/** 支付金额 */
-	@ApiModelProperty(name = "pay", value = "支付金额",required = true)
+	@ApiModelProperty(name = "pay", value = "支付金额",hidden = true)
 	private java.math.BigDecimal pay;
 	private java.math.BigDecimal pay;
 	
 	
 	/** 收费方式 */
 	/** 收费方式 */
-	@ApiModelProperty(name = "changeMode", value = "收费方式",required = true)
+	@ApiModelProperty(name = "changeMode", value = "收费方式",hidden = true)
 	private Integer changeMode;
 	private Integer changeMode;
 	
 	
 	/** 学费单价 */
 	/** 学费单价 */
-	@ApiModelProperty(name = "price", value = "学费单价",required = true)
+	@ApiModelProperty(name = "price", value = "学费单价",hidden = true)
 	private java.math.BigDecimal price;
 	private java.math.BigDecimal price;
-	
+
+	/** 课程id */
+	@ApiModelProperty(name = "courseId", value = "课程id",hidden = true)
+	private Integer courseId;
+
 	/** 购买数量 */
 	/** 购买数量 */
-	@ApiModelProperty(name = "buy", value = "购买数量",required = true)
+	@ApiModelProperty(name = "buy", value = "购买数量",hidden = true)
 	private Integer buy;
 	private Integer buy;
 	
 	
 	/** 订单号 */
 	/** 订单号 */
-	@ApiModelProperty(name = "buy", value = "订单号")
+	@ApiModelProperty(name = "orderId", value = "订单号",hidden = true)
 	private Integer orderId;
 	private Integer orderId;
+
+	/** 购买课程 */
+	@ApiModelProperty(name = "courses", value = "购买课程,json格式({\"courseId\":\"100012\",\"buyCount\":\"3\",\"price\":\"300\"})",required = true)
+	private String courses;
 	
 	
 	public void setId(Integer id){
 	public void setId(Integer id){
 		this.id = id;
 		this.id = id;
@@ -133,4 +141,19 @@ public class Renewals {
 		return ToStringBuilder.reflectionToString(this);
 		return ToStringBuilder.reflectionToString(this);
 	}
 	}
 
 
+	public String getCourses() {
+		return courses;
+	}
+
+	public void setCourses(String courses) {
+		this.courses = courses;
+	}
+
+	public Integer getCourseId() {
+		return courseId;
+	}
+
+	public void setCourseId(Integer courseId) {
+		this.courseId = courseId;
+	}
 }
 }

+ 8 - 4
src/main/java/com/ym/mec/collectfee/service/ApplyInfoService.java

@@ -1,10 +1,7 @@
 package com.ym.mec.collectfee.service;
 package com.ym.mec.collectfee.service;
 
 
 import com.ym.mec.collectfee.common.service.BaseService;
 import com.ym.mec.collectfee.common.service.BaseService;
-import com.ym.mec.collectfee.entity.ApplyInfo;
-import com.ym.mec.collectfee.entity.Branch;
-import com.ym.mec.collectfee.entity.RenewBean;
-import com.ym.mec.collectfee.entity.StudentsQueryInfo;
+import com.ym.mec.collectfee.entity.*;
 
 
 import java.util.List;
 import java.util.List;
 
 
@@ -57,6 +54,13 @@ public interface ApplyInfoService extends BaseService<Integer, ApplyInfo> {
     Object queryUserCourse(Integer userId);
     Object queryUserCourse(Integer userId);
 
 
     /**
     /**
+     * 查询mec用户信息
+     * @param userId
+     * @return
+     */
+    MecUser findMecUser(Integer userId);
+
+    /**
      * 推送续费成功订单到mec
      * 推送续费成功订单到mec
      * @param orderId 订单编号
      * @param orderId 订单编号
      * @param chargeMode 收费方式
      * @param chargeMode 收费方式

+ 14 - 1
src/main/java/com/ym/mec/collectfee/service/RenewalsService.java

@@ -1,10 +1,23 @@
 package com.ym.mec.collectfee.service;
 package com.ym.mec.collectfee.service;
 
 
-import java.util.List;
+import java.math.BigDecimal;
+import java.util.ArrayList;
 
 
 import com.ym.mec.collectfee.common.service.BaseService;
 import com.ym.mec.collectfee.common.service.BaseService;
+import com.ym.mec.collectfee.entity.MecCourse;
+import com.ym.mec.collectfee.entity.Order;
 import com.ym.mec.collectfee.entity.Renewals;
 import com.ym.mec.collectfee.entity.Renewals;
 
 
 public interface RenewalsService extends BaseService<Integer, Renewals> {
 public interface RenewalsService extends BaseService<Integer, Renewals> {
 
 
+    /**
+     * 生成续费的订单
+     * @param orderNo
+     * @param mecCourses
+     * @return
+     */
+    Order addRenewalsOrder(Renewals renewals,BigDecimal amount, String orderNo, ArrayList<MecCourse> mecCourses, String routingMerNo,String remark);
+
+    void renewalsInsert(ArrayList<Renewals> renewalsArrayList);
+
 }
 }

+ 45 - 26
src/main/java/com/ym/mec/collectfee/service/impl/ApplyInfoServiceImpl.java

@@ -7,7 +7,7 @@ import com.ym.mec.collectfee.common.service.impl.BaseServiceImpl;
 import com.ym.mec.collectfee.dao.*;
 import com.ym.mec.collectfee.dao.*;
 import com.ym.mec.collectfee.entity.*;
 import com.ym.mec.collectfee.entity.*;
 import com.ym.mec.collectfee.service.ApplyInfoService;
 import com.ym.mec.collectfee.service.ApplyInfoService;
-import com.ym.mec.collectfee.utils.DES;
+import com.ym.mec.collectfee.utils.CDesECB;
 import com.ym.mec.collectfee.utils.HttpUtil;
 import com.ym.mec.collectfee.utils.HttpUtil;
 import com.ym.mec.collectfee.utils.MapUtil;
 import com.ym.mec.collectfee.utils.MapUtil;
 import com.ym.mec.collectfee.utils.XStreamUtil;
 import com.ym.mec.collectfee.utils.XStreamUtil;
@@ -70,7 +70,7 @@ public class ApplyInfoServiceImpl extends BaseServiceImpl<Integer, ApplyInfo> im
 				String body = xs.toXML(applyInfo);
 				String body = xs.toXML(applyInfo);
 				body = body.substring(body.indexOf("<user>")+6,body.indexOf("</user>"));
 				body = body.substring(body.indexOf("<user>")+6,body.indexOf("</user>"));
 				//推送mec注册接口
 				//推送mec注册接口
-				body = getBody(body,12301,null,null);
+				body = getBody(body,12301);
 				Date date = new Date();
 				Date date = new Date();
 				try {
 				try {
 					applyInfo.setUpdateTime(date);
 					applyInfo.setUpdateTime(date);
@@ -81,7 +81,7 @@ public class ApplyInfoServiceImpl extends BaseServiceImpl<Integer, ApplyInfo> im
 					body = xs.toXML(applyClass);
 					body = xs.toXML(applyClass);
 					body = body.substring(body.indexOf("<body>")+6,body.indexOf("</body>"));
 					body = body.substring(body.indexOf("<body>")+6,body.indexOf("</body>"));
 					//推送mec用户缴费
 					//推送mec用户缴费
-					getBody(body,125218,null,null);
+					getBody(body,125218);
 					applyInfoDao.update(applyInfo);
 					applyInfoDao.update(applyInfo);
 					return true;
 					return true;
 				}catch (Exception e){
 				}catch (Exception e){
@@ -146,7 +146,7 @@ public class ApplyInfoServiceImpl extends BaseServiceImpl<Integer, ApplyInfo> im
 			List<Branch> branchList = branchDao.findAll(null);
 			List<Branch> branchList = branchDao.findAll(null);
 			if(branchList == null || branchList.size() < 1){
 			if(branchList == null || branchList.size() < 1){
 				String body = "<province>0</province>";
 				String body = "<province>0</province>";
-				body = getBody(body,121002,null,null);
+				body = getBody(body,121002);
 				body = "<body><branches>" + new String(Base64.getDecoder().decode(body)) + "</branches></body>";
 				body = "<body><branches>" + new String(Base64.getDecoder().decode(body)) + "</branches></body>";
 				ResponseBranchesBean branches = XStreamUtil.xmlToObject("body", ResponseBranchesBean.class, body);
 				ResponseBranchesBean branches = XStreamUtil.xmlToObject("body", ResponseBranchesBean.class, body);
 				branchDao.batchInsert(branches.getBranches());
 				branchDao.batchInsert(branches.getBranches());
@@ -169,7 +169,7 @@ public class ApplyInfoServiceImpl extends BaseServiceImpl<Integer, ApplyInfo> im
 					break;
 					break;
 				}
 				}
 				String body = "<branchId>" + branch.getBranchId() + "</branchId>";
 				String body = "<branchId>" + branch.getBranchId() + "</branchId>";
-				body = getBody(body,121107,null,null);
+				body = getBody(body,121107);
 				body = "<body><schools>" + new String(Base64.getDecoder().decode(body)) + "</schools></body>";
 				body = "<body><schools>" + new String(Base64.getDecoder().decode(body)) + "</schools></body>";
 				ResponseSeminariesBean seminaries = XStreamUtil.xmlToObject("body", ResponseSeminariesBean.class, body);
 				ResponseSeminariesBean seminaries = XStreamUtil.xmlToObject("body", ResponseSeminariesBean.class, body);
 				if(seminaries.getSchools() == null || seminaries.getSchools().size() < 1){
 				if(seminaries.getSchools() == null || seminaries.getSchools().size() < 1){
@@ -218,17 +218,7 @@ public class ApplyInfoServiceImpl extends BaseServiceImpl<Integer, ApplyInfo> im
 	public Object queryUserCourse(Integer userId) {
 	public Object queryUserCourse(Integer userId) {
 		try {
 		try {
 			//获取学员信息
 			//获取学员信息
-			MecUser mecUser = mecUserDao.get(userId);
-			if(mecUser == null){
-				String body = "<body><userId>" + userId + "</userId></body>";
-				body = getBody(body, 121313,null,null);
-				if(!StringUtils.isEmpty(body)){
-					body = new String(Base64.getDecoder().decode(body));
-					mecUser = XStreamUtil.xmlToObject("student", MecUser.class, body);
-					//同步mec用户数据
-					mecUserDao.insert(mecUser);
-				}
-			}
+			findMecUser(userId);
 			//获取学员课程班数据
 			//获取学员课程班数据
 			//1小课,2乐团
 			//1小课,2乐团
 			String body = "<body><userId>" + userId + "</userId><classType>1</classType></body>";
 			String body = "<body><userId>" + userId + "</userId><classType>1</classType></body>";
@@ -258,19 +248,48 @@ public class ApplyInfoServiceImpl extends BaseServiceImpl<Integer, ApplyInfo> im
 	}
 	}
 
 
 	@Override
 	@Override
+	public MecUser findMecUser(Integer userId) {
+		try {
+			//获取学员信息
+			MecUser mecUser = mecUserDao.get(userId);
+			if(mecUser == null){
+				String body = "<body><userId>" + userId + "</userId></body>";
+				body = getBody(body, 121313);
+				if(!StringUtils.isEmpty(body)){
+					body = new String(Base64.getDecoder().decode(body));
+					mecUser = XStreamUtil.xmlToObject("student", MecUser.class, body);
+					//同步mec用户数据
+					mecUserDao.insert(mecUser);
+				}
+			}
+			return mecUser;
+		}catch (Exception e){
+			e.printStackTrace();
+		}
+		return null;
+	}
+
+	@Override
 	public boolean pushRenew(RenewBean renewBean) {
 	public boolean pushRenew(RenewBean renewBean) {
 		try {
 		try {
 			XStream xs = new XStream();
 			XStream xs = new XStream();
 			xs.autodetectAnnotations(true);
 			xs.autodetectAnnotations(true);
 			String body = xs.toXML(renewBean);
 			String body = xs.toXML(renewBean);
 			body = body.substring(body.indexOf("<body>")+6,body.indexOf("</body>"));
 			body = body.substring(body.indexOf("<body>")+6,body.indexOf("</body>"));
-//			while (body.length()%8 != 0){
-//				body = body+"0";
-//			}
-			byte[] encrypt = DES.encrypt(body.getBytes(), key.getBytes());
-			body = getBody(new String(encrypt), 123255, 2,1);
-			body = new String(Base64.getDecoder().decode(body),"UTF-8");
-			if(StringUtils.isEmpty(body)){
+			body = CDesECB.encode(key,body);
+			RequestParamBean requestParamBean = new RequestParamBean();
+			requestParamBean.setBody(body);
+			requestParamBean.setHead(XStreamUtil.getOrdersHead(body,123255,publicKey,2,4));
+			Writer writer = new StringWriter();
+			writer.write("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n");
+			xs = new XStream();
+			xs.autodetectAnnotations(true);
+			xs.toXML(requestParamBean,writer);
+			body = HttpUtil.postXmlData(writer.toString(), url);
+			body = body.substring(body.indexOf("<errCode>") + 9, body.indexOf("</errCode>"));
+//			body = new String(CDesECB.decode(key,body.getBytes()));
+//			body = CDesECB.decodeValue(key,body);
+			if(!StringUtils.equals(body,"0")){
 				return false;
 				return false;
 			}
 			}
 			return true;
 			return true;
@@ -282,7 +301,7 @@ public class ApplyInfoServiceImpl extends BaseServiceImpl<Integer, ApplyInfo> im
 
 
 
 
 	private List<MecCourse> getCourses(String body) throws Exception{
 	private List<MecCourse> getCourses(String body) throws Exception{
-		body = getBody(body,123031,null,null);
+		body = getBody(body,123031);
 		if(StringUtils.isEmpty(body)){
 		if(StringUtils.isEmpty(body)){
 			return null;
 			return null;
 		}
 		}
@@ -291,11 +310,11 @@ public class ApplyInfoServiceImpl extends BaseServiceImpl<Integer, ApplyInfo> im
 		return parseMecCourse.getCourses();
 		return parseMecCourse.getCourses();
 	}
 	}
 
 
-	private String getBody(String body,Integer cmd,Integer uid,Integer encrypt) throws Exception{
+	private String getBody(String body,Integer cmd) throws Exception{
 		body = Base64.getEncoder().encodeToString(body.getBytes());
 		body = Base64.getEncoder().encodeToString(body.getBytes());
 		RequestParamBean requestParamBean = new RequestParamBean();
 		RequestParamBean requestParamBean = new RequestParamBean();
 		requestParamBean.setBody(body);
 		requestParamBean.setBody(body);
-		requestParamBean.setHead(XStreamUtil.getOrdersHead(body,cmd,publicKey,uid,encrypt));
+		requestParamBean.setHead(XStreamUtil.getOrdersHead(body,cmd,publicKey,null,null));
 		Writer writer = new StringWriter();
 		Writer writer = new StringWriter();
 		writer.write("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n");
 		writer.write("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n");
 		XStream xs = new XStream();
 		XStream xs = new XStream();

+ 80 - 9
src/main/java/com/ym/mec/collectfee/service/impl/RenewalsServiceImpl.java

@@ -4,20 +4,91 @@ package com.ym.mec.collectfee.service.impl;
 import com.ym.mec.collectfee.common.dao.BaseDAO;
 import com.ym.mec.collectfee.common.dao.BaseDAO;
 import com.ym.mec.collectfee.common.service.impl.BaseServiceImpl;
 import com.ym.mec.collectfee.common.service.impl.BaseServiceImpl;
 import com.ym.mec.collectfee.dao.RenewalsDao;
 import com.ym.mec.collectfee.dao.RenewalsDao;
+import com.ym.mec.collectfee.entity.Account;
+import com.ym.mec.collectfee.entity.MecCourse;
+import com.ym.mec.collectfee.entity.Order;
 import com.ym.mec.collectfee.entity.Renewals;
 import com.ym.mec.collectfee.entity.Renewals;
+import com.ym.mec.collectfee.service.AccountService;
+import com.ym.mec.collectfee.service.CourseGroupInfoService;
+import com.ym.mec.collectfee.service.OrderService;
 import com.ym.mec.collectfee.service.RenewalsService;
 import com.ym.mec.collectfee.service.RenewalsService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Date;
 
 
 @Service
 @Service
 public class RenewalsServiceImpl extends BaseServiceImpl<Integer, Renewals> implements RenewalsService {
 public class RenewalsServiceImpl extends BaseServiceImpl<Integer, Renewals> implements RenewalsService {
-	
-	@Autowired
-	private RenewalsDao renewalsDao;
-
-	@Override
-	public BaseDAO<Integer, Renewals> getDAO() {
-		return renewalsDao;
-	}
-	
+
+    @Autowired
+    private RenewalsDao renewalsDao;
+
+    @Autowired
+    private OrderService orderService;
+    @Autowired
+    private RenewalsService renewalsService;
+    @Autowired
+    private AccountService accountService;
+
+    @Override
+    public BaseDAO<Integer, Renewals> getDAO() {
+        return renewalsDao;
+    }
+
+    @Override
+    public void renewalsInsert(ArrayList<Renewals> renewalsArrayList) {
+        renewalsDao.renewalsInsert(renewalsArrayList);
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public Order addRenewalsOrder(Renewals renewals, BigDecimal amount, String orderNo, ArrayList<MecCourse> mecCourses, String routingMerNo, String remark) {
+
+        Order order = new Order();
+        order.setBranchId(renewals.getBranchId());
+        order.setUserId(renewals.getUserId());
+        order.setOrderNo(orderNo);
+        order.setAmount(amount);
+        order.setAccount(routingMerNo);
+        order.setRemark(remark);
+        order.setClassId(renewals.getClassId());
+        order.setStatus(1);
+        order.setCreateTime(new Date());
+
+        //1、插入订单
+        Long id = orderService.insert(order);
+
+        ArrayList<Renewals> renewalsArrayList = new ArrayList<>();
+
+        for (int i = 0; i < mecCourses.size(); i++) {
+            MecCourse course = mecCourses.get(i);
+            Renewals rws = new Renewals();
+            rws.setUserId(course.getStudentId());
+            rws.setBranchId(renewals.getBranchId());
+            rws.setClassId(course.getClassId());
+            rws.setCourseId(course.getCourseId());
+            rws.setWay(30);
+            rws.setPay(course.getPrice());
+            rws.setChangeMode(course.getChargeMode());
+            rws.setPrice(course.getPrice());
+            rws.setBuy(renewals.getBuy());
+            rws.setOrderId(id.intValue());
+            renewalsArrayList.add(rws);
+        }
+
+        //2、添加
+        renewalsService.renewalsInsert(renewalsArrayList);
+        //3、修改分佣账户已收金额
+        //获取分佣账户
+        Account account = accountService.getAccountByBranchId(renewals.getBranchId());
+        BigDecimal HasRouting = account.getHasRouting().add(amount);
+        account.setHasRouting(HasRouting);
+        accountService.upByIdAndVersion(account);
+        return order;
+    }
+
+
 }
 }

+ 104 - 0
src/main/java/com/ym/mec/collectfee/utils/CDesECB.java

@@ -0,0 +1,104 @@
+package com.ym.mec.collectfee.utils;
+
+import javax.crypto.Cipher;
+import javax.crypto.SecretKeyFactory;
+import javax.crypto.spec.DESKeySpec;
+import java.security.Key;
+import java.util.Base64;
+
+public class CDesECB
+{
+    public static final String ALGORITHM_DES = "DES/ECB/PKCS5Padding";
+
+    /**
+     * 加密
+     * @param data 待加密字符串
+     * @param key 加密私钥,长度不能够小于8位
+     * @return 加密后的字节数组,一般结合Base64编码使用
+     */
+    public static String encode(String key, String data) throws Exception
+    {
+        return encode(key, data.getBytes());
+    }
+    /**
+     * 加密
+     * @param data 待加密字符串
+     * @param key 加密私钥,长度不能够小于8位
+     * @return 加密后的字节数组,一般结合Base64编码使用
+     */
+    public static String encode(String key, byte[] data) throws Exception
+    {
+        try
+        {
+            DESKeySpec dks = new DESKeySpec(key.getBytes());
+            SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DES");
+            // key的长度不能够小于8位字节
+            Key secretKey = keyFactory.generateSecret(dks);
+            Cipher cipher = Cipher.getInstance(ALGORITHM_DES);
+            cipher.init(Cipher.ENCRYPT_MODE, secretKey);
+            byte[] bytes = cipher.doFinal(data);
+            return Base64.getEncoder().encodeToString(bytes);
+        }
+        catch (Exception e)
+        {
+            throw new Exception(e);
+        }
+    }
+    /**
+     * 解密
+     * @param data 待解密字符串
+     * @param key 解密私钥,长度不能够小于8位
+     * @return 解密后的字节数组
+     * @throws Exception 异常
+     */
+    public static byte[] decode(String key, byte[] data) throws Exception
+    {
+        try
+        {
+            DESKeySpec dks = new DESKeySpec(key.getBytes());
+            SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DES");
+            // key的长度不能够小于8位字节
+            Key secretKey = keyFactory.generateSecret(dks);
+            Cipher cipher = Cipher.getInstance(ALGORITHM_DES);
+            cipher.init(Cipher.DECRYPT_MODE, secretKey);
+            return cipher.doFinal(data);
+        }
+        catch (Exception e)
+        {
+            throw new Exception(e);
+        }
+    }
+
+    /**
+     * 获取编码后的值
+     *
+     * @param key
+     * @param data
+     * @return
+     * @throws Exception
+     */
+    public static String decodeValue(String key, String data)
+    {
+        byte[] datas;
+        String value = null;
+        try
+        {
+            if (System.getProperty("os.name") != null
+                    && (System.getProperty("os.name").equalsIgnoreCase("sunos") || System
+                    .getProperty("os.name").equalsIgnoreCase("linux")))
+            {
+                datas = decode(key, Base64.getDecoder().decode(data));
+            }
+            else
+            {
+                datas = decode(key, Base64.getDecoder().decode(data));
+            }
+            value = new String(datas);
+        }
+        catch (Exception e)
+        {
+            value = "";
+        }
+        return value;
+    }
+}

+ 0 - 54
src/main/java/com/ym/mec/collectfee/utils/DES.java

@@ -1,54 +0,0 @@
-package com.ym.mec.collectfee.utils;
-
-import javax.crypto.Cipher;
-import javax.crypto.SecretKey;
-import javax.crypto.SecretKeyFactory;
-import javax.crypto.spec.DESKeySpec;
-import java.security.Key;
-import java.security.SecureRandom;
-import java.security.spec.KeySpec;
-
-public class DES {
-    //加密算是是des
-    private static final String ALGORITHM = "DES";
-    //转换格式
-    private static final String TRANSFORMATION = "DES/ECB/PKCS5Padding";
-
-    //利用8个字节64位的key给src加密
-    @SuppressWarnings("unused")
-    public static byte[] encrypt(byte[] src,byte[]key)
-    {
-        try {
-            //加密
-            Cipher cipher = Cipher.getInstance(TRANSFORMATION);
-            SecretKeyFactory secretKeyFactory = SecretKeyFactory.getInstance(ALGORITHM);
-            KeySpec keySpec = new DESKeySpec(key);
-            SecretKey secretKey = secretKeyFactory.generateSecret(keySpec);
-            cipher.init(Cipher.ENCRYPT_MODE, secretKey,new SecureRandom());
-            byte[] enMsgBytes = cipher.doFinal(src);
-            return enMsgBytes;
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-        return null;
-    }
-
-    //利用8个字节64位的key给src解密
-    @SuppressWarnings("unused")
-    public static byte[] decrypt(byte[] encryptBytes,byte[]key){
-        try {
-            //解密
-            //Cipher deCipher = Cipher.getInstance("DES/CBC/PKCS5Padding");
-            Cipher deCipher = Cipher.getInstance(TRANSFORMATION);
-            SecretKeyFactory deDecretKeyFactory = SecretKeyFactory.getInstance(ALGORITHM);
-            KeySpec deKeySpec = new DESKeySpec(key);
-            SecretKey deSecretKey = deDecretKeyFactory.generateSecret(deKeySpec);
-            deCipher.init(Cipher.DECRYPT_MODE, deSecretKey,new SecureRandom());
-            byte[] deMsgBytes = deCipher.doFinal(encryptBytes);
-            return deMsgBytes;
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-        return null;
-    }
-}

+ 1 - 1
src/main/resources/config/mybatis/CourseGroupInfoMapper.xml

@@ -93,7 +93,7 @@
 
 
 	<select id="getCourses" resultMap="CourseGroupInfo">
 	<select id="getCourses" resultMap="CourseGroupInfo">
 		SELECT * FROM course_group_info WHERE sub_id_ IN (SELECT MIN(sub_id_)sub_id_ FROM course_group_info
 		SELECT * FROM course_group_info WHERE sub_id_ IN (SELECT MIN(sub_id_)sub_id_ FROM course_group_info
-		WHERE class_id_ = #{classId} GROUP BY sub_name_)
+		WHERE class_id_ = #{classId} GROUP BY sub_name_) AND class_id_ = #{classId}
 	</select>
 	</select>
 
 
 	<!-- 根据id和version更新实际已招生人数 -->
 	<!-- 根据id和version更新实际已招生人数 -->

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

@@ -9,6 +9,7 @@
 	<resultMap type="com.ym.mec.collectfee.entity.Renewals" id="Renewals">
 	<resultMap type="com.ym.mec.collectfee.entity.Renewals" id="Renewals">
 		<result column="id" property="id" />
 		<result column="id" property="id" />
 		<result column="user_id" property="userId" />
 		<result column="user_id" property="userId" />
+		<result column="branch_id" property="branchId" />
 		<result column="class_id" property="classId" />
 		<result column="class_id" property="classId" />
 		<result column="way" property="way" />
 		<result column="way" property="way" />
 		<result column="pay" property="pay" />
 		<result column="pay" property="pay" />
@@ -58,4 +59,11 @@
 	<select id="queryCount" resultType="int">
 	<select id="queryCount" resultType="int">
 		SELECT COUNT(*) FROM renewals
 		SELECT COUNT(*) FROM renewals
 	</select>
 	</select>
+
+	<insert id="renewalsInsert" parameterType="java.util.ArrayList">
+		INSERT INTO `renewals` (id,user_id,branch_id,class_id,course_id,way,pay,change_mode,price,buy,order_id) VALUES
+		<foreach collection="renewalses" item="item" index="index" separator=",">
+			(#{item.id},#{item.userId},#{item.branchId},#{item.classId},#{item.courseId},#{item.way},#{item.pay},#{item.changeMode},#{item.price},#{item.buy},#{item.orderId})
+		</foreach>
+	</insert>
 </mapper>
 </mapper>