浏览代码

Merge remote-tracking branch 'origin/master'

Joe 5 年之前
父节点
当前提交
011d4c6c9f

+ 5 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/MusicGroupPaymentCalenderDetailDao.java

@@ -75,4 +75,9 @@ public interface MusicGroupPaymentCalenderDetailDao extends BaseDAO<Long, MusicG
 	 * @return
 	 */
 	int queryIntersectionByPaymentDate(@Param("musicGroupId") String musicGroupId, @Param("userId") Integer userId);
+
+	/**
+	 * 刷新学员乐团付费状态
+	 */
+	void refreshUserMusicGroupPaymentStatusTask();
 }

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

@@ -5,6 +5,7 @@ import java.util.Date;
 import java.util.List;
 import java.util.Map;
 
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderDetail;
 import org.apache.ibatis.annotations.Param;
 
 import com.ym.mec.biz.dal.dto.UpdateStudentFeeDto;
@@ -175,4 +176,10 @@ public interface MusicGroupStudentFeeDao extends BaseDAO<Long, MusicGroupStudent
 	 * @param courseFee
 	 */
     void batchUpdateCourseFee(@Param("ids") String ids, @Param("courseFee") BigDecimal courseFee);
+
+	/**
+	 * 将乐团的学生缴费状态设置为未缴费
+	 * @param calenderDetails
+	 */
+	void setNoPayment(@Param("calenderDetails") List<MusicGroupPaymentCalenderDetail> calenderDetails);
 }

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

@@ -30,4 +30,10 @@ public interface MusicGroupPaymentCalenderDetailService extends BaseService<Long
      * @return
      */
     List<SimpleUserDto> findMusicGroupStudentWithSubject(String musicGroupId,Integer subjectId);
+
+    /**
+     * 刷新学员乐团付费状态
+     */
+    void refreshUserMusicGroupPaymentStatusTask();
+
 }

+ 11 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderDetailServiceImpl.java

@@ -2,11 +2,13 @@ package com.ym.mec.biz.service.impl;
 
 import com.ym.mec.biz.dal.dao.MusicGroupDao;
 import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderDetailDao;
+import com.ym.mec.biz.dal.dao.MusicGroupStudentFeeDao;
 import com.ym.mec.biz.dal.dto.SimpleUserDto;
 import com.ym.mec.biz.dal.entity.MusicGroup;
 import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderDetail;
 import com.ym.mec.biz.dal.enums.MessageTypeEnum;
 import com.ym.mec.biz.service.MusicGroupPaymentCalenderDetailService;
+import com.ym.mec.biz.service.MusicGroupStudentFeeService;
 import com.ym.mec.biz.service.SysMessageService;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.exception.BizException;
@@ -32,6 +34,8 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
 	@Autowired
 	private MusicGroupDao musicGroupDao;
 	@Autowired
+	private MusicGroupStudentFeeDao musicGroupStudentFeeDao;
+	@Autowired
 	private SysMessageService sysMessageService;
 
 	@Override
@@ -92,6 +96,8 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
 			e.setDeadlinePaymentDate(date);
 		});
 		musicGroupPaymentCalenderDetailDao.batchUpdate(calenderDetails);
+		//修改学员缴费状态为未缴费
+		musicGroupStudentFeeDao.setNoPayment(calenderDetails);
 		Set<Integer> studentIds = calenderDetails.stream().map(e -> e.getUserId()).collect(Collectors.toSet());
 		//推送消息
 		if (studentIds.size() > 0) {
@@ -113,4 +119,9 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
 		}
 		return musicGroupPaymentCalenderDetailDao.findMusicGroupStudentWithSubject(musicGroupId, subjectId);
 	}
+
+	@Override
+	public void refreshUserMusicGroupPaymentStatusTask() {
+		musicGroupPaymentCalenderDetailDao.refreshUserMusicGroupPaymentStatusTask();
+	}
 }

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

@@ -106,6 +106,12 @@
 		<foreach collection="calenderDetails" item="item" index="index" open="" close="" separator=";">
 			UPDATE music_group_payment_calender_detail
 			<set>
+				<if test="item.startPaymentDate != null">
+					start_payment_date_ = #{item.startPaymentDate},
+				</if>
+				<if test="item.deadlinePaymentDate != null">
+					deadline_payment_date_ = #{item.deadlinePaymentDate},
+				</if>
 				<if test="item.open != null">
 					open_ = #{item.open},
 				</if>
@@ -137,6 +143,11 @@
 			WHERE id_ = #{item.id}
 		</foreach>
 	</update>
+	<update id="refreshUserMusicGroupPaymentStatusTask">
+		UPDATE music_group_payment_calender_detail mgpcd
+		SET mgpcd.open_ = 0,mgpcd.start_payment_date_ = NULL,mgpcd.deadline_payment_date_ = NULL
+		WHERE mgpcd.deadline_payment_date_ &lt; DATE_FORMAT(NOW(),'%Y-%m-%d')
+	</update>
 
 	<!-- 根据主键删除一条记录 -->
 	<delete id="delete">
