From 77a46c1952fc08a0a240d99273add44e71c6adba Mon Sep 17 00:00:00 2001 From: "Stormeye.Wu" Date: Fri, 7 Sep 2018 14:42:53 +0800 Subject: [PATCH] =?UTF-8?q?[=E5=BE=AE=E4=BF=A1=E6=89=8B=E7=BB=AD=E8=B4=B9]?= =?UTF-8?q?[=E4=BF=AE=E5=A4=8D]=E6=89=8B=E7=BB=AD=E8=B4=B9=E9=87=8D?= =?UTF-8?q?=E6=96=B0=E8=AE=A1=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../simple/service/impl/WxPayOrderServiceImpl.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/mallinkService/src/main/java/com/simple/service/impl/WxPayOrderServiceImpl.java b/mallinkService/src/main/java/com/simple/service/impl/WxPayOrderServiceImpl.java index 32d5cf9e2..753c3ba7e 100644 --- a/mallinkService/src/main/java/com/simple/service/impl/WxPayOrderServiceImpl.java +++ b/mallinkService/src/main/java/com/simple/service/impl/WxPayOrderServiceImpl.java @@ -23,9 +23,11 @@ import com.simple.service.WxOrderService; import com.simple.service.WxPayOrderService; import com.simple.utils.*; import io.swagger.models.auth.In; +import jdk.nashorn.internal.ir.IdentNode; import me.chanjar.weixin.common.error.WxErrorException; import org.apache.commons.lang3.StringUtils; import org.apache.log4j.Logger; +import org.omg.PortableInterceptor.SYSTEM_EXCEPTION; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.simple.common.IdWorker; @@ -154,8 +156,8 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { record.setShare(isShare.getCode()); if (isShare == EnumPayShare.YES) { // 分账金额 - Float dChargeFee = record.getPayAmount()*1.0f*payAccount.getRate()/1000; - Integer share_amount = record.getPayAmount() - Math.round(dChargeFee.floatValue()); + Double dChargeFee = Math.ceil(record.getPayAmount()*1.0D*payAccount.getRate()/1000); + Integer share_amount = record.getPayAmount() - dChargeFee.intValue(); record.setShareAmount(share_amount); } @@ -914,4 +916,12 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { throw new MallinkException(ErrorCode.TEMPLATE_SEND_FAILED); } } + + public static void main(String [] args) { + Integer v = 500; + Integer rate = 6; + Double dChargeFee = Math.ceil(v*1.0D*6/1000); + Integer share_amount = v - dChargeFee.intValue(); + System.out.println("share value " + share_amount); + } }