Bläddra i källkod

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

hgw 3 år sedan
förälder
incheckning
4e2829fd12

+ 6 - 11
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CloudTeacherOrderDao.java

@@ -1,20 +1,15 @@
 package com.ym.mec.biz.dal.dao;
 
-import java.math.BigDecimal;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
 import com.ym.mec.biz.dal.dto.CloudTeacherActiveTargetDetailDto;
-import com.ym.mec.biz.dal.entity.CloudTeacherStudent;
-import com.ym.mec.biz.dal.page.CloudTeacherActiveQueryInfo;
-import com.ym.mec.biz.dal.page.CloudTeacherOrderQueryInfo;
-import org.apache.ibatis.annotations.Param;
-
 import com.ym.mec.biz.dal.dto.CloudTeacherOrderDto;
 import com.ym.mec.biz.dal.entity.CloudTeacherOrder;
+import com.ym.mec.biz.dal.entity.CloudTeacherStudent;
 import com.ym.mec.common.dal.BaseDAO;
+import org.apache.ibatis.annotations.Param;
+import java.math.BigDecimal;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
 
 public interface CloudTeacherOrderDao extends BaseDAO<Long, CloudTeacherOrder> {
 	

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

@@ -11,4 +11,6 @@ public interface MusicGroupPaymentCalenderActivityDao extends BaseMapper<MusicGr
     void insertBatch(@Param("calenderActivityList") List<MusicGroupPaymentCalenderActivity> musicGroupPaymentCalenderActivities);
 
     void delByCalenderId(@Param("calenderId") Long calenderId);
+
+    List<MusicGroupPaymentCalenderActivity> findByCalenderId(Long calenderId);
 }

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroupPaymentCalender.java

