Browse Source

Merge remote-tracking branch 'origin/saas' into saas

hgw 3 years ago
parent
commit
6037bbc1a4

+ 2 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentPaymentOrderDetailDao.java

@@ -167,4 +167,6 @@ public interface StudentPaymentOrderDetailDao extends BaseDAO<Long, StudentPayme
     List<Goods> getGoodsSellPrice(@Param("orderIds") List<Long> orderIds, @Param("type") String type);
 
     List<StudentPaymentOrderDetail> findByOrderId(Long paymentOrderId);
+
+    List<StudentPaymentOrderDetail> findByCalenderId(Long calenderId);
 }

+ 10 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/StudentPaymentOrderDetail.java

@@ -66,6 +66,16 @@ public class StudentPaymentOrderDetail extends BaseEntity {
 	
 	private CloudTeacherOrderDto cloudTeacherOrderDto;
 
+	private Integer userId;
+
+	public Integer getUserId() {
+		return userId;
+	}
+
+	public void setUserId(Integer userId) {
+		this.userId = userId;
+	}
+
 	public void setId(Long id){
 		this.id = id;
 	}

+ 3 - 4
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderDetailServiceImpl.java

@@ -703,11 +703,10 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
 			pageInfo.setTotal(count);
 			params.put("offset", pageInfo.getOffset());
 			dataList = musicGroupPaymentCalenderDetailDao.queryDetailPage(params);
-			List<Long> orderIds = dataList.stream().map(e -> e.getPaymentOrderId()).collect(Collectors.toList());
-			List<StudentPaymentOrderDetail> orderDetail = studentPaymentOrderDetailDao.getOrderDetailByOrderId(orderIds);
-			Map<Long, List<StudentPaymentOrderDetail>> orderDetailMap = orderDetail.stream().collect(Collectors.groupingBy(StudentPaymentOrderDetail::getPaymentOrderId));
+			List<StudentPaymentOrderDetail> orderDetail = studentPaymentOrderDetailDao.findByCalenderId(dataList.get(0).getMusicGroupPaymentCalenderId());
+			Map<Integer, List<StudentPaymentOrderDetail>> orderDetailMap = orderDetail.stream().collect(Collectors.groupingBy(StudentPaymentOrderDetail::getUserId));
 			for (MusicGroupPaymentCalenderDetailDto row : dataList) {
-				List<StudentPaymentOrderDetail> orderDetailList = orderDetailMap.get(row.getPaymentOrderId());
+				List<StudentPaymentOrderDetail> orderDetailList = orderDetailMap.get(row.getUserId());
 				if(orderDetailList != null && orderDetailList.size() > 0){
 					BigDecimal totalAmount = orderDetailList.stream().map(e -> e.getPrice()).reduce(BigDecimal.ZERO, BigDecimal::add);
 					//辅件

+ 2 - 1
mec-biz/src/main/resources/config/mybatis/MusicGroupPaymentCalenderDetailMapper.xml

@@ -556,7 +556,8 @@
 		SELECT mgpcd.id_,mgpcd.user_id_,su.username_,st.name_ subject_names_,sr.music_group_status_,su.phone_,
 		CASE WHEN mgpcd.start_payment_date_ IS NULL THEN mgpc.start_payment_date_ ELSE mgpcd.start_payment_date_ END start_payment_date_mgpc_,
 		CASE WHEN mgpcd.deadline_payment_date_ IS NULL THEN mgpc.deadline_payment_date_ ELSE mgpcd.deadline_payment_date_ END deadline_payment_date_mgpc_,
-		CASE WHEN mgpc.status_ = 'OPEN' OR mgpcd.open_ = 1 THEN 1 ELSE 0 END open_,mgpc.payment_type_,mgpcd.payment_order_id_,mgpcd.payment_status_,mgpcd.pay_time_
+		CASE WHEN mgpc.status_ = 'OPEN' OR mgpcd.open_ = 1 THEN 1 ELSE 0 END open_,mgpc.payment_type_,mgpcd.payment_order_id_,mgpcd.payment_status_,mgpcd.pay_time_,
+		mgpcd.music_group_payment_calender_id_
 		FROM music_group_payment_calender_detail mgpcd
 		LEFT JOIN sys_user su ON su.id_ = mgpcd.user_id_
 		LEFT JOIN student_registration sr ON sr.user_id_ = mgpcd.user_id_

+ 10 - 0
mec-biz/src/main/resources/config/mybatis/StudentPaymentOrderDetailMapper.xml

@@ -19,6 +19,7 @@
                 typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
         <result column="student_instrument_id_" property="studentInstrumentId"/>
         <result column="is_renew_" property="isRenew"/>
+        <result column="user_id_" property="userId"/>
         <collection property="goodsList" ofType="com.ym.mec.biz.dal.entity.Goods">
             <result column="goods_id_" property="id"/>
             <result column="goods_name_" property="name"/>
@@ -338,4 +339,13 @@
     <select id="findByOrderId" resultMap="StudentPaymentOrderDetail">
         SELECT * FROM student_payment_order_detail WHERE payment_order_id_ = #{paymentOrderId}
     </select>
+    <select id="findByCalenderId" resultMap="StudentPaymentOrderDetail">
+        SELECT spod.*,spo.user_id_ FROM student_payment_order spo
+        LEFT JOIN student_payment_order_detail spod  ON spo.id_ = spod.payment_order_id_
+        WHERE spo.id_ IN (
+        SELECT c.id_ FROM (SELECT payment_order_id_ id_ FROM music_group_payment_calender_detail
+        WHERE music_group_payment_calender_id_ = #{calenderId} AND payment_order_id_ IS NOT NULL
+        UNION
+        SELECT id_ FROM student_payment_order WHERE calender_id_ = #{calenderId} AND status_ = 'SUCCESS')c)
+    </select>
 </mapper>

+ 17 - 12
mec-student/src/main/java/com/ym/mec/student/controller/MusicGroupController.java

@@ -169,20 +169,25 @@ public class MusicGroupController extends BaseController {
                         flag = false;
                     }
                 }
-                //是否购买会员
-                if(Objects.nonNull(calenderDetail.get("member"))){
-                    if(typeList.contains(OrderDetailTypeEnum.CLOUD_TEACHER) || typeList.contains(OrderDetailTypeEnum.CLOUD_TEACHER_PLUS)){
-                        flag = true;
-                    }else {
-                        flag = false;
+
+                if(!flag){
+                    //是否购买会员
+                    if(Objects.nonNull(calenderDetail.get("member"))){
+                        if(typeList.contains(OrderDetailTypeEnum.CLOUD_TEACHER) || typeList.contains(OrderDetailTypeEnum.CLOUD_TEACHER_PLUS)){
+                            flag = true;
+                        }else {
+                            flag = false;
+                        }
                     }
                 }
-                //是否购买活动包
-                if(Objects.nonNull(calenderDetail.get("activity"))){
-                    if(typeList.contains(OrderDetailTypeEnum.VIP) || typeList.contains(OrderDetailTypeEnum.PRACTICE)){
-                        flag = true;
-                    }else {
-                        flag = false;
+                if(!flag){
+                    //是否购买活动包
+                    if(Objects.nonNull(calenderDetail.get("activity"))){
+                        if(typeList.contains(OrderDetailTypeEnum.VIP) || typeList.contains(OrderDetailTypeEnum.PRACTICE)){
+                            flag = true;
+                        }else {
+                            flag = false;
+                        }
                     }
                 }
                 if(flag){