@@ -208,7 +219,7 @@
 	</select>
 	<select id="sumActualAmount" resultType="java.math.BigDecimal">
 		SELECT SUM(mgpcd.actual_amount_) FROM music_group_payment_calender_detail mgpcd
-		WHERE mgpcd.music_group_payment_calender_id_ = #{id} AND mgpcd.payment_status_ = "PAID_COMPLETED"
+		WHERE mgpcd.music_group_payment_calender_id_ = #{id}
 	</select>
 
 	<select id="getUserLastCalenderDetail" resultMap="MusicGroupPaymentCalenderDetail">
@@ -221,7 +232,7 @@
 		SELECT mgpcd.*,mgpc.music_group_id_ FROM music_group_payment_calender_detail mgpcd
 		LEFT JOIN music_group_payment_calender mgpc ON mgpc.id_ = mgpcd.music_group_payment_calender_id_
 		LEFT JOIN student_registration sr ON sr.music_group_id_ = mgpc.music_group_id_
-		WHERE mgpcd.payment_status_ = 'NON_PAYMENT' AND mgpcd.open_ = 0 AND sr.music_group_status_ != 'QUIT'
+		WHERE mgpcd.payment_status_ = 'NON_PAYMENT' AND mgpcd.open_ = 0 AND sr.music_group_status_ != 'QUIT' AND mgpc.payment_status_ = 'YES'
 		AND FIND_IN_SET(mgpcd.id_,#{ids})
 	</select>
 	<select id="queryIntersectionByPaymentDate" resultType="java.lang.Integer">

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

@@ -274,4 +274,10 @@
         UPDATE music_group_student_fee_ mgsf SET mgsf.course_fee_ = #{courseFee}
         WHERE FIND_IN_SET(mgsf.id_,#{ids})
     </update>
+    <update id="setNoPayment">
+        <foreach collection="calenderDetails" item="item" index="index" open="" close="" separator=";">
+            UPDATE music_group_student_fee_ m SET m.payment_status_ = 'NON_PAYMENT'
+            WHERE m.music_group_id_ = #{item.musicGroupId} AND m.user_id_ = #{item.userId}
+        </foreach>
+    </update>
 </mapper>

+ 4 - 0
mec-client-api/src/main/java/com/ym/mec/task/TaskRemoteService.java

@@ -13,6 +13,10 @@ public interface TaskRemoteService {
 	// 刷新付费状态
 	public void refreshPaymentFeeStatus();
 
+	@GetMapping(value = "task/refreshUserMusicGroupPaymentStatusTask")
+	// 刷新学员乐团付费状态
+	public void refreshUserMusicGroupPaymentStatusTask();
+
 	@GetMapping(value = "task/vipGroupAwardedMonthlyRewards")
 	// vip课月度奖励
 	public void vipGroupAwardedMonthlyRewards();

+ 5 - 0
mec-client-api/src/main/java/com/ym/mec/task/fallback/TaskRemoteServiceFallback.java

@@ -17,6 +17,11 @@ public class TaskRemoteServiceFallback implements TaskRemoteService {
 	}
 
 	@Override
+	public void refreshUserMusicGroupPaymentStatusTask() {
+		logger.info("刷新学员乐团付费状态");
+	}
+
+	@Override
 	public void vipGroupAwardedMonthlyRewards() {
 		logger.info("vip课月度奖励的服务调用失败");
 	}

+ 19 - 0
mec-task/src/main/java/com/ym/mec/task/jobs/RefreshUserMusicGroupPaymentStatusTask.java

@@ -0,0 +1,19 @@
+package com.ym.mec.task.jobs;
+
+import com.ym.mec.task.TaskRemoteService;
+import com.ym.mec.task.core.BaseTask;
+import com.ym.mec.task.core.TaskException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class RefreshUserMusicGroupPaymentStatusTask extends BaseTask {
+
+	@Autowired
+	private TaskRemoteService taskRemoteService;
+
+	@Override
+	public void execute() throws TaskException {
+		taskRemoteService.refreshUserMusicGroupPaymentStatusTask();
+	}
+}

+ 9 - 0
mec-web/src/main/java/com/ym/mec/web/controller/TaskController.java

@@ -65,6 +65,15 @@ public class TaskController extends BaseController {
 	@Autowired
 	private MusicGroupPaymentCalenderService musicGroupPaymentCalenderService;
 
+	@Autowired
+	private MusicGroupPaymentCalenderDetailService musicGroupPaymentCalenderDetailService;
+
+	@GetMapping(value = "/refreshUserMusicGroupPaymentStatusTask")
+	// 刷新学员乐团付费状态
+	public void refreshUserMusicGroupPaymentStatusTask(){
+		musicGroupPaymentCalenderDetailService.refreshUserMusicGroupPaymentStatusTask();
+	}
+
 	@GetMapping("/refreshPaymentFeeStatus")
 	// 刷新付费状态
 	public void refreshPaymentFeeStatus() {