Browse Source

Merge remote-tracking branch 'origin/master_saas' into master_saas

zouxuan 3 years ago
parent
commit
b26455497f

+ 12 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/MusicGroupCalenderRefundPeriodDao.java

@@ -0,0 +1,12 @@
+package com.ym.mec.biz.dal.dao;
+
+import com.ym.mec.biz.dal.entity.MusicGroupCalenderRefundPeriod;
+import com.ym.mec.common.dal.BaseDAO;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+public interface MusicGroupCalenderRefundPeriodDao extends BaseDAO<Integer, MusicGroupCalenderRefundPeriod> {
+
+    void batchInsert(@Param("refundPeriods") List<MusicGroupCalenderRefundPeriod> refundPeriods);
+}

+ 56 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/MusicGroupPaymentBaseCalender.java

@@ -5,6 +5,7 @@ import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PayUserType;
 import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentType;
 import io.swagger.annotations.ApiModelProperty;
 
+import java.math.BigDecimal;
 import java.util.Date;
 import java.util.List;
 
@@ -57,6 +58,53 @@ public class MusicGroupPaymentBaseCalender {
 	@ApiModelProperty(value = "缴费项目显示状态", required = false)
 	private String paymentItemShowState;
 	
+	@ApiModelProperty(value = "是否显示销售价", required = false)
+	private Boolean isShowSalePrice;
+
+	@ApiModelProperty(value = "学校缴费计价json", required = false)
+	private String calenderFeeJson;
+
+	@ApiModelProperty(value = "学校缴费计价标准,STUDENT、TEACHER", required = false)
+	private String calenderFeeType;
+
+	@ApiModelProperty(value = "学校缴费回款周期", required = false)
+	private List<MusicGroupCalenderRefundPeriod> musicGroupCalenderRefundPeriods;
+
+	@ApiModelProperty(value = "学校缴费折扣价", required = false)
+	private BigDecimal currentTotalAmount;
+
+	public BigDecimal getCurrentTotalAmount() {
+		return currentTotalAmount;
+	}
+
+	public void setCurrentTotalAmount(BigDecimal currentTotalAmount) {
+		this.currentTotalAmount = currentTotalAmount;
+	}
+
+	public List<MusicGroupCalenderRefundPeriod> getMusicGroupCalenderRefundPeriods() {
+		return musicGroupCalenderRefundPeriods;
+	}
+
+	public void setMusicGroupCalenderRefundPeriods(List<MusicGroupCalenderRefundPeriod> musicGroupCalenderRefundPeriods) {
+		this.musicGroupCalenderRefundPeriods = musicGroupCalenderRefundPeriods;
+	}
+
+	public String getCalenderFeeJson() {
+		return calenderFeeJson;
+	}
+
+	public void setCalenderFeeJson(String calenderFeeJson) {
+		this.calenderFeeJson = calenderFeeJson;
+	}
+
+	public String getCalenderFeeType() {
+		return calenderFeeType;
+	}
+
+	public void setCalenderFeeType(String calenderFeeType) {
+		this.calenderFeeType = calenderFeeType;
+	}
+
 	public Boolean getConfirmCreate() {
 		return confirmCreate;
 	}
@@ -193,4 +241,12 @@ public class MusicGroupPaymentBaseCalender {
 		this.paymentItemShowState = paymentItemShowState;
 	}
 
+	public Boolean getIsShowSalePrice() {
+		return isShowSalePrice;
+	}
+
+	public void setIsShowSalePrice(Boolean isShowSalePrice) {
+		this.isShowSalePrice = isShowSalePrice;
+	}
+
 }

+ 114 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroupCalenderRefundPeriod.java

