소스 검색

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

zouxuan 2 년 전
부모
커밋
7d1a375a58
30개의 변경된 파일1192개의 추가작업 그리고 110개의 파일을 삭제
  1. 9 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/MusicGroupDeliveryRecordDao.java
  2. 9 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/MusicGroupShippingAddressDao.java
  3. 6 1
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentPaymentOrderDetailDao.java
  4. 10 2
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/SubjectChangeDao.java
  5. 10 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/StudentApplyInstrumentDto.java
  6. 114 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroupDeliveryRecord.java
  7. 168 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroupShippingAddress.java
  8. 10 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/StudentPaymentOrderDetail.java
  9. 10 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/SubjectChange.java
  10. 16 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/page/MusicGroupShippingAddressQueryInfo.java
  11. 56 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/vo/MusicGroupDeliveryVo.java
  12. 8 0
      mec-biz/src/main/java/com/ym/mec/biz/service/MusicGroupDeliveryRecordService.java
  13. 5 3
      mec-biz/src/main/java/com/ym/mec/biz/service/MusicGroupService.java
  14. 8 0
      mec-biz/src/main/java/com/ym/mec/biz/service/MusicGroupShippingAddressService.java
  15. 5 3
      mec-biz/src/main/java/com/ym/mec/biz/service/StudentPaymentOrderDetailService.java
  16. 1 1
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/ExportServiceImpl.java
  17. 23 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupDeliveryRecordServiceImpl.java
  18. 79 36
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupServiceImpl.java
  19. 23 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupShippingAddressServiceImpl.java
  20. 63 26
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentInstrumentServiceImpl.java
  21. 71 16
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentPaymentOrderDetailServiceImpl.java
  22. 26 2
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/SubjectChangeServiceImpl.java
  23. 94 0
      mec-biz/src/main/resources/config/mybatis/MusicGroupDeliveryRecordMapper.xml
  24. 121 0
      mec-biz/src/main/resources/config/mybatis/MusicGroupShippingAddressMapper.xml
  25. 28 6
      mec-biz/src/main/resources/config/mybatis/StudentPaymentOrderDetailMapper.xml
  26. 126 4
      mec-biz/src/main/resources/config/mybatis/SubjectChangeMapper.xml
  27. 4 4
      mec-web/src/main/java/com/ym/mec/web/controller/ExportController.java
  28. 3 3
      mec-web/src/main/java/com/ym/mec/web/controller/MusicGroupController.java
  29. 83 0
      mec-web/src/main/java/com/ym/mec/web/controller/MusicGroupShippingAddressController.java
  30. 3 3
      mec-web/src/main/java/com/ym/mec/web/controller/StudentPaymentOrderController.java

+ 9 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/MusicGroupDeliveryRecordDao.java

@@ -0,0 +1,9 @@
+package com.ym.mec.biz.dal.dao;
+
+import com.ym.mec.common.dal.BaseDAO;
+import com.ym.mec.biz.dal.entity.MusicGroupDeliveryRecord;
+
+public interface MusicGroupDeliveryRecordDao extends BaseDAO<Long, MusicGroupDeliveryRecord> {
+
+	
+}

+ 9 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/MusicGroupShippingAddressDao.java

@@ -0,0 +1,9 @@
+package com.ym.mec.biz.dal.dao;
+
+import com.ym.mec.common.dal.BaseDAO;
+import com.ym.mec.biz.dal.entity.MusicGroupShippingAddress;
+
+public interface MusicGroupShippingAddressDao extends BaseDAO<Integer, MusicGroupShippingAddress> {
+
+	
+}

+ 6 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentPaymentOrderDetailDao.java

@@ -5,7 +5,9 @@ import java.util.List;
 import java.util.Map;
 
 import com.ym.mec.biz.dal.entity.Goods;
+
 import org.apache.ibatis.annotations.Param;
+import org.junit.runners.Parameterized.Parameters;
 
 import com.ym.mec.biz.dal.dto.Mapper;
 import com.ym.mec.biz.dal.dto.MusicalListDetailDto;
@@ -34,9 +36,10 @@ public interface StudentPaymentOrderDetailDao extends BaseDAO<Long, StudentPayme
      *
      * @param musicGroupId
      * @param status
+     * @param deliveryStatus  发货状态 (1-已发货  0-未发货)
      * @return
      */
-    List<StudentPaymentOrderDetail> findApplyOrderSuccess(@Param("musicGroupId") String musicGroupId, @Param("status") DealStatusEnum status);
+    List<StudentPaymentOrderDetail> findApplyOrderSuccess(@Param("musicGroupId") String musicGroupId, @Param("status") DealStatusEnum status, @Param("deliveryStatus") Integer deliveryStatus);
 
     /**
      * 查询订单商品
@@ -171,4 +174,6 @@ public interface StudentPaymentOrderDetailDao extends BaseDAO<Long, StudentPayme
     List<StudentPaymentOrderDetail> findByOrderId(Long paymentOrderId);
 
     List<StudentPaymentOrderDetail> findByCalenderId(Long calenderId);
+    
+    List<StudentPaymentOrderDetail> querySubjectChangeByMusicGroupId(@Param("musicGroupId") String musicGroupId);
 }

+ 10 - 2
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/SubjectChangeDao.java

@@ -11,6 +11,7 @@ import com.ym.mec.common.dal.BaseDAO;
 
 public interface SubjectChangeDao extends BaseDAO<Integer, SubjectChange> {
 
+	int batchUpdate(List<SubjectChange> subjectChangeList);
 
     /**
      * 获取学生最后一次乐器替换记录
@@ -49,9 +50,10 @@ public interface SubjectChangeDao extends BaseDAO<Integer, SubjectChange> {
      * 获取更换的乐器辅件
      *
      * @param musicGroupId
+     * @param deliveryStatus  发货状态 (1-已发货  0-未发货)
      * @return
      */
-    SubjectChange getChangeGoods(@Param("musicGroupId") String musicGroupId);
+    SubjectChange getChangeGoods(@Param("musicGroupId") String musicGroupId, @Param("deliveryStatus") Integer deliveryStatus);
 
     /**
      * 获取用户换取的乐器辅件
@@ -83,4 +85,10 @@ public interface SubjectChangeDao extends BaseDAO<Integer, SubjectChange> {
      * @return
      */
     BigDecimal getTotalCourseMargin(@Param("musicGroupId") String musicGroupId);
-}
+    
+    /**
+     * 查询待发货记录
+     * @param musicGroupId
+     * @return
+     */
+    List<SubjectChange> queryWaitDeliveryList(@Param("musicGroupId") String musicGroupId);}

+ 10 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/StudentApplyInstrumentDto.java

