Bläddra i källkod

update:手续费

yonge 3 år sedan
förälder
incheckning
ef9f930c36

+ 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) {