浏览代码

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

zouxuan 4 年之前
父节点
当前提交
e38861acbf

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

@@ -1,14 +1,13 @@
 package com.ym.mec.biz.service;
 
+import java.math.BigDecimal;
+import java.util.List;
+
 import com.ym.mec.biz.dal.dto.FeeStudentDto;
 import com.ym.mec.biz.dal.dto.SimpleUserDto;
 import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderDetail;
-import com.ym.mec.common.entity.HttpResponseResult;
 import com.ym.mec.common.service.BaseService;
 
-import java.math.BigDecimal;
-import java.util.List;
-
 public interface MusicGroupPaymentCalenderDetailService extends BaseService<Long, MusicGroupPaymentCalenderDetail> {
 
     /**
@@ -46,6 +45,13 @@ public interface MusicGroupPaymentCalenderDetailService extends BaseService<Long
     void add(Long musicGroupPaymentCalenderId, Integer userId);
 
     /**
+     * 乐团缴费记录新增学员
+     * @param musicGroupPaymentCalenderId
+     * @param userIdList
+     */
+    void batchAdd(Long musicGroupPaymentCalenderId, List<Integer> userIdList);
+
+    /**
      * 获取fee表学员列表
      * @param musicGroupId
      * @return

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

@@ -4,6 +4,7 @@ import static com.ym.mec.biz.dal.entity.MusicGroupStudentFee.PaymentStatus.NON_P
 import static com.ym.mec.biz.dal.entity.MusicGroupStudentFee.PaymentStatus.PAID_COMPLETED;
 
 import java.math.BigDecimal;
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -20,6 +21,7 @@ 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.MusicGroupStudentFeeDao;
@@ -29,8 +31,10 @@ import com.ym.mec.biz.dal.dto.SimpleUserDto;
 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.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;
 import com.ym.mec.biz.service.SysConfigService;
@@ -47,6 +51,10 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
 	private MusicGroupPaymentCalenderDetailDao musicGroupPaymentCalenderDetailDao;
 	@Autowired
 	private MusicGroupPaymentCalenderDao musicGroupPaymentCalenderDao;
+	
+	@Autowired
+	private MusicGroupPaymentCalenderCourseSettingsDao musicGroupPaymentCalenderCourseSettingsDao;
+	
 	@Autowired
 	private MusicGroupDao musicGroupDao;
 	@Autowired
@@ -245,6 +253,45 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
 	}
 
 	@Override
+	public void batchAdd(Long musicGroupPaymentCalenderId, List<Integer> userIdList) {
+		
+		MusicGroupPaymentCalender musicGroupPaymentCalender = musicGroupPaymentCalenderDao.get(musicGroupPaymentCalenderId);
+		if(musicGroupPaymentCalender == null){
+			throw new BizException("查询缴费信息失败");
+		}
+		
+		List<MusicGroupPaymentCalenderCourseSettings> courseSettingsList = musicGroupPaymentCalenderCourseSettingsDao.getWithPaymentCalender(musicGroupPaymentCalenderId);
+		
+		BigDecimal totalPrice = new BigDecimal(0);
+		for(MusicGroupPaymentCalenderCourseSettings courseSettings : courseSettingsList){
+			totalPrice.add(courseSettings.getCourseCurrentPrice());
+		}
+		
+		Date date = new Date();
+		MusicGroupPaymentCalenderDetail musicGroupPaymentCalenderDetail = null;
+
+		List<MusicGroupPaymentCalenderDetail> musicGroupPaymentCalenderDetailList = new ArrayList<MusicGroupPaymentCalenderDetail>();
+		//创建缴费明细
+		for(Integer studentId : userIdList){
+			musicGroupPaymentCalenderDetail = new MusicGroupPaymentCalenderDetail();
+			musicGroupPaymentCalenderDetail.setMusicGroupPaymentCalenderId(musicGroupPaymentCalenderId);
+			musicGroupPaymentCalenderDetail.setCreateTime(date);
+			musicGroupPaymentCalenderDetail.setExpectAmount(totalPrice);
+			musicGroupPaymentCalenderDetail.setPaymentStatus(PaymentStatus.NON_PAYMENT);
+			musicGroupPaymentCalenderDetail.setUpdateTime(date);
+			musicGroupPaymentCalenderDetail.setUserId(studentId);
+			musicGroupPaymentCalenderDetail.setStartPaymentDate(musicGroupPaymentCalender.getStartPaymentDate());
+			musicGroupPaymentCalenderDetail.setDeadlinePaymentDate(musicGroupPaymentCalender.getDeadlinePaymentDate());
+			
+			musicGroupPaymentCalenderDetailList.add(musicGroupPaymentCalenderDetail);
+		}
+
+		if (musicGroupPaymentCalenderDetailList.size() > 0) {
+			musicGroupPaymentCalenderDetailDao.batchInsert(musicGroupPaymentCalenderDetailList);
+		}
+	}
+
+	@Override
 	public List<FeeStudentDto> queryFeeStudents(String musicGroupId,String search,Integer subjectId) {
 		return musicGroupStudentFeeDao.queryFeeStudents(musicGroupId,search,subjectId);
 	}

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

@@ -213,7 +213,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
 
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public String createGroup(SubFeeSettingDto subFeeSettingDto){
+    public String createGroup(SubFeeSettingDto subFeeSettingDto) {
         SysUser sysUser = sysUserFeignService.queryUserInfo();
         if (sysUser == null || sysUser.getId() == null) {
             throw new BizException("获取用户信息失败");
@@ -465,7 +465,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
 
         //获取课程价格
         MusicGroupSubjectPlan musicOneSubjectClassPlan = musicGroupSubjectPlanService.getMusicOneSubjectClassPlan(studentRegistration.getMusicGroupId(), studentRegistration.getActualSubjectId());
-        BigDecimal courseFee = musicOneSubjectClassPlan.getFee();
+        BigDecimal courseFee = musicOneSubjectClassPlan.getFee() == null ? BigDecimal.ZERO : musicOneSubjectClassPlan.getFee();
         if (studentRegistration.getTemporaryCourseFee() != null) {
             courseFee = studentRegistration.getTemporaryCourseFee();
         }
@@ -680,7 +680,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
 
         //获取课程价格
         MusicGroupSubjectPlan musicOneSubjectClassPlan = musicGroupSubjectPlanService.getMusicOneSubjectClassPlan(studentRegistration.getMusicGroupId(), studentRegistration.getActualSubjectId());
-        BigDecimal courseFee = musicOneSubjectClassPlan.getFee();
+        BigDecimal courseFee = musicOneSubjectClassPlan.getFee() == null ? BigDecimal.ZERO : musicOneSubjectClassPlan.getFee();
         if (studentRegistration.getTemporaryCourseFee() != null) {
             courseFee = studentRegistration.getTemporaryCourseFee();
         }

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

@@ -119,7 +119,7 @@
 		LEFT JOIN music_group_payment_calender_course_settings mgpccs
 		ON mgpccs.music_group_payment_calender_id_ = mgpc.id_
 		WHERE mgpc.music_group_id_ = #{musicGroupId}
-		AND mgpc.payment_type_ = 1
+		AND mgpc.payment_type_ = 'MUSIC_APPLY'
 	</select>
 
     <select id="getCalenderCourseSettings" resultMap="MusicGroupPaymentCalenderCourseSettings">

+ 16 - 5
mec-web/src/main/java/com/ym/mec/web/controller/MusicGroupPaymentCalenderDetailController.java

@@ -1,11 +1,11 @@
 package com.ym.mec.web.controller;
 
-import com.ym.mec.biz.dal.page.MusicCalenderDetailQueryInfo;
-import com.ym.mec.biz.service.MusicGroupPaymentCalenderDetailService;
-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 java.math.BigDecimal;
+import java.util.List;
+
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -13,7 +13,10 @@ import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
-import java.math.BigDecimal;
+import com.ym.mec.biz.dal.page.MusicCalenderDetailQueryInfo;
+import com.ym.mec.biz.service.MusicGroupPaymentCalenderDetailService;
+import com.ym.mec.common.controller.BaseController;
+import com.ym.mec.common.entity.HttpResponseResult;
 
 @RequestMapping("musicGroupPaymentCalenderDetail")
 @Api(tags = "乐团缴费明细")
@@ -53,6 +56,14 @@ public class MusicGroupPaymentCalenderDetailController extends BaseController {
         return succeed();
     }
 
+    @ApiOperation(value = "乐团缴费记录新增学员")
+    @PostMapping("/batchAdd")
+    @PreAuthorize("@pcs.hasPermissions('musicGroupPaymentCalenderDetail/batchAdd')")
+    public Object batchAdd(Long musicGroupPaymentCalenderId,List<Integer> userIdList) {
+        musicGroupPaymentCalenderDetailService.batchAdd(musicGroupPaymentCalenderId,userIdList);
+        return succeed();
+    }
+
     @ApiOperation(value = "批量删除缴费信息")
     @PostMapping("/batchDel")
     @PreAuthorize("@pcs.hasPermissions('musicGroupPaymentCalenderDetail/batchDel')")