Quellcode durchsuchen

update:缴费项目学员列表删除

yonge vor 4 Jahren
Ursprung
Commit
8cac1935e6

+ 7 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/MusicGroupPaymentStudentCourseDetailDao.java

@@ -71,4 +71,11 @@ public interface MusicGroupPaymentStudentCourseDetailDao extends BaseDAO<Long, M
      * @return
      */
     int deleteByMusicGroupPaymentCalenderId(Long musicGroupPaymentCalenderId);
+
+    /**
+     * 删除信息
+     * @param musicGroupPaymentCalenderDetailIdList
+     * @return
+     */
+    int deleteByMusicGroupPaymentCalenderDetailId(List<Long> musicGroupPaymentCalenderDetailIdList);
 }

+ 2 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/MusicGroupPaymentCalenderDetailService.java

@@ -67,7 +67,7 @@ public interface MusicGroupPaymentCalenderDetailService extends BaseService<Long
 
     /**
      * 批量删除缴费信息
-     * @param musicGroupPaymentCalenderIds
+     * @param musicGroupPaymentCalenderDetailIds
      */
-    void batchDel(String musicGroupPaymentCalenderIds);
+    void batchDel(String musicGroupPaymentCalenderDetailIds);
 }

+ 41 - 18
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderDetailServiceImpl.java

@@ -1,10 +1,39 @@
 package com.ym.mec.biz.service.impl;
 
-import com.ym.mec.biz.dal.dao.*;
+import static com.ym.mec.biz.dal.entity.MusicGroupStudentFee.PaymentStatus.NON_PAYMENT;
+
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import com.ym.mec.biz.dal.dao.MusicGroupDao;
+import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderCourseSettingsDao;
+import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderDao;
+import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderDetailDao;
+import com.ym.mec.biz.dal.dao.MusicGroupPaymentStudentCourseDetailDao;
+import com.ym.mec.biz.dal.dao.MusicGroupStudentFeeDao;
+import com.ym.mec.biz.dal.dao.SysConfigDao;
 import com.ym.mec.biz.dal.dto.FeeStudentDto;
 import com.ym.mec.biz.dal.dto.SimpleUserDto;
-import com.ym.mec.biz.dal.entity.*;
+import com.ym.mec.biz.dal.entity.MusicGroup;
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender;
 import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentCalenderStatusEnum;
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderCourseSettings;
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderDetail;
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentStudentCourseDetail;
+import com.ym.mec.biz.dal.entity.MusicGroupStudentFee;
 import com.ym.mec.biz.dal.entity.MusicGroupStudentFee.PaymentStatus;
 import com.ym.mec.biz.dal.enums.MessageTypeEnum;
 import com.ym.mec.biz.service.MusicGroupPaymentCalenderDetailService;
@@ -16,18 +45,6 @@ import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
 import com.ym.mec.thirdparty.message.MessageSenderPluginContext;
 
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import java.math.BigDecimal;
-import java.util.*;
-import java.util.stream.Collectors;
-
-import static com.ym.mec.biz.dal.entity.MusicGroupStudentFee.PaymentStatus.NON_PAYMENT;
-import static com.ym.mec.biz.dal.entity.MusicGroupStudentFee.PaymentStatus.PAID_COMPLETED;
-
 @Service
 public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<Long, MusicGroupPaymentCalenderDetail>  implements MusicGroupPaymentCalenderDetailService {
 	
@@ -428,15 +445,21 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
 
 	@Override
 	@Transactional(rollbackFor = Exception.class)
-	public void batchDel(String musicGroupPaymentCalenderIds) {
-		List<MusicGroupPaymentCalenderDetail> details = musicGroupPaymentCalenderDetailDao.queryListByIds(musicGroupPaymentCalenderIds);
+	public void batchDel(String musicGroupPaymentCalenderDetailIds) {
+		List<MusicGroupPaymentCalenderDetail> details = musicGroupPaymentCalenderDetailDao.queryListByIds(musicGroupPaymentCalenderDetailIds);
 		if(details == null || details.size() == 0){
 			throw new BizException("删除失败: 数据不可为空");
 		}
-		long count = details.stream().filter(e -> e.getPaymentStatus() == PAID_COMPLETED).count();
+		long count = details.stream().filter(e -> e.getPaymentStatus() != NON_PAYMENT).count();
 		if(count > 0){
 			throw new BizException("删除失败: 存在已缴费的学员");
 		}
-		musicGroupPaymentCalenderDetailDao.batchDel(musicGroupPaymentCalenderIds);
+		musicGroupPaymentCalenderDetailDao.batchDel(musicGroupPaymentCalenderDetailIds);
+		
+		List<Long> musicGroupPaymentCalenderDetailIdList = new ArrayList<Long>();
+		for(String s : musicGroupPaymentCalenderDetailIds.split(",")){
+			musicGroupPaymentCalenderDetailIdList.add(Long.parseLong(s));
+		}
+		musicGroupPaymentStudentCourseDetailDao.deleteByMusicGroupPaymentCalenderDetailId(musicGroupPaymentCalenderDetailIdList);
 	}
 }

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

@@ -188,7 +188,7 @@
 		DELETE FROM music_group_payment_calender_detail WHERE id_ = #{id}
 	</delete>
 	<delete id="batchDel">
-		DELETE FROM music_group_payment_calender_detail WHERE FIND_IN_SET(id_,#{musicGroupPaymentCalenderIds})
+		DELETE FROM music_group_payment_calender_detail WHERE FIND_IN_SET(id_,#{musicGroupPaymentCalenderIdDetails})
 	</delete>
 	<delete id="deleteByUserIdAndMusicGroupId">
 		DELETE FROM music_group_payment_calender_detail

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

@@ -126,6 +126,16 @@
         DELETE FROM music_group_payment_student_course_detail
         WHERE music_group_payment_calender_id_ = #{musicGroupPaymentCalenderId}
     </delete>
+    
+    <delete id="deleteByMusicGroupPaymentCalenderDetailId">
+        DELETE FROM music_group_payment_student_course_detail
+        <where>
+        	music_group_payment_calender_detail_id_ in    
+		    <foreach item="item" collection="list" separator="," open="(" close=")" index="">    
+		      #{item}    
+		    </foreach>
+        </where>
+    </delete>
 
     <!-- 分页查询 -->
     <select id="queryPage" resultMap="MusicGroupPaymentStudentCourseDetail"

+ 6 - 2
mec-web/src/main/java/com/ym/mec/web/controller/MusicGroupPaymentCalenderDetailController.java

@@ -5,6 +5,7 @@ import io.swagger.annotations.ApiOperation;
 
 import java.math.BigDecimal;
 
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -69,8 +70,11 @@ public class MusicGroupPaymentCalenderDetailController extends BaseController {
     @ApiOperation(value = "批量删除缴费信息")
     @PostMapping("/batchDel")
     @PreAuthorize("@pcs.hasPermissions('musicGroupPaymentCalenderDetail/batchDel')")
-    public Object batchDel(String musicGroupPaymentCalenderIds) {
-        musicGroupPaymentCalenderDetailService.batchDel(musicGroupPaymentCalenderIds);
+    public Object batchDel(String musicGroupPaymentCalenderDetailIds) {
+    	if(StringUtils.isBlank(musicGroupPaymentCalenderDetailIds)){
+    		return failed("请求参数错误");
+    	}
+        musicGroupPaymentCalenderDetailService.batchDel(musicGroupPaymentCalenderDetailIds);
         return succeed();
     }