浏览代码

Merge remote-tracking branch 'origin/master'

zouxuan 4 年之前
父节点
当前提交
0cd05d014a

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

@@ -6,6 +6,7 @@ import java.util.List;
 
 import com.ym.mec.biz.dal.entity.MusicGroupPaymentStudentCourseDetail;
 import com.ym.mec.common.dal.BaseDAO;
+
 import org.apache.ibatis.annotations.Param;
 
 public interface MusicGroupPaymentStudentCourseDetailDao extends BaseDAO<Long, MusicGroupPaymentStudentCourseDetail> {
@@ -63,4 +64,11 @@ public interface MusicGroupPaymentStudentCourseDetailDao extends BaseDAO<Long, M
      * @return
      */
     int deleteByUserIdAndMusicGroupId(@Param("userId") Integer userId, @Param("musicGroupId") String musicGroupId);
+    
+    /**
+     * 根据缴费编号删除信息
+     * @param musicGroupPaymentCalenderId
+     * @return
+     */
+    int deleteByMusicGroupPaymentCalenderId(Long musicGroupPaymentCalenderId);
 }

+ 22 - 9
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderServiceImpl.java

@@ -259,9 +259,15 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 						if (defaultUnitPrice == null) {
 							throw new BizException("请先设置分部课程类型单价");
 						}
-						if (courseSettings.getCourseCurrentPrice()
-								.divide(new BigDecimal(courseSettings.getCourseTotalMinuties()), CommonConstants.DECIMAL_FINAL_PLACE, BigDecimal.ROUND_DOWN)
-								.compareTo(defaultUnitPrice.getUnitPrice()) != 0) {
+						if (courseSettings.getCourseTotalMinuties() != 0) {
+							if (courseSettings
+									.getCourseCurrentPrice()
+									.divide(new BigDecimal(courseSettings.getCourseTotalMinuties()), CommonConstants.DECIMAL_FINAL_PLACE, BigDecimal.ROUND_DOWN)
+									.compareTo(defaultUnitPrice.getUnitPrice()) != 0) {
+								status = AUDITING;
+								break;
+							}
+						} else {
 							status = AUDITING;
 							break;
 						}
@@ -564,9 +570,14 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 					if (defaultUnitPrice == null) {
 						throw new BizException("请先设置分部课程类型单价");
 					}
-					if (courseSettings.getCourseCurrentPrice()
-							.divide(new BigDecimal(courseSettings.getCourseTotalMinuties()), CommonConstants.DECIMAL_FINAL_PLACE, BigDecimal.ROUND_DOWN)
-							.compareTo(defaultUnitPrice.getUnitPrice()) != 0) {
+					if (courseSettings.getCourseTotalMinuties() != 0) {
+						if (courseSettings.getCourseCurrentPrice()
+								.divide(new BigDecimal(courseSettings.getCourseTotalMinuties()), CommonConstants.DECIMAL_FINAL_PLACE, BigDecimal.ROUND_DOWN)
+								.compareTo(defaultUnitPrice.getUnitPrice()) != 0) {
+							status = AUDITING;
+							break;
+						}
+					} else {
 						status = AUDITING;
 						break;
 					}
@@ -1210,12 +1221,13 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 		if (id == null) {
 			throw new BizException("参数校验失败");
 		}
-		MusicGroupPaymentCalender calender = musicGroupPaymentCalenderDao.get(id);
+		MusicGroupPaymentCalender calender = musicGroupPaymentCalenderDao.getForLock(id);
 		if (calender == null) {
 			throw new BizException("缴费信息不存在");
 		}
-		if (calender.getStatus() != PaymentCalenderStatusEnum.NO || calender.getStatus() != PaymentCalenderStatusEnum.REJECT) {
-			throw new BizException("删除失败,只有“拒绝”或“未开启缴费”状态才能删除");
+		if (calender.getStatus() != PaymentCalenderStatusEnum.AUDITING || calender.getStatus() != PaymentCalenderStatusEnum.NO
+				|| calender.getStatus() != PaymentCalenderStatusEnum.REJECT) {
+			throw new BizException("删除失败,只有[审核中]、[拒绝]或[未开启缴费]状态才能删除");
 		}
 
 		List<MusicGroupPaymentCalenderDetail> musicGroupPaymentCalenderDetailList = musicGroupPaymentCalenderDetailDao.queryByCalenderId(id,null);
@@ -1230,6 +1242,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 
 		musicGroupPaymentCalenderDao.delete(id);
 		musicGroupPaymentCalenderDetailDao.deleteByCalenderId(id);
+		musicGroupPaymentStudentCourseDetailDao.deleteByMusicGroupPaymentCalenderId(id);
 		
 		List<Long> calenderIds = new ArrayList<Long>();
 		calenderIds.add(id);

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

@@ -433,6 +433,7 @@
     </resultMap>
     <sql id="MusicGroupPaymentCalenderAuditDtoSql">
         <where>
+                mgpc.batch_no_ IS NOT NULL
             <if test="paymentType != null">
                 AND mgpc.payment_type_ = #{paymentType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
             </if>

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

@@ -121,6 +121,12 @@
         WHERE id_ = #{id}
     </delete>
 
+    <!-- 根据主键删除一条记录 -->
+    <delete id="deleteByMusicGroupPaymentCalenderId">
+        DELETE FROM music_group_payment_student_course_detail
+        WHERE music_group_payment_calender_id_ = #{musicGroupPaymentCalenderId}
+    </delete>
+
     <!-- 分页查询 -->
     <select id="queryPage" resultMap="MusicGroupPaymentStudentCourseDetail"
             parameterType="map">