yonge 4 年之前
父节点
当前提交
8a60b513b2

+ 65 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/MusicGroupPaymentCalenderDto.java

@@ -0,0 +1,65 @@
+package com.ym.mec.biz.dal.dto;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender;
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderCourseSettings;
+
+public class MusicGroupPaymentCalenderDto extends MusicGroupPaymentCalender {
+
+	private String studentIds;
+
+	private List<MusicGroupPaymentCalenderCourseSettings> MusicGroupPaymentCalenderCourseSettingsList = new ArrayList<MusicGroupPaymentCalenderCourseSettings>();
+
+	private List<PaymentDateRange> paymentDateRangeList = new ArrayList<PaymentDateRange>();
+
+	public String getStudentIds() {
+		return studentIds;
+	}
+
+	public void setStudentIds(String studentIds) {
+		this.studentIds = studentIds;
+	}
+
+	public List<MusicGroupPaymentCalenderCourseSettings> getMusicGroupPaymentCalenderCourseSettingsList() {
+		return MusicGroupPaymentCalenderCourseSettingsList;
+	}
+
+	public void setMusicGroupPaymentCalenderCourseSettingsList(List<MusicGroupPaymentCalenderCourseSettings> musicGroupPaymentCalenderCourseSettingsList) {
+		MusicGroupPaymentCalenderCourseSettingsList = musicGroupPaymentCalenderCourseSettingsList;
+	}
+
+	public List<PaymentDateRange> getPaymentDateRangeList() {
+		return paymentDateRangeList;
+	}
+
+	public void setPaymentDateRangeList(List<PaymentDateRange> paymentDateRangeList) {
+		this.paymentDateRangeList = paymentDateRangeList;
+	}
+
+	public class PaymentDateRange {
+
+		private Date startDate;
+
+		private Date endDate;
+
+		public Date getStartDate() {
+			return startDate;
+		}
+
+		public void setStartDate(Date startDate) {
+			this.startDate = startDate;
+		}
+
+		public Date getEndDate() {
+			return endDate;
+		}
+
+		public void setEndDate(Date endDate) {
+			this.endDate = endDate;
+		}
+	}
+
+}

+ 0 - 22
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroupPaymentCalender.java

@@ -2,9 +2,7 @@ package com.ym.mec.biz.dal.entity;
 
 import io.swagger.annotations.ApiModelProperty;
 
-import java.util.ArrayList;
 import java.util.Date;
-import java.util.List;
 
 import org.apache.commons.lang3.builder.ToStringBuilder;
 
