Przeglądaj źródła

Merge remote-tracking branch 'origin/master'

zouxuan 4 lat temu
rodzic
commit
313e495fd7

+ 14 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/MusicGroupPaymentStudentCourseDetailDao.java

@@ -71,4 +71,18 @@ public interface MusicGroupPaymentStudentCourseDetailDao extends BaseDAO<Long, M
      * @return
      */
     int deleteByMusicGroupPaymentCalenderId(Long musicGroupPaymentCalenderId);
+
+    /**
+     * 删除信息
+     * @param musicGroupPaymentCalenderDetailIdList
+     * @return
+     */
+    int deleteByMusicGroupPaymentCalenderDetailId(List<Long> musicGroupPaymentCalenderDetailIdList);
+    
+    /**
+     * 查询对象
+     * @param musicGroupPaymentCalenderDetailIdList
+     * @return
+     */
+    List<MusicGroupPaymentStudentCourseDetail> queryByMusicGroupPaymentStudentCourseDetailId(List<Long> musicGroupPaymentCalenderDetailIdList);
 }

+ 7 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentPaymentRouteOrderDao.java

@@ -78,4 +78,11 @@ public interface StudentPaymentRouteOrderDao extends BaseDAO<Long, StudentPaymen
      * @return
      */
     BigDecimal sumAmountByCalenderId(Long calenderId);
+
+    /**
+     * 更换订单号获取
+     * @param orderNo
+     * @return
+     */
+    StudentPaymentRouteOrder getByOrderNo(String orderNo);
 }

+ 11 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/OutOrderInfoDto.java

