Преглед изворни кода

Merge remote-tracking branch 'origin/master'

Joburgess пре 4 година
родитељ
комит
0fbfa32ea6

+ 12 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/OrganizationCourseUnitPriceSettingsDao.java

@@ -1,5 +1,9 @@
 package com.ym.mec.biz.dal.dao;
 
+import java.util.List;
+
+import org.apache.ibatis.annotations.Param;
+
 import com.ym.mec.biz.dal.entity.OrganizationCourseUnitPriceSettings;
 import com.ym.mec.biz.dal.entity.CourseSchedule.CourseScheduleType;
 import com.ym.mec.common.dal.BaseDAO;
@@ -12,5 +16,12 @@ public interface OrganizationCourseUnitPriceSettingsDao extends BaseDAO<Integer,
 	 * @param courseType 课程类型
 	 * @return
 	 */
-	OrganizationCourseUnitPriceSettings queryByOrganIdAndCourseType(Integer organId, CourseScheduleType courseType);
+	OrganizationCourseUnitPriceSettings queryByOrganIdAndCourseType(@Param("organId") Integer organId, @Param("courseScheduleType") CourseScheduleType courseType);
+	
+	/**
+	 * 批量新增
+	 * @param organizationCourseUnitPriceSettingsList
+	 * @return
+	 */
+	int batchInsert(List<OrganizationCourseUnitPriceSettings> organizationCourseUnitPriceSettingsList);
 }

+ 16 - 3
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroupPaymentCalender.java

@@ -1,13 +1,16 @@
 package com.ym.mec.biz.dal.entity;
 
-import com.ym.mec.common.enums.BaseEnum;
 import io.swagger.annotations.ApiModelProperty;
-import org.apache.commons.lang3.builder.ToStringBuilder;
 
+import java.math.BigDecimal;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+import com.ym.mec.common.enums.BaseEnum;
+
 /**
  * 对应数据库表(music_group_payment_calender):
  */