@@ -98,10 +96,6 @@ public class MusicGroupPaymentCalender {
 
 	private java.util.Date updateTime;
 
-	private String studentIds;
-	
-	private List<MusicGroupPaymentCalenderCourseSettings> MusicGroupPaymentCalenderCourseSettingsList = new ArrayList<MusicGroupPaymentCalenderCourseSettings>();
-
 	public Integer getPaymentType() {
 		return paymentType;
 	}
@@ -134,14 +128,6 @@ public class MusicGroupPaymentCalender {
 		this.paymentValidEndDate = paymentValidEndDate;
 	}
 
-	public String getStudentIds() {
-		return studentIds;
-	}
-
-	public void setStudentIds(String studentIds) {
-		this.studentIds = studentIds;
-	}
-
 	public void setId(Long id) {
 		this.id = id;
 	}
@@ -254,14 +240,6 @@ public class MusicGroupPaymentCalender {
 		this.payUserType = payUserType;
 	}
 
-	public List<MusicGroupPaymentCalenderCourseSettings> getMusicGroupPaymentCalenderCourseSettingsList() {
-		return MusicGroupPaymentCalenderCourseSettingsList;
-	}
-
-	public void setMusicGroupPaymentCalenderCourseSettingsList(List<MusicGroupPaymentCalenderCourseSettings> musicGroupPaymentCalenderCourseSettingsList) {
-		MusicGroupPaymentCalenderCourseSettingsList = musicGroupPaymentCalenderCourseSettingsList;
-	}
-
 	@Override
 	public String toString() {
 		return ToStringBuilder.reflectionToString(this);

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

@@ -2,6 +2,7 @@ package com.ym.mec.biz.service;
 
 import java.util.List;
 
+import com.ym.mec.biz.dal.dto.MusicGroupPaymentCalenderDto;
 import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender;
 import com.ym.mec.common.service.BaseService;
 
@@ -9,10 +10,10 @@ public interface MusicGroupPaymentCalenderService extends BaseService<Long, Musi
 
 	/**
 	 * 创建缴费信息
-	 * @param musicGroupPaymentCalenderList
+	 * @param musicGroupPaymentCalenderDto
 	 * @return
 	 */
-	boolean create(List<MusicGroupPaymentCalender> musicGroupPaymentCalenderList);
+	boolean create(MusicGroupPaymentCalenderDto musicGroupPaymentCalenderDto);
 	
 	/**
 	 * 更新缴费信息

+ 21 - 13
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderServiceImpl.java

@@ -25,6 +25,8 @@ import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderDetailDao;
 import com.ym.mec.biz.dal.dao.MusicGroupStudentFeeDao;
 import com.ym.mec.biz.dal.dao.SysConfigDao;
 import com.ym.mec.biz.dal.dto.CalenderPushDto;
+import com.ym.mec.biz.dal.dto.MusicGroupPaymentCalenderDto;
+import com.ym.mec.biz.dal.dto.MusicGroupPaymentCalenderDto.PaymentDateRange;
 import com.ym.mec.biz.dal.entity.CourseSchedule.CourseScheduleType;
 import com.ym.mec.biz.dal.entity.MusicGroup;
 import com.ym.mec.biz.dal.entity.MusicGroupOrganizationCourseSettingsDetail;
@@ -77,12 +79,9 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 
 	@Override
 	@Transactional(rollbackFor = Exception.class)
-	public boolean create(List<MusicGroupPaymentCalender> musicGroupPaymentCalenderList) {
-		if(musicGroupPaymentCalenderList == null || musicGroupPaymentCalenderList.size() == 0){
-			throw new BizException("请重新创建缴费记录");
-		}
+	public boolean create(MusicGroupPaymentCalenderDto musicGroupPaymentCalenderDto) {
 		
-		String musicGroupId = musicGroupPaymentCalenderList.get(0).getMusicGroupId();
+		String musicGroupId = musicGroupPaymentCalenderDto.getMusicGroupId();
 
 		MusicGroup musicGroup = musicGroupDao.getLocked(musicGroupId);
 		
@@ -92,12 +91,18 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 
 		Date date = new Date();
 		Map<Integer, String> pushUserMap = new HashMap<Integer, String>();
+		MusicGroupPaymentCalender musicGroupPaymentCalender = null;
 		MusicGroupPaymentCalenderDetail musicGroupPaymentCalenderDetail = null;
+		List<MusicGroupPaymentCalender> musicGroupPaymentCalenderList = new ArrayList<MusicGroupPaymentCalender>();
 		List<MusicGroupPaymentCalenderDetail> musicGroupPaymentCalenderDetailList = new ArrayList<MusicGroupPaymentCalenderDetail>();
-
-		for(MusicGroupPaymentCalender musicGroupPaymentCalender : musicGroupPaymentCalenderList){
+		
+		for(PaymentDateRange paymentDateRange : musicGroupPaymentCalenderDto.getPaymentDateRangeList()){
+			musicGroupPaymentCalender = musicGroupPaymentCalenderDto;
 			musicGroupPaymentCalender.setCreateTime(date);
 			musicGroupPaymentCalender.setUpdateTime(date);
+			musicGroupPaymentCalender.setPaymentValidStartDate(paymentDateRange.getStartDate());
+			musicGroupPaymentCalender.setPaymentValidEndDate(paymentDateRange.getEndDate());
+			
 			if (musicGroupPaymentCalender.getDeadlinePaymentDate() == null) {
 				musicGroupPaymentCalender.setDeadlinePaymentDate(DateUtil.addDays(musicGroupPaymentCalender.getStartPaymentDate(), 3));
 			}
@@ -112,7 +117,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 			Map<CourseScheduleType, BigDecimal> defaultCoursePrice = musicGroupOrganizationCourseSettingsDetailDao.queryByMusicGroupOrganizationCourseSettingsId(musicGroupOrganizationCourseSettingId).stream().collect(Collectors.toMap(MusicGroupOrganizationCourseSettingsDetail :: getCourseType, MusicGroupOrganizationCourseSettingsDetail :: getCourseCurrentPrice));
 			
 			//当前缴费的课程费用
-			Map<CourseScheduleType,BigDecimal> currentCoursePrice = musicGroupPaymentCalender.getMusicGroupPaymentCalenderCourseSettingsList().stream().collect(Collectors.toMap(MusicGroupPaymentCalenderCourseSettings :: getCourseType, MusicGroupPaymentCalenderCourseSettings :: getCourseCurrentPrice));
+			Map<CourseScheduleType,BigDecimal> currentCoursePrice = musicGroupPaymentCalenderDto.getMusicGroupPaymentCalenderCourseSettingsList().stream().collect(Collectors.toMap(MusicGroupPaymentCalenderCourseSettings :: getCourseType, MusicGroupPaymentCalenderCourseSettings :: getCourseCurrentPrice));
 			
 			BigDecimal totalPrice = new BigDecimal(0);
 			//相同类型的课程如果修改了课程费用,需要走审批
@@ -141,8 +146,8 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 			}
 
 			musicGroupPaymentCalender.setExpectNum(0);
-			if(StringUtils.isNoneBlank(musicGroupPaymentCalender.getStudentIds())){
-				String[] sutdentIdList = musicGroupPaymentCalender.getStudentIds().split(",");
+			if(StringUtils.isNoneBlank(musicGroupPaymentCalenderDto.getStudentIds())){
+				String[] sutdentIdList = musicGroupPaymentCalenderDto.getStudentIds().split(",");
 				musicGroupPaymentCalender.setExpectNum(sutdentIdList.length);
 				
 				if (musicGroupPaymentCalender.getStatus() == PaymentCalenderStatusEnum.OPEN) {
@@ -164,6 +169,8 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 					musicGroupPaymentCalenderDetailList.add(musicGroupPaymentCalenderDetail);
 				}
 			}
+			
+			musicGroupPaymentCalenderList.add(musicGroupPaymentCalender);
 		}
 
 		if (musicGroupPaymentCalenderDetailList.size() > 0) {
@@ -214,7 +221,8 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 		Map<CourseScheduleType, BigDecimal> defaultCoursePrice = musicGroupOrganizationCourseSettingsDetailDao.queryByMusicGroupOrganizationCourseSettingsId(musicGroupOrganizationCourseSettingId).stream().collect(Collectors.toMap(MusicGroupOrganizationCourseSettingsDetail :: getCourseType, MusicGroupOrganizationCourseSettingsDetail :: getCourseCurrentPrice));
 		
 		//当前缴费的课程费用
-		Map<CourseScheduleType,BigDecimal> currentCoursePrice = musicGroupPaymentCalender.getMusicGroupPaymentCalenderCourseSettingsList().stream().collect(Collectors.toMap(MusicGroupPaymentCalenderCourseSettings :: getCourseType, MusicGroupPaymentCalenderCourseSettings :: getCourseCurrentPrice));
+		Map<CourseScheduleType,BigDecimal> currentCoursePrice = null;
+				//musicGroupPaymentCalender.getMusicGroupPaymentCalenderCourseSettingsList().stream().collect(Collectors.toMap(MusicGroupPaymentCalenderCourseSettings :: getCourseType, MusicGroupPaymentCalenderCourseSettings :: getCourseCurrentPrice));
 		
 		BigDecimal totalPrice = new BigDecimal(0);
 		//相同类型的课程如果修改了课程费用,需要走审批
@@ -245,7 +253,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 		Map<Integer, String> pushUserMap = new HashMap<Integer, String>();
 
 		musicGroupPaymentCalender.setExpectNum(0);
-		if(StringUtils.isNoneBlank(musicGroupPaymentCalender.getStudentIds())){
+		/*if(StringUtils.isNoneBlank(musicGroupPaymentCalender.getStudentIds())){
 			String[] sutdentIdList = musicGroupPaymentCalender.getStudentIds().split(",");
 			musicGroupPaymentCalender.setExpectNum(sutdentIdList.length);
 			
@@ -271,7 +279,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 				
 				musicGroupPaymentCalenderDetailList.add(musicGroupPaymentCalenderDetail);
 			}
-		}
+		}*/
 		
 		musicGroupPaymentCalenderDao.update(musicGroupPaymentCalender);
 

+ 3 - 4
mec-web/src/main/java/com/ym/mec/web/controller/MusicGroupPaymentCalenderController.java

@@ -1,7 +1,5 @@
 package com.ym.mec.web.controller;
 
-import java.util.List;
-
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 
@@ -14,6 +12,7 @@ import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import com.ym.mec.biz.dal.dto.MusicGroupPaymentCalenderDto;
 import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender;
 import com.ym.mec.biz.dal.page.MusicGroupPaymentCalenderQueryInfo;
 import com.ym.mec.biz.service.MusicGroupPaymentCalenderService;
@@ -37,8 +36,8 @@ public class MusicGroupPaymentCalenderController extends BaseController {
     @ApiOperation(value = "新增乐团缴费日历")
     @PostMapping(value = "/add", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
     @PreAuthorize("@pcs.hasPermissions('musicGroupPaymentCalender/add')")
-    public Object add(@RequestBody List<MusicGroupPaymentCalender> musicGroupPaymentCalenderList) {
-        musicGroupPaymentCalenderService.create(musicGroupPaymentCalenderList);
+    public Object add(@RequestBody MusicGroupPaymentCalenderDto musicGroupPaymentCalenderDto) {
+        musicGroupPaymentCalenderService.create(musicGroupPaymentCalenderDto);
         return succeed();
     }