| @@ -23,9 +23,11 @@ import com.simple.service.WxOrderService; | |||||
| import com.simple.service.WxPayOrderService; | import com.simple.service.WxPayOrderService; | ||||
| import com.simple.utils.*; | import com.simple.utils.*; | ||||
| import io.swagger.models.auth.In; | import io.swagger.models.auth.In; | ||||
| import jdk.nashorn.internal.ir.IdentNode; | |||||
| import me.chanjar.weixin.common.error.WxErrorException; | import me.chanjar.weixin.common.error.WxErrorException; | ||||
| import org.apache.commons.lang3.StringUtils; | import org.apache.commons.lang3.StringUtils; | ||||
| import org.apache.log4j.Logger; | import org.apache.log4j.Logger; | ||||
| import org.omg.PortableInterceptor.SYSTEM_EXCEPTION; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
| import com.simple.common.IdWorker; | import com.simple.common.IdWorker; | ||||
| @@ -154,8 +156,8 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { | |||||
| record.setShare(isShare.getCode()); | record.setShare(isShare.getCode()); | ||||
| if (isShare == EnumPayShare.YES) { | 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); | record.setShareAmount(share_amount); | ||||
| } | } | ||||
| @@ -914,4 +916,12 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { | |||||
| throw new MallinkException(ErrorCode.TEMPLATE_SEND_FAILED); | 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); | |||||
| } | |||||
| } | } | ||||