Bläddra i källkod

Merge branch 'master' of http://git.dayaedu.com/yonge/mec

# Conflicts:
#	mec-biz/src/main/java/com/ym/mec/biz/dal/dao/MusicGroupPaymentCalenderDao.java
zouxuan 4 år sedan
förälder
incheckning
b2d0b3de6c

+ 28 - 19
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/MusicGroupPaymentCalenderDao.java

@@ -69,10 +69,11 @@ public interface MusicGroupPaymentCalenderDao extends BaseDAO<Long, MusicGroupPa
      * @return
      */
     int queryIntersectionByPaymentDate(@Param("musicGroupId") String musicGroupId, @Param("startPaymentDate") Date startPaymentDate,
-                                       @Param("deadlinePaymentDate") Date deadlinePaymentDate,@Param("calenderId") Long calenderId);
+                                       @Param("deadlinePaymentDate") Date deadlinePaymentDate, @Param("calenderId") Long calenderId);
 
     /**
      * 乐团最后一次交费信息
+     *
      * @param musicGroupId
      * @return
      */
@@ -81,15 +82,15 @@ public interface MusicGroupPaymentCalenderDao extends BaseDAO<Long, MusicGroupPa
     int queryIntersectionByDate(@Param("musicGroupId") String musicGroupId, @Param("startTime") String startTime, @Param("endTime") String endTime);
 
     /**
+     * @param musicGroupId:
+     * @param paymentValidStartDate:
+     * @param paymentValidEndDate:
+     * @return int
      * @describe 根据指定乐团的有效日期查询交集
      * @apiNote 时光荏苒,认真工作的时间总是过得很快,而我、享受这一刻!
      * @author zouxuan
      * @date 2020/9/21
      * @time 10:46
-     * @param musicGroupId:
-     * @param paymentValidStartDate:
-     * @param paymentValidEndDate:
-     * @return int
      */
     int queryIntersectionByValidDate(@Param("musicGroupId") String musicGroupId,
                                      @Param("paymentValidStartDate") Date paymentValidStartDate,
@@ -97,13 +98,13 @@ public interface MusicGroupPaymentCalenderDao extends BaseDAO<Long, MusicGroupPa
                                      @Param("calenderId") Long calenderId);
 
     /**
+     * @param configValue:
+     * @return void
      * @describe 获取指定时间后的缴费信息
      * @apiNote 时光荏苒,认真工作的时间总是过得很快,而我、享受这一刻!
      * @author zouxuan
      * @date 2020/9/21
      * @time 17:35
-     * @param configValue:
-     * @return void
      */
     List<Map<Long, Long>> queryCalenderByDay(@Param("configValue") String configValue, @Param("format") String format);
 
@@ -116,53 +117,53 @@ public interface MusicGroupPaymentCalenderDao extends BaseDAO<Long, MusicGroupPa
     List<CalenderPushDto> getMusicCalenderPushDto(@Param("configValue") String configValue, @Param("format") String format);
 
     /**
+     * @param musicGroupId:
+     * @return com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender
      * @describe 获取乐团下未使用的最早的缴费记录
      * @author Joburgess
      * @date 2020.10.27
-     * @param musicGroupId:
-     * @return com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender
      */
     MusicGroupPaymentCalender getMusicGroupUnusedFirstPaymentCalender(@Param("musicGroupId") String musicGroupId,
                                                                       @Param("studentIds") List<Integer> studentIds);
 
     /**
+     * @param calenderIds:
+     * @return com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender
      * @describe 获取指定缴费日历中下未使用的最早的缴费记录
      * @author Joburgess
      * @date 2020.10.27
-     * @param calenderIds:
-     * @return com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender
      */
     MusicGroupPaymentCalender getUnusedFirstPaymentCalenderWithCalenders(@Param("calenderIds") List<Long> calenderIds);
 
     /**
+     * @param batchNo: 批次号
+     * @return java.util.List<com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender>
      * @describe 根据批次号获取缴费日历
      * @author Joburgess
      * @date 2020.10.30
-     * @param batchNo: 批次号
-     * @return java.util.List<com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender>
      */
     List<MusicGroupPaymentCalender> findByBatchNo(@Param("batchNo") String batchNo);
 
 
     /**
+     * @param params:
+     * @return int
      * @describe 乐团缴费日历审核列表
      * @apiNote 时光荏苒,认真工作的时间总是过得很快,而我、享受这一刻!
      * @author zouxuan
      * @date 2020/10/30
      * @time 13:47
-     * @param params:
-     * @return int
      */
     int countAuditList(Map<String, Object> params);
 
     /**
+     * @param params:
+     * @return int
      * @describe 乐团缴费日历审核列表
      * @apiNote 时光荏苒,认真工作的时间总是过得很快,而我、享受这一刻!
      * @author zouxuan
      * @date 2020/10/30
      * @time 13:47
-     * @param params:
-     * @return int
      */
     List<MusicGroupPaymentCalenderAuditDto> queryAuditList(Map<String, Object> params);
 