@@ -97,8 +100,10 @@ public class MusicGroupPaymentCalender {
 	@ApiModelProperty(value = "缴费方式0按月,1按学期,2一次性", required = false)
 	private Integer paymentPattern;
 
-	@ApiModelProperty(value = "缴费类型0续费,1报名", required = false)
+	@ApiModelProperty(value = "缴费类型", required = false)
 	private PaymentType paymentType;
+	
+	private BigDecimal paymentAmount = new BigDecimal(0);
 
 	@ApiModelProperty(value = "状态", required = false)
 	private PaymentCalenderStatusEnum status;
@@ -315,6 +320,14 @@ public class MusicGroupPaymentCalender {
 		this.batchNo = batchNo;
 	}
 
+	public BigDecimal getPaymentAmount() {
+		return paymentAmount;
+	}
+
+	public void setPaymentAmount(BigDecimal paymentAmount) {
+		this.paymentAmount = paymentAmount;
+	}
+
 	@Override
 	public String toString() {
 		return ToStringBuilder.reflectionToString(this);

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

@@ -53,6 +53,12 @@ public class MusicGroupPaymentCalenderDetail {
 	/**  */
 	private java.util.Date deadlinePaymentDate;
 
+	/**  */
+	private java.util.Date startPaymentDateMgpc;
+
+	/**  */
+	private java.util.Date deadlinePaymentDateMgpc;
+
 	@ApiModelProperty(value = "订单编号",required = true)
 	private Long paymentOrderId;
 
@@ -66,6 +72,22 @@ public class MusicGroupPaymentCalenderDetail {
 
 	private SysUser sysUser = new SysUser();
 
+	public Date getStartPaymentDateMgpc() {
+		return startPaymentDateMgpc;
+	}
+
+	public void setStartPaymentDateMgpc(Date startPaymentDateMgpc) {
+		this.startPaymentDateMgpc = startPaymentDateMgpc;
+	}
+
+	public Date getDeadlinePaymentDateMgpc() {
+		return deadlinePaymentDateMgpc;
+	}
+
+	public void setDeadlinePaymentDateMgpc(Date deadlinePaymentDateMgpc) {
+		this.deadlinePaymentDateMgpc = deadlinePaymentDateMgpc;
+	}
+
 	public YesOrNoEnum getOpenFlag() {
 		return openFlag;
 	}

+ 40 - 9
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/OrganizationCourseUnitPriceSettings.java

@@ -1,5 +1,7 @@
 package com.ym.mec.biz.dal.entity;
 
+import java.math.BigDecimal;
+
 import org.apache.commons.lang3.builder.ToStringBuilder;
 
 import com.ym.mec.biz.dal.entity.CourseSchedule.CourseScheduleType;
@@ -17,9 +19,10 @@ public class OrganizationCourseUnitPriceSettings {
 	
 	/** 课程类型 */
 	private CourseScheduleType courseType;
+
+	private Integer chargeTypeId;
 	
-	/** 单价的json串(key-乐团模式,value-单价) */
-	private String unitPriceJson;
+	private BigDecimal unitPrice = new BigDecimal(0);
 	
 	/**  */
 	private java.util.Date createTime;
@@ -27,6 +30,10 @@ public class OrganizationCourseUnitPriceSettings {
 	/**  */
 	private java.util.Date updateTime;
 	
+	private Organization organ = new Organization();
+	
+	private ChargeType chargeType = new ChargeType();
+	
 	public void setId(Integer id){
 		this.id = id;
 	}
@@ -50,15 +57,15 @@ public class OrganizationCourseUnitPriceSettings {
 	public void setCourseType(CourseScheduleType courseType) {
 		this.courseType = courseType;
 	}
-
-	public void setUnitPriceJson(String unitPriceJson){
-		this.unitPriceJson = unitPriceJson;
+			
+	public BigDecimal getUnitPrice() {
+		return unitPrice;
 	}
-	
-	public String getUnitPriceJson(){
-		return this.unitPriceJson;
+
+	public void setUnitPrice(BigDecimal unitPrice) {
+		this.unitPrice = unitPrice;
 	}
-			
+
 	public void setCreateTime(java.util.Date createTime){
 		this.createTime = createTime;
 	}
@@ -75,6 +82,30 @@ public class OrganizationCourseUnitPriceSettings {
 		return this.updateTime;
 	}
 			
+	public Integer getChargeTypeId() {
+		return chargeTypeId;
+	}
+
+	public void setChargeTypeId(Integer chargeTypeId) {
+		this.chargeTypeId = chargeTypeId;
+	}
+
+	public Organization getOrgan() {
+		return organ;
+	}
+
+	public void setOrgan(Organization organ) {
+		this.organ = organ;
+	}
+
+	public ChargeType getChargeType() {
+		return chargeType;
+	}
+
+	public void setChargeType(ChargeType chargeType) {
+		this.chargeType = chargeType;
+	}
+
 	@Override
 	public String toString() {
 		return ToStringBuilder.reflectionToString(this);

+ 9 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/OrganizationCourseUnitPriceSettingsService.java

@@ -1,5 +1,7 @@
 package com.ym.mec.biz.service;
 
+import java.util.List;
+
 import com.ym.mec.biz.dal.entity.OrganizationCourseUnitPriceSettings;
 import com.ym.mec.biz.dal.entity.CourseSchedule.CourseScheduleType;
 import com.ym.mec.common.service.BaseService;
@@ -7,6 +9,13 @@ import com.ym.mec.common.service.BaseService;
 public interface OrganizationCourseUnitPriceSettingsService extends BaseService<Integer, OrganizationCourseUnitPriceSettings> {
 
 	/**
+	 * 批量新增
+	 * @param organizationCourseUnitPriceSettingsList
+	 * @return
+	 */
+	boolean batchInsert(List<OrganizationCourseUnitPriceSettings> organizationCourseUnitPriceSettingsList);
+
+	/**
 	 * 根据分部编号以及课程类型查询对象
 	 * @param organId 分部编号
 	 * @param courseType 课程类型

+ 40 - 30
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderServiceImpl.java

@@ -38,6 +38,9 @@ import java.util.*;
 import java.util.Map.Entry;
 import java.util.stream.Collectors;
 
+import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentType.MUSIC_APPLY;
+import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentType.MUSIC_RENEW;
+
 @Service
 public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long, MusicGroupPaymentCalender> implements MusicGroupPaymentCalenderService {
 
@@ -95,7 +98,8 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 		musicGroupPaymentCalender.setOperator(sysUser.getId());
 		musicGroupPaymentCalender.setCreateTime(date);
 		musicGroupPaymentCalender.setUpdateTime(date);
-		
+		musicGroupPaymentCalender.setStatus(PaymentCalenderStatusEnum.NO);
+
 		if (musicGroupPaymentCalender.getDeadlinePaymentDate() == null && musicGroupPaymentCalender.getPayUserType() == PayUserType.STUDENT) {
 			musicGroupPaymentCalender.setDeadlinePaymentDate(DateUtil.addDays(musicGroupPaymentCalender.getStartPaymentDate(), 3));
 		}
@@ -104,29 +108,40 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 		if (count > 0) {
 			throw new BizException("缴费有效期存在冲突,请修改缴费有效期");
 		}
-		
 		//获取设置的课程
 		List<MusicGroupPaymentCalenderCourseSettings> musicGroupPaymentCalenderCourseSettingsList = musicGroupPaymentCalender.getMusicGroupPaymentCalenderCourseSettingsList();
 		if(musicGroupPaymentCalenderCourseSettingsList == null){
 			musicGroupPaymentCalenderCourseSettingsList = new ArrayList<>();
 		}
-		
-		//查询默认课程费用
-		Integer musicGroupOrganizationCourseSettingId = musicGroupPaymentCalender.getMusicGroupOrganizationCourseSettingId();
-		Map<CourseScheduleType, BigDecimal> defaultCoursePrice = musicGroupOrganizationCourseSettingsDetailDao.queryByMusicGroupOrganizationCourseSettingsId(musicGroupOrganizationCourseSettingId).stream().collect(Collectors.toMap(MusicGroupOrganizationCourseSettingsDetail :: getCourseType, MusicGroupOrganizationCourseSettingsDetail :: getCourseCurrentPrice));
-		
 		//当前缴费的课程费用
-		Map<CourseScheduleType,BigDecimal> currentCoursePrice = musicGroupPaymentCalenderCourseSettingsList.stream().collect(Collectors.toMap(MusicGroupPaymentCalenderCourseSettings :: getCourseType, MusicGroupPaymentCalenderCourseSettings :: getCourseCurrentPrice));
-		
-		BigDecimal totalPrice = new BigDecimal(0);
-		//相同类型的课程如果修改了课程费用,需要走审批
-		for(Entry<CourseScheduleType, BigDecimal> entry : currentCoursePrice.entrySet()){
-			if(defaultCoursePrice.get(entry.getKey()).compareTo(entry.getValue()) != 0){
-				musicGroupPaymentCalender.setStatus(PaymentCalenderStatusEnum.AUDITING);
+		Map<CourseScheduleType,BigDecimal> currentCoursePrice = musicGroupPaymentCalenderCourseSettingsList.stream().
+				collect(Collectors.toMap(MusicGroupPaymentCalenderCourseSettings :: getCourseType, MusicGroupPaymentCalenderCourseSettings :: getCourseCurrentPrice));
+
+		if(musicGroupPaymentCalender.getPaymentType() == MUSIC_APPLY || musicGroupPaymentCalender.getPaymentType() == MUSIC_RENEW){
+			//查询默认课程费用
+			Integer musicGroupOrganizationCourseSettingId = musicGroupPaymentCalender.getMusicGroupOrganizationCourseSettingId();
+			Map<CourseScheduleType, BigDecimal> defaultCoursePrice = musicGroupOrganizationCourseSettingsDetailDao.queryByMusicGroupOrganizationCourseSettingsId(musicGroupOrganizationCourseSettingId).stream().
+					collect(Collectors.toMap(MusicGroupOrganizationCourseSettingsDetail :: getCourseType, MusicGroupOrganizationCourseSettingsDetail :: getCourseCurrentPrice));
+
+			//相同类型的课程如果修改了课程费用,需要走审批
+			for(Entry<CourseScheduleType, BigDecimal> entry : currentCoursePrice.entrySet()){
+				if(defaultCoursePrice.get(entry.getKey()).compareTo(entry.getValue()) != 0){
+					musicGroupPaymentCalender.setStatus(PaymentCalenderStatusEnum.AUDITING);
+				}
 			}
-			totalPrice.add(entry.getValue());
+			for(MusicGroupPaymentCalenderCourseSettings musicGroupPaymentCalenderCourseSettings : musicGroupPaymentCalenderCourseSettingsList){
+				musicGroupPaymentCalenderCourseSettings.setMusicGroupPaymentCalenderId(musicGroupPaymentCalender.getId());
+				musicGroupPaymentCalenderCourseSettings.setCreateTime(date);
+				musicGroupPaymentCalenderCourseSettings.setUpdateTime(date);
+			}
+
+			if(musicGroupPaymentCalenderCourseSettingsList.size() > 0){
+				musicGroupPaymentCalenderCourseSettingsDao.batchInsert(musicGroupPaymentCalenderCourseSettingsList);
+			}
+		}else {
+			musicGroupPaymentCalender.setStatus(PaymentCalenderStatusEnum.AUDITING);
 		}
-		
+
 		if (musicGroupPaymentCalender.getStatus() != PaymentCalenderStatusEnum.AUDITING) {
 			if (date.after(musicGroupPaymentCalender.getDeadlinePaymentDate())) {
 				musicGroupPaymentCalender.setStatus(PaymentCalenderStatusEnum.OVER);
@@ -137,7 +152,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 			}
 			
 			//如果是报名,需要修改乐团状态
-			if (musicGroupPaymentCalender.getPaymentType() == MusicGroupPaymentCalender.PaymentType.MUSIC_APPLY) {
+			if (musicGroupPaymentCalender.getPaymentType() == MUSIC_APPLY) {
 				if(musicGroup.getStatus() != MusicGroupStatusEnum.DRAFT){
 					throw new BizException("创建失败:缴费项目类型不匹配");
 				}
@@ -159,7 +174,12 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 					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();
@@ -178,16 +198,6 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 		//设置批次号
 		musicGroupPaymentCalender.setBatchNo(idGeneratorService.generatorId()+"");
 		musicGroupPaymentCalenderDao.insert(musicGroupPaymentCalender);
-		
-		for(MusicGroupPaymentCalenderCourseSettings musicGroupPaymentCalenderCourseSettings : musicGroupPaymentCalenderCourseSettingsList){
-			musicGroupPaymentCalenderCourseSettings.setMusicGroupPaymentCalenderId(musicGroupPaymentCalender.getId());
-			musicGroupPaymentCalenderCourseSettings.setCreateTime(date);
-			musicGroupPaymentCalenderCourseSettings.setUpdateTime(date);
-		}
-		
-		if(musicGroupPaymentCalenderCourseSettingsList.size() > 0){
-			musicGroupPaymentCalenderCourseSettingsDao.batchInsert(musicGroupPaymentCalenderCourseSettingsList);
-		}
 
 		if (musicGroupPaymentCalenderDetailList.size() > 0) {
 			musicGroupPaymentCalenderDetailDao.batchInsert(musicGroupPaymentCalenderDetailList);
@@ -285,7 +295,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 			}
 			
 			//如果是报名,需要修改乐团状态
-			if (musicGroupPaymentCalender.getPaymentType() == MusicGroupPaymentCalender.PaymentType.MUSIC_APPLY) {
+			if (musicGroupPaymentCalender.getPaymentType() == MUSIC_APPLY) {
 				musicGroup.setStatus(MusicGroupStatusEnum.AUDIT);
 				musicGroup.setUpdateTime(date);
 				musicGroupDao.update(musicGroup);
@@ -450,7 +460,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 			musicGroupPaymentCalender.setStatus(PaymentCalenderStatusEnum.NO);
 		}
 		//如果是报名,需要修改乐团状态
-		if (musicGroupPaymentCalender.getPaymentType() == MusicGroupPaymentCalender.PaymentType.MUSIC_APPLY) {
+		if (musicGroupPaymentCalender.getPaymentType() == MUSIC_APPLY) {
 			MusicGroup musicGroup = musicGroupDao.get(musicGroupPaymentCalender.getMusicGroupId());
 			musicGroup.setStatus(MusicGroupStatusEnum.AUDIT);
 			musicGroup.setUpdateTime(date);

+ 8 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/OrganizationCourseUnitPriceSettingsServiceImpl.java

@@ -1,5 +1,7 @@
 package com.ym.mec.biz.service.impl;
 
+import java.util.List;
+
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -22,6 +24,12 @@ public class OrganizationCourseUnitPriceSettingsServiceImpl extends BaseServiceI
 	}
 
 	@Override
+	public boolean batchInsert(List<OrganizationCourseUnitPriceSettings> organizationCourseUnitPriceSettingsList) {
+		organizationCourseUnitPriceSettingsDao.batchInsert(organizationCourseUnitPriceSettingsList);
+		return true;
+	}
+
+	@Override
 	public OrganizationCourseUnitPriceSettings queryByOrganIdAndCourseType(Integer organId, CourseScheduleType courseType) {
 		return organizationCourseUnitPriceSettingsDao.queryByOrganIdAndCourseType(organId, courseType);
 	}

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

@@ -693,14 +693,14 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                 });
             }
             StudentPaymentOrderDetail studentPaymentOrderDetail = new StudentPaymentOrderDetail();
-            studentPaymentOrderDetail.setPrice(studentAddDto.getTemporaryCourseFee());
+            studentPaymentOrderDetail.setPrice(studentAddDto.getTemporaryCourseFee() == null ? BigDecimal.ZERO : studentAddDto.getTemporaryCourseFee());
             studentPaymentOrderDetail.setType(OrderDetailTypeEnum.COURSE);
             studentPaymentOrderDetails.add(studentPaymentOrderDetail);
             //汇总金额
 
-            BigDecimal reduce = studentPaymentOrderDetails.stream().map(e -> e.getPrice()).reduce(BigDecimal.ZERO, BigDecimal::add);
+            BigDecimal reduce = studentPaymentOrderDetails.stream().map(StudentPaymentOrderDetail::getPrice).reduce(BigDecimal.ZERO, BigDecimal::add);
             MusicGroupStudentFee.PaymentStatus paymentStatus = MusicGroupStudentFee.PaymentStatus.NON_PAYMENT;
-            if (reduce == BigDecimal.ZERO) {
+            if (reduce.compareTo(BigDecimal.ZERO) == 0) {
                 paymentStatus = MusicGroupStudentFee.PaymentStatus.PAID_COMPLETED;
                 studentPaymentOrder.setStatus(DealStatusEnum.SUCCESS);
                 studentRegistration.setPaymentStatus(PaymentStatusEnum.YES);
@@ -737,7 +737,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
             if (musicGroup.getOwnershipType() != null && musicGroup.getOwnershipType() == CooperationOrgan.OwnershipType.OWN) {
                 Map<Integer, String> receivers = new HashMap<>(1);
                 receivers.put(studentRegistration.getUserId(), studentRegistration.getParentsPhone());
-                if (reduce == BigDecimal.ZERO) {
+                if (reduce.compareTo(BigDecimal.ZERO) == 0) {
                     sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.AWSMS, MessageTypeEnum.SMS_MUSIC_GROUP_ADD_STUDENT_FREE,
                             receivers, null, 0, null, "", studentRegistration.getParentsName(), studentRegistration.getName(), musicGroup.getName());
                 } else {

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

@@ -50,7 +50,7 @@
 		<foreach collection="list" item="item" separator=",">
 		(#{item.musicGroupPaymentCalenderId},#{item.courseType, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
 		#{item.courseTotalMinuties},#{item.unitPrice},#{item.courseOriginalPrice},#{item.courseCurrentPrice},
-		#{item.isStudentOptional},#{item.createTime},#{item.updateTime},#{name})
+		#{item.isStudentOptional},#{item.createTime},#{item.updateTime},#{item.name})
 		</foreach>
 	</insert>
 

+ 11 - 4
mec-biz/src/main/resources/config/mybatis/MusicGroupPaymentCalenderMapper.xml

@@ -27,6 +27,7 @@
         <result column="payment_pattern_" property="paymentPattern"/>
         <result column="payment_type_" property="paymentType" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
         <result column="batch_no_" property="batchNo"/>
+        <result column="payment_amount_" property="paymentAmount"/>
     </resultMap>
 
     <!-- 根据主键查询一条记录 -->
@@ -44,24 +45,24 @@
             keyColumn="id_" keyProperty="id">
         INSERT INTO music_group_payment_calender
         (music_group_id_,music_group_organization_course_settings_id_,pay_user_type_,reject_reason_,start_payment_date_,deadline_payment_date_,status_,expect_num_,
-        actual_num_,memo_,is_give_music_network_,create_time_,update_time_,payment_valid_start_date_,payment_valid_end_date_,payment_pattern_,payment_type_,batch_no_,audit_memo_)
+        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_)
         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},#{batchNo},#{auditMemo})
+        #{paymentValidStartDate},#{paymentValidEndDate},#{paymentPattern},#{paymentType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{paymentAmount},#{batchNo},#{auditMemo})
     </insert>
 
     <insert id="batchInsert" parameterType="com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender" useGeneratedKeys="true"
             keyColumn="id_" keyProperty="id">
         INSERT INTO music_group_payment_calender
         (music_group_id_,music_group_organization_course_settings_id_,pay_user_type_,reject_reason_,start_payment_date_,deadline_payment_date_,status_,expect_num_,
-        actual_num_,memo_,is_give_music_network_,create_time_,update_time_,payment_valid_start_date_,payment_valid_end_date_,payment_pattern_,
+        actual_num_,memo_,is_give_music_network_,create_time_,update_time_,payment_valid_start_date_,payment_valid_end_date_,payment_pattern_,payment_amount_,
         payment_type_,batch_no_,audit_memo_)
         VALUES
         <foreach collection="list" item="item" index="index" separator=",">
         (#{item.musicGroupId},#{item.musicGroupOrganizationCourseSettingId},#{item.payUserType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{item.rejectReason},#{item.startPaymentDate},#{item.deadlinePaymentDate},#{item.status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
         #{item.expectNum},#{item.actualNum},#{item.memo},#{item.isGiveMusicNetwork},now(),now(),
-        #{item.paymentValidStartDate},#{item.paymentValidEndDate},#{item.paymentPattern},#{item.paymentType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
+        #{item.paymentValidStartDate},#{item.paymentValidEndDate},#{item.paymentPattern},#{item.paymentAmount},#{item.paymentType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
         #{item.batchNo},#{item.auditMemo})
         </foreach>
     </insert>
@@ -122,6 +123,9 @@
             <if test="batchNo != null">
                 batch_no_ = #{batchNo},
             </if>
+            <if test="paymentAmount != null">
+                payment_amount_ = #{paymentAmount},
+            </if>
         </set>
         WHERE id_ = #{id}
     </update>
@@ -175,6 +179,9 @@
                 <if test="item.batchNo != null">
                     batch_no_ = #{item.batchNo},
                 </if>
+	            <if test="item.paymentAmount != null">
+	                payment_amount_ = #{item.paymentAmount},
+	            </if>
 	        </set>
 	        WHERE id_ = #{item.id}
 		</foreach>

+ 28 - 12
mec-biz/src/main/resources/config/mybatis/OrganizationCourseUnitPriceSettingsMapper.xml

@@ -7,9 +7,12 @@
 		<result column="id_" property="id" />
 		<result column="organ_id_" property="organId" />
 		<result column="course_type_" property="courseType" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler" />
-		<result column="unit_price_json_" property="unitPriceJson" />
+		<result column="charge_type_id_" property="chargeTypeId" />
+		<result column="unit_price_" property="unitPrice" />
 		<result column="create_time_" property="createTime" />
 		<result column="update_time_" property="updateTime" />
+		<result column="organ_name_" property="organ.name" />
+		<result column="charge_type_name_" property="chargeType.name" />
 	</resultMap>
 
 	<!-- 根据主键查询一条记录 -->
@@ -27,8 +30,17 @@
 		<!-- <selectKey resultClass="int" keyProperty="id" > SELECT SEQ_WSDEFINITION_ID.nextval 
 			AS ID FROM DUAL </selectKey> -->
 		INSERT INTO organization_course_unit_price_settings
-		(id_,organ_id_,course_type_,unit_price_json_,create_time_,update_time_)
-		VALUES(#{id},#{organId},#{courseType, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{unitPriceJson},#{createTime},#{updateTime})
+		(id_,organ_id_,course_type_,charge_type_id_,unit_price_,create_time_,update_time_)
+		VALUES(#{id},#{organId},#{courseType, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{chargeTypeId},#{unitPrice},now(),now())
+	</insert>
+	
+	<insert id="batchInsert" parameterType="java.util.List" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
+		INSERT INTO organization_course_unit_price_settings
+		(id_,organ_id_,course_type_,charge_type_id_,unit_price_,create_time_,update_time_)
+		VALUES
+		<foreach collection="list" item="item" separator=",">
+		(#{item.id},#{item.organId},#{item.courseType, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{item.chargeTypeId},#{item.unitPrice},now(),now())
+		</foreach>
 	</insert>
 
 	<!-- 根据主键查询一条记录 -->
@@ -47,8 +59,11 @@
 			<if test="courseType != null">
 				course_type_ = #{courseType, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
 			</if>
-			<if test="unitPriceJson != null">
-				unit_price_json_ = #{unitPriceJson},
+			<if test="chargeTypeId != null">
+				charge_type_id_ = #{chargeTypeId},
+			</if>
+			<if test="unitPrice != null">
+				unit_price_ = #{unitPrice},
 			</if>
 			<if test="createTime != null">
 				create_time_ = #{createTime},
@@ -64,28 +79,29 @@
 
 	<!-- 分页查询 -->
 	<select id="queryPage" resultMap="OrganizationCourseUnitPriceSettings" parameterType="map">
-		SELECT * FROM organization_course_unit_price_settings 
+		SELECT ups.*,o.name_ organ_name_ ,ct.name_ charge_type_name_ FROM organization_course_unit_price_settings ups left join organization o on ups.organ_id_ = o.id_
+		left join charge_type ct on ct.id_ = ups.charge_type_id_
 		<where>
 			<if test="organId != null">
-				and organ_id_ = #{organId}
+				and ups.organ_id_ = #{organId}
 			</if>
 			<if test="courseScheduleType != null">
-				and course_type_ = #{courseScheduleType, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
+				and ups.course_type_ = #{courseScheduleType, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
 			</if>
 		</where>
-		ORDER BY id_
+		ORDER BY ups.id_ desc
 		<include refid="global.limit" />
 	</select>
 
 	<!-- 查询当前表的总记录数 -->
 	<select id="queryCount" resultType="int">
-		SELECT COUNT(*) FROM organization_course_unit_price_settings
+		SELECT COUNT(ups.id_) FROM organization_course_unit_price_settings ups
 		<where>
 			<if test="organId != null">
-				and organ_id_ = #{organId}
+				and ups.organ_id_ = #{organId}
 			</if>
 			<if test="courseScheduleType != null">
-				and course_type_ = #{courseScheduleType, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
+				and ups.course_type_ = #{courseScheduleType, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
 			</if>
 		</where>
 	</select>

+ 13 - 7
mec-web/src/main/java/com/ym/mec/web/controller/OrganizationCourseUnitPriceSettingsController.java

@@ -4,6 +4,9 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
 
+import java.util.Date;
+import java.util.List;
+
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.MediaType;
 import org.springframework.security.access.prepost.PreAuthorize;
@@ -36,14 +39,16 @@ public class OrganizationCourseUnitPriceSettingsController extends BaseControlle
 
 	@ApiOperation(value = "新增对象")
 	@PostMapping(value = "/insert", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
-	@PreAuthorize("@pcs.hasPermissions('organizationCourseUnitPriceSettings/update')")
-	public Object insert(@RequestBody OrganizationCourseUnitPriceSettings organizationCourseUnitPriceSettings) {
-		OrganizationCourseUnitPriceSettings originalObj = organizationCourseUnitPriceSettingsService.queryByOrganIdAndCourseType(
-				organizationCourseUnitPriceSettings.getOrganId(), organizationCourseUnitPriceSettings.getCourseType());
-		if (originalObj != null) {
-			return failed("当前分部已经存在该课程类型的单价");
+	@PreAuthorize("@pcs.hasPermissions('organizationCourseUnitPriceSettings/insert')")
+	public Object insert(@RequestBody List<OrganizationCourseUnitPriceSettings> organizationCourseUnitPriceSettingsList) {
+		for (OrganizationCourseUnitPriceSettings organizationCourseUnitPriceSettings : organizationCourseUnitPriceSettingsList) {
+			OrganizationCourseUnitPriceSettings originalObj = organizationCourseUnitPriceSettingsService.queryByOrganIdAndCourseType(
+					organizationCourseUnitPriceSettings.getOrganId(), organizationCourseUnitPriceSettings.getCourseType());
+			if (originalObj != null) {
+				return failed("当前分部已经存在该课程类型的单价");
+			}
 		}
-		organizationCourseUnitPriceSettingsService.insert(organizationCourseUnitPriceSettings);
+		organizationCourseUnitPriceSettingsService.batchInsert(organizationCourseUnitPriceSettingsList);
 		return succeed();
 	}
 
@@ -51,6 +56,7 @@ public class OrganizationCourseUnitPriceSettingsController extends BaseControlle
 	@PostMapping(value = "/update", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
 	@PreAuthorize("@pcs.hasPermissions('organizationCourseUnitPriceSettings/update')")
 	public Object update(@RequestBody OrganizationCourseUnitPriceSettings organizationCourseUnitPriceSettings) {
+		organizationCourseUnitPriceSettings.setUpdateTime(new Date());
 		organizationCourseUnitPriceSettingsService.update(organizationCourseUnitPriceSettings);
 		return succeed();
 	}