| @@ -11,6 +11,7 @@ import com.iformall.domain.po.MallUserInfo; | |||||
| import com.iformall.domain.po.WxBillProperty; | import com.iformall.domain.po.WxBillProperty; | ||||
| import com.iformall.domain.po.WxMerchant; | import com.iformall.domain.po.WxMerchant; | ||||
| import com.iformall.domain.po.WxPropertyContract; | import com.iformall.domain.po.WxPropertyContract; | ||||
| import com.iformall.domain.po.WxRentContract; | |||||
| import com.iformall.domain.po.WxUserDataRule; | import com.iformall.domain.po.WxUserDataRule; | ||||
| import com.iformall.domain.po.base.BaseEntity.SortField; | import com.iformall.domain.po.base.BaseEntity.SortField; | ||||
| import com.iformall.enums.*; | import com.iformall.enums.*; | ||||
| @@ -164,6 +165,7 @@ public class WxPropertyContractController extends WxContractBaseController { | |||||
| MallUserInfo user = getUser(); | MallUserInfo user = getUser(); | ||||
| wxPropertyContract.updateTenantInfo(user); | wxPropertyContract.updateTenantInfo(user); | ||||
| wxPropertyContract.setAdjustPeriodHandle(); | wxPropertyContract.setAdjustPeriodHandle(); | ||||
| wxPropertyContract.calcutePrice(); | |||||
| Integer contractType = wxRentPropertyContractService.getContractType(wxPropertyContract.getRentShopType(), wxPropertyContract.getOperationType(), EnumContractType.PROPERTY.getCode()); | Integer contractType = wxRentPropertyContractService.getContractType(wxPropertyContract.getRentShopType(), wxPropertyContract.getOperationType(), EnumContractType.PROPERTY.getCode()); | ||||
| wxPropertyContract.setContractType(contractType); | wxPropertyContract.setContractType(contractType); | ||||
| if(wxPropertyContract.getRentStartType()!=null && wxPropertyContract.getRentStartType().equals(EnumRentStartType.STARTTIME.getCode())){ | 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") | @GetMapping("/findById") | ||||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | ||||
| public ResultData findById(Long id) { | public ResultData findById(Long id) { | ||||
| @@ -10,10 +10,14 @@ import lombok.Data; | |||||
| import lombok.EqualsAndHashCode; | import lombok.EqualsAndHashCode; | ||||
| import lombok.ToString; | import lombok.ToString; | ||||
| import java.math.BigDecimal; | |||||
| import java.math.RoundingMode; | |||||
| import java.util.Date; | import java.util.Date; | ||||
| import java.util.List; | import java.util.List; | ||||
| import java.util.Map; | import java.util.Map; | ||||
| import org.apache.commons.lang3.StringUtils; | |||||
| /** | /** | ||||
| * @author gongbiao | * @author gongbiao | ||||
| */ | */ | ||||
| @@ -222,6 +226,12 @@ public class WxPropertyContract extends TenantEntity { | |||||
| this.adjustPeriod = EnumRentContractAdjustPeriod.ADJUST_PERIOD_DAY.getCode(); | 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") | @io.swagger.annotations.ApiModelProperty(value = "合同类型", name = "contractType") | ||||
| private Integer contractType; | private Integer contractType; | ||||
| @@ -210,7 +210,7 @@ public class WxRentContractHelper { | |||||
| String[] revenuePriceArrs = new String[size]; | String[] revenuePriceArrs = new String[size]; | ||||
| if (wxRentContract.getType().equals(EnumRentContractType.RENT_BY_AREA_AND_JOINT.getCode())) { | if (wxRentContract.getType().equals(EnumRentContractType.RENT_BY_AREA_AND_JOINT.getCode())) { | ||||
| String _revenuePriceD = new BigDecimal(wxRentContract.getRevenue()).multiply(new BigDecimal(wxRentContract.getPayRatio())) | 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; | revenuePriceArrs[0] = _revenuePriceD; | ||||
| BigDecimal revenuePriceD = new BigDecimal(_revenuePriceD); | BigDecimal revenuePriceD = new BigDecimal(_revenuePriceD); | ||||
| //联营扣点调整比率 | //联营扣点调整比率 | ||||
| @@ -2564,12 +2564,12 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| BigDecimal rentPrice = new BigDecimal(priceRent); | BigDecimal rentPrice = new BigDecimal(priceRent); | ||||
| //保底 | //保底 | ||||
| if (wxRentContract.getRevenue() != null) { | 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)); | result.put("revenueUpper", PriceUtil.digitUppercase(revenue)); | ||||
| } else { | } else { | ||||
| result.put("revenue", 0); | |||||
| result.put("revenue", "0"); | |||||
| result.put("revenueUpper", PriceUtil.digitUppercase(0)); | result.put("revenueUpper", PriceUtil.digitUppercase(0)); | ||||
| } | } | ||||
| if (!wxRentContract.getType().equals(EnumRentContractType.RENT_BY_JOINT.getCode())) { | if (!wxRentContract.getType().equals(EnumRentContractType.RENT_BY_JOINT.getCode())) { | ||||