@@ -0,0 +1,114 @@
+package com.ym.mec.biz.dal.entity;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+/**
+ * 对应数据库表(music_group_calender_refund_period):
+ */
+public class MusicGroupCalenderRefundPeriod {
+
+	/**  */
+	private Integer id;
+	
+	/** 分部 */
+	private Integer organId;
+	
+	/** 合作单位编号 */
+	private Integer cooperationOrganId;
+	
+	/** 缴费项目编号 */
+	private Long calenderId;
+	
+	/** 回款时间 */
+	private java.util.Date refundDate;
+	
+	/** 回款金额 */
+	private java.math.BigDecimal refundAmount;
+	
+	/** 剩余待回款金额 */
+	private java.math.BigDecimal subRefundAmount;
+	
+	/**  */
+	private java.util.Date createTime;
+	
+	/**  */
+	private java.util.Date updateTime;
+	
+	public void setId(Integer id){
+		this.id = id;
+	}
+	
+	public Integer getId(){
+		return this.id;
+	}
+			
+	public void setOrganId(Integer organId){
+		this.organId = organId;
+	}
+	
+	public Integer getOrganId(){
+		return this.organId;
+	}
+			
+	public void setCooperationOrganId(Integer cooperationOrganId){
+		this.cooperationOrganId = cooperationOrganId;
+	}
+	
+	public Integer getCooperationOrganId(){
+		return this.cooperationOrganId;
+	}
+			
+	public void setCalenderId(Long calenderId){
+		this.calenderId = calenderId;
+	}
+	
+	public Long getCalenderId(){
+		return this.calenderId;
+	}
+			
+	public void setRefundDate(java.util.Date refundDate){
+		this.refundDate = refundDate;
+	}
+	
+	public java.util.Date getRefundDate(){
+		return this.refundDate;
+	}
+			
+	public void setRefundAmount(java.math.BigDecimal refundAmount){
+		this.refundAmount = refundAmount;
+	}
+	
+	public java.math.BigDecimal getRefundAmount(){
+		return this.refundAmount;
+	}
+			
+	public void setSubRefundAmount(java.math.BigDecimal subRefundAmount){
+		this.subRefundAmount = subRefundAmount;
+	}
+	
+	public java.math.BigDecimal getSubRefundAmount(){
+		return this.subRefundAmount;
+	}
+			
+	public void setCreateTime(java.util.Date createTime){
+		this.createTime = createTime;
+	}
+	
+	public java.util.Date getCreateTime(){
+		return this.createTime;
+	}
+			
+	public void setUpdateTime(java.util.Date updateTime){
+		this.updateTime = updateTime;
+	}
+	
+	public java.util.Date getUpdateTime(){
+		return this.updateTime;
+	}
+			
+	@Override
+	public String toString() {
+		return ToStringBuilder.reflectionToString(this);
+	}
+
+}

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