@@ -9,6 +9,8 @@ public class StudentApplyInstrumentDto {
 	private Long studentInstrumentId;
 	
 	private Long studentPyamentOrderId;
+	
+	private Long musicGroupPaymentCalenderId;
 
 	public String getMusicGroupId() {
 		return musicGroupId;
@@ -41,4 +43,12 @@ public class StudentApplyInstrumentDto {
 	public void setStudentPyamentOrderId(Long studentPyamentOrderId) {
 		this.studentPyamentOrderId = studentPyamentOrderId;
 	}
+
+	public Long getMusicGroupPaymentCalenderId() {
+		return musicGroupPaymentCalenderId;
+	}
+
+	public void setMusicGroupPaymentCalenderId(Long musicGroupPaymentCalenderId) {
+		this.musicGroupPaymentCalenderId = musicGroupPaymentCalenderId;
+	}
 }

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

@@ -0,0 +1,114 @@
+package com.ym.mec.biz.dal.entity;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+/**
+ * 对应数据库表(music_group_delivery_record):
+ */
+public class MusicGroupDeliveryRecord {
+
+	/**  */
+	private Long id;
+	
+	/**  */
+	private String deliveryBatchNo;
+	
+	/**  */
+	private String musicGroupId;
+	
+	/**  */
+	private String expressCompany;
+	
+	/**  */
+	private String expressBillNo;
+	
+	/**  */
+	private Integer musicGroupShippingAddressId;
+	
+	/**  */
+	private Integer operatorUserId;
+	
+	/**  */
+	private java.util.Date updateTime;
+	
+	/**  */
+	private java.util.Date createTime;
+	
+	public void setId(Long id){
+		this.id = id;
+	}
+	
+	public Long getId(){
+		return this.id;
+	}
+			
+	public void setDeliveryBatchNo(String deliveryBatchNo){
+		this.deliveryBatchNo = deliveryBatchNo;
+	}
+	
+	public String getDeliveryBatchNo(){
+		return this.deliveryBatchNo;
+	}
+			
+	public void setMusicGroupId(String musicGroupId){
+		this.musicGroupId = musicGroupId;
+	}
+	
+	public String getMusicGroupId(){
+		return this.musicGroupId;
+	}
+			
+	public void setExpressCompany(String expressCompany){
+		this.expressCompany = expressCompany;
+	}
+	
+	public String getExpressCompany(){
+		return this.expressCompany;
+	}
+			
+	public void setExpressBillNo(String expressBillNo){
+		this.expressBillNo = expressBillNo;
+	}
+	
+	public String getExpressBillNo(){
+		return this.expressBillNo;
+	}
+			
+	public void setMusicGroupShippingAddressId(Integer musicGroupShippingAddressId){
+		this.musicGroupShippingAddressId = musicGroupShippingAddressId;
+	}
+	
+	public Integer getMusicGroupShippingAddressId(){
+		return this.musicGroupShippingAddressId;
+	}
+			
+	public void setOperatorUserId(Integer operatorUserId){
+		this.operatorUserId = operatorUserId;
+	}
+	
+	public Integer getOperatorUserId(){
+		return this.operatorUserId;
+	}
+			
+	public void setUpdateTime(java.util.Date updateTime){
+		this.updateTime = updateTime;
+	}
+	
+	public java.util.Date getUpdateTime(){
+		return this.updateTime;
+	}
+			
+	public void setCreateTime(java.util.Date createTime){
+		this.createTime = createTime;
+	}
+	
+	public java.util.Date getCreateTime(){
+		return this.createTime;
+	}
+			
+	@Override
+	public String toString() {
+		return ToStringBuilder.reflectionToString(this);
+	}
+
+}

+ 168 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroupShippingAddress.java

@@ -0,0 +1,168 @@
+package com.ym.mec.biz.dal.entity;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+/**
+ * 对应数据库表(music_group_shipping_address):
+ */
+public class MusicGroupShippingAddress {
+
+	/**  */
+	private Integer id;
+	
+	/**  */
+	private String musicGroupId;
+	
+	/** 收货人 */
+	private String consigneeName;
+	
+	/** 手机号码 */
+	private String mobile;
+	
+	/** 省 */
+	private String regionProvince;
+	
+	/** 省 */
+	private String regionProvinceId;
+	
+	/** 市 */
+	private String regionCity;
+	
+	/** 市 */
+	private String regionCityId;
+	
+	/** 县/街道 */
+	private String regionCounty;
+	
+	/** 县/街道 */
+	private String regionCountyId;
+	
+	/** 详细地址 */
+	private String detailAddress;
+	
+	private Integer delFlag;
+	
+	/**  */
+	private java.util.Date updateTime;
+	
+	/**  */
+	private java.util.Date createTime;
+	
+	public void setId(Integer id){
+		this.id = id;
+	}
+	
+	public Integer getId(){
+		return this.id;
+	}
+			
+	public void setMusicGroupId(String musicGroupId){
+		this.musicGroupId = musicGroupId;
+	}
+	
+	public String getMusicGroupId(){
+		return this.musicGroupId;
+	}
+			
+	public void setConsigneeName(String consigneeName){
+		this.consigneeName = consigneeName;
+	}
+	
+	public String getConsigneeName(){
+		return this.consigneeName;
+	}
+			
+	public void setMobile(String mobile){
+		this.mobile = mobile;
+	}
+	
+	public String getMobile(){
+		return this.mobile;
+	}
+			
+	public void setRegionProvince(String regionProvince){
+		this.regionProvince = regionProvince;
+	}
+	
+	public String getRegionProvince(){
+		return this.regionProvince;
+	}
+			
+	public void setRegionCity(String regionCity){
+		this.regionCity = regionCity;
+	}
+	
+	public String getRegionCity(){
+		return this.regionCity;
+	}
+			
+	public void setRegionCounty(String regionCounty){
+		this.regionCounty = regionCounty;
+	}
+	
+	public String getRegionCounty(){
+		return this.regionCounty;
+	}
+			
+	public void setDetailAddress(String detailAddress){
+		this.detailAddress = detailAddress;
+	}
+	
+	public String getDetailAddress(){
+		return this.detailAddress;
+	}
+			
+	public void setUpdateTime(java.util.Date updateTime){
+		this.updateTime = updateTime;
+	}
+	
+	public java.util.Date getUpdateTime(){
+		return this.updateTime;
+	}
+			
+	public void setCreateTime(java.util.Date createTime){
+		this.createTime = createTime;
+	}
+	
+	public java.util.Date getCreateTime(){
+		return this.createTime;
+	}
+			
+	public String getRegionProvinceId() {
+		return regionProvinceId;
+	}
+
+	public void setRegionProvinceId(String regionProvinceId) {
+		this.regionProvinceId = regionProvinceId;
+	}
+
+	public String getRegionCityId() {
+		return regionCityId;
+	}
+
+	public void setRegionCityId(String regionCityId) {
+		this.regionCityId = regionCityId;
+	}
+
+	public String getRegionCountyId() {
+		return regionCountyId;
+	}
+
+	public void setRegionCountyId(String regionCountyId) {
+		this.regionCountyId = regionCountyId;
+	}
+
+	public Integer getDelFlag() {
+		return delFlag;
+	}
+
+	public void setDelFlag(Integer delFlag) {
+		this.delFlag = delFlag;
+	}
+
+	@Override
+	public String toString() {
+		return ToStringBuilder.reflectionToString(this);
+	}
+
+}

+ 10 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/StudentPaymentOrderDetail.java

@@ -75,6 +75,8 @@ public class StudentPaymentOrderDetail extends BaseEntity {
 	private CloudTeacherOrderDto cloudTeacherOrderDto;
 
 	private Integer userId;
+	
+	private String deliveryBatchNo;//发货批次
 
 	public Integer getUserId() {
 		return userId;
@@ -248,4 +250,12 @@ public class StudentPaymentOrderDetail extends BaseEntity {
 	public void setMinuendStockGoodsIdList(String minuendStockGoodsIdList) {
 		this.minuendStockGoodsIdList = minuendStockGoodsIdList;
 	}
+
+	public String getDeliveryBatchNo() {
+		return deliveryBatchNo;
+	}
+
+	public void setDeliveryBatchNo(String deliveryBatchNo) {
+		this.deliveryBatchNo = deliveryBatchNo;
+	}
 }

+ 10 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/SubjectChange.java

@@ -213,6 +213,8 @@ public class SubjectChange extends BaseEntity {
 
     @ApiModelProperty(value = "更改后成本")
     private BigDecimal changeCost = BigDecimal.ZERO;
+	
+	private String deliveryBatchNo;//发货批次
 
     public Integer getId() {
         return id;
@@ -581,4 +583,12 @@ public class SubjectChange extends BaseEntity {
     public void setOriginalKitGroupPurchaseType(KitGroupPurchaseTypeEnum originalKitGroupPurchaseType) {
         this.originalKitGroupPurchaseType = originalKitGroupPurchaseType;
     }
+
+	public String getDeliveryBatchNo() {
+		return deliveryBatchNo;
+	}
+
+	public void setDeliveryBatchNo(String deliveryBatchNo) {
+		this.deliveryBatchNo = deliveryBatchNo;
+	}
 }

+ 16 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/page/MusicGroupShippingAddressQueryInfo.java

@@ -0,0 +1,16 @@
+package com.ym.mec.biz.dal.page;
+
+import com.ym.mec.common.page.QueryInfo;
+
+public class MusicGroupShippingAddressQueryInfo extends QueryInfo {
+
+	private String musicGroupId;
+
+	public String getMusicGroupId() {
+		return musicGroupId;
+	}
+
+	public void setMusicGroupId(String musicGroupId) {
+		this.musicGroupId = musicGroupId;
+	}
+}

+ 56 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/vo/MusicGroupDeliveryVo.java

@@ -0,0 +1,56 @@
+package com.ym.mec.biz.dal.vo;
+
+import java.util.Date;
+
+public class MusicGroupDeliveryVo {
+
+	private String musicGroupId;
+	
+	private String expressCompany;
+	
+	private String expressBillNo;
+	
+	private Integer addressId;
+	
+	private Date orderCutoffDate;
+
+	public String getMusicGroupId() {
+		return musicGroupId;
+	}
+
+	public void setMusicGroupId(String musicGroupId) {
+		this.musicGroupId = musicGroupId;
+	}
+
+	public String getExpressCompany() {
+		return expressCompany;
+	}
+
+	public void setExpressCompany(String expressCompany) {
+		this.expressCompany = expressCompany;
+	}
+
+	public String getExpressBillNo() {
+		return expressBillNo;
+	}
+
+	public void setExpressBillNo(String expressBillNo) {
+		this.expressBillNo = expressBillNo;
+	}
+
+	public Integer getAddressId() {
+		return addressId;
+	}
+
+	public void setAddressId(Integer addressId) {
+		this.addressId = addressId;
+	}
+
+	public Date getOrderCutoffDate() {
+		return orderCutoffDate;
+	}
+
+	public void setOrderCutoffDate(Date orderCutoffDate) {
+		this.orderCutoffDate = orderCutoffDate;
+	}
+}

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

@@ -0,0 +1,8 @@
+package com.ym.mec.biz.service;
+
+import com.ym.mec.biz.dal.entity.MusicGroupDeliveryRecord;
+import com.ym.mec.common.service.BaseService;
+
+public interface MusicGroupDeliveryRecordService extends BaseService<Long, MusicGroupDeliveryRecord> {
+
+}

+ 5 - 3
mec-biz/src/main/java/com/ym/mec/biz/service/MusicGroupService.java

@@ -5,6 +5,7 @@ import com.ym.mec.biz.dal.entity.*;
 import com.ym.mec.biz.dal.enums.SysUserRoleEnum;
 import com.ym.mec.biz.dal.page.MusicGroupQueryInfo;
 import com.ym.mec.biz.dal.page.MusicMemberQueryInfo;
+import com.ym.mec.biz.dal.vo.MusicGroupDeliveryVo;
 import com.ym.mec.common.entity.HttpResponseResult;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.service.BaseService;
@@ -441,10 +442,11 @@ public interface MusicGroupService extends BaseService<String, MusicGroup> {
     Object getQuitGroupDetail(String musicGroupId);
 
     /**
-     * 乐保生效
+     * 确认发货
      *
-     * @param musicGroupId
+     * @param userId
+     * @param musicGroupDeliveryVo
      * @return
      */
-    boolean takeEffectOfinstrumentInsurance(String musicGroupId);
+    boolean confirmDelivery(Integer userId, MusicGroupDeliveryVo musicGroupDeliveryVo);
 }

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

@@ -0,0 +1,8 @@
+package com.ym.mec.biz.service;
+
+import com.ym.mec.biz.dal.entity.MusicGroupShippingAddress;
+import com.ym.mec.common.service.BaseService;
+
+public interface MusicGroupShippingAddressService extends BaseService<Integer, MusicGroupShippingAddress> {
+
+}

+ 5 - 3
mec-biz/src/main/java/com/ym/mec/biz/service/StudentPaymentOrderDetailService.java

@@ -45,17 +45,19 @@ public interface StudentPaymentOrderDetailService extends BaseService<Long, Stud
      *
      * @param musicGroupId
      * @param status
+     * @param deliveryStatus  发货状态 (1-已发货  0-未发货)
      * @return
      */
-    List<StudentPaymentOrderDetail> findApplyOrderSuccess(String musicGroupId, DealStatusEnum status);
+    List<StudentPaymentOrderDetail> findApplyOrderSuccess(String musicGroupId, DealStatusEnum status, Integer deliveryStatus);
 
     /**
      * 获取乐器的采购清单
      *
      * @param musicGroupId
+     * @param deliveryStatus  发货状态 (1-已发货  0-未发货)
      * @return
      */
-    List<Goods> getMusicalList(String musicGroupId);
+    List<Goods> getMusicalList(String musicGroupId, Integer deliveryStatus);
 
     /**
      * 确认采购清单
@@ -88,7 +90,7 @@ public interface StudentPaymentOrderDetailService extends BaseService<Long, Stud
      * @param musicGroupId
      * @return
      */
-    List<MusicalListDetailDto> getMusicalListDetail(String musicGroupId, Integer studentId);
+    List<MusicalListDetailDto> getMusicalListDetail(String musicGroupId, Integer deliveryStatus);
 
     /**
      * 获取订单的乐器信息

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ExportServiceImpl.java

@@ -311,7 +311,7 @@ public class ExportServiceImpl implements ExportService {
         exportFuncMap.put(ExportEnum.PRACTICE_GROUP_LIST, info -> practiceGroupList(info));
         exportFuncMap.put(ExportEnum.VIP_GROUP_LIST, info -> vipGroupService.findVipGroups(getQueryInfo(info, VipGroupQueryInfo.class, true)).getRows());
         exportFuncMap.put(ExportEnum.SPORADIC_CHARGE_INFO, info -> sporadicChargeInfoService.queryDetailPage(getQueryInfo(info, SporadicChargeInfoQueryInfo.class, true)).getRows());
-        exportFuncMap.put(ExportEnum.MUSICAL_LIST_EXPORT, info -> studentPaymentOrderDetailService.getMusicalList(getParam(info, "musicGroupId", String.class)));
+        exportFuncMap.put(ExportEnum.MUSICAL_LIST_EXPORT, info -> studentPaymentOrderDetailService.getMusicalList(getParam(info, "musicGroupId", String.class),null));
         exportFuncMap.put(ExportEnum.MUSICAL_LIST_DETAIL_EXPORT, info -> studentPaymentOrderDetailService.getMusicalListDetail(getParam(info, "musicGroupId", String.class), null));
         exportFuncMap.put(ExportEnum.QUERY_STUDENT_APPLY_DETAIL_EXPORT, info -> queryStudentApplyDetailExport(info));
         exportFuncMap.put(ExportEnum.COURSE_SCHEDULE_TEACHER_SALARY, info -> courseScheduleTeacherSalaryService.querySalaries(getQueryInfo(info, CourseScheduleTeacherSalaryQueryInfo.class, false)).getRows());

+ 23 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupDeliveryRecordServiceImpl.java

@@ -0,0 +1,23 @@
+package com.ym.mec.biz.service.impl;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import com.ym.mec.biz.dal.dao.MusicGroupDeliveryRecordDao;
+import com.ym.mec.biz.dal.entity.MusicGroupDeliveryRecord;
+import com.ym.mec.biz.service.MusicGroupDeliveryRecordService;
+import com.ym.mec.common.dal.BaseDAO;
+import com.ym.mec.common.service.impl.BaseServiceImpl;
+
+@Service
+public class MusicGroupDeliveryRecordServiceImpl extends BaseServiceImpl<Long, MusicGroupDeliveryRecord>  implements MusicGroupDeliveryRecordService {
+	
+	@Autowired
+	private MusicGroupDeliveryRecordDao musicGroupDeliveryRecordDao;
+
+	@Override
+	public BaseDAO<Long, MusicGroupDeliveryRecord> getDAO() {
+		return musicGroupDeliveryRecordDao;
+	}
+	
+}

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

@@ -14,6 +14,7 @@ import com.ym.mec.biz.dal.entity.MusicGroupStudentFee.PaymentStatus;
 import com.ym.mec.biz.dal.enums.*;
 import com.ym.mec.biz.dal.page.MusicGroupQueryInfo;
 import com.ym.mec.biz.dal.page.MusicMemberQueryInfo;
+import com.ym.mec.biz.dal.vo.MusicGroupDeliveryVo;
 import com.ym.mec.biz.event.source.GroupEventSource;
 import com.ym.mec.biz.event.source.SendSeoMessageSource;
 import com.ym.mec.biz.service.*;
@@ -32,6 +33,7 @@ import com.ym.mec.util.date.DateUtil;
 import com.ym.mec.util.http.HttpUtil;
 import com.ym.mec.util.json.JsonUtil;
 import com.ym.mec.util.validator.CommonValidator;
+
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
@@ -69,6 +71,10 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
     private ChargeTypeDao chargeTypeDao;
     @Autowired
     private TeacherDao teacherDao;
+    
+    @Autowired
+    private MusicGroupDeliveryRecordDao musicGroupDeliveryRecordDao;
+    
     @Autowired
     private StudentService studentService;
     @Autowired
@@ -198,6 +204,9 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
     private SysUserCashAccountDao sysUserCashAccountDao;
     @Autowired
     private StudentDao studentDao;
+    
+    @Autowired
+    private MusicGroupPaymentCalenderRepairDao musicGroupPaymentCalenderRepairDao;
 
     private SimpleDateFormat sdf_ymd = new SimpleDateFormat("yyyy-MM-dd");
 
@@ -1377,7 +1386,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         MusicGroup musicGroup = saveLog(musicGroupId, MusicGroupStatusEnum.PREPARE);
 
         //乐器采购清单是否确认
-        List<StudentPaymentOrderDetail> applyOrder = studentPaymentOrderDetailService.findApplyOrderSuccess(musicGroupId, DealStatusEnum.SUCCESS);
+        /*List<StudentPaymentOrderDetail> applyOrder = studentPaymentOrderDetailService.findApplyOrderSuccess(musicGroupId, DealStatusEnum.SUCCESS);
         if (applyOrder != null && applyOrder.size() > 0) {
             //是否购买了乐器,支持无乐器乐团
             long count = applyOrder.stream().filter(e -> e != null && StringUtils.isNotEmpty(e.getGoodsIdList())).count();
@@ -1390,7 +1399,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
                     throw new BizException("采购清单未确认");
                 }
             }
-        }
+        }*/
 
         //课酬是否确认
         Integer courseScheduleNum = courseScheduleDao.countCourseScheduleByMusicGroupId(musicGroupId);
@@ -3839,61 +3848,95 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
     }
 
     @Override
-    public boolean takeEffectOfinstrumentInsurance(String musicGroupId) {
+    @Transactional(rollbackFor = Exception.class)
+    public boolean confirmDelivery(Integer userId, MusicGroupDeliveryVo musicGroupDeliveryVo) {
+    	
+    	String musicGroupId = musicGroupDeliveryVo.getMusicGroupId();
 
         MusicGroup musicGroup = musicGroupDao.get(musicGroupId);
         if (musicGroup == null) {
             throw new BizException("乐团信息查询失败");
         }
 
-        if (musicGroup.getMusicalInstrumentsProvideStatus() != 0) {
-            throw new BizException("乐器已发货,请勿重复操作");
+        Date date = new Date();
+        
+        String deliveryBatchNo = idGeneratorService.generatorId("delivery") + "";
+        
+        //更新订单的发货状态(包括声部更换)
+        List<StudentPaymentOrderDetail> studentPaymentOrderDetailList = studentPaymentOrderDetailDao.querySubjectChangeByMusicGroupId(musicGroupId);
+        if(studentPaymentOrderDetailList == null){
+        	studentPaymentOrderDetailList = new ArrayList<StudentPaymentOrderDetail>();
         }
-
-        Set<String> musicGroupIds = new HashSet<String>();
-        musicGroupIds.add(musicGroupId);
-        List<MusicGroupPurchaseList> musicGroupPurchaseListCount = musicGroupPurchaseListDao.getCount(musicGroupIds);
-        if (musicGroupPurchaseListCount == null || musicGroupPurchaseListCount.size() == 0) {
-            throw new BizException("乐器清单未确认,不能确认发货");
+        
+        List<StudentPaymentOrderDetail> studentPaymentOrderDetailList1 = studentPaymentOrderDetailDao.findApplyOrderSuccess(musicGroupId, DealStatusEnum.SUCCESS, 0);
+        if(studentPaymentOrderDetailList1 != null && studentPaymentOrderDetailList1.size() > 0){
+        	studentPaymentOrderDetailList.addAll(studentPaymentOrderDetailList1);
+        }
+        
+        if(studentPaymentOrderDetailList == null || studentPaymentOrderDetailList.size() == 0){
+        	throw new BizException("没有商品信息,不能发货");
+        }
+        
+        studentPaymentOrderDetailList.forEach(t -> {
+        	t.setDeliveryBatchNo(deliveryBatchNo);
+        	t.setUpdateTime(date);
+        });
+        if(studentPaymentOrderDetailList.size() > 0){
+        	studentPaymentOrderDetailDao.batchUpdate(studentPaymentOrderDetailList);
+        }
+        
+        List<SubjectChange> subjectChangeList = subjectChangeDao.queryWaitDeliveryList(musicGroupId);
+        subjectChangeList.forEach(t -> {
+        	t.setDeliveryBatchNo(deliveryBatchNo);
+        	t.setUpdateTime(date);
+        });
+        if(subjectChangeList.size() > 0){
+        	subjectChangeDao.batchUpdate(subjectChangeList);
         }
-
-        Date date = new Date();
-
-        musicGroup.setMusicalInstrumentsProvideStatus(1);
-        musicGroup.setUpdateTime(date);
-		musicGroup.setMusicalInstrumentsProvideTime(DateUtil.format(date,DateUtil.ISO_YEAR_MONTH_FORMAT));
-        musicGroupDao.update(musicGroup);
 
         //查询当前乐团报名订单中购买了乐保的订单
         List<StudentApplyInstrumentDto> maintenanceList = studentPaymentOrderDetailDao.queryByType(musicGroupId, OrderDetailTypeEnum.MAINTENANCE);
 
-        if (maintenanceList == null || maintenanceList.size() == 0) {
-            return true;
-        }
+        if (maintenanceList != null && maintenanceList.size() > 0) {
+        	List<Long> instrumentIdList = maintenanceList.stream().map(t -> t.getStudentInstrumentId()).collect(Collectors.toList());
 
-        List<Long> instrumentIdList = maintenanceList.stream().map(t -> t.getStudentInstrumentId()).collect(Collectors.toList());
+            List<StudentInstrument> studentInstrumentList = studentInstrumentDao.queryById(instrumentIdList);
+            
+            MusicGroupPaymentCalenderRepair musicGroupPaymentCalenderRepair = musicGroupPaymentCalenderRepairDao.findByCalenderId(maintenanceList.get(0).getMusicGroupPaymentCalenderId());
 
-        List<StudentInstrument> studentInstrumentList = studentInstrumentDao.queryById(instrumentIdList);
+            List<StudentInstrument> updateList = new ArrayList<StudentInstrument>();
 
-        List<StudentInstrument> updateList = new ArrayList<StudentInstrument>();
+            for (StudentInstrument si : studentInstrumentList) {
+                if (si.getDelFlag() == 1) {
+                    continue;
+                }
+                if (si.getStatus() == 0 && si.getStartTime() == null) {
+                    si.setStatus(1);
+                    si.setStartTime(date);
+                    si.setEndTime(DateUtil.addYears(date, musicGroupPaymentCalenderRepair.getNum().intValue()));
+                    si.setUpdateTime(date);
 
-        for (StudentInstrument si : studentInstrumentList) {
-            if (si.getDelFlag() == 1) {
-                continue;
+                    updateList.add(si);
+                }
             }
-            if (si.getStatus() == 0 && si.getStartTime() == null) {
-                si.setStatus(1);
-                si.setStartTime(date);
-                si.setEndTime(DateUtil.addYears(date, 1));
-                si.setUpdateTime(date);
 
-                updateList.add(si);
+            if (updateList.size() > 0) {
+                studentInstrumentDao.batchModify(updateList);
             }
         }
 
-        if (updateList.size() > 0) {
-            studentInstrumentDao.batchModify(updateList);
-        }
+        //添加记录
+        MusicGroupDeliveryRecord dr = new MusicGroupDeliveryRecord();
+        dr.setCreateTime(date);
+        dr.setDeliveryBatchNo(deliveryBatchNo);
+        dr.setExpressBillNo(musicGroupDeliveryVo.getExpressBillNo());
+        dr.setExpressCompany(musicGroupDeliveryVo.getExpressCompany());
+        dr.setMusicGroupId(musicGroupId);
+        dr.setMusicGroupShippingAddressId(musicGroupDeliveryVo.getAddressId());
+        dr.setOperatorUserId(userId);
+        dr.setUpdateTime(date);
+        
+        musicGroupDeliveryRecordDao.insert(dr);
 
         return true;
     }

+ 23 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupShippingAddressServiceImpl.java

@@ -0,0 +1,23 @@
+package com.ym.mec.biz.service.impl;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import com.ym.mec.biz.dal.dao.MusicGroupShippingAddressDao;
+import com.ym.mec.biz.dal.entity.MusicGroupShippingAddress;
+import com.ym.mec.biz.service.MusicGroupShippingAddressService;
+import com.ym.mec.common.dal.BaseDAO;
+import com.ym.mec.common.service.impl.BaseServiceImpl;
+
+@Service
+public class MusicGroupShippingAddressServiceImpl extends BaseServiceImpl<Integer, MusicGroupShippingAddress>  implements MusicGroupShippingAddressService {
+	
+	@Autowired
+	private MusicGroupShippingAddressDao musicGroupShippingAddressDao;
+
+	@Override
+	public BaseDAO<Integer, MusicGroupShippingAddress> getDAO() {
+		return musicGroupShippingAddressDao;
+	}
+	
+}

+ 63 - 26
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentInstrumentServiceImpl.java

@@ -1,15 +1,13 @@
 package com.ym.mec.biz.service.impl;
 
 import java.math.BigDecimal;
-import java.util.ArrayList;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.Optional;
 import java.util.stream.Collectors;
 
-import com.ym.mec.biz.service.*;
-import com.ym.mec.common.tenant.TenantContextHolder;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -32,15 +30,28 @@ import com.ym.mec.biz.dal.entity.SysUserCashAccount;
 import com.ym.mec.biz.dal.entity.SysUserCashAccountDetail;
 import com.ym.mec.biz.dal.enums.DealStatusEnum;
 import com.ym.mec.biz.dal.enums.GroupType;
-import com.ym.mec.biz.dal.enums.KitGroupPurchaseTypeEnum;
 import com.ym.mec.biz.dal.enums.MessageTypeEnum;
 import com.ym.mec.biz.dal.enums.OrderDetailTypeEnum;
 import com.ym.mec.biz.dal.enums.OrderTypeEnum;
 import com.ym.mec.biz.dal.enums.PlatformCashAccountDetailTypeEnum;
+import com.ym.mec.biz.service.ContractService;
+import com.ym.mec.biz.service.GoodsCategoryService;
+import com.ym.mec.biz.service.GoodsService;
+import com.ym.mec.biz.service.PayService;
+import com.ym.mec.biz.service.StudentInstrumentService;
+import com.ym.mec.biz.service.StudentPaymentOrderService;
+import com.ym.mec.biz.service.StudentPaymentRouteOrderService;
+import com.ym.mec.biz.service.SysConfigService;
+import com.ym.mec.biz.service.SysCouponCodeService;
+import com.ym.mec.biz.service.SysMessageService;
+import com.ym.mec.biz.service.SysTenantConfigService;
+import com.ym.mec.biz.service.SysUserCashAccountDetailService;
+import com.ym.mec.biz.service.SysUserCashAccountService;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.service.IdGeneratorService;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
+import com.ym.mec.common.tenant.TenantContextHolder;
 import com.ym.mec.thirdparty.message.MessageSenderPluginContext;
 import com.ym.mec.util.date.DateUtil;
 
@@ -350,44 +361,70 @@ public class StudentInstrumentServiceImpl extends BaseServiceImpl<Long, StudentI
     }
 
     @Override
+    @Transactional(rollbackFor = Exception.class)
     public Boolean subjectChangeUpdateInstrument(SubjectChange subjectChange) {
+    	
         StudentInstrument studentInstrument = null;
     	
 		if (subjectChange.getOriginalOrderId() != null) {
-		    //获取购买了乐器的报名订单
-            Integer orderId = studentPaymentOrderService.getOrderIdByMusical(subjectChange.getMusicGroupId(),subjectChange.getStudentId());
-            if(orderId != null){
-                studentInstrument = studentInstrumentDao.getByOrderId(orderId.longValue());
-            }
+            studentInstrument = studentInstrumentDao.getByOrderId(subjectChange.getOriginalOrderId().longValue());
 		}
+    	if(subjectChange.getChangeMusical() == null){
+    		if(studentInstrument != null){
+    			studentInstrumentDao.delete(studentInstrument.getId());
+    		}
+    		return true;
+    	}
+		
+		Date date = new Date();
         
-		if (subjectChange == null || subjectChange.getChangeMusical() == null ||
-                KitGroupPurchaseTypeEnum.OWNED.equals(subjectChange.getKitGroupPurchaseType())) {
-        	
-        	if(studentInstrument != null){
-        		studentInstrument.setDelFlag(1);
-        		update(studentInstrument);
-        	}
-        	
-            return false;
-        }
         if (studentInstrument == null) {
             studentInstrument = new StudentInstrument();
             studentInstrument.setStudentId(subjectChange.getStudentId());
             studentInstrument.setOrganId(subjectChange.getOrganId());
-            if (subjectChange.getOriginalOrderId() != null) {
-            	studentInstrument.setOrderId(subjectChange.getOriginalOrderId().longValue());
-            }
-            studentInstrument.setStatus(0);
+            studentInstrument.setCreateTime(date);
         }
-        studentInstrument.setChangeOrderId(subjectChange.getOrderId().longValue());
+        studentInstrument.setStatus(0);
         studentInstrument.setGoodsId(subjectChange.getChangeMusical());
+        studentInstrument.setChangeOrderId(subjectChange.getOrderId().longValue());
+        if(subjectChange.getOriginalOrderId() != null){
+        	studentInstrument.setOrderId(subjectChange.getOriginalOrderId().longValue());
+        }
+        
+        Goods goods = goodsService.get(studentInstrument.getGoodsId());
+        GoodsCategory goodsCategory = goodsCategoryService.get(goods.getGoodsCategoryId());
+        studentInstrument.setGoodsCategoryId(goods.getGoodsCategoryId());
+        studentInstrument.setGoodsCategoryName(goodsCategory.getName());
+        studentInstrument.setGoodsName(goods.getName());
+        studentInstrument.setGoodsBrand(goods.getBrand());
+        studentInstrument.setSpecification(goods.getSpecification());
+        studentInstrument.setGoodsImg(goods.getImage());
+        studentInstrument.setUpdateTime(date);
+        studentInstrument.setDelFlag(0);
+        //studentInstrument.setOperation(operation);
         
         if (studentInstrument.getId() == null) {
-            addStudentInstrument(studentInstrument);
+        	studentInstrumentDao.insert(studentInstrument);
+        	
+        	//反向更新student_payment_order_detail表中的Id
+        	List<StudentPaymentOrderDetail> spodList = studentPaymentOrderDetailDao.findApplyOrderSuccess(subjectChange.getMusicGroupId(), DealStatusEnum.SUCCESS, null);
+        	if(spodList != null && spodList.size() > 0){
+        		StudentPaymentOrderDetail spod = null;
+        		Optional<StudentPaymentOrderDetail> optional = spodList.stream().filter(t -> t.getUserId().intValue() == subjectChange.getStudentId() && t.getType() == OrderDetailTypeEnum.MAINTENANCE).findFirst();
+        		if(optional.isPresent()){
+        			spod = optional.get();
+        			
+        			if(spod != null){
+        				spod.setStudentInstrumentId(studentInstrument.getId());
+        				spod.setUpdateTime(date);
+        				studentPaymentOrderDetailDao.update(spod);
+        			}
+        		}
+        	}
+        	
             return true;
         }
-        updateStudentInstrument(studentInstrument);
+        studentInstrumentDao.update(studentInstrument);
         return true;
     }
 

+ 71 - 16
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentPaymentOrderDetailServiceImpl.java

@@ -138,13 +138,13 @@ public class StudentPaymentOrderDetailServiceImpl extends BaseServiceImpl<Long,
     }
 
     @Override
-    public List<StudentPaymentOrderDetail> findApplyOrderSuccess(String musicGroupId, DealStatusEnum status) {
-        return studentPaymentOrderDetailDao.findApplyOrderSuccess(musicGroupId, status);
+    public List<StudentPaymentOrderDetail> findApplyOrderSuccess(String musicGroupId, DealStatusEnum status, Integer deliveryStatus) {
+        return studentPaymentOrderDetailDao.findApplyOrderSuccess(musicGroupId, status, deliveryStatus);
     }
 
     @Override
-    public List<Goods> getMusicalList(String musicGroupId) {
-        List<StudentPaymentOrderDetail> applyOrder = findApplyOrderSuccess(musicGroupId, DealStatusEnum.SUCCESS);
+    public List<Goods> getMusicalList(String musicGroupId, Integer deliveryStatus) {
+        List<StudentPaymentOrderDetail> applyOrder = findApplyOrderSuccess(musicGroupId, DealStatusEnum.SUCCESS, deliveryStatus);
         if (applyOrder == null || applyOrder.size() == 0) {
             return null;
         }
@@ -177,7 +177,7 @@ public class StudentPaymentOrderDetailServiceImpl extends BaseServiceImpl<Long,
             }
         });
         //乐器更换的
-        SubjectChange changeGoods = subjectChangeDao.getChangeGoods(musicGroupId);
+        SubjectChange changeGoods = subjectChangeDao.getChangeGoods(musicGroupId, deliveryStatus);
         if (changeGoods == null) {
             return goodies;
         }
@@ -246,15 +246,15 @@ public class StudentPaymentOrderDetailServiceImpl extends BaseServiceImpl<Long,
 
     @Override
     public Boolean verifyMusicalList(String musicGroupId) throws BizException {
-        //乐器采购清单是否确认
+        /*//乐器采购清单是否确认
         Map<String, Object> param = new HashMap<>();
         param.put("musicGroupId", musicGroupId);
         int count = musicGroupPurchaseListDao.queryCount(param);
         if (count > 0) {
             throw new BizException("采购清单已经确认");
-        }
+        }*/
 
-        List<Goods> musicalList = getMusicalList(musicGroupId);
+        List<Goods> musicalList = getMusicalList(musicGroupId, null);
         Date date = new Date();
         List<MusicGroupPurchaseList> musicGroupPurchaseLists = new ArrayList<>();
         //发放清单没有时确认特殊处理
@@ -320,7 +320,7 @@ public class StudentPaymentOrderDetailServiceImpl extends BaseServiceImpl<Long,
     }
 
     @Override
-    public List<MusicalListDetailDto> getMusicalListDetail(String musicGroupId, Integer studentId) {
+    public List<MusicalListDetailDto> getMusicalListDetail(String musicGroupId, Integer deliveryStatus) {
 
         List<MusicalListDetailDto> musicalListDetailDtos = new ArrayList<MusicalListDetailDto>();
 
@@ -376,7 +376,6 @@ public class StudentPaymentOrderDetailServiceImpl extends BaseServiceImpl<Long,
             }
 
             Map<OrderDetailTypeEnum, BigDecimal> userOrderTypeMap = new HashMap<OrderDetailTypeEnum, BigDecimal>();
-            ;
 
             BigDecimal amount = BigDecimal.ZERO;
             KitGroupPurchaseTypeEnum kitGroupPurchaseType = null;
@@ -389,6 +388,16 @@ public class StudentPaymentOrderDetailServiceImpl extends BaseServiceImpl<Long,
             boolean isChangeAccessories = false;
 
             for (StudentPaymentOrderDetail spod : orderDetailList) {
+            	
+            	if(deliveryStatus != null){
+					if (deliveryStatus == 0 && StringUtils.isNotBlank(spod.getDeliveryBatchNo())) {
+						continue;
+					}
+					
+					if (deliveryStatus == 1 && StringUtils.isBlank(spod.getDeliveryBatchNo())) {
+						continue;
+					}
+            	}
 
                 if (spod.getType() == OrderDetailTypeEnum.COURSE || spod.getType() == OrderDetailTypeEnum.HIGH_ONLINE_COURSE
                         || spod.getType() == OrderDetailTypeEnum.SINGLE || spod.getType() == OrderDetailTypeEnum.VIP
@@ -399,26 +408,54 @@ public class StudentPaymentOrderDetailServiceImpl extends BaseServiceImpl<Long,
                         || spod.getType() == OrderDetailTypeEnum.MUSIC_NETWORK || spod.getType() == OrderDetailTypeEnum.CLASSROOM || spod.getType() == OrderDetailTypeEnum.THEORY_COURSE) {
                     spod.setType(OrderDetailTypeEnum.COURSE);
                     //courseAmount = courseAmount.add(spod.getPrice().subtract(spod.getRemitFee()));
-                } else if (spod.getType() == OrderDetailTypeEnum.MUSICAL) {
+                } else if (spod.getType() == OrderDetailTypeEnum.MUSICAL || spod.getType() == OrderDetailTypeEnum.ORGAN_SHARE_PROFIT) {
                     if (subjectChange != null && spod.getPaymentOrderId() <= subjectChange.getOriginalOrderId()) {
                         if (subjectChange.getChangeMusical() == null) {
                             continue;
                         }
-                        kitGroupPurchaseType = subjectChange.getKitGroupPurchaseType();
-                        musicalId = subjectChange.getChangeMusical() + "";
-                        spod.setPrice(subjectChange.getChangeMusicalPrice());
+                        if(deliveryStatus != null){
+        					if (deliveryStatus == 0 && StringUtils.isNotBlank(subjectChange.getDeliveryBatchNo())) {
+        						continue;
+        					}
+        					
+        					if (deliveryStatus == 1 && StringUtils.isBlank(subjectChange.getDeliveryBatchNo())) {
+        						continue;
+        					}
+                    	}
+                        
+                        if(spod.getType() == OrderDetailTypeEnum.MUSICAL){
+                            kitGroupPurchaseType = subjectChange.getKitGroupPurchaseType();
+                            musicalId = subjectChange.getChangeMusical() + "";
+                            spod.setPrice(subjectChange.getChangeMusicalPrice());
+                        }else{
+                        	if(subjectChange.getKitGroupPurchaseType() == KitGroupPurchaseTypeEnum.GROUP){
+                        		spod.setPrice(subjectChange.getChangeCourseFee());
+                        	}
+                        }
                         spod.setRemitFee(BigDecimal.ZERO);
                         isChangeMusical = true;
                     } else {
-                        kitGroupPurchaseType = spod.getKitGroupPurchaseType();
-                        musicalId = spod.getGoodsIdList();
+						if (spod.getType() == OrderDetailTypeEnum.MUSICAL) {
+							kitGroupPurchaseType = spod.getKitGroupPurchaseType();
+							musicalId = spod.getGoodsIdList();
+						}
                         //musicalAmount = musicalAmount.add(spod.getPrice());
                     }
+                    spod.setType(OrderDetailTypeEnum.MUSICAL);
                 } else if (spod.getType() == OrderDetailTypeEnum.ACCESSORIES) {
                     if (subjectChange != null && (subjectChange.getOriginalOrderId() != null && spod.getPaymentOrderId() <= subjectChange.getOriginalOrderId())) {
                         if (StringUtils.isBlank(subjectChange.getChangeAccessories()) || isCalculatedOfAccessories == true) {
                             continue;
                         }
+                        if(deliveryStatus != null){
+        					if (deliveryStatus == 0 && StringUtils.isNotBlank(subjectChange.getDeliveryBatchNo())) {
+        						continue;
+        					}
+        					
+        					if (deliveryStatus == 1 && StringUtils.isBlank(subjectChange.getDeliveryBatchNo())) {
+        						continue;
+        					}
+                    	}
                         isCalculatedOfAccessories = true;
                         accessoriesId = accessoriesId.append(subjectChange.getChangeAccessories()).append(",");
                         //accessoriesAmount = accessoriesAmount.add(subjectChange.getChangeAccessoriesPrice());
@@ -444,6 +481,15 @@ public class StudentPaymentOrderDetailServiceImpl extends BaseServiceImpl<Long,
 
             if (orderDetailList.size() == 0) {
                 if (subjectChange != null) {
+                    if(deliveryStatus != null){
+    					if (deliveryStatus == 0 && StringUtils.isNotBlank(subjectChange.getDeliveryBatchNo())) {
+    						continue;
+    					}
+    					
+    					if (deliveryStatus == 1 && StringUtils.isBlank(subjectChange.getDeliveryBatchNo())) {
+    						continue;
+    					}
+                	}
                     if (subjectChange.getChangeMusical() != null) {
                         kitGroupPurchaseType = subjectChange.getKitGroupPurchaseType();
                         musicalId = subjectChange.getChangeMusical() + "";
@@ -458,6 +504,15 @@ public class StudentPaymentOrderDetailServiceImpl extends BaseServiceImpl<Long,
                 }
             } else if (isChangeAccessories == false || isChangeMusical == false) {
                 if (subjectChange != null) {
+                    if(deliveryStatus != null){
+    					if (deliveryStatus == 0 && StringUtils.isNotBlank(subjectChange.getDeliveryBatchNo())) {
+    						continue;
+    					}
+    					
+    					if (deliveryStatus == 1 && StringUtils.isBlank(subjectChange.getDeliveryBatchNo())) {
+    						continue;
+    					}
+                	}
                     if (subjectChange.getChangeMusical() != null && isChangeMusical == false) {
                         kitGroupPurchaseType = subjectChange.getKitGroupPurchaseType();
                         musicalId = subjectChange.getChangeMusical() + "";

+ 26 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/impl/SubjectChangeServiceImpl.java

@@ -482,6 +482,15 @@ public class SubjectChangeServiceImpl extends BaseServiceImpl<Integer, SubjectCh
         if (musicGroupPurchaseListCount.size() > 0) {
             throw new BizException("乐器清单已确认,不能做声部更改");
         }
+        
+        Integer userId = subjectChange.getStudentId();
+        
+        //乐器已发货,不能做声部更换
+		List<StudentPaymentOrderDetail> spodList = studentPaymentOrderDetailDao.findUserApplyOrder(userId, musicGroupId, DealStatusEnum.SUCCESS);
+		spodList = spodList.stream().filter(t -> StringUtils.isNotBlank(t.getDeliveryBatchNo())).collect(Collectors.toList());
+		if (spodList != null && spodList.size() > 0) {
+			throw new BizException("当前学生乐器已发货,不能做声部更改");
+		}
 
         //判断新声部人数是否已满
         MusicGroupSubjectPlan changeSubjectPlan = musicGroupSubjectPlanService.getMusicOneSubjectClassPlan(musicGroupId, subjectChange.getChangeSubjectId());
@@ -499,6 +508,13 @@ public class SubjectChangeServiceImpl extends BaseServiceImpl<Integer, SubjectCh
                 throw new BizException("声部更换失败,当前用户是0元入团,且当前声部已有0元入团学生");
             }
         }
+        
+        if(StringUtils.isBlank(subjectChange.getChangeAccessories()) && StringUtils.isBlank(subjectChange.getOriginalAccessories())
+        		&& subjectChange.getOriginalMusical() == null && subjectChange.getChangeMusical() == null){
+        	studentRegistrationService.changeStudentSubject(subjectChange.getStudentId(), subjectChange.getMusicGroupId(), subjectChange.getOriginalSubjectId(), subjectChange.getChangeSubjectId());
+        	return subjectChange;
+        }
+        
         Date nowDate = new Date();
         SubjectChange lastSubjectChange = getStudentOriginal(subjectChange.getStudentId(), subjectChange.getMusicGroupId());
         if (lastSubjectChange != null) {
@@ -738,7 +754,10 @@ public class SubjectChangeServiceImpl extends BaseServiceImpl<Integer, SubjectCh
         	}
             
             //原始订单的库存要归还
-            List<StudentPaymentOrderDetail> originalStudentPaymentOrderDetailList = studentPaymentOrderDetailService.queryOrderDetail(subjectChange.getOriginalOrderId().longValue());
+            List<StudentPaymentOrderDetail> originalStudentPaymentOrderDetailList = new ArrayList<StudentPaymentOrderDetail>();
+            if(subjectChange.getOriginalOrderId() != null){
+            	originalStudentPaymentOrderDetailList = studentPaymentOrderDetailService.queryOrderDetail(subjectChange.getOriginalOrderId().longValue());
+            }
             String originalGoodsIds = originalStudentPaymentOrderDetailList.stream().filter(t -> StringUtils.isNotBlank(t.getMinuendStockGoodsIdList())).map(t -> t.getMinuendStockGoodsIdList()).collect(Collectors.joining(","));
             if(StringUtils.isNotBlank(originalGoodsIds)){
             	List<Goods> goodsList = goodsService.getGoodsWithLocked(originalGoodsIds);
@@ -785,7 +804,9 @@ public class SubjectChangeServiceImpl extends BaseServiceImpl<Integer, SubjectCh
     		}
 
             //退原订单商品
-            sellOrderService.refundByOrderId(subjectChange.getOriginalOrderId().longValue(), false);
+    		if(subjectChange.getOriginalOrderId() != null) {
+    			sellOrderService.refundByOrderId(subjectChange.getOriginalOrderId().longValue(), false);
+    		}
 
             if (StringUtils.isNotBlank(goodsIds)) {
                 List<Integer> goodsIdList = Arrays.stream(goodsIds.split(",")).map(Integer::parseInt).collect(Collectors.toList());
@@ -944,6 +965,9 @@ public class SubjectChangeServiceImpl extends BaseServiceImpl<Integer, SubjectCh
         goodies.add(subjectChange.getChangeMusicalGoods());
         
         for (Goods goods : goodies) {
+        	if(goods == null){
+        		continue;
+        	}
             goodsPrice = goodsPrice.add(goods.getDiscountPrice());
         }
         subjectChange.setChangeCost(goodsPrice);

+ 94 - 0
mec-biz/src/main/resources/config/mybatis/MusicGroupDeliveryRecordMapper.xml

@@ -0,0 +1,94 @@
+<?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.MusicGroupDeliveryRecordDao">
+
+	<resultMap type="com.ym.mec.biz.dal.entity.MusicGroupDeliveryRecord"
+		id="MusicGroupDeliveryRecord">
+		<result column="id_" property="id" />
+		<result column="delivery_batch_no_" property="deliveryBatchNo" />
+		<result column="music_group_id_" property="musicGroupId" />
+		<result column="express_company_" property="expressCompany" />
+		<result column="express_bill_no_" property="expressBillNo" />
+		<result column="music_group_shipping_address_id_" property="musicGroupShippingAddressId" />
+		<result column="operator_user_id_" property="operatorUserId" />
+		<result column="update_time_" property="updateTime" />
+		<result column="create_time_" property="createTime" />
+	</resultMap>
+
+	<!-- 根据主键查询一条记录 -->
+	<select id="get" resultMap="MusicGroupDeliveryRecord">
+		SELECT *
+		FROM music_group_delivery_record WHERE id_ = #{id}
+	</select>
+
+	<!-- 全查询 -->
+	<select id="findAll" resultMap="MusicGroupDeliveryRecord">
+		SELECT * FROM
+		music_group_delivery_record ORDER BY id_
+	</select>
+
+	<!-- 向数据库增加一条记录 -->
+	<insert id="insert" parameterType="com.ym.mec.biz.dal.entity.MusicGroupDeliveryRecord"
+		useGeneratedKeys="true" keyColumn="id" keyProperty="id">
+		<!-- <selectKey resultClass="int" keyProperty="id" > SELECT SEQ_WSDEFINITION_ID.nextval 
+			AS ID FROM DUAL </selectKey> -->
+		INSERT INTO music_group_delivery_record
+		(id_,delivery_batch_no_,music_group_id_,express_company_,express_bill_no_,music_group_shipping_address_id_,operator_user_id_,update_time_,create_time_)
+		VALUES(#{id},#{deliveryBatchNo},#{musicGroupId},#{expressCompany},#{expressBillNo},#{musicGroupShippingAddressId},#{operatorUserId},#{updateTime},#{createTime})
+	</insert>
+
+	<!-- 根据主键查询一条记录 -->
+	<update id="update" parameterType="com.ym.mec.biz.dal.entity.MusicGroupDeliveryRecord">
+		UPDATE music_group_delivery_record
+		<set>
+			<if test="id != null">
+				id_ = #{id},
+			</if>
+			<if test="deliveryBatchNo != null">
+				delivery_batch_no_ = #{deliveryBatchNo},
+			</if>
+			<if test="updateTime != null">
+				update_time_ = #{updateTime},
+			</if>
+			<if test="expressCompany != null">
+				express_company_ = #{expressCompany},
+			</if>
+			<if test="musicGroupShippingAddressId != null">
+				music_group_shipping_address_id_ = #{musicGroupShippingAddressId},
+			</if>
+			<if test="operatorUserId != null">
+				operator_user_id_ = #{operatorUserId},
+			</if>
+			<if test="expressBillNo != null">
+				express_bill_no_ = #{expressBillNo},
+			</if>
+			<if test="musicGroupId != null">
+				music_group_id_ = #{musicGroupId},
+			</if>
+			<if test="createTime != null">
+				create_time_ = #{createTime},
+			</if>
+		</set>
+		WHERE id_ = #{id}
+	</update>
+
+	<!-- 根据主键删除一条记录 -->
+	<delete id="delete">
+		DELETE FROM music_group_delivery_record
+		WHERE id_ = #{id}
+	</delete>
+
+	<!-- 分页查询 -->
+	<select id="queryPage" resultMap="MusicGroupDeliveryRecord"
+		parameterType="map">
+		SELECT * FROM music_group_delivery_record ORDER BY id_
+		<include refid="global.limit" />
+	</select>
+
+	<!-- 查询当前表的总记录数 -->
+	<select id="queryCount" resultType="int">
+		SELECT COUNT(*) FROM
+		music_group_delivery_record
+	</select>
+</mapper>

+ 121 - 0
mec-biz/src/main/resources/config/mybatis/MusicGroupShippingAddressMapper.xml

@@ -0,0 +1,121 @@
+<?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.MusicGroupShippingAddressDao">
+
+	<resultMap type="com.ym.mec.biz.dal.entity.MusicGroupShippingAddress"
+		id="MusicGroupShippingAddress">
+		<result column="id_" property="id" />
+		<result column="music_group_id_" property="musicGroupId" />
+		<result column="consignee_name_" property="consigneeName" />
+		<result column="mobile_" property="mobile" />
+		<result column="region_province_id_" property="regionProvinceId" />
+		<result column="region_city_id_" property="regionCityId" />
+		<result column="region_county_id_" property="regionCountyId" />
+		<result column="region_province_" property="regionProvince" />
+		<result column="region_city_" property="regionCity" />
+		<result column="region_county_" property="regionCounty" />
+		<result column="detail_address_" property="detailAddress" />
+		<result column="del_flag_" property="delFlag" />
+		<result column="update_time_" property="updateTime" />
+		<result column="create_time_" property="createTime" />
+	</resultMap>
+
+	<!-- 根据主键查询一条记录 -->
+	<select id="get" resultMap="MusicGroupShippingAddress">
+		SELECT sa.*,pa.name_ region_province_,ca.name_ region_city_,coa.name_ region_county_ FROM music_group_shipping_address sa 
+		left join sys_area pa on sa.region_province_id_ = pa.id_
+		left join sys_area ca on sa.region_city_id_ = ca.id_
+		left join sys_area coa on sa.region_county_id_ = coa.id_
+		WHERE sa.id_ = #{id}
+	</select>
+
+	<!-- 全查询 -->
+	<select id="findAll" resultMap="MusicGroupShippingAddress">
+		SELECT sa.*,pa.name_ region_province_,ca.name_ region_city_,coa.name_ region_county_ FROM music_group_shipping_address sa 
+		left join sys_area pa on sa.region_province_id_ = pa.id_
+		left join sys_area ca on sa.region_city_id_ = ca.id_
+		left join sys_area coa on sa.region_county_id_ = coa.id_
+		where sa.del_flag_ = 0
+		ORDER BY sa.id_
+	</select>
+
+	<!-- 向数据库增加一条记录 -->
+	<insert id="insert" parameterType="com.ym.mec.biz.dal.entity.MusicGroupShippingAddress"
+		useGeneratedKeys="true" keyColumn="id" keyProperty="id">
+		<!-- <selectKey resultClass="int" keyProperty="id" > SELECT SEQ_WSDEFINITION_ID.nextval 
+			AS ID FROM DUAL </selectKey> -->
+		INSERT INTO music_group_shipping_address
+		(id_,music_group_id_,consignee_name_,mobile_,region_province_id_,region_city_id_,region_county_id_,detail_address_,del_flag_,update_time_,create_time_)
+		VALUES(#{id},#{musicGroupId},#{consigneeName},#{mobile},#{regionProvinceId},#{regionCityId},#{regionCountyId},#{detailAddress},#{delFlag},#{updateTime},#{createTime})
+	</insert>
+
+	<!-- 根据主键查询一条记录 -->
+	<update id="update" parameterType="com.ym.mec.biz.dal.entity.MusicGroupShippingAddress">
+		UPDATE music_group_shipping_address
+		<set>
+			<if test="consigneeName != null">
+				consignee_name_ = #{consigneeName},
+			</if>
+			<if test="id != null">
+				id_ = #{id},
+			</if>
+			<if test="detailAddress != null">
+				detail_address_ = #{detailAddress},
+			</if>
+			<if test="updateTime != null">
+				update_time_ = #{updateTime},
+			</if>
+			<if test="regionCountyId != null">
+				region_county_id_ = #{regionCountyId},
+			</if>
+			<if test="regionProvinceId != null">
+				region_province_id_ = #{regionProvinceId},
+			</if>
+			<if test="mobile != null">
+				mobile_ = #{mobile},
+			</if>
+			<if test="regionCityId != null">
+				region_city_id_ = #{regionCityId},
+			</if>
+			<if test="delFlag != null">
+				del_flag_ = #{delFlag},
+			</if>
+			<if test="musicGroupId != null">
+				music_group_id_ = #{musicGroupId},
+			</if>
+			<if test="createTime != null">
+				create_time_ = #{createTime},
+			</if>
+		</set>
+		WHERE id_ = #{id}
+	</update>
+
+	<!-- 根据主键删除一条记录 -->
+	<delete id="delete">
+		update music_group_shipping_address set del_flag_ = 1,update_time_ = now() WHERE id_ = #{id}
+	</delete>
+
+	<!-- 分页查询 -->
+	<select id="queryPage" resultMap="MusicGroupShippingAddress" parameterType="map">
+		SELECT sa.*,pa.name_ region_province_,ca.name_ region_city_,coa.name_ region_county_ FROM music_group_shipping_address sa 
+		left join sys_area pa on sa.region_province_id_ = pa.id_
+		left join sys_area ca on sa.region_city_id_ = ca.id_
+		left join sys_area coa on sa.region_county_id_ = coa.id_ 
+		where sa.del_flag_ = 0
+		<if test="musicGroupId != null">
+			and sa.music_group_id_ = #{musicGroupId}
+		</if>
+		ORDER BY sa.id_
+		<include refid="global.limit" />
+	</select>
+
+	<!-- 查询当前表的总记录数 -->
+	<select id="queryCount" resultType="int">
+		SELECT COUNT(*) FROM music_group_shipping_address sa
+		where sa.del_flag_ = 0
+		<if test="musicGroupId != null">
+			and sa.music_group_id_ = #{musicGroupId}
+		</if>
+	</select>
+</mapper>

+ 28 - 6
mec-biz/src/main/resources/config/mybatis/StudentPaymentOrderDetailMapper.xml

@@ -24,6 +24,7 @@
         <result column="balance_income_" property="balanceIncome"/>
         <result column="minuend_stock_goods_id_list_" property="minuendStockGoodsIdList"/>
         <result column="user_id_" property="userId"/>
+        <result column="delivery_batch_no_" property="deliveryBatchNo"/>
         <collection property="goodsList" ofType="com.ym.mec.biz.dal.entity.Goods">
             <result column="goods_id_" property="id"/>
             <result column="goods_name_" property="name"/>
@@ -45,6 +46,7 @@
         <result column="student_instrument_id_" property="studentInstrumentId"/>
         <result column="user_id_" property="userId"/>
         <result column="student_payment_order_id_" property="studentPyamentOrderId"/>
+        <result column="calender_id_" property="musicGroupPaymentCalenderId"/>
     </resultMap>
 
     <!-- 根据主键查询一条记录 -->
@@ -66,10 +68,10 @@
             keyColumn="id" keyProperty="id">
         INSERT INTO student_payment_order_detail
         (type_,goods_id_list_,price_,create_time_,update_time_,payment_order_id_,kit_group_purchase_type_,
-         student_instrument_id_,is_renew_,income_item_,income_,balance_income_,minuend_stock_goods_id_list_,tenant_id_,remit_fee_)
+         student_instrument_id_,is_renew_,income_item_,income_,balance_income_,minuend_stock_goods_id_list_,tenant_id_,remit_fee_,delivery_batch_no_)
         VALUES(#{type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{goodsIdList},#{price},now(),now(),
         #{paymentOrderId},#{kitGroupPurchaseType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
-               #{studentInstrumentId},#{isRenew},#{incomeItem},#{income},#{balanceIncome},#{minuendStockGoodsIdList},#{tenantId},#{remitFee})
+               #{studentInstrumentId},#{isRenew},#{incomeItem},#{income},#{balanceIncome},#{minuendStockGoodsIdList},#{tenantId},#{remitFee},#{deliveryBatchNo})
     </insert>
 
     <!-- 根据主键查询一条记录 -->
@@ -110,6 +112,9 @@
             <if test="minuendStockGoodsIdList != null">
                 minuend_stock_goods_id_list_ = #{minuendStockGoodsIdList},
             </if>
+            <if test="deliveryBatchNo != null">
+                delivery_batch_no_ = #{deliveryBatchNo},
+            </if>
         </set>
         WHERE id_ = #{id} and tenant_id_ = #{tenantId}
     </update>
@@ -152,6 +157,9 @@
 	            <if test="item.minuendStockGoodsIdList != null">
 	                minuend_stock_goods_id_list_ = #{item.minuendStockGoodsIdList},
 	            </if>
+	            <if test="item.deliveryBatchNo != null">
+	                delivery_batch_no_ = #{item.deliveryBatchNo},
+	            </if>
 	        </set>
 	        WHERE id_ = #{item.id} and tenant_id_ = #{item.tenantId}
         </foreach>
@@ -179,19 +187,19 @@
     <insert id="batchAdd" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id_">
         INSERT INTO student_payment_order_detail
         (type_,goods_id_list_,price_,remit_fee_,create_time_,update_time_,payment_order_id_,
-         kit_group_purchase_type_,student_instrument_id_,is_renew_,income_item_,income_,balance_income_,minuend_stock_goods_id_list_,tenant_id_)
+         kit_group_purchase_type_,student_instrument_id_,is_renew_,income_item_,income_,balance_income_,minuend_stock_goods_id_list_,tenant_id_,delivery_batch_no_)
         VALUE
         <foreach collection="studentPaymentOrderDetailList" item="orderDetail" separator=",">
             (#{orderDetail.type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
             #{orderDetail.goodsIdList},#{orderDetail.price},#{orderDetail.remitFee},now(),now(),#{orderDetail.paymentOrderId},
             #{orderDetail.kitGroupPurchaseType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
-            #{orderDetail.studentInstrumentId},#{orderDetail.isRenew},#{orderDetail.incomeItem},#{orderDetail.income},#{orderDetail.balanceIncome},#{orderDetail.minuendStockGoodsIdList},#{orderDetail.tenantId})
+            #{orderDetail.studentInstrumentId},#{orderDetail.isRenew},#{orderDetail.incomeItem},#{orderDetail.income},#{orderDetail.balanceIncome},#{orderDetail.minuendStockGoodsIdList},#{orderDetail.tenantId},#{orderDetail.deliveryBatchNo})
         </foreach>
     </insert>
 
     <!-- 查询注册订单详情 -->
     <select id="findApplyOrderSuccess" resultMap="StudentPaymentOrderDetail">
-        SELECT spod.*
+        SELECT spod.*,spo.user_id_
         FROM student_payment_order spo
                  LEFT JOIN student_payment_order_detail spod ON spo.id_ = spod.payment_order_id_
                  LEFT JOIN student_registration sr ON spo.user_id_ = sr.user_id_
@@ -200,6 +208,12 @@
           AND spo.type_ = 'APPLY'
           AND sr.music_group_id_ = #{musicGroupId}
           AND sr.music_group_status_ != 'QUIT' AND spod.id_ IS NOT NULL
+          <if test="deliveryStatus != null and deliveryStatus == 1">
+          	and spod.delivery_batch_no_ is NOT NULL
+          </if>
+          <if test="deliveryStatus != null and deliveryStatus == 0">
+          	and spod.delivery_batch_no_ is NULL
+          </if>
     </select>
 
     <!-- 查询订单详情 -->
@@ -380,7 +394,7 @@
     </select>
 
     <select id="queryByType" resultMap="StudentApplyInstrumentDto" parameterType="map">
-    	select spo.user_id_,spo.music_group_id_,spod.student_instrument_id_ from student_payment_order_detail spod left join student_payment_order spo on spod.payment_order_id_ = spo.id_ 
+    	select spo.user_id_,spo.music_group_id_,spo.calender_id_,spod.student_instrument_id_ from student_payment_order_detail spod left join student_payment_order spo on spod.payment_order_id_ = spo.id_ 
         WHERE spo.music_group_id_ = #{musicGroupId}
         AND spo.type_ = 'APPLY' and spo.status_ = 'SUCCESS' and spod.type_ = #{orderDetailType, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
     </select>
@@ -407,4 +421,12 @@
         UNION
         SELECT id_ FROM student_payment_order WHERE calender_id_ = #{calenderId} AND status_ = 'SUCCESS')c) AND spod.id_ IS NOT NULL
     </select>
+    
+    <select id="querySubjectChangeByMusicGroupId" resultMap="StudentPaymentOrderDetail">
+        SELECT spod.*,spo.user_id_ FROM student_payment_order_detail spod
+        LEFT JOIN  student_payment_order spo ON spo.id_ = spod.payment_order_id_
+        left join subject_change sc on sc.order_id_ = spo.id_
+        WHERE sc.music_group_id_ = #{musicGroupId}
+        AND spo.type_ = 'SUBJECT_CHANGE' and spo.status_ = 'SUCCESS' and spod.delivery_batch_no_ is NULL
+    </select>
 </mapper>

+ 126 - 4
mec-biz/src/main/resources/config/mybatis/SubjectChangeMapper.xml

@@ -49,6 +49,7 @@
         <result column="create_time_" property="createTime"/>
         <result column="update_time" property="updateTime"/>
         <result column="version_" property="version"/>
+        <result column="delivery_batch_no_" property="deliveryBatchNo"/>
     </resultMap>
     <sql id="Base_Column_List">
         <!--@mbg.generated-->
@@ -60,7 +61,7 @@
         original_cost_,change_musical_price_,change_accessories_, change_accessories_price_,change_cost_, goods_margin_,
         course_margin_,cost_margin_,sell_amount_,order_id_,order_no_,trans_no_,
         status_,payment_channel_,mer_no_,sell_time_,create_time_,
-        update_time,version_,tenant_id_
+        update_time,version_,tenant_id_,delivery_batch_no_
     </sql>
     <select id="get" parameterType="java.lang.Integer" resultMap="SubjectChange">
         <!--@mbg.generated-->
@@ -84,7 +85,7 @@
         change_subject_id_,change_course_fee_, change_musical_, change_musical_price_,
         change_accessories_, change_accessories_price_, change_cost_,goods_margin_,
         course_margin_,cost_margin_,sell_amount_,order_id_,
-        order_no_,trans_no_,status_,sell_time_, create_time_, update_time,version_,tenant_id_)
+        order_no_,trans_no_,status_,sell_time_, create_time_, update_time,version_,tenant_id_,delivery_batch_no_)
         values
         (#{studentId},#{eduTeacherId},#{organId},#{cooperationOrganId},#{musicGroupId},#{originalOrderId},#{originalSubjectId},#{originalCourseFee},
         #{originalMusical},
@@ -96,7 +97,7 @@
         #{changeMusicalPrice}, #{changeAccessories}, #{changeAccessoriesPrice},#{changeCost}, #{goodsMargin},
         #{courseMargin},#{costMargin},
         #{sellAmount},#{orderId},#{orderNo},#{transNo},#{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{sellTime},
-        #{createTime}, #{updateTime},#{version},#{tenantId})
+        #{createTime}, #{updateTime},#{version},#{tenantId},#{deliveryBatchNo})
     </insert>
     <update id="update" parameterType="com.ym.mec.biz.dal.entity.SubjectChange">
         <!--@mbg.generated-->
@@ -189,10 +190,114 @@
             <if test="updateTime != null">
                 update_time = #{updateTime},
             </if>
+            <if test="deliveryBatchNo != null">
+                delivery_batch_no_ = #{deliveryBatchNo},
+            </if>
             version_ = version_+1
         </set>
         where id_ = #{id} AND version_ = #{version} and tenant_id_ = #{tenantId}
     </update>
+    
+    <update id="batchUpdate" parameterType="java.util.List">
+        <foreach collection="list" item="item" index="index" open="" close="" separator=";">
+	        <!--@mbg.generated-->
+	        update subject_change
+	        <set>
+	            <if test="item.eduTeacherId !=null ">
+	                edu_teacher_id_ = #{item.eduTeacherId},
+	            </if>
+	            <if test="item.studentId != null">
+	                student_id_ = #{item.studentId},
+	            </if>
+	            <if test="item.organId != null">
+	                organ_id_ = #{item.organId},
+	            </if>
+	            <if test="item.musicGroupId != null">
+	                music_group_id_ = #{item.musicGroupId},
+	            </if>
+	            <if test="item.originalCourseFee != null">
+	                original_course_fee_ = #{item.originalCourseFee},
+	            </if>
+	            <if test="item.originalMusical != null">
+	                original_musical_ = #{item.originalMusical},
+	            </if>
+	            <if test="item.originalMusicalPrice != null">
+	                original_musical_price_ = #{item.originalMusicalPrice},
+	            </if>
+	            <if test="item.originalAccessories != null">
+	                original_accessories_ = #{item.originalAccessories},
+	            </if>
+	            <if test="item.originalAccessoriesPrice != null">
+	                original_accessories_price_ = #{item.originalAccessoriesPrice},
+	            </if>
+	            <if test="item.originalCost != null">
+	                original_cost_ = #{item.originalCost},
+	            </if>
+	            <if test="item.changeCourseFee != null">
+	                change_course_fee_ = #{item.changeCourseFee},
+	            </if>
+	            <if test="item.changeMusical != null">
+	                change_musical_ = #{item.changeMusical},
+	            </if>
+	            <if test="item.changeMusicalPrice != null">
+	                change_musical_price_ = #{item.changeMusicalPrice},
+	            </if>
+	            <if test="item.changeAccessories != null">
+	                change_accessories_ = #{item.changeAccessories},
+	            </if>
+	            <if test="item.changeAccessoriesPrice != null">
+	                change_accessories_price_ = #{item.changeAccessoriesPrice},
+	            </if>
+	            <if test="item.changeCost != null">
+	                change_cost_ = #{item.changeCost},
+	            </if>
+	            <if test="item.goodsMargin != null">
+	                goods_margin_ = #{item.goodsMargin},
+	            </if>
+	            <if test="item.courseMargin != null">
+	                course_margin_ = #{item.courseMargin},
+	            </if>
+	            <if test="item.costMargin != null">
+	                cost_margin_ = #{item.costMargin},
+	            </if>
+	            <if test="item.sellAmount != null">
+	                sell_amount_ = #{item.sellAmount},
+	            </if>
+	            <if test="item.orderId != null">
+	                order_id_ = #{item.orderId},
+	            </if>
+	            <if test="item.orderNo != null">
+	                order_no_ = #{item.orderNo},
+	            </if>
+	            <if test="item.transNo != null">
+	                trans_no_ = #{item.transNo},
+	            </if>
+	            <if test="item.status != null">
+	                status_ = #{item.status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
+	            </if>
+	            <if test="item.paymentChannel != null">
+	                payment_channel_=#{item.paymentChannel},
+	            </if>
+	            <if test="item.merNo != null">
+	                mer_no_ = #{item.merNo},
+	            </if>
+	            <if test="item.sellTime != null">
+	                sell_time_ = #{item.sellTime},
+	            </if>
+	            <if test="item.createTime != null">
+	                create_time_ = #{item.createTime},
+	            </if>
+	            <if test="item.updateTime != null">
+	                update_time = #{item.updateTime},
+	            </if>
+	            <if test="item.deliveryBatchNo != null">
+	                delivery_batch_no_ = #{item.deliveryBatchNo},
+	            </if>
+	            version_ = version_+1
+	        </set>
+	        where id_ = #{item.id} AND version_ = #{item.version} and tenant_id_ = #{item.tenantId}
+        </foreach>
+    </update>
 
     <select id="getStudentLastChange" resultMap="SubjectChange">
         SELECT *
@@ -258,6 +363,9 @@
             <if test="endTime != null">
                 AND sc.sell_time_ &lt;= #{endTime}
             </if>
+            <if test="deliveryBatchNo != null">
+                AND sc.delivery_batch_no_ = #{deliveryBatchNo}
+            </if>
         </where>
     </sql>
     <select id="queryCount" resultType="int">
@@ -272,10 +380,16 @@
                GROUP_CONCAT(sc.change_musical_)       trans_no_,
                GROUP_CONCAT(sc.change_accessories_)   change_accessories_
         FROM subject_change sc
-                 LEFT JOIN student_registration sr ON sc.student_id_ = sr.user_id_
+                 LEFT JOIN student_registration sr ON sc.student_id_ = sr.user_id_ and sc.music_group_id_ = sr.music_group_id_
         WHERE sc.music_group_id_ = #{musicGroupId}
           AND sc.status_ = 2
           AND sr.music_group_status_ != 'QUIT'
+          <if test="deliveryStatus != null and deliveryStatus == 1">
+          	and sc.delivery_batch_no_ is NOT NULL
+          </if>
+          <if test="deliveryStatus != null and deliveryStatus == 0">
+          	and sc.delivery_batch_no_ is NULL
+          </if>
         GROUP BY sc.music_group_id_
     </select>
     <resultMap id="SubjectChangeDto" type="com.ym.mec.biz.dal.entity.SubjectChange" extends="SubjectChange">
@@ -317,6 +431,7 @@
           AND status_ = 2
         GROUP BY student_id_
     </select>
+
     
     <select id="getTotalCourseMargin" resultType="java.math.BigDecimal">
         SELECT SUM(course_margin_)
@@ -325,4 +440,11 @@
           AND status_ = 2
         GROUP BY music_group_id_
     </select>
+    
+    <select id="queryWaitDeliveryList" resultMap="SubjectChange">
+        SELECT * FROM subject_change
+        WHERE music_group_id_ = #{musicGroupId}
+          AND status_ = 2 and delivery_batch_no_ is NULL
+    </select>
+    
 </mapper>

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

@@ -1269,8 +1269,8 @@ public class ExportController extends BaseController {
     @ApiOperation(value = "导出乐器采购清单")
     @PostMapping("order/musicalListExport")
     @PreAuthorize("@pcs.hasPermissions('order/musicalListExport')")
-    public void musicalListExport(HttpServletResponse response, String musicGroupId) throws IOException {
-        List<Goods> musicalList = studentPaymentOrderDetailService.getMusicalList(musicGroupId);
+    public void musicalListExport(HttpServletResponse response, String musicGroupId, int deliveryStatus) throws IOException {
+        List<Goods> musicalList = studentPaymentOrderDetailService.getMusicalList(musicGroupId, deliveryStatus);
         if (musicalList == null) {
             throw new BizException("数据集为空");
         }
@@ -1303,8 +1303,8 @@ public class ExportController extends BaseController {
     @ApiOperation(value = "导出学员采购清单明细")
     @PostMapping("order/musicalListDetailExport")
     @PreAuthorize("@pcs.hasPermissions('order/musicalListDetailExport')")
-    public void musicalListDetailExport(HttpServletResponse response, String musicGroupId) throws IOException {
-        List<MusicalListDetailDto> musicalList = studentPaymentOrderDetailService.getMusicalListDetail(musicGroupId, null);
+    public void musicalListDetailExport(HttpServletResponse response, String musicGroupId, int deliveryStatus) throws IOException {
+        List<MusicalListDetailDto> musicalList = studentPaymentOrderDetailService.getMusicalListDetail(musicGroupId, deliveryStatus);
         if (musicalList.size() > 50000) {
             throw new BizException("数据集太大,不能导出.最大数据集不能超过50000");
         }

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

@@ -28,9 +28,9 @@ import com.ym.mec.biz.dal.entity.MusicMemberDto;
 import com.ym.mec.biz.dal.entity.StudentRegistration;
 import com.ym.mec.biz.dal.page.MusicGroupQueryInfo;
 import com.ym.mec.biz.dal.page.MusicMemberQueryInfo;
+import com.ym.mec.biz.dal.vo.MusicGroupDeliveryVo;
 import com.ym.mec.biz.service.MusicGroupService;
 import com.ym.mec.biz.service.OrganizationService;
-import com.ym.mec.biz.service.SysEmployeePositionService;
 import com.ym.mec.biz.service.SysUserService;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.entity.HttpResponseResult;
@@ -331,7 +331,7 @@ public class MusicGroupController extends BaseController {
 	@ApiOperation(value = "确认发放乐器")
 	@PostMapping("/takeEffectOfinstrumentInsurance")
 	@PreAuthorize("@pcs.hasPermissions('musicGroup/takeEffectOfinstrumentInsurance')")
-	public HttpResponseResult takeEffectOfinstrumentInsurance(String musicGroupId) {
-		return succeed(musicGroupService.takeEffectOfinstrumentInsurance(musicGroupId));
+	public HttpResponseResult takeEffectOfinstrumentInsurance(@RequestBody MusicGroupDeliveryVo musicGroupDeliveryVo) {
+		return succeed(musicGroupService.confirmDelivery(sysUserService.getUserId(), musicGroupDeliveryVo));
 	}
 }

+ 83 - 0
mec-web/src/main/java/com/ym/mec/web/controller/MusicGroupShippingAddressController.java

@@ -0,0 +1,83 @@
+package com.ym.mec.web.controller;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+
+import java.util.Date;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.MediaType;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+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.entity.MusicGroupShippingAddress;
+import com.ym.mec.biz.dal.page.MusicGroupShippingAddressQueryInfo;
+import com.ym.mec.biz.service.MusicGroupShippingAddressService;
+import com.ym.mec.common.controller.BaseController;
+import com.ym.mec.common.entity.HttpResponseResult;
+import com.ym.mec.common.page.PageInfo;
+import com.yonge.log.model.AuditLogAnnotation;
+
+@Api(tags = "乐团收货地址")
+@RestController
+@RequestMapping("musicGroupShippingAddress")
+public class MusicGroupShippingAddressController extends BaseController {
+
+	@Autowired
+	private MusicGroupShippingAddressService musicGroupShippingAddressService;
+
+	@ApiOperation(value = "查询所有收货地址列表")
+	@GetMapping(value = "/queryPage", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
+	@PreAuthorize("@pcs.hasPermissions('musicGroupShippingAddress/queryPage')")
+	public HttpResponseResult<PageInfo<MusicGroupShippingAddress>> findAll(MusicGroupShippingAddressQueryInfo queryInfo) {
+
+		return succeed(musicGroupShippingAddressService.queryPage(queryInfo));
+	}
+
+	@ApiOperation(value = "查询所有收货地址列表")
+	@GetMapping(value = "/query", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
+	@PreAuthorize("@pcs.hasPermissions('musicGroupShippingAddress/query')")
+	public HttpResponseResult<MusicGroupShippingAddress> query(Integer id) {
+		return succeed(musicGroupShippingAddressService.get(id));
+	}
+
+	@ApiOperation("新增")
+	@PostMapping(value = "/add", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
+	@AuditLogAnnotation(operateName = "乐团收货地址新增", interfaceURL = "musicGroupShippingAddress/add")
+	@PreAuthorize("@pcs.hasPermissions('musicGroupShippingAddress/add')")
+	public Object add(@RequestBody MusicGroupShippingAddress shippingAddress) {
+		Date date = new Date();
+		shippingAddress.setUpdateTime(date);
+		shippingAddress.setCreateTime(date);
+		shippingAddress.setDelFlag(0);
+		return succeed(musicGroupShippingAddressService.insert(shippingAddress));
+	}
+
+	@ApiOperation("修改")
+	@PostMapping(value = "/update", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
+	@AuditLogAnnotation(operateName = "乐团收货地址修改", interfaceURL = "musicGroupShippingAddress/update")
+	@PreAuthorize("@pcs.hasPermissions('musicGroupShippingAddress/update')")
+	public Object update(@RequestBody MusicGroupShippingAddress shippingAddress) {
+		Date date = new Date();
+		shippingAddress.setUpdateTime(date);
+		MusicGroupShippingAddress originNewsInfo = musicGroupShippingAddressService.get(shippingAddress.getId());
+		if (originNewsInfo == null) {
+			return failed("请求参数错误");
+		}
+
+		return succeed(musicGroupShippingAddressService.update(shippingAddress));
+	}
+
+	@ApiOperation("删除")
+	@PostMapping(value = "/delete", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
+	@AuditLogAnnotation(operateName = "删除收货地址", interfaceURL = "musicGroupShippingAddress/delete")
+	@PreAuthorize("@pcs.hasPermissions('musicGroupShippingAddress/delete')")
+	public Object delete(Integer id) {
+
+		return succeed(musicGroupShippingAddressService.delete(id));
+	}
+}

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

@@ -123,9 +123,9 @@ public class StudentPaymentOrderController extends BaseController {
     @ApiOperation(value = "获取乐器采购清单")
     @GetMapping("/getMusicalList")
     @PreAuthorize("@pcs.hasPermissions('order/getMusicalList')")
-    @ApiImplicitParams({@ApiImplicitParam(name = "musicGroupId", value = "乐团id", required = true, dataType = "String")})
-    public Object getMusicalList(String musicGroupId) {
-        return succeed(studentPaymentOrderDetailService.getMusicalList(musicGroupId));
+    @ApiImplicitParams({@ApiImplicitParam(name = "musicGroupId", value = "乐团id", required = true, dataType = "String"),@ApiImplicitParam(name = "deliveryStatus", value = "发货状态(1:已发货 0:未发货)", required = true, dataType = "String")})
+    public Object getMusicalList(String musicGroupId,int deliveryStatus) {
+        return succeed(studentPaymentOrderDetailService.getMusicalList(musicGroupId, deliveryStatus));
     }
 
     @ApiOperation(value = "乐器清单确认")