From 03351657cad50c72565f182b8cf194242181000a Mon Sep 17 00:00:00 2001 From: winter Date: Sat, 27 Apr 2024 11:46:11 +0800 Subject: [PATCH] fix contract bill --- .../contract/WxPropertyContractController.java | 11 +++++++++++ .../com/iformall/domain/po/WxPropertyContract.java | 10 ++++++++++ .../iformall/service/helper/WxRentContractHelper.java | 2 +- .../service/impl/WxRentContractServiceImpl.java | 8 ++++---- 4 files changed, 26 insertions(+), 5 deletions(-) diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxPropertyContractController.java b/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxPropertyContractController.java index de3c6cfb8..06f7096f6 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxPropertyContractController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxPropertyContractController.java @@ -11,6 +11,7 @@ import com.iformall.domain.po.MallUserInfo; import com.iformall.domain.po.WxBillProperty; import com.iformall.domain.po.WxMerchant; import com.iformall.domain.po.WxPropertyContract; +import com.iformall.domain.po.WxRentContract; import com.iformall.domain.po.WxUserDataRule; import com.iformall.domain.po.base.BaseEntity.SortField; import com.iformall.enums.*; @@ -164,6 +165,7 @@ public class WxPropertyContractController extends WxContractBaseController { MallUserInfo user = getUser(); wxPropertyContract.updateTenantInfo(user); wxPropertyContract.setAdjustPeriodHandle(); + wxPropertyContract.calcutePrice(); Integer contractType = wxRentPropertyContractService.getContractType(wxPropertyContract.getRentShopType(), wxPropertyContract.getOperationType(), EnumContractType.PROPERTY.getCode()); wxPropertyContract.setContractType(contractType); if(wxPropertyContract.getRentStartType()!=null && wxPropertyContract.getRentStartType().equals(EnumRentStartType.STARTTIME.getCode())){ @@ -196,6 +198,15 @@ public class WxPropertyContractController extends WxContractBaseController { } + /** + * 计算价格 + */ + @PostMapping("calcutePrice") + public ResultData calcutePrice(@RequestBody WxPropertyContract wxPropertyContract) { + wxPropertyContract.calcutePrice(); + return new ResultData(wxPropertyContract.getPrice()); + } + @GetMapping("/findById") @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) public ResultData findById(Long id) { diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxPropertyContract.java b/mallinkService/src/main/java/com/iformall/domain/po/WxPropertyContract.java index c0dd0ff2e..2256e39a6 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxPropertyContract.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxPropertyContract.java @@ -10,10 +10,14 @@ import lombok.Data; import lombok.EqualsAndHashCode; import lombok.ToString; +import java.math.BigDecimal; +import java.math.RoundingMode; import java.util.Date; import java.util.List; import java.util.Map; +import org.apache.commons.lang3.StringUtils; + /** * @author gongbiao */ @@ -222,6 +226,12 @@ public class WxPropertyContract extends TenantEntity { this.adjustPeriod = EnumRentContractAdjustPeriod.ADJUST_PERIOD_DAY.getCode(); } } + + public void calcutePrice() { + if (StringUtils.isNoneBlank(this.rentArea) && StringUtils.isNotBlank(this.rentPrice)) { + this.price = new BigDecimal(this.rentArea).multiply(new BigDecimal(this.rentPrice)).setScale(this.decimalSize, RoundingMode.HALF_UP).toPlainString(); + } + } @io.swagger.annotations.ApiModelProperty(value = "合同类型", name = "contractType") private Integer contractType; diff --git a/mallinkService/src/main/java/com/iformall/service/helper/WxRentContractHelper.java b/mallinkService/src/main/java/com/iformall/service/helper/WxRentContractHelper.java index f866378f6..bdf378c4c 100644 --- a/mallinkService/src/main/java/com/iformall/service/helper/WxRentContractHelper.java +++ b/mallinkService/src/main/java/com/iformall/service/helper/WxRentContractHelper.java @@ -210,7 +210,7 @@ public class WxRentContractHelper { String[] revenuePriceArrs = new String[size]; if (wxRentContract.getType().equals(EnumRentContractType.RENT_BY_AREA_AND_JOINT.getCode())) { String _revenuePriceD = new BigDecimal(wxRentContract.getRevenue()).multiply(new BigDecimal(wxRentContract.getPayRatio())) - .divide(new BigDecimal(100)).setScale(wxRentContract.getDecimalSize(), RoundingMode.HALF_UP).toPlainString(); + .divide(new BigDecimal(10000)).setScale(wxRentContract.getDecimalSize(), RoundingMode.HALF_UP).toPlainString(); revenuePriceArrs[0] = _revenuePriceD; BigDecimal revenuePriceD = new BigDecimal(_revenuePriceD); //联营扣点调整比率 diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java index d403cf0f0..647418c69 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java @@ -2564,12 +2564,12 @@ public class WxRentContractServiceImpl implements WxRentContractService { BigDecimal rentPrice = new BigDecimal(priceRent); //保底 if (wxRentContract.getRevenue() != null) { - double revenue = new BigDecimal(wxRentContract.getRevenue()) - .divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); - result.put("revenue", revenue); +// double revenue = new BigDecimal(wxRentContract.getRevenue()) +// .divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); + result.put("revenue", wxRentContract.getRevenue()); result.put("revenueUpper", PriceUtil.digitUppercase(revenue)); } else { - result.put("revenue", 0); + result.put("revenue", "0"); result.put("revenueUpper", PriceUtil.digitUppercase(0)); } if (!wxRentContract.getType().equals(EnumRentContractType.RENT_BY_JOINT.getCode())) {