zouxuan 4 年之前
父节点
当前提交
b2b1292950

+ 14 - 6
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRepairServiceImpl.java

@@ -116,8 +116,15 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
         studentDao.lockUser(studentId);
         SysUser student = sysUserFeignService.queryUserById(studentId);
         String orderNo = idGeneratorService.generatorId("payment") + "";
+
+        String[] goodsIds = goodsId.split(",");
+        Map<String, BigDecimal> map = getMap("goods", "id_", "group_purchase_price_", goodsId, String.class, BigDecimal.class);
+        BigDecimal amount = BigDecimal.ZERO;
+        for (String id : goodsIds) {
+            amount.add(map.get(id));
+        }
         List<Goods> goods = goodsService.findGoodsByIds(goodsId);
-        BigDecimal amount = goods.stream().map(e -> e.getGroupPurchasePrice()).reduce(BigDecimal.ZERO, BigDecimal::add);
+//        BigDecimal amount = goods.stream().map(e -> e.getGroupPurchasePrice()).reduce(BigDecimal.ZERO, BigDecimal::add);
 
         StudentPaymentOrder studentPaymentOrder = new StudentPaymentOrder();
         studentPaymentOrder.setUserId(studentId);
@@ -131,9 +138,11 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
         studentPaymentOrder.setRoutingOrganId(student.getOrganId());
         studentPaymentOrderService.insert(studentPaymentOrder);
 
-        Map<GoodsType, List<Goods>> collect = goods.stream().collect(Collectors.groupingBy(Goods::getType));
+//        Map<GoodsType, List<Goods>> collect = goods.stream().collect(Collectors.groupingBy(Goods::getType));
+        Map<Integer, List<Goods>> collect = goods.stream().collect(Collectors.groupingBy(Goods::getId));
         List<StudentPaymentOrderDetail> studentPaymentOrderDetailList = new ArrayList<>();
-        goods.forEach(e->{
+        for (String id : goodsIds) {
+            Goods e = collect.get(id).get(0);
             StudentPaymentOrderDetail studentPaymentOrderDetail = new StudentPaymentOrderDetail();
             studentPaymentOrderDetail.setRemitFee(BigDecimal.ZERO);
             OrderDetailTypeEnum type = null;
@@ -146,12 +155,11 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
             }
             studentPaymentOrderDetail.setType(type);
             studentPaymentOrderDetail.setPrice(e.getGroupPurchasePrice());
-            String join = StringUtils.join(collect.get(e.getType()).stream().map(g -> g.getId()).collect(Collectors.toList()), ",");
-            studentPaymentOrderDetail.setGoodsIdList(join);
+            studentPaymentOrderDetail.setGoodsIdList(id);
             studentPaymentOrderDetail.setPaymentOrderId(studentPaymentOrder.getId());
             studentPaymentOrderDetail.setKitGroupPurchaseType(KitGroupPurchaseTypeEnum.GROUP);
             studentPaymentOrderDetailList.add(studentPaymentOrderDetail);
-        });
+        }
         studentPaymentOrderDetailService.batchAdd(studentPaymentOrderDetailList);
 
         studentPaymentOrder.setVersion(0);

+ 18 - 31
mec-student/src/main/java/com/ym/mec/student/controller/StudentOrderController.java

@@ -1,29 +1,28 @@
 package com.ym.mec.student.controller;
 
+import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
-import com.huifu.adapay.Adapay;
 import com.ym.mec.biz.dal.dao.*;
 import com.ym.mec.biz.dal.dto.*;
 import com.ym.mec.biz.dal.entity.*;
+import com.ym.mec.biz.dal.enums.DealStatusEnum;
+import com.ym.mec.biz.dal.enums.GroupType;
 import com.ym.mec.biz.dal.enums.OrderTypeEnum;
 import com.ym.mec.biz.service.*;
+import com.ym.mec.common.controller.BaseController;
+import com.ym.mec.common.entity.HttpResponseResult;
 import com.ym.mec.thirdparty.adapay.ConfigInit;
 import com.ym.mec.thirdparty.adapay.Payment;
+import com.ym.mec.thirdparty.yqpay.Msg;
+import com.ym.mec.thirdparty.yqpay.RsqMsg;
+import com.ym.mec.thirdparty.yqpay.YqPayFeignService;
+import com.ym.mec.thirdparty.yqpay.YqPayUtil;
 import com.ym.mec.util.date.DateUtil;
+import com.ym.mec.util.http.HttpUtil;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
-
-import java.io.IOException;
-import java.math.BigDecimal;
-import java.net.URLEncoder;
-import java.text.SimpleDateFormat;
-import java.util.*;
-import java.util.stream.Collectors;
-
-import javax.servlet.http.HttpServletResponse;
-
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -31,23 +30,15 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.scheduling.annotation.EnableScheduling;
 import org.springframework.util.DigestUtils;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.ModelAttribute;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
-import com.alibaba.fastjson.JSON;
-import com.ym.mec.biz.dal.enums.DealStatusEnum;
-import com.ym.mec.biz.dal.enums.GroupType;
-import com.ym.mec.common.controller.BaseController;
-import com.ym.mec.common.entity.HttpResponseResult;
-import com.ym.mec.thirdparty.yqpay.Msg;
-import com.ym.mec.thirdparty.yqpay.RsqMsg;
-import com.ym.mec.thirdparty.yqpay.YqPayFeignService;
-import com.ym.mec.thirdparty.yqpay.YqPayUtil;
-import com.ym.mec.util.http.HttpUtil;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.math.BigDecimal;
+import java.net.URLEncoder;
+import java.text.SimpleDateFormat;
+import java.util.*;
+import java.util.stream.Collectors;
 
 @RequestMapping("studentOrder")
 @Api(tags = "订单回调")
@@ -58,8 +49,6 @@ public class StudentOrderController extends BaseController {
     @Autowired
     private StudentPaymentOrderService studentPaymentOrderService;
     @Autowired
-    private StudentRegistrationService studentRegistrationService;
-    @Autowired
     private VipGroupService vipGroupService;
     @Autowired
     private MusicGroupService musicGroupService;
@@ -76,8 +65,6 @@ public class StudentOrderController extends BaseController {
     @Autowired
     private OrganizationDao organizationDao;
     @Autowired
-    private TeacherCourseStatisticsDao teacherCourseStatisticsDao;
-    @Autowired
     private CourseScheduleEvaluateDao courseScheduleEvaluateDao;
     @Autowired
     private TenantPaymentOrderService tenantPaymentOrderService;