@@ -17,6 +17,9 @@ public class OutOrderInfoDto {
     @ApiModelProperty(value = "销售收入",required = true)
     private BigDecimal goodsAmount = BigDecimal.ZERO;
 
+    @ApiModelProperty(value = "缴费单号",required = true)
+    private Long calenderId;
+
     private List<SellOrder> sellOrders;
 
     public List<SellOrder> getSellOrders() {
@@ -50,4 +53,12 @@ public class OutOrderInfoDto {
     public void setStudentPaymentOrder(com.ym.mec.biz.dal.entity.StudentPaymentOrder studentPaymentOrder) {
         StudentPaymentOrder = studentPaymentOrder;
     }
+
+    public Long getCalenderId() {
+        return calenderId;
+    }
+
+    public void setCalenderId(Long calenderId) {
+        this.calenderId = calenderId;
+    }
 }

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

@@ -67,7 +67,7 @@ public interface MusicGroupPaymentCalenderDetailService extends BaseService<Long
 
     /**
      * 批量删除缴费信息
-     * @param musicGroupPaymentCalenderIds
+     * @param musicGroupPaymentCalenderDetailIds
      */
-    void batchDel(String musicGroupPaymentCalenderIds);
+    void batchDel(String musicGroupPaymentCalenderDetailIds);
 }

+ 48 - 18
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderDetailServiceImpl.java

@@ -1,10 +1,39 @@
 package com.ym.mec.biz.service.impl;
 
-import com.ym.mec.biz.dal.dao.*;
+import static com.ym.mec.biz.dal.entity.MusicGroupStudentFee.PaymentStatus.NON_PAYMENT;
+
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import com.ym.mec.biz.dal.dao.MusicGroupDao;
+import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderCourseSettingsDao;
+import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderDao;
+import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderDetailDao;
+import com.ym.mec.biz.dal.dao.MusicGroupPaymentStudentCourseDetailDao;
+import com.ym.mec.biz.dal.dao.MusicGroupStudentFeeDao;
+import com.ym.mec.biz.dal.dao.SysConfigDao;
 import com.ym.mec.biz.dal.dto.FeeStudentDto;
 import com.ym.mec.biz.dal.dto.SimpleUserDto;
-import com.ym.mec.biz.dal.entity.*;
+import com.ym.mec.biz.dal.entity.MusicGroup;
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender;
 import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentCalenderStatusEnum;
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderCourseSettings;
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderDetail;
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentStudentCourseDetail;
+import com.ym.mec.biz.dal.entity.MusicGroupStudentFee;
 import com.ym.mec.biz.dal.entity.MusicGroupStudentFee.PaymentStatus;
 import com.ym.mec.biz.dal.enums.MessageTypeEnum;
 import com.ym.mec.biz.service.MusicGroupPaymentCalenderDetailService;
@@ -16,18 +45,6 @@ import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
 import com.ym.mec.thirdparty.message.MessageSenderPluginContext;
 
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import java.math.BigDecimal;
-import java.util.*;
-import java.util.stream.Collectors;
-
-import static com.ym.mec.biz.dal.entity.MusicGroupStudentFee.PaymentStatus.NON_PAYMENT;
-import static com.ym.mec.biz.dal.entity.MusicGroupStudentFee.PaymentStatus.PAID_COMPLETED;
-
 @Service
 public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<Long, MusicGroupPaymentCalenderDetail>  implements MusicGroupPaymentCalenderDetailService {
 	
@@ -428,15 +445,28 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
 
 	@Override
 	@Transactional(rollbackFor = Exception.class)
-	public void batchDel(String musicGroupPaymentCalenderIds) {
-		List<MusicGroupPaymentCalenderDetail> details = musicGroupPaymentCalenderDetailDao.queryListByIds(musicGroupPaymentCalenderIds);
+	public void batchDel(String musicGroupPaymentCalenderDetailIds) {
+		List<MusicGroupPaymentCalenderDetail> details = musicGroupPaymentCalenderDetailDao.queryListByIds(musicGroupPaymentCalenderDetailIds);
 		if(details == null || details.size() == 0){
 			throw new BizException("删除失败: 数据不可为空");
 		}
-		long count = details.stream().filter(e -> e.getPaymentStatus() == PAID_COMPLETED).count();
+		//是否已缴费
+		long count = details.stream().filter(e -> e.getPaymentStatus() != NON_PAYMENT).count();
 		if(count > 0){
 			throw new BizException("删除失败: 存在已缴费的学员");
 		}
-		musicGroupPaymentCalenderDetailDao.batchDel(musicGroupPaymentCalenderIds);
+		List<Long> musicGroupPaymentCalenderDetailIdList = new ArrayList<Long>();
+		for(String s : musicGroupPaymentCalenderDetailIds.split(",")){
+			musicGroupPaymentCalenderDetailIdList.add(Long.parseLong(s));
+		}
+		//是否已排课
+		List<MusicGroupPaymentStudentCourseDetail> musicGroupPaymentStudentCourseDetailList = musicGroupPaymentStudentCourseDetailDao.queryByMusicGroupPaymentStudentCourseDetailId(musicGroupPaymentCalenderDetailIdList);
+		count = musicGroupPaymentStudentCourseDetailList.stream().filter(e -> e.getUsedCourseMinutes() > 0).count();
+		if(count > 0){
+			throw new BizException("删除失败:存在已排课的学员");
+		}
+		
+		musicGroupPaymentCalenderDetailDao.batchDel(musicGroupPaymentCalenderDetailIds);
+		musicGroupPaymentStudentCourseDetailDao.deleteByMusicGroupPaymentCalenderDetailId(musicGroupPaymentCalenderDetailIdList);
 	}
 }

+ 10 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderServiceImpl.java

@@ -1225,8 +1225,8 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 		if (calender == null) {
 			throw new BizException("缴费信息不存在");
 		}
-		if (calender.getStatus() != PaymentCalenderStatusEnum.AUDITING || calender.getStatus() != PaymentCalenderStatusEnum.NO
-				|| calender.getStatus() != PaymentCalenderStatusEnum.REJECT) {
+		if (calender.getStatus() != PaymentCalenderStatusEnum.AUDITING && calender.getStatus() != PaymentCalenderStatusEnum.NO
+				&& calender.getStatus() != PaymentCalenderStatusEnum.REJECT) {
 			throw new BizException("删除失败,只有[审核中]、[拒绝]或[未开启缴费]状态才能删除");
 		}
 
@@ -1238,6 +1238,14 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 			if (paidList.size() > 0) {
 				throw new BizException("存在已缴费的学生不能删除");
 			}
+			
+			List<Long> calenderDetailIdList = musicGroupPaymentCalenderDetailList.stream().map(cd -> cd.getId()).collect(Collectors.toList());
+			//是否已排课
+			List<MusicGroupPaymentStudentCourseDetail> musicGroupPaymentStudentCourseDetailList = musicGroupPaymentStudentCourseDetailDao.queryByMusicGroupPaymentStudentCourseDetailId(calenderDetailIdList);
+			long count = musicGroupPaymentStudentCourseDetailList.stream().filter(e -> e.getUsedCourseMinutes() > 0).count();
+			if(count > 0){
+				throw new BizException("存在已排课的学员");
+			}
 		}
 
 		musicGroupPaymentCalenderDao.delete(id);

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

@@ -188,7 +188,7 @@
 		DELETE FROM music_group_payment_calender_detail WHERE id_ = #{id}
 	</delete>
 	<delete id="batchDel">
-		DELETE FROM music_group_payment_calender_detail WHERE FIND_IN_SET(id_,#{musicGroupPaymentCalenderIds})
+		DELETE FROM music_group_payment_calender_detail WHERE FIND_IN_SET(id_,#{musicGroupPaymentCalenderIdDetails})
 	</delete>
 	<delete id="deleteByUserIdAndMusicGroupId">
 		DELETE FROM music_group_payment_calender_detail

+ 22 - 0
mec-biz/src/main/resources/config/mybatis/MusicGroupPaymentStudentCourseDetailMapper.xml

@@ -126,6 +126,28 @@
         DELETE FROM music_group_payment_student_course_detail
         WHERE music_group_payment_calender_id_ = #{musicGroupPaymentCalenderId}
     </delete>
+    
+    <delete id="deleteByMusicGroupPaymentCalenderDetailId">
+        DELETE FROM music_group_payment_student_course_detail
+        <where>
+        	music_group_payment_calender_detail_id_ in    
+		    <foreach item="item" collection="list" separator="," open="(" close=")" index="">    
+		      #{item}    
+		    </foreach>
+        </where>
+    </delete>
+
+    <!-- 分页查询 -->
+    <select id="queryByMusicGroupPaymentStudentCourseDetailId" resultMap="MusicGroupPaymentStudentCourseDetail"
+            parameterType="map">
+        SELECT * FROM music_group_payment_student_course_detail 
+        <where>
+        	music_group_payment_calender_detail_id_ in    
+		    <foreach item="item" collection="list" separator="," open="(" close=")" index="">    
+		      #{item}    
+		    </foreach>
+        </where>
+    </select>
 
     <!-- 分页查询 -->
     <select id="queryPage" resultMap="MusicGroupPaymentStudentCourseDetail"

+ 3 - 0
mec-biz/src/main/resources/config/mybatis/StudentPaymentRouteOrderMapper.xml

@@ -380,5 +380,8 @@
     <select id="sumAmountByCalenderId" resultType="java.math.BigDecimal">
         SELECT IF(SUM(route_amount_) IS NULL,0, SUM(route_amount_)) FROM student_payment_route_order WHERE calender_id_ = #{calenderId} AND audit_status_='PASS'
     </select>
+    <select id="getByOrderNo" resultMap="StudentPaymentRouteOrder">
+        SELECT * FROM student_payment_route_order WHERE order_no_ = #{orderNo} LIMIT 1
+    </select>
 
 </mapper>

+ 6 - 2
mec-web/src/main/java/com/ym/mec/web/controller/MusicGroupPaymentCalenderDetailController.java

@@ -5,6 +5,7 @@ import io.swagger.annotations.ApiOperation;
 
 import java.math.BigDecimal;
 
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -69,8 +70,11 @@ public class MusicGroupPaymentCalenderDetailController extends BaseController {
     @ApiOperation(value = "批量删除缴费信息")
     @PostMapping("/batchDel")
     @PreAuthorize("@pcs.hasPermissions('musicGroupPaymentCalenderDetail/batchDel')")
-    public Object batchDel(String musicGroupPaymentCalenderIds) {
-        musicGroupPaymentCalenderDetailService.batchDel(musicGroupPaymentCalenderIds);
+    public Object batchDel(String musicGroupPaymentCalenderDetailIds) {
+    	if(StringUtils.isBlank(musicGroupPaymentCalenderDetailIds)){
+    		return failed("请求参数错误");
+    	}
+        musicGroupPaymentCalenderDetailService.batchDel(musicGroupPaymentCalenderDetailIds);
         return succeed();
     }
 

+ 8 - 1
mec-web/src/main/java/com/ym/mec/web/controller/StudentPaymentRouteOrderController.java

@@ -1,5 +1,7 @@
 package com.ym.mec.web.controller;
 
+import com.ym.mec.biz.dal.dao.StudentPaymentRouteOrderDao;
+import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 
@@ -52,6 +54,8 @@ public class StudentPaymentRouteOrderController extends BaseController {
     private StudentPaymentOrderDao studentPaymentOrderDao;
     @Autowired
     private SellOrderDao sellOrderDao;
+    @Autowired
+    private StudentPaymentRouteOrderDao studentPaymentRouteOrderDao;
 
     @ApiOperation(value = "财务订单列表")
     @GetMapping("/finance")
@@ -181,7 +185,10 @@ public class StudentPaymentRouteOrderController extends BaseController {
     @PreAuthorize("@pcs.hasPermissions('routeOrder/getOrderInfo')")
     public HttpResponseResult<OutOrderInfoDto> getOrderInfo(Long orderId) {
         OutOrderInfoDto outOrderInfoDto = new OutOrderInfoDto();
-        outOrderInfoDto.setStudentPaymentOrder(studentPaymentOrderDao.get(orderId));
+        StudentPaymentOrder order = studentPaymentOrderDao.get(orderId);
+        outOrderInfoDto.setStudentPaymentOrder(order);
+        StudentPaymentRouteOrder routeOrder = studentPaymentRouteOrderDao.getByOrderNo(order.getOrderNo());
+        outOrderInfoDto.setCalenderId(routeOrder.getCalenderId());
         List<SellOrder> sellOrders = sellOrderDao.getOrderSellOrder(orderId);
         BigDecimal goodsAmount = sellOrders.stream().map(SellOrder::getActualAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
         BigDecimal serviceAmount = outOrderInfoDto.getStudentPaymentOrder().getActualAmount().subtract(goodsAmount);