@@ -171,7 +171,7 @@ public class MusicGroupPaymentCalender extends BaseEntity {
 	private CourseViewTypeEnum courseViewType;
 
 	//会员周期
-	private PeriodEnum memberPeriod = MONTH;
+	private PeriodEnum memberPeriod;
 
 	//会员有效期(月)
 	private Integer memberValidDate;

+ 2 - 2
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/VipGroupActivity.java

@@ -147,9 +147,9 @@ public class VipGroupActivity extends BaseEntity {
 	@ApiModelProperty(value = "-1:所有;0:线上;1:线下")
 	private Integer giveTeachMode = -1;
 
-	private PeriodEnum periodEnum = MONTH;
+	private PeriodEnum periodEnum;
 
-	private PeriodEnum givePeriodEnum = DAY;
+	private PeriodEnum givePeriodEnum;
 
 	private String status = "DRAFT";
 

+ 5 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/MusicGroupPaymentCalenderActivityService.java

@@ -1,6 +1,9 @@
 package com.ym.mec.biz.service;
 
 import com.ym.mec.biz.dal.dto.MusicGroupPaymentBaseCalender;
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderActivity;
+
+import java.util.List;
 
 public interface MusicGroupPaymentCalenderActivityService {
     /**
@@ -14,4 +17,6 @@ public interface MusicGroupPaymentCalenderActivityService {
     void batchInsert(MusicGroupPaymentBaseCalender musicGroupPaymentBaseCalender, Long calenderId);
 
     void delByCalenderId(Long calenderId);
+
+    List<MusicGroupPaymentCalenderActivity> findByCalenderId(Long calenderId);
 }

+ 5 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderActivityServiceImpl.java

@@ -52,4 +52,9 @@ public class MusicGroupPaymentCalenderActivityServiceImpl extends ServiceImpl<Mu
     public void delByCalenderId(Long calenderId) {
         baseMapper.delByCalenderId(calenderId);
     }
+
+    @Override
+    public List<MusicGroupPaymentCalenderActivity> findByCalenderId(Long calenderId) {
+        return baseMapper.findByCalenderId(calenderId);
+    }
 }

+ 26 - 55
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderDetailServiceImpl.java

@@ -51,16 +51,12 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
 	private MusicGroupPaymentCalenderDao musicGroupPaymentCalenderDao;
 	@Autowired
 	private MusicGroupPaymentCalenderService musicGroupPaymentCalenderService;
-	
 	@Autowired
 	private MusicGroupPaymentCalenderCourseSettingsDao musicGroupPaymentCalenderCourseSettingsDao;
-	
 	@Autowired
 	private MusicGroupPaymentStudentCourseDetailDao musicGroupPaymentStudentCourseDetailDao;
-
 	@Autowired
 	private MusicGroupPaymentCalenderStudentDetailDao musicGroupPaymentCalenderStudentDetailDao;
-	
 	@Autowired
 	private MusicGroupDao musicGroupDao;
 	@Autowired
@@ -77,6 +73,8 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
 	private StudentService studentService;
 	@Autowired
 	private CloudTeacherOrderDao cloudTeacherOrderDao;
+	@Autowired
+	private MusicGroupPaymentCalenderActivityService musicGroupPaymentCalenderActivityService;
 
 	@Override
 	public BaseDAO<Long, MusicGroupPaymentCalenderDetail> getDAO() {
@@ -467,11 +465,8 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
 				}
 			}
 		}
-		List<MusicGroupPaymentStudentCourseDetail> musicGroupPaymentStudentCourseDetailList = new ArrayList<MusicGroupPaymentStudentCourseDetail>();
-		
-		Long musicGroupPaymentCalenderId = null;
 		for(MusicGroupPaymentCalender musicGroupPaymentCalender : musicGroupPaymentCalenderList){
-			musicGroupPaymentCalenderId = musicGroupPaymentCalender.getId();
+			Long musicGroupPaymentCalenderId = musicGroupPaymentCalender.getId();
 			
 			if(musicGroupPaymentCalender.getPaymentType() == MusicGroupPaymentCalender.PaymentType.MUSIC_APPLY){
 				throw new BizException("操作失败:报名缴费项不允许添加学员");
@@ -480,31 +475,15 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
 					|| musicGroupPaymentCalender.getStatus() == PaymentCalenderStatusEnum.REJECT) {
 				throw new BizException("当前缴费状态不能添加学生");
 			}
-			
 			//判断学生是否已存在
 			Set<Integer> userList = musicGroupPaymentCalenderDetailDao.queryStudentIds(musicGroupPaymentCalenderId);
-
 			if(Collections.disjoint(userList, userIdList) == false){
 				throw new BizException("操作失败:包含已存在的学员");
 			}
 			
-			List<MusicGroupPaymentCalenderCourseSettings> courseSettingsList = musicGroupPaymentCalenderCourseSettingsDao.getWithPaymentCalender(musicGroupPaymentCalenderId);
-//
-//			BigDecimal expectAmount = BigDecimal.ZERO;
-//			BigDecimal expectMemberAmount = musicGroupPaymentCalender.getMemberPaymentAmount();
-
-//			if (musicGroupPaymentCalender.getPayUserType() == STUDENT) {
-//				for (MusicGroupPaymentCalenderCourseSettings courseSettings : courseSettingsList) {
-//					// 剔除可选课程
-//					if (courseSettings.getIsStudentOptional() == false) {
-//						expectAmount = expectAmount.add(courseSettings.getCourseCurrentPrice());
-//					}
-//				}
-//			}
-			
 			Date date = new Date();
 			MusicGroupPaymentCalenderDetail musicGroupPaymentCalenderDetail = null;
-			Map<Integer,MusicGroupPaymentCalenderDetail> userMap = new HashMap<Integer, MusicGroupPaymentCalenderDetail>();
+			Map<Integer,Long> userMap = new HashMap<>();
 			List<MusicGroupPaymentCalenderDetail> musicGroupPaymentCalenderDetailList = new ArrayList<MusicGroupPaymentCalenderDetail>();
 			//创建缴费明细
 			MusicGroup musicGroup = musicGroupDao.get(musicGroupId);
@@ -512,8 +491,6 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
 				musicGroupPaymentCalenderDetail = new MusicGroupPaymentCalenderDetail();
 				musicGroupPaymentCalenderDetail.setMusicGroupPaymentCalenderId(musicGroupPaymentCalenderId);
 				musicGroupPaymentCalenderDetail.setCreateTime(date);
-//				musicGroupPaymentCalenderDetail.setExpectAmount(musicGroupPaymentCalender.getPaymentAmount());
-//				musicGroupPaymentCalenderDetail.setExpectMemberAmount(musicGroupPaymentCalender.getMemberPaymentAmount());
 				if (musicGroupPaymentCalender.getPaymentAmount().compareTo(BigDecimal.ZERO) == 0) {
 					musicGroupPaymentCalenderDetail.setPaymentStatus(PaymentStatus.PAID_COMPLETED);
 				} else {
@@ -524,7 +501,7 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
 				musicGroupPaymentCalenderDetail.setStartPaymentDate(musicGroupPaymentCalender.getStartPaymentDate());
 				musicGroupPaymentCalenderDetail.setDeadlinePaymentDate(musicGroupPaymentCalender.getDeadlinePaymentDate());
 				musicGroupPaymentCalenderDetail.setResponsibleUserId(musicGroupPaymentCalender.getOperator());
-				
+
 				musicGroupPaymentCalenderDetailList.add(musicGroupPaymentCalenderDetail);
 				if (musicGroupPaymentCalender.getPaymentAmount().compareTo(BigDecimal.ZERO) == 0) {
 					// 添加会员有效时长
@@ -540,16 +517,13 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
 						cloudTeacherOrder.setRemark("缴费项目0元新增学员");
 						cloudTeacherOrder.setMusicGroupId(musicGroupId);
 						cloudTeacherOrderDao.insert(cloudTeacherOrder);
-//						studentService.updateMemberRank(cloudTeacherOrder);
 					}
 				}
 			}
 
 			if (musicGroupPaymentCalenderDetailList.size() > 0) {
 				musicGroupPaymentCalenderDetailDao.batchInsert(musicGroupPaymentCalenderDetailList);
-				for(MusicGroupPaymentCalenderDetail cd : musicGroupPaymentCalenderDetailList){
-					userMap.put(cd.getUserId(), cd);
-				}
+				musicGroupPaymentCalenderDetailList.stream().map(e-> userMap.put(e.getUserId(),e.getId()));
 			}
 			//更新预计缴费人数
 			musicGroupPaymentCalender.setExpectNum(musicGroupPaymentCalender.getExpectNum() + userIdList.size());
@@ -558,34 +532,31 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
 				musicGroupPaymentCalender.setActualNum(musicGroupPaymentCalender.getActualNum() + userIdList.size());
 			}
 			musicGroupPaymentCalenderService.update(musicGroupPaymentCalender);
-			
-			MusicGroupPaymentStudentCourseDetail musicGroupPaymentStudentCourseDetail = null;
+
 			//创建学生课排课分钟数
-			for(Integer studentId : userIdList){
-				for(MusicGroupPaymentCalenderCourseSettings courseSettings : courseSettingsList){
-					if (courseSettings.getIsStudentOptional() == true || courseSettings.getCourseTotalMinuties() == null || courseSettings.getCourseTotalMinuties() == 0) {
-						continue;
+			List<MusicGroupPaymentCalenderCourseSettings> courseSettingsList = musicGroupPaymentCalenderCourseSettingsDao.getWithPaymentCalender(musicGroupPaymentCalenderId);
+			if(courseSettingsList != null && courseSettingsList.size() > 0){
+				List<MusicGroupPaymentStudentCourseDetail> musicGroupPaymentStudentCourseDetailList = new ArrayList<>();
+				MusicGroupPaymentStudentCourseDetail musicGroupPaymentStudentCourseDetail = null;
+				for(Integer studentId : userIdList){
+					for(MusicGroupPaymentCalenderCourseSettings courseSettings : courseSettingsList){
+						musicGroupPaymentStudentCourseDetail = new MusicGroupPaymentStudentCourseDetail();
+						musicGroupPaymentStudentCourseDetail.setCourseType(courseSettings.getCourseType());
+						musicGroupPaymentStudentCourseDetail.setCreateTime(date);
+						musicGroupPaymentStudentCourseDetail.setMusicGroupPaymentCalenderId(musicGroupPaymentCalenderId);
+						musicGroupPaymentStudentCourseDetail.setMusicGroupPaymentCalenderDetailId(userMap.get(studentId));
+						musicGroupPaymentStudentCourseDetail.setTotalCourseMinutes(courseSettings.getCourseTotalMinuties());
+						musicGroupPaymentStudentCourseDetail.setCourseOriginalPrice(courseSettings.getCourseOriginalPrice());
+						musicGroupPaymentStudentCourseDetail.setCourseCurrentPrice(courseSettings.getCourseCurrentPrice());
+						musicGroupPaymentStudentCourseDetail.setUpdateTime(date);
+						musicGroupPaymentStudentCourseDetail.setUsedCourseMinutes(0);
+						musicGroupPaymentStudentCourseDetail.setUserId(studentId);
+						musicGroupPaymentStudentCourseDetailList.add(musicGroupPaymentStudentCourseDetail);
 					}
-					musicGroupPaymentStudentCourseDetail = new MusicGroupPaymentStudentCourseDetail();
-					musicGroupPaymentStudentCourseDetail.setCourseType(courseSettings.getCourseType());
-					musicGroupPaymentStudentCourseDetail.setCreateTime(date);
-					musicGroupPaymentStudentCourseDetail.setMusicGroupPaymentCalenderId(musicGroupPaymentCalenderId);
-					musicGroupPaymentStudentCourseDetail.setMusicGroupPaymentCalenderDetailId(userMap.get(studentId).getId());
-					musicGroupPaymentStudentCourseDetail.setTotalCourseMinutes(courseSettings.getCourseTotalMinuties());
-					musicGroupPaymentStudentCourseDetail.setCourseOriginalPrice(courseSettings.getCourseOriginalPrice());
-					musicGroupPaymentStudentCourseDetail.setCourseCurrentPrice(courseSettings.getCourseCurrentPrice());
-					musicGroupPaymentStudentCourseDetail.setUpdateTime(date);
-					musicGroupPaymentStudentCourseDetail.setUsedCourseMinutes(0);
-					musicGroupPaymentStudentCourseDetail.setUserId(studentId);
-					
-					musicGroupPaymentStudentCourseDetailList.add(musicGroupPaymentStudentCourseDetail);
 				}
+				musicGroupPaymentStudentCourseDetailDao.batchInsert(musicGroupPaymentStudentCourseDetailList);
 			}
 		}
-		
-		if(musicGroupPaymentStudentCourseDetailList.size() > 0){
-			musicGroupPaymentStudentCourseDetailDao.batchInsert(musicGroupPaymentStudentCourseDetailList);
-		}
 		//给学员推送缴费通知
 		for (MusicGroupPaymentCalender musicGroupPaymentCalender : musicGroupPaymentCalenderList) {
 			if (musicGroupPaymentCalender.getPayUserType() == STUDENT && musicGroupPaymentCalender.getStatus() == PaymentCalenderStatusEnum.OPEN) {

+ 1 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderServiceImpl.java

@@ -663,6 +663,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 		musicGroupPaymentCalenderDao.insert(musicGroupPaymentCalender);
 
 		//课程费用列表
+		musicGroupPaymentCalender.setMusicGroupPaymentCalenderCourseSettingsList(musicGroupPaymentBaseCalender.getMusicGroupPaymentCalenderCourseSettingsList());
 		musicGroupPaymentCalenderCourseSettingsService.batchInsert(musicGroupPaymentCalender);
 		//活动费用列表
 		musicGroupPaymentCalenderActivityService.batchInsert(musicGroupPaymentBaseCalender,musicGroupPaymentCalender.getId());

+ 3 - 0
mec-biz/src/main/resources/config/mybatis/MusicGroupPaymentCalenderActivityDao.xml

@@ -27,4 +27,7 @@
   <delete id="delByCalenderId">
     DELETE FROM music_group_payment_calender_activity WHERE calender_id_ = #{calenderId}
   </delete>
+    <select id="findByCalenderId" resultType="com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderActivity">
+      SELECT <include refid="Base_Column_List"/> FROM music_group_payment_calender_activity WHERE calender_id_ = #{calenderId}
+    </select>
 </mapper>

+ 3 - 3
mec-biz/src/main/resources/config/mybatis/MusicGroupPaymentCalenderMapper.xml

@@ -66,7 +66,7 @@
         #{expectNum},#{actualNum},#{memo},#{isGiveMusicNetwork},now(),now(),
         #{paymentValidStartDate},#{paymentValidEndDate},#{paymentPattern},#{paymentType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
         #{paymentAmount},#{batchNo},#{auditMemo},#{operator},#{attribute1},#{attribute2},#{studentIds},
-               #{memberPaymentAmount},#{memberRankSettingId},#{memberValidDate},#{originalMemberPaymentAmount},#{memberPeriod},
+               #{memberPaymentAmount},#{memberRankSettingId},#{memberValidDate},#{originalMemberPaymentAmount},#{memberPeriod,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
                #{memberOptionalFlag},#{musicRepairNum},#{musicRepairActualPrice},#{musicRepairOptionalFlag})
     </insert>
 
@@ -84,7 +84,7 @@
         #{item.expectNum},#{item.actualNum},#{item.memo},#{item.isGiveMusicNetwork},now(),now(),
         #{item.paymentValidStartDate},#{item.paymentValidEndDate},#{item.paymentPattern},#{item.paymentAmount},#{item.paymentType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
         #{item.batchNo},#{item.auditMemo},#{item.operator},#{item.attribute1},#{item.attribute2},
-         #{item.studentIds},#{item.memberPaymentAmount},#{item.memberRankSettingId},#{item.memberValidDate},#{item.originalMemberPaymentAmount},#{item.memberPeriod},
+         #{item.studentIds},#{item.memberPaymentAmount},#{item.memberRankSettingId},#{item.memberValidDate},#{item.originalMemberPaymentAmount},#{item.memberPeriod,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
             #{item.memberOptionalFlag},#{item.musicRepairNum},#{item.musicRepairActualPrice},#{item.musicRepairOptionalFlag})
         </foreach>
     </insert>
@@ -106,7 +106,7 @@
                 music_repair_optional_flag_ = #{musicRepairOptionalFlag},
             </if>
             <if test="memberPeriod != null">
-                member_period_ = #{memberPeriod},
+                member_period_ = #{memberPeriod,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
             </if>
             <if test="originalMemberPaymentAmount != null">
                 original_member_payment_amount_ = #{originalMemberPaymentAmount},

+ 7 - 1
mec-student/src/main/java/com/ym/mec/student/controller/MusicGroupPaymentCalenderController.java

@@ -12,6 +12,7 @@ import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderDetail;
 import com.ym.mec.biz.dal.entity.MusicGroupStudentFee.PaymentStatus;
 import com.ym.mec.biz.dal.entity.StudentRegistration;
 import com.ym.mec.biz.service.MemberRankPrivilegesService;
+import com.ym.mec.biz.service.MusicGroupPaymentCalenderActivityService;
 import com.ym.mec.biz.service.MusicGroupPaymentCalenderService;
 import com.ym.mec.biz.service.StudentRegistrationService;
 import com.ym.mec.common.controller.BaseController;
@@ -48,6 +49,8 @@ public class MusicGroupPaymentCalenderController extends BaseController {
     private MusicGroupPaymentCalenderStudentDetailDao musicGroupPaymentCalenderStudentDetailDao;
     @Autowired
     private MusicGroupPaymentStudentCourseDetailDao musicGroupPaymentStudentCourseDetailDao;
+    @Autowired
+    private MusicGroupPaymentCalenderActivityService musicGroupPaymentCalenderActivityService;
 	@Autowired
 	private MemberRankPrivilegesService memberRankPrivilegesService;
 
@@ -76,14 +79,17 @@ public class MusicGroupPaymentCalenderController extends BaseController {
                 return failed("乐团报名信息不存在");
             }
             ModelMap model = new ModelMap();
+            //课程相关信息
             if(calender.getPaymentType() == MusicGroupPaymentCalender.PaymentType.SPAN_GROUP_CLASS_ADJUST){
                 model.put("musicGroupPaymentCalenderStudentDetails",musicGroupPaymentCalenderStudentDetailDao.findByBatchNoAndUserId(calender.getBatchNo(),userId));
             }else {
                 model.put("calenderCourseSettings", musicGroupPaymentStudentCourseDetailDao.findByCalenderAndUserId(calenderId,userId));
             }
+            //活动相关信息
+            model.put("activity",musicGroupPaymentCalenderActivityService.findByCalenderId(calenderId));
             calender.setMemberPaymentAmount(calenderDetail.getExpectMemberAmount());
             model.put("musicGroup",musicGroupDao.get(musicGroupId));
-            model.put("amount", calenderDetail.getExpectAmount().add(calenderDetail.getExpectMemberAmount()));
+            model.put("amount", calender.getPaymentAmount());
             model.put("balance",studentRegistration.getBalance());
             model.put("calender",calender);
             model.put("memberPrivilegesItemList", memberRankPrivilegesService.queryByMemberRankId(calender.getMemberRankSettingId()));