Browse Source

Merge branch 'vip_price_827' into online1

yonge 3 years ago
parent
commit
cb4587aeea

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

@@ -20,6 +20,7 @@ import com.ym.mec.util.collection.MapUtil;
 import com.ym.mec.util.date.DateUtil;
 import com.ym.mec.util.excel.POIUtil;
 import com.ym.mec.util.upload.UploadUtil;
+
 import org.apache.commons.lang3.StringUtils;
 import org.apache.poi.hssf.usermodel.HSSFWorkbook;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -361,6 +362,9 @@ public class ExportServiceImpl implements ExportService {
             cooperationOrganMap = cooperationOrgans.stream().collect(Collectors.toMap(CooperationOrgan::getId, CooperationOrgan::getName));
         }
         long i = 1;
+        
+        Map<String,BigDecimal> serviceChargeMap = new HashMap<String, BigDecimal>();
+        
         for (StudentPaymentOrderExportDto row : studentPaymentOrderExportDtos) {
             if (row.getActualAmount() == null) {
                 row.setActualAmount(BigDecimal.ZERO);
@@ -375,17 +379,35 @@ public class ExportServiceImpl implements ExportService {
                 row.setMemo("");
             }
             BigDecimal transferFee = BigDecimal.ZERO;
+            BigDecimal currentFee = BigDecimal.ZERO;
+            BigDecimal totalFee = BigDecimal.ZERO;
             if (row.getPaymentChannel() != null && row.getPaymentChannel().equals("ADAPAY")) {
-                FeeFlagNumDto countFeeFlagNum = studentPaymentRouteOrderDao.getCountFeeFlagNum(row.getOrderNo());
-                if (countFeeFlagNum.getTotalNum() > countFeeFlagNum.getYesNum() && row.getFeeFlag().equals("Y")) {
+                //FeeFlagNumDto countFeeFlagNum = studentPaymentRouteOrderDao.getCountFeeFlagNum(row.getOrderNo());
+                
+                transferFee = serviceChargeMap.get(row.getOrderNo());
+                if(transferFee == null){
+                	transferFee = BigDecimal.ZERO;
+                }
+                
+                currentFee = row.getRouteAmount().multiply(new BigDecimal("0.28")).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP);
+                totalFee = row.getActualAmount().multiply(new BigDecimal("0.28")).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP);
+                if(totalFee.subtract(transferFee.add(currentFee)).doubleValue() < 0){
+                	currentFee = totalFee.subtract(transferFee);
+                	serviceChargeMap.put(row.getOrderNo(), totalFee);
+                }else{
+                	serviceChargeMap.put(row.getOrderNo(), transferFee.add(currentFee));
+                }
+                
+                /*if (countFeeFlagNum.getTotalNum() > countFeeFlagNum.getYesNum() && row.getFeeFlag().equals("Y")) {
                     transferFee = row.getActualAmount().multiply(new BigDecimal("0.28")).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP);
                 }
                 if (countFeeFlagNum.getTotalNum().equals(countFeeFlagNum.getYesNum())) {
                     BigDecimal totalTransferFee = row.getActualAmount().multiply(new BigDecimal("0.28")).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP);
                     transferFee = totalTransferFee.multiply(row.getRouteAmount()).divide(row.getActualAmount(), 2, BigDecimal.ROUND_HALF_UP);
-                }
+                }*/
+                
             }
-            row.setTransferFee(transferFee);
+            row.setTransferFee(currentFee);
 
             String goodsName = "";
             if (row.getOrderDetailList() != null) {

+ 15 - 5
mec-biz/src/main/java/com/ym/mec/biz/service/impl/VipGroupServiceImpl.java

@@ -3491,7 +3491,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 				throw new BizException("已有学员购买了该课程组,无法添加,请走学员购买流程!");
 			}
 		}
-
+		
 		VipGroupDefaultClassesUnitPrice vipGroupDefaultClassesUnitPrice = vipGroupDefaultClassesUnitPriceDao.getByVipGroup(vipGroup.getId());
 		if(Objects.isNull(vipGroupDefaultClassesUnitPrice)){
 			throw new BizException("课程单价设置错误");
@@ -3503,14 +3503,24 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 			throw new BizException("当前课程组已经停止,无法进行添加学员操作。");
 		}
 
+        Integer exitStudentNum = classGroupStudentMapperDao.countClassGroupExitStudentNum(classGroup.getId(), studentIds);
+		if(exitStudentNum>0){
+			throw new BizException("选择的学生中存在此课程中已存在的学生");
+		}
+
         Integer studentNum = classGroupStudentMapperDao.countClassGroupStudentNum(classGroup.getId());
         if(studentNum.compareTo(classGroup.getExpectStudentNum())>=0){
             throw new BizException("该班级人数已达上限");
         }
-
-        Integer exitStudentNum = classGroupStudentMapperDao.countClassGroupExitStudentNum(classGroup.getId(), studentIds);
-		if(exitStudentNum>0){
-			throw new BizException("选择的学生中存在此课程中已存在的学生");
+		
+		VipGroupCategory vipGroupCategory = vipGroupCategoryDao.get(vipGroup.getVipGroupCategoryId());
+		
+		if(vipGroupCategory == null){
+			throw new BizException("请修改VIP课课程形式");
+		}
+		
+		if(vipGroupCategory.getStudentNum() < (studentCoursePriceMap.size() + studentNum)){
+			throw new BizException("学生人数超过{}人,请调整", vipGroupCategory.getStudentNum());
 		}
 
 		VipGroupActivity vipGroupActivity = null;