@@ -183,13 +184,21 @@ public interface MusicGroupPaymentCalenderDao extends BaseDAO<Long, MusicGroupPa
     List<Map<Long, Long>> countActualNum(@Param("id") Long id);
 
     /**
+     * @param calenderId:
+     * @return com.ym.mec.biz.dal.dto.MusicGroupPaymentCalenderAuditDto
      * @describe 获取审核详情
      * @apiNote 时光荏苒,认真工作的时间总是过得很快,而我、享受这一刻!
      * @author zouxuan
      * @date 2020/11/2
      * @time 17:46
-     * @param calenderId:
-     * @return com.ym.mec.biz.dal.dto.MusicGroupPaymentCalenderAuditDto
      */
     MusicGroupPaymentCalenderAuditDto getAuditDetail(@Param("calenderId") Long calenderId);
+
+    /**
+     * 获取乐团的报名缴费日历
+     *
+     * @param musicGroupId
+     * @return
+     */
+    MusicGroupPaymentCalender findByMusicGroupRegCalender(@Param("musicGroupId") String musicGroupId);
 }

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

@@ -7,7 +7,6 @@ import com.ym.mec.biz.dal.dto.MusicGroupPaymentCalenderAuditDto;
 import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender;
 import com.ym.mec.biz.dal.page.MusicGroupPaymentCalenderQueryInfo;
 import com.ym.mec.common.page.PageInfo;
-import com.ym.mec.common.page.QueryInfo;
 import com.ym.mec.common.service.BaseService;
 
 public interface MusicGroupPaymentCalenderService extends BaseService<Long, MusicGroupPaymentCalender> {
@@ -17,7 +16,7 @@ public interface MusicGroupPaymentCalenderService extends BaseService<Long, Musi
 	 * @param musicGroupPaymentCalender
 	 * @return
 	 */
-	boolean create(MusicGroupPaymentCalender musicGroupPaymentCalender);
+	Long create(MusicGroupPaymentCalender musicGroupPaymentCalender);
 
 	/**
 	 * 获取明细
@@ -117,4 +116,11 @@ public interface MusicGroupPaymentCalenderService extends BaseService<Long, Musi
 	 * @return void
 	 */
 	void auditRefuse(Long calenderId,String auditMemo);
+
+	/**
+	 * 获取乐团报名的缴费日历
+	 * @param musicGroupId
+	 * @return
+	 */
+	MusicGroupPaymentCalender findByMusicGroupRegCalender(String musicGroupId);
 }

+ 8 - 33
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderServiceImpl.java

@@ -82,7 +82,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 
 	@Override
 	@Transactional(rollbackFor = Exception.class)
-	public boolean create(MusicGroupPaymentCalender musicGroupPaymentCalender) {
+	public Long create(MusicGroupPaymentCalender musicGroupPaymentCalender) {
 		
 		String musicGroupId = musicGroupPaymentCalender.getMusicGroupId();
 
@@ -97,7 +97,6 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 		}
 		Date date = new Date();
 		Map<Integer, String> pushUserMap = new HashMap<>();
-		MusicGroupPaymentCalenderDetail musicGroupPaymentCalenderDetail = null;
 		List<MusicGroupPaymentCalenderDetail> musicGroupPaymentCalenderDetailList = new ArrayList<>();
 		musicGroupPaymentCalender.setOperator(sysUser.getId());
 		musicGroupPaymentCalender.setCreateTime(date);
@@ -160,36 +159,6 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 		}
 
 		musicGroupPaymentCalender.setExpectNum(0);
