yonge 5 年之前
父节点
当前提交
49ab88dd6d

+ 6 - 16
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/MusicGroupStudentFeeDao.java

@@ -1,16 +1,15 @@
 package com.ym.mec.biz.dal.dao;
 
-import com.ym.mec.biz.dal.dto.SimpleUserDto;
-import com.ym.mec.biz.dal.dto.UpdateStudentFeeDto;
-import com.ym.mec.biz.dal.entity.MusicGroupStudentFee;
-import com.ym.mec.common.dal.BaseDAO;
-import org.apache.ibatis.annotations.Param;
-
 import java.math.BigDecimal;
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
-import java.util.Set;
+
+import org.apache.ibatis.annotations.Param;
+
+import com.ym.mec.biz.dal.dto.UpdateStudentFeeDto;
+import com.ym.mec.biz.dal.entity.MusicGroupStudentFee;
+import com.ym.mec.common.dal.BaseDAO;
 
 public interface MusicGroupStudentFeeDao extends BaseDAO<Long, MusicGroupStudentFee> {
 
@@ -104,15 +103,6 @@ public interface MusicGroupStudentFeeDao extends BaseDAO<Long, MusicGroupStudent
 	Integer countStudentNoPayNum(String musicGroupId);
 
 	/**
-	 * 获取当前乐团对应缴费状态的学院
-	 * @param musicGroupId
-	 * @param paymentStatus
-	 * @return
-	 */
-	List<SimpleUserDto> findStudentWithMusicGroupAndPaymentStatus(@Param("musicGroupId") String musicGroupId,
-																  @Param("paymentStatus")MusicGroupStudentFee.PaymentStatus paymentStatus);
-
-	/**
 	 * 根据乐团声部修改学员课程费用
 	 * @param musicGroupId
 	 * @param subjectId

+ 7 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/MusicGroupPaymentCalenderService.java

@@ -8,6 +8,13 @@ import java.util.Date;
 import java.util.List;
 
 public interface MusicGroupPaymentCalenderService extends BaseService<Long, MusicGroupPaymentCalender> {
+	
+	/**
+	 * 创建缴费信息
+	 * @param musicGroupPaymentCalender
+	 * @return
+	 */
+	boolean create(MusicGroupPaymentCalender musicGroupPaymentCalender);
 
 	/**
 	 * 批量新增、修改乐团缴费周期

+ 37 - 3
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderServiceImpl.java

@@ -1,5 +1,6 @@
 package com.ym.mec.biz.service.impl;
 
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.Date;
@@ -12,8 +13,10 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderDao;
+import com.ym.mec.biz.dal.dao.MusicGroupStudentFeeDao;
 import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender;
 import com.ym.mec.biz.dal.entity.MusicGroupStudentFee;
+import com.ym.mec.biz.dal.enums.PaymentStatusEnum;
 import com.ym.mec.biz.service.MusicGroupPaymentCalenderService;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
@@ -24,6 +27,9 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 
 	@Autowired
 	private MusicGroupPaymentCalenderDao musicGroupPaymentCalenderDao;
+	
+	@Autowired
+	private MusicGroupStudentFeeDao musicGroupStudentFeeDao;
 
 	@Override
 	public BaseDAO<Long, MusicGroupPaymentCalender> getDAO() {
@@ -32,6 +38,34 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 
 	@Override
 	@Transactional(rollbackFor = Exception.class)
+	public boolean create(MusicGroupPaymentCalender musicGroupPaymentCalender) {
+		Date date = new Date();
+		musicGroupPaymentCalender.setCreateTime(date);
+		musicGroupPaymentCalender.setUpdateTime(date);
+		musicGroupPaymentCalender.setDeadlinePaymentDate(DateUtil.addDays(musicGroupPaymentCalender.getStartPaymentDate(), 3));
+		if (date.after(musicGroupPaymentCalender.getDeadlinePaymentDate())) {
+			musicGroupPaymentCalender.setPaymentStatus(PaymentStatusEnum.YES);
+		} else if (date.after(musicGroupPaymentCalender.getStartPaymentDate())) {
+			musicGroupPaymentCalender.setPaymentStatus(PaymentStatusEnum.OPEN);
+			//统计缴费人数
+			List<MusicGroupStudentFee> list = musicGroupStudentFeeDao.queryByMusicGroupId(musicGroupPaymentCalender.getMusicGroupId());
+			if(list == null){
+				list = new ArrayList<MusicGroupStudentFee>();
+			}
+			musicGroupPaymentCalender.setExpectNum(list.size());
+		} else {
+			musicGroupPaymentCalender.setPaymentStatus(PaymentStatusEnum.NO);
+		}
+		
+		this.insert(musicGroupPaymentCalender);
+		
+		//创建缴费明细
+
+		return true;
+	}
+
+	@Override
+	@Transactional(rollbackFor = Exception.class)
 	public void batchInsert(List<MusicGroupPaymentCalender> musicGroupPaymentCalenders) {
 		if (musicGroupPaymentCalenders != null && musicGroupPaymentCalenders.size() > 0) {
 			musicGroupPaymentCalenderDao.delByGroupId(musicGroupPaymentCalenders.get(0).getMusicGroupId());
@@ -44,15 +78,15 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 	@Override
 	public Date getNextPaymentDate(String musicGroupId, Date latestPaidDate, MusicGroupStudentFee fee) {
 		List<Integer> months = null;
-		if(fee != null){
+		if (fee != null) {
 			String paymentPeriodList = fee.getPaymentPeriodList();
-			if(StringUtils.isEmpty(paymentPeriodList)){
+			if (StringUtils.isEmpty(paymentPeriodList)) {
 				return null;
 			} else {
 				months = Arrays.asList(paymentPeriodList.split(",")).stream().map(x -> Integer.parseInt(x)).collect(Collectors.toList());
 				Collections.sort(months);
 			}
-		}else {
+		} else {
 			List<MusicGroupPaymentCalender> musicGroupPaymentCalenderList = musicGroupPaymentCalenderDao.findByMusicGroupId(musicGroupId);
 			if (musicGroupPaymentCalenderList != null && musicGroupPaymentCalenderList.size() > 0) {
 				months = musicGroupPaymentCalenderList.stream().map(e -> e.getPaymentMonth()).sorted().collect(Collectors.toList());

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

@@ -194,16 +194,6 @@
         SELECT * FROM music_group_student_fee_ WHERE music_group_id_ = #{musicGroupId}
     </select>
 
-    <select id="findStudentWithMusicGroupAndPaymentStatus" resultType="com.ym.mec.biz.dal.dto.SimpleUserDto">
-        SELECT
-            DISTINCT su.id_ userId,
-            su.real_name_ userName,
-            su.avatar_ avatar
-        FROM music_group_student_fee_ mgsf
-        LEFT JOIN sys_user su ON su.id_=mgsf.user_id_
-        WHERE music_group_id_='19120116225600001' AND payment_status_='PAID_COMPLETED'
-    </select>
-
     <update id="batchUpdate" parameterType="java.util.List">
     	<foreach collection="list" item="item" index="index" open="" close="" separator=";">
         UPDATE music_group_student_fee_

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

@@ -33,7 +33,7 @@ public class MusicGroupPaymentCalenderController extends BaseController {
     @PostMapping("/add")
     @PreAuthorize("@pcs.hasPermissions('musicGroupPaymentCalender/add')")
     public Object add(MusicGroupPaymentCalender musicGroupPaymentCalender) {
-        musicGroupPaymentCalenderService.insert(musicGroupPaymentCalender);
+        musicGroupPaymentCalenderService.create(musicGroupPaymentCalender);
         return succeed();
     }