@@ -205,6 +205,31 @@ public class MusicGroupPaymentCalender extends BaseEntity {
 	
 	@ApiModelProperty(value = "缴费项目显示状态", required = false)
 	private String paymentItemShowState;
+	
+	@ApiModelProperty(value = "是否显示销售价", required = false)
+	private Boolean isShowSalePrice;
+
+	@ApiModelProperty(value = "学校缴费计价json", required = false)
+	private String calenderFeeJson;
+
+	@ApiModelProperty(value = "学校缴费计价标准,STUDENT、TEACHER", required = false)
+	private String calenderFeeType;
+
+	public String getCalenderFeeJson() {
+		return calenderFeeJson;
+	}
+
+	public void setCalenderFeeJson(String calenderFeeJson) {
+		this.calenderFeeJson = calenderFeeJson;
+	}
+
+	public String getCalenderFeeType() {
+		return calenderFeeType;
+	}
+
+	public void setCalenderFeeType(String calenderFeeType) {
+		this.calenderFeeType = calenderFeeType;
+	}
 
 	public Boolean getCloudTeacherPaymentFlag() {
 		return cloudTeacherPaymentFlag;
@@ -502,6 +527,14 @@ public class MusicGroupPaymentCalender extends BaseEntity {
 		this.paymentItemShowState = paymentItemShowState;
 	}
 
+	public Boolean getIsShowSalePrice() {
+		return isShowSalePrice;
+	}
+
+	public void setIsShowSalePrice(Boolean isShowSalePrice) {
+		this.isShowSalePrice = isShowSalePrice;
+	}
+
 	@Override
 	public String toString() {
 		return ToStringBuilder.reflectionToString(this);

+ 10 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/MusicGroupCalenderRefundPeriodService.java

@@ -0,0 +1,10 @@
+package com.ym.mec.biz.service;
+
+import com.ym.mec.biz.dal.dto.MusicGroupPaymentBaseCalender;
+import com.ym.mec.biz.dal.entity.MusicGroupCalenderRefundPeriod;
+import com.ym.mec.common.service.BaseService;
+
+public interface MusicGroupCalenderRefundPeriodService extends BaseService<Integer, MusicGroupCalenderRefundPeriod> {
+
+    void savePeriod(MusicGroupPaymentBaseCalender musicGroupPaymentBaseCalender);
+}

+ 57 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupCalenderRefundPeriodServiceImpl.java

@@ -0,0 +1,57 @@
+package com.ym.mec.biz.service.impl;
+
+import com.ym.mec.biz.dal.dao.MusicGroupCalenderRefundPeriodDao;
+import com.ym.mec.biz.dal.dao.MusicGroupDao;
+import com.ym.mec.biz.dal.dto.MusicGroupPaymentBaseCalender;
+import com.ym.mec.biz.dal.entity.MusicGroup;
+import com.ym.mec.biz.dal.entity.MusicGroupCalenderRefundPeriod;
+import com.ym.mec.biz.service.MusicGroupCalenderRefundPeriodService;
+import com.ym.mec.common.dal.BaseDAO;
+import com.ym.mec.common.exception.BizException;
+import com.ym.mec.common.service.impl.BaseServiceImpl;
+import org.apache.commons.collections.CollectionUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.Date;
+import java.util.List;
+
+import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PayUserType.SCHOOL;
+
+@Service
+public class MusicGroupCalenderRefundPeriodServiceImpl extends BaseServiceImpl<Integer, MusicGroupCalenderRefundPeriod>  implements MusicGroupCalenderRefundPeriodService {
+
+    @Autowired
+    private MusicGroupCalenderRefundPeriodDao musicGroupCalenderRefundPeriodDao;
+    @Autowired
+    private MusicGroupDao musicGroupDao;
+
+    @Override
+    public BaseDAO<Integer, MusicGroupCalenderRefundPeriod> getDAO() {
+        return musicGroupCalenderRefundPeriodDao;
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void savePeriod(MusicGroupPaymentBaseCalender baseCalender) {
+        if(baseCalender.getPayUserType() != SCHOOL){
+            return;
+        }
+        List<MusicGroupCalenderRefundPeriod> refundPeriods = baseCalender.getMusicGroupCalenderRefundPeriods();
+        if(CollectionUtils.isEmpty(refundPeriods)){
+            throw new BizException("请录入回款周期");
+        }
+        MusicGroup musicGroup = musicGroupDao.get(baseCalender.getMusicGroupId());
+        Date date = new Date();
+        refundPeriods.forEach(e-> {
+            e.setCalenderId(baseCalender.getCalenderId());
+            e.setSubRefundAmount(e.getRefundAmount());
+            e.setOrganId(musicGroup.getOrganId());
+            e.setCooperationOrganId(musicGroup.getCooperationOrganId());
+            e.setCreateTime(date);
+            e.setUpdateTime(date);
+        });
+        musicGroupCalenderRefundPeriodDao.batchInsert(refundPeriods);
+    }
+}

+ 51 - 55
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderServiceImpl.java

@@ -29,6 +29,7 @@ import com.ym.mec.util.collection.MapUtil;
 import com.ym.mec.util.date.DateUtil;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpStatus;
 import org.springframework.stereotype.Service;
@@ -121,6 +122,8 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
     private VipGroupActivityDao vipGroupActivityDao;
     @Autowired
     private OperatingReportCloudService operatingReportCloudService;
+    @Autowired
+    private MusicGroupCalenderRefundPeriodService musicGroupCalenderRefundPeriodService;
 
     @Override
     public BaseDAO<Long, MusicGroupPaymentCalender> getDAO() {
@@ -238,15 +241,15 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
             throw new BizException("请登录");
         });
 
-        if (musicGroup.getStatus() != MusicGroupStatusEnum.PROGRESS && musicGroup.getStatus() != MusicGroupStatusEnum.PRE_BUILD_FEE) {
-            throw new BizException("创建缴费失败:已存在缴费项目");
+        if (musicGroup.getStatus() != MusicGroupStatusEnum.DRAFT) {
+            throw new BizException("只有‘草稿’状态才能创建报名缴费");
         }
         // 所有缴费项目已完成排课才能创建下一个缴费项目
-        String orignBatchNo = musicGroupPaymentStudentCourseDetailDao.getUnUseBatchNoWithStudentAndCourseTypeAndCourseMinutes(musicGroupId, null, null, null);
+        /*String orignBatchNo = musicGroupPaymentStudentCourseDetailDao.getUnUseBatchNoWithStudentAndCourseTypeAndCourseMinutes(musicGroupId, null, null, null);
         if (!musicGroupPaymentBaseCalender.getConfirmCreate() && StringUtils.isNoneBlank(orignBatchNo)) {
             TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
-            return BaseController.failed(HttpStatus.MULTI_STATUS,"当前乐团存在未排课的缴费项目,请再次确认操作");
-        }
+            return BaseController.failed(HttpStatus.MULTI_STATUS, "当前乐团存在未排课的缴费项目,请再次确认操作");
+        }*/
 
         // 不是进行中,只能创建一次缴费
         if (musicGroup.getStatus() != MusicGroupStatusEnum.PROGRESS) {
@@ -258,8 +261,9 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
         //进行中加学员拓展信息
         CalenderAddStudent calenderAddStudent = musicGroupPaymentBaseCalender.getCalenderAddStudent();
         MusicGroupPaymentCalender musicGroupPaymentCalender = new MusicGroupPaymentCalender();
+        BeanUtils.copyProperties(musicGroupPaymentBaseCalender,musicGroupPaymentCalender);
         //判断缴费项目类型
-        if (musicGroup.getStatus() == MusicGroupStatusEnum.PRE_BUILD_FEE) {
+        if (musicGroup.getStatus() == MusicGroupStatusEnum.DRAFT) {
             musicGroupPaymentBaseCalender.setPaymentType(MUSIC_APPLY);
         } else {
             if (calenderAddStudent != null && calenderAddStudent.getStudentIds() != null) {
@@ -289,19 +293,24 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
         BigDecimal originalTotalAmount = courseOriginalAmount.add(memberOriginalAmount)
                 .add(activityOriginalAmount)
                 .add(repairOriginalAmount).setScale(0, BigDecimal.ROUND_HALF_UP);
+        BigDecimal actualTotalAmount;
 
-        //计算缴费项目总金额(前端录入)
-        BigDecimal courseActualAmount = musicGroupPaymentCalenderCourseSettingsService.getActualAmount(musicGroupPaymentBaseCalender);
-        BigDecimal memberActualAmount = musicGroupPaymentCalenderMemberService.getActualAmount(musicGroupPaymentBaseCalender);
-        BigDecimal repairActualAmount = musicGroupPaymentCalenderRepairService.getActualAmount(musicGroupPaymentBaseCalender);
-        BigDecimal activityActualAmount = musicGroupPaymentCalenderActivityService.getActualAmount(musicGroupPaymentBaseCalender);
+        if(musicGroupPaymentBaseCalender.getPayUserType() == SCHOOL){
+            actualTotalAmount = musicGroupPaymentBaseCalender.getCurrentTotalAmount();
+        }else {
+            //计算缴费项目总金额(前端录入)
+            BigDecimal courseActualAmount = musicGroupPaymentCalenderCourseSettingsService.getActualAmount(musicGroupPaymentBaseCalender);
+            BigDecimal memberActualAmount = musicGroupPaymentCalenderMemberService.getActualAmount(musicGroupPaymentBaseCalender);
+            BigDecimal repairActualAmount = musicGroupPaymentCalenderRepairService.getActualAmount(musicGroupPaymentBaseCalender);
+            BigDecimal activityActualAmount = musicGroupPaymentCalenderActivityService.getActualAmount(musicGroupPaymentBaseCalender);
 
-        BigDecimal actualTotalAmount = courseActualAmount.add(memberActualAmount)
-                .add(repairActualAmount)
-                .add(activityActualAmount).setScale(0, BigDecimal.ROUND_HALF_UP);
+            actualTotalAmount = courseActualAmount.add(memberActualAmount)
+                    .add(repairActualAmount)
+                    .add(activityActualAmount).setScale(0, BigDecimal.ROUND_HALF_UP);
+        }
 
         PaymentCalenderStatusEnum status;
-        if (musicGroupPaymentBaseCalender.getPayUserType() == SCHOOL) {
+        if (musicGroupPaymentBaseCalender.getPaymentType() == MUSIC_APPLY || musicGroupPaymentBaseCalender.getPayUserType() == SCHOOL) {
             status = AUDITING;
         } else {
             //计算项目原现价
@@ -321,24 +330,16 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
                 status = actualTotalAmount.compareTo(currentTotalAmount) == 0 ? NO : AUDITING;
             }
         }
-
         Date date = new Date();
 
-        musicGroupPaymentCalender.setDeadlinePaymentDate(musicGroupPaymentBaseCalender.getDeadlinePaymentDate());
-        musicGroupPaymentCalender.setMemo(musicGroupPaymentBaseCalender.getMemo());
         musicGroupPaymentCalender.setMusicGroupId(musicGroupId);
-        musicGroupPaymentCalender.setMusicGroupOrganizationCourseSettingId(musicGroupPaymentBaseCalender.getMusicGroupOrganizationCourseSettingId());
-        musicGroupPaymentCalender.setPayUserType(musicGroupPaymentBaseCalender.getPayUserType());
-        musicGroupPaymentCalender.setStartPaymentDate(musicGroupPaymentBaseCalender.getStartPaymentDate());
         musicGroupPaymentCalender.setOperator(sysUser.getId());
         musicGroupPaymentCalender.setCreateTime(date);
         musicGroupPaymentCalender.setUpdateTime(date);
-        musicGroupPaymentCalender.setPaymentType(musicGroupPaymentBaseCalender.getPaymentType());
         musicGroupPaymentCalender.setCurrentTotalAmount(actualTotalAmount);
         musicGroupPaymentCalender.setOriginalTotalAmount(originalTotalAmount);
         musicGroupPaymentCalender.setStatus(status);
         musicGroupPaymentCalender.setOrganId(musicGroup.getOrganId());
-        musicGroupPaymentCalender.setPaymentItemShowState(musicGroupPaymentBaseCalender.getPaymentItemShowState());
 
         if (musicGroupPaymentCalender.getStatus() != AUDITING) {
             if (date.after(musicGroupPaymentCalender.getStartPaymentDate())) {
@@ -349,7 +350,6 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
                 musicGroupPaymentCalender.setStatus(PaymentCalenderStatusEnum.NO);
             }
         }
-
         // 设置批次号
         String batchNo = idGeneratorService.generatorId() + "";
         musicGroupPaymentCalender.setBatchNo(batchNo);
@@ -357,13 +357,16 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
         if(musicGroupPaymentCalender.getPayUserType() == STUDENT && musicGroup.getCourseViewType() == CourseViewTypeEnum.MEMBER_FEE){
             if(musicGroupPaymentCalender.getPaymentType() == ADD_STUDENT){
                 musicGroupPaymentCalender.setCloudTeacherPaymentFlag(true);
-            }else if(memberActualAmount.compareTo(BigDecimal.ZERO) > 0 &&
+            }/*else if(memberActualAmount.compareTo(BigDecimal.ZERO) > 0 &&
                     ((courseActualAmount.compareTo(BigDecimal.ZERO) == 0 && CollectionUtils.isNotEmpty(musicGroupPaymentBaseCalender.getMusicGroupPaymentCalenderCourseSettingsList()))
                             || (activityActualAmount.compareTo(BigDecimal.ZERO) == 0 && CollectionUtils.isNotEmpty(musicGroupPaymentBaseCalender.getCalenderActivityList())))) {
                 musicGroupPaymentCalender.setCloudTeacherPaymentFlag(true);
-            }
+            }*/
         }
         musicGroupPaymentCalenderDao.insert(musicGroupPaymentCalender);
+        musicGroupPaymentBaseCalender.setCalenderId(musicGroupPaymentCalender.getId());
+        //如果是学校缴费,需要保存还款周期
+        musicGroupCalenderRefundPeriodService.savePeriod(musicGroupPaymentBaseCalender);
 
         operatingReportCloudService.save(musicGroupPaymentCalender);
         Long calenderId = musicGroupPaymentCalender.getId();
@@ -403,38 +406,31 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 
         // 如果是报名,需要修改乐团状态
         if (musicGroupPaymentBaseCalender.getPaymentType() == MUSIC_APPLY) {
-            if (status != AUDITING) {
-                musicGroup.setStatus(MusicGroupStatusEnum.APPLY);
-                // 记录操作日志
-                musicGroupBuildLogDao.insert(new MusicGroupBuildLog(musicGroupId, "报名缴费项目创建成功(创建缴费中 -> 报名中)", sysUser.getId(), ""));
-            } else {
-                musicGroup.setStatus(MusicGroupStatusEnum.FEE_AUDIT);
-                // 记录操作日志
-                musicGroupBuildLogDao.insert(new MusicGroupBuildLog(musicGroupId, "报名缴费项目创建成功(创建缴费 -> 费用审核中)", sysUser.getId(), ""));
-            }
+        	// 记录操作日志
+            musicGroupBuildLogDao.insert(new MusicGroupBuildLog(musicGroupId, "报名缴费项目创建成功", sysUser.getId(), ""));
+            
             musicGroup.setUpdateTime(date);
             musicGroupDao.update(musicGroup);
         }
-        if (status == AUDITING) {
-            // 如果是审核中
-            Organization organization = organizationDao.get(musicGroup.getOrganId());
-            sendSeoMessageSource.sendSeoMessage(musicGroup.getOrganId(), new SysUserRoleEnum[]{ORGAN_MANAGER},
-                    null, null, MessageTypeEnum.BACKSTAGE_PAYMENT_CALENDER_AUDIT, organization.getName(), musicGroup.getName());
-        } else {
-            if (musicGroupPaymentCalender.getPaymentType() == PaymentType.ADD_STUDENT) {
-                addStudent(musicGroupPaymentCalender, musicGroup);
-                //将0元未缴费学员缴费状态更新为已缴费
-                this.updateNoPaymentAndZeroPaymentStatus(musicGroupPaymentCalender, true);
-                // 学生加到班级
-                classGroupService.addStudentToClassGroupAndCourseArranging(calenderAddStudent.getStudentIds(), calenderAddStudent.getClassGroupIds(),
-                        batchNo, musicGroupPaymentBaseCalender.getMusicGroupPaymentCalenderCourseSettingsList(), musicGroup);
-                ExecutorService executor = Executors.newFixedThreadPool(5);
-                CompletableFuture.runAsync(() -> {
-                    imUserFriendService.refreshGroupImUserFriend(musicGroupId, GroupType.MUSIC);
-                }, executor);
-                executor.shutdown();
-            }
-        }
+        
+        Organization organization = organizationDao.get(musicGroup.getOrganId());
+        sendSeoMessageSource.sendSeoMessage(musicGroup.getOrganId(), new SysUserRoleEnum[]{ORGAN_MANAGER},
+                null, null, MessageTypeEnum.BACKSTAGE_PAYMENT_CALENDER_AUDIT, organization.getName(), musicGroup.getName());
+        
+        if (musicGroupPaymentCalender.getPaymentType() == PaymentType.ADD_STUDENT) {
+            addStudent(musicGroupPaymentCalender, musicGroup);
+            //将0元未缴费学员缴费状态更新为已缴费
+            this.updateNoPaymentAndZeroPaymentStatus(musicGroupPaymentCalender, true);
+            // 学生加到班级
+            classGroupService.addStudentToClassGroupAndCourseArranging(calenderAddStudent.getStudentIds(), calenderAddStudent.getClassGroupIds(),
+                    batchNo, musicGroupPaymentBaseCalender.getMusicGroupPaymentCalenderCourseSettingsList(), musicGroup);
+            ExecutorService executor = Executors.newFixedThreadPool(5);
+            CompletableFuture.runAsync(() -> {
+                imUserFriendService.refreshGroupImUserFriend(musicGroupId, GroupType.MUSIC);
+            }, executor);
+            executor.shutdown();
+        }
+        
         ModelMap map = new ModelMap(1);
         map.put("musicGroupPaymentCalenderBatchNo", batchNo);
         return BaseController.succeed(map);

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

@@ -1,6 +1,7 @@
 package com.ym.mec.biz.service.impl;
 
 import static com.ym.mec.biz.dal.entity.ApprovalStatus.PROCESSING;
+import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PayUserType.SCHOOL;
 import static com.ym.mec.biz.dal.entity.MusicGroupStudentFee.PaymentStatus.PAID_COMPLETED;
 import static com.ym.mec.biz.dal.enums.DealStatusEnum.ING;
 import static com.ym.mec.biz.dal.enums.DealStatusEnum.SUCCESS;
@@ -806,7 +807,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
                 }
             }
         }
-        musicGroup.setStatus(MusicGroupStatusEnum.PRE_BUILD_FEE);
+        musicGroup.setStatus(MusicGroupStatusEnum.APPLY);
         musicGroup.setUpdateTime(new Date());
         musicGroupDao.update(musicGroup);
 
@@ -816,7 +817,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         }
 
         //记录操作日志
-        musicGroupBuildLogDao.insert(new MusicGroupBuildLog(musicGroup.getId(), "报名缴费项目失败(预报名 -> 准备创建缴费)", sysUser.getId(), ""));
+        musicGroupBuildLogDao.insert(new MusicGroupBuildLog(musicGroup.getId(), "预报名完成(预报名 -> 报名中)", sysUser.getId(), ""));
 
         return true;
     }
@@ -1546,11 +1547,27 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         if (sysUser == null) {
             throw new BizException("用户信息获取失败");
         }
+        Date date = new Date();
+        
         MusicGroup musicGroup = saveLog(musicGroupId, MusicGroupStatusEnum.DRAFT);
         //记录操作日志
         musicGroupBuildLogDao.insert(new MusicGroupBuildLog(musicGroupId, "提交审核(草稿 -> 审核中)", sysUser.getId(), ""));
         musicGroup.setStatus(MusicGroupStatusEnum.AUDIT);
+        musicGroup.setUpdateTime(date);
         musicGroupDao.update(musicGroup);
+        
+        List<PaymentCalenderStatusEnum> statusList = new ArrayList<MusicGroupPaymentCalender.PaymentCalenderStatusEnum>();
+        statusList.add(PaymentCalenderStatusEnum.DRAFT);
+        //修改乐团报名缴费项目状态
+        List<MusicGroupPaymentCalender> musicGroupPaymentCalenderList = musicGroupPaymentCalenderDao.queryByPaymentStatus(musicGroupId, statusList, null);
+        
+        musicGroupPaymentCalenderList.forEach(t -> {
+        	t.setStatus(PaymentCalenderStatusEnum.AUDITING);
+        	t.setUpdateTime(date);
+        });
+        
+        musicGroupPaymentCalenderDao.batchUpdate(musicGroupPaymentCalenderList);
+        
         sendSeoMessageSource.sendSeoMessage(musicGroup.getOrganId(), new SysUserRoleEnum[]{ORGAN_MANAGER},
                 null, null, MessageTypeEnum.BACKSTAGE_CREATE_MUSIC_GROUP_APPLY, sysUser.getRealName(), musicGroup.getName());
     }
@@ -1562,20 +1579,28 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         if (sysUser == null) {
             throw new BizException("用户信息获取失败");
         }
+        Date date = new Date();
+        
         MusicGroup musicGroup = saveLog(musicGroupId, MusicGroupStatusEnum.AUDIT);
         //记录操作日志
         musicGroupBuildLogDao.insert(new MusicGroupBuildLog(musicGroupId, "乐团审核失败(审核中 -> 审核失败)", sysUser.getId(), memo));
         musicGroup.setMemo(memo);
         musicGroup.setStatus(MusicGroupStatusEnum.AUDIT_FAILED);
+        musicGroup.setUpdateTime(date);
         musicGroupDao.update(musicGroup);
-        //修改缴费项目状态
-        List<MusicGroupPaymentCalender> musicGroupPaymentCalenders = musicGroupPaymentCalenderDao.findByMusicGroupId(musicGroupId);
-        if (musicGroupPaymentCalenders != null && musicGroupPaymentCalenders.size() > 0) {
-            musicGroupPaymentCalenders.forEach(e -> {
-                e.setStatus(MusicGroupPaymentCalender.PaymentCalenderStatusEnum.REJECT);
-            });
-            musicGroupPaymentCalenderDao.batchUpdate(musicGroupPaymentCalenders);
-        }
+        
+        List<PaymentCalenderStatusEnum> statusList = new ArrayList<MusicGroupPaymentCalender.PaymentCalenderStatusEnum>();
+        statusList.add(PaymentCalenderStatusEnum.AUDITING);
+        //修改乐团报名缴费项目状态
+        List<MusicGroupPaymentCalender> musicGroupPaymentCalenderList = musicGroupPaymentCalenderDao.queryByPaymentStatus(musicGroupId, statusList, null);
+        
+        musicGroupPaymentCalenderList.forEach(t -> {
+        	t.setStatus(PaymentCalenderStatusEnum.REJECT);
+        	t.setUpdateTime(date);
+        	t.setMemo(memo);
+        });
+        
+        musicGroupPaymentCalenderDao.batchUpdate(musicGroupPaymentCalenderList);
     }
 
     @Override
@@ -1589,10 +1614,38 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         if (musicGroup.getTenantId() == null) {
             throw new BizException("乐团机构信息异常,请联系管理员");
         }
+        
+        Date date = new Date();
+        
         //记录操作日志
         musicGroupBuildLogDao.insert(new MusicGroupBuildLog(musicGroupId, "审核通过(审核中 -> 预报名)", sysUser.getId(), ""));
         musicGroup.setStatus(MusicGroupStatusEnum.PRE_APPLY);
+        musicGroup.setUpdateTime(date);
         musicGroupDao.update(musicGroup);
+        
+        List<PaymentCalenderStatusEnum> statusList = new ArrayList<MusicGroupPaymentCalender.PaymentCalenderStatusEnum>();
+        statusList.add(PaymentCalenderStatusEnum.AUDITING);
+        //修改乐团报名缴费项目状态
+        List<MusicGroupPaymentCalender> musicGroupPaymentCalenderList = musicGroupPaymentCalenderDao.queryByPaymentStatus(musicGroupId, statusList, null);
+        
+        musicGroupPaymentCalenderList.forEach(t -> {
+            if (t.getPayUserType() == SCHOOL) {
+                if (t.getCurrentTotalAmount().compareTo(BigDecimal.ZERO) > 0) {
+                    t.setStatus(PaymentCalenderStatusEnum.OPEN);
+                } else {
+                    t.setStatus(PaymentCalenderStatusEnum.PAID);
+                }
+            } else if (date.after(t.getStartPaymentDate())) {
+                t.setStatus(PaymentCalenderStatusEnum.OPEN);
+            } else if (date.after(t.getDeadlinePaymentDate())) {
+                t.setStatus(PaymentCalenderStatusEnum.OVER);
+            } else {
+                t.setStatus(PaymentCalenderStatusEnum.NO);
+            }
+        	t.setUpdateTime(date);
+        });
+        
+        musicGroupPaymentCalenderDao.batchUpdate(musicGroupPaymentCalenderList);
 
         // 创建群
         imGroupService.create(musicGroupId, null, "乐团预报名", null,

+ 52 - 0
mec-biz/src/main/resources/config/mybatis/MusicGroupCalenderRefundPeriodMapper.xml

@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<!--
+这个文件是自动生成的。
+不要修改此文件。所有改动将在下次重新自动生成时丢失。
+-->
+<mapper namespace="com.ym.mec.biz.dal.dao.MusicGroupCalenderRefundPeriodDao">
+	
+	<resultMap type="com.ym.mec.biz.dal.entity.MusicGroupCalenderRefundPeriod" id="MusicGroupCalenderRefundPeriod">
+		<result column="id_" property="id" />
+		<result column="organ_id_" property="organId" />
+		<result column="cooperation_organ_id_" property="cooperationOrganId" />
+		<result column="calender_id_" property="calenderId" />
+		<result column="refund_date_" property="refundDate" />
+		<result column="refund_amount_" property="refundAmount" />
+		<result column="sub_refund_amount_" property="subRefundAmount" />
+		<result column="create_time_" property="createTime" />
+		<result column="update_time_" property="updateTime" />
+	</resultMap>
+	
+	
+	<!-- 全查询 -->
+	<select id="findAll" resultMap="MusicGroupCalenderRefundPeriod">
+		SELECT * FROM music_group_calender_refund_period
+	</select>
+	
+	<!-- 向数据库增加一条记录 -->
+	<insert id="insert" parameterType="com.ym.mec.biz.dal.entity.MusicGroupCalenderRefundPeriod" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
+		INSERT INTO music_group_calender_refund_period (organ_id_,cooperation_organ_id_,calender_id_,
+		                                                refund_date_,refund_amount_,sub_refund_amount_,create_time_,update_time_)
+		VALUES(#{organId},#{cooperationOrganId},#{calenderId},#{refundDate},#{refundAmount},#{subRefundAmount},NOW(),NOW())
+	</insert>
+	<insert id="batchInsert">
+		INSERT INTO music_group_calender_refund_period (organ_id_,cooperation_organ_id_,calender_id_,
+														refund_date_,refund_amount_,sub_refund_amount_,create_time_,update_time_)
+		VALUES
+		<foreach collection="refundPeriods" separator="," item="bean">
+			(#{organId},#{cooperationOrganId},#{calenderId},#{refundDate},#{refundAmount},#{subRefundAmount},#{createTime},#{updateTime})
+		</foreach>
+	</insert>
+
+
+	<!-- 分页查询 -->
+	<select id="queryPage" resultMap="MusicGroupCalenderRefundPeriod" parameterType="map">
+		SELECT * FROM music_group_calender_refund_period <include refid="global.limit"/>
+	</select>
+	
+	<!-- 查询当前表的总记录数 -->
+	<select id="queryCount" resultType="int">
+		SELECT COUNT(*) FROM music_group_calender_refund_period
+	</select>
+</mapper>

+ 9 - 2
mec-biz/src/main/resources/config/mybatis/MusicGroupPaymentCalenderMapper.xml

@@ -40,6 +40,7 @@
         <result column="current_total_amount_" property="currentTotalAmount"/>
         <result column="original_total_amount_" property="originalTotalAmount"/>
         <result column="payment_item_show_state_" property="paymentItemShowState"/>
+        <result column="is_show_sale_price_" property="isShowSalePrice"/>
     </resultMap>
 
     <!-- 根据主键查询一条记录 -->
@@ -60,14 +61,14 @@
         actual_num_,memo_,is_give_music_network_,create_time_,update_time_,payment_valid_start_date_,payment_valid_end_date_,
         payment_pattern_,payment_type_,payment_amount_,batch_no_,audit_memo_,operator_,attribute1_,
          attribute2_,student_ids_,member_payment_amount_,member_rank_setting_id_,member_valid_date_
-         ,original_member_payment_amount_,current_total_amount_,original_total_amount_,tenant_id_,organ_id_,cloud_teacher_payment_flag_,payment_item_show_state_)
+         ,original_member_payment_amount_,current_total_amount_,original_total_amount_,tenant_id_,organ_id_,cloud_teacher_payment_flag_,payment_item_show_state_,is_show_sale_price_)
         VALUES(#{musicGroupId},#{musicGroupOrganizationCourseSettingId},#{payUserType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
         #{rejectReason},#{startPaymentDate},#{deadlinePaymentDate},#{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
         #{expectNum},#{actualNum},#{memo},#{isGiveMusicNetwork},now(),now(),
         #{paymentValidStartDate},#{paymentValidEndDate},#{paymentPattern},#{paymentType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
         #{paymentAmount},#{batchNo},#{auditMemo},#{operator},#{attribute1},#{attribute2},#{studentIds},
                #{memberPaymentAmount},#{memberRankSettingId},#{memberValidDate},#{originalMemberPaymentAmount},
-               #{currentTotalAmount},#{originalTotalAmount},#{tenantId},#{organId},#{cloudTeacherPaymentFlag},#{paymentItemShowState})
+               #{currentTotalAmount},#{originalTotalAmount},#{tenantId},#{organId},#{cloudTeacherPaymentFlag},#{paymentItemShowState},#{isShowSalePrice})
     </insert>
 
 
@@ -160,6 +161,9 @@
             <if test="paymentItemShowState != null">
                 payment_item_show_state_ = #{paymentItemShowState},
             </if>
+            <if test="isShowSalePrice != null">
+                is_show_sale_price_ = #{isShowSalePrice},
+            </if>
         </set>
         WHERE id_ = #{id} and tenant_id_ = #{tenantId}
     </update>
@@ -246,6 +250,9 @@
 	            <if test="item.paymentItemShowState != null">
 	                payment_item_show_state_ = #{item.paymentItemShowState},
 	            </if>
+	            <if test="item.isShowSalePrice != null">
+	                is_show_sale_price_ = #{item.isShowSalePrice},
+	            </if>
 	        </set>
 	        WHERE id_ = #{item.id} and tenant_id_ = #{item.tenantId}
 		</foreach>