-		if(StringUtils.isNoneBlank(musicGroupPaymentCalender.getStudentIds())){
-			String[] sutdentIdList = musicGroupPaymentCalender.getStudentIds().split(",");
-			musicGroupPaymentCalender.setExpectNum(sutdentIdList.length);
-			
-			if (musicGroupPaymentCalender.getStatus() == PaymentCalenderStatusEnum.OPEN) {
-				for(String studentId : sutdentIdList){
-					pushUserMap.put(Integer.parseInt(studentId), studentId);
-				}
-			}
-
-			BigDecimal totalPrice = new BigDecimal(0);
-			//相同类型的课程如果修改了课程费用,需要走审批
-			for(Entry<CourseScheduleType, BigDecimal> entry : currentCoursePrice.entrySet()){
-				totalPrice.add(entry.getValue());
-			}
-			//创建缴费明细
-			for(String studentId : sutdentIdList){
-				musicGroupPaymentCalenderDetail = new MusicGroupPaymentCalenderDetail();
-				musicGroupPaymentCalenderDetail.setMusicGroupPaymentCalenderId(musicGroupPaymentCalender.getId());
-				musicGroupPaymentCalenderDetail.setCreateTime(date);
-				musicGroupPaymentCalenderDetail.setExpectAmount(totalPrice);
-				musicGroupPaymentCalenderDetail.setPaymentStatus(PaymentStatus.NON_PAYMENT);
-				musicGroupPaymentCalenderDetail.setUpdateTime(date);
-				musicGroupPaymentCalenderDetail.setUserId(Integer.parseInt(studentId));
-				musicGroupPaymentCalenderDetail.setStartPaymentDate(musicGroupPaymentCalender.getStartPaymentDate());
-				musicGroupPaymentCalenderDetail.setDeadlinePaymentDate(musicGroupPaymentCalender.getDeadlinePaymentDate());
-				
-				musicGroupPaymentCalenderDetailList.add(musicGroupPaymentCalenderDetail);
-			}
-		}
 		//设置批次号
 		musicGroupPaymentCalender.setBatchNo(idGeneratorService.generatorId()+"");
 		musicGroupPaymentCalenderDao.insert(musicGroupPaymentCalender);
@@ -214,7 +183,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 			sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.STUDENT_PUSH_WAIT_RENEW_MESSAGE,
 					pushUserMap, null, 0, memo, "STUDENT", musicGroup.getName());
 		}
-		return true;
+		return musicGroupPaymentCalender.getId();
 	}
 
 	@Override
@@ -772,4 +741,10 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 			}
 		}
 	}
+
+	@Override
+	public MusicGroupPaymentCalender findByMusicGroupRegCalender(String musicGroupId) {
+		return musicGroupPaymentCalenderDao.findByMusicGroupRegCalender(musicGroupId);
+	}
+
 }

+ 21 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRegistrationServiceImpl.java

@@ -107,6 +107,8 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
     private GoodsDao goodsDao;
     @Autowired
     private CourseScheduleStudentPaymentDao courseScheduleStudentPaymentDao;
+    @Autowired
+    private MusicGroupPaymentCalenderDetailDao musicGroupPaymentCalenderDetailDao;
 
     @Override
     public BaseDAO<Long, StudentRegistration> getDAO() {
@@ -929,6 +931,25 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                 sellOrderService.addOrderDetail2SellOrder(orderDetails, studentPaymentOrder, musicGroup);
             }
 
+            //缴费详情 calender detail
+            MusicGroupPaymentCalender musicGroupRegCalender = musicGroupPaymentCalenderService.findByMusicGroupRegCalender(musicGroup.getId());
+            MusicGroupPaymentCalenderDetail musicGroupPaymentCalenderDetail = new MusicGroupPaymentCalenderDetail();
+            musicGroupPaymentCalenderDetail.setMusicGroupPaymentCalenderId(musicGroupRegCalender.getId());
+            musicGroupPaymentCalenderDetail.setUserId(studentPaymentOrder.getUserId());
+            musicGroupPaymentCalenderDetail.setExpectAmount(studentPaymentOrder.getExpectAmount());
+            musicGroupPaymentCalenderDetail.setActualAmount(studentPaymentOrder.getActualAmount());
+            musicGroupPaymentCalenderDetail.setPaymentStatus(MusicGroupStudentFee.PaymentStatus.PAID_COMPLETED);
+            musicGroupPaymentCalenderDetail.setUserStatus(null);
+            musicGroupPaymentCalenderDetail.setPayTime(nowDate);
+            musicGroupPaymentCalenderDetail.setDeadlinePaymentDate(musicGroupRegCalender.getDeadlinePaymentDate());
+            musicGroupPaymentCalenderDetail.setStartPaymentDate(musicGroupRegCalender.getStartPaymentDate());
+            musicGroupPaymentCalenderDetail.setOpen(1);
+            musicGroupPaymentCalenderDetail.setCreateTime(nowDate);
+            musicGroupPaymentCalenderDetail.setUpdateTime(nowDate);
+            musicGroupPaymentCalenderDetail.setPaymentOrderId(studentPaymentOrder.getId());
+            musicGroupPaymentCalenderDetail.setUseInCourse(0);
+            musicGroupPaymentCalenderDetailDao.insert(musicGroupPaymentCalenderDetail);
+
             //三方乐团不发送缴费通知
             if (musicGroup.getOwnershipType() != null && musicGroup.getOwnershipType() == CooperationOrgan.OwnershipType.OWN) {
                 //发送缴费成功通知(短信 + push)

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

@@ -120,6 +120,7 @@
 		ON mgpccs.music_group_payment_calender_id_ = mgpc.id_
 		WHERE mgpc.music_group_id_ = #{musicGroupId}
 		AND mgpc.payment_type_ = 'MUSIC_APPLY'
+		AND mgpc.pay_user_type_='STUDENT'
 	</select>
 
     <select id="getCalenderCourseSettings" resultMap="MusicGroupPaymentCalenderCourseSettings">

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

@@ -437,4 +437,7 @@
         LEFT JOIN music_group_payment_calender_course_settings mgpccs ON mgpc.id_ = mgpccs.music_group_payment_calender_id_
         WHERE mgpc.id_ = #{calenderId} LIMIT 1
     </select>
+    <select id="findByMusicGroupRegCalender" resultMap="MusicGroupPaymentCalender">
+        SELECT * FROM music_group_payment_calender WHERE music_group_id_=#{musicGroupId} AND payment_type_='MUSIC_APPLY'
+    </select>
 </mapper>

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

@@ -11,12 +11,15 @@ import com.ym.mec.biz.service.MusicGroupPaymentCalenderCourseSettingsService;
 import com.ym.mec.biz.service.MusicGroupPaymentCalenderService;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.entity.HttpResponseResult;
+
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.MediaType;
 import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.ui.ModelMap;
 import org.springframework.web.bind.annotation.*;
 
 import java.util.Arrays;
@@ -55,8 +58,10 @@ public class MusicGroupPaymentCalenderController extends BaseController {
     @PostMapping(value = "/add", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
     @PreAuthorize("@pcs.hasPermissions('musicGroupPaymentCalender/add')")
     public Object add(@RequestBody MusicGroupPaymentCalender musicGroupPaymentCalender) {
-        musicGroupPaymentCalenderService.create(musicGroupPaymentCalender);
-        return succeed();
+        Long musicGroupPaymentCalenderId = musicGroupPaymentCalenderService.create(musicGroupPaymentCalender);
+        ModelMap map = new ModelMap();
+        map.put("musicGroupPaymentCalenderId", musicGroupPaymentCalenderId);
+        return succeed(map);
     }
 
     @ApiOperation(value = "删除乐团缴费日历")