From a2d8b56aca3cc046b9947b7800c8f63498473b90 Mon Sep 17 00:00:00 2001 From: winter Date: Tue, 23 Apr 2024 13:56:35 +0800 Subject: [PATCH] fix --- .../contract/WxContractBaseController.java | 2 + .../contract/WxRentContractController.java | 122 +++++++------- .../resources/db/migration/V202405001.sql | 35 ++++ .../com/iformall/domain/po/WxBillDeposit.java | 14 +- .../com/iformall/domain/po/WxBillRent.java | 60 +++---- .../iformall/domain/po/WxBillRentManage.java | 82 +++++----- .../domain/po/WxPropertyContract.java | 2 + .../iformall/domain/po/WxRentContract.java | 65 ++++---- .../java/com/iformall/domain/vo/RatioVo.java | 2 +- .../service/helper/WxRentContractHelper.java | 132 ++++++++------- .../impl/WxRentContractServiceImpl.java | 152 +++++++++--------- .../java/com/iformall/utils/PriceUtilV2.java | 11 ++ .../resources/mapper/WxBillDepositMapper.xml | 10 +- .../mapper/WxBillRentManageMapper.xml | 10 +- .../resources/mapper/WxBillRentMapper.xml | 16 +- .../mapper/WxPropertyContractMapper.xml | 3 +- .../resources/mapper/WxRentContractMapper.xml | 10 +- 17 files changed, 398 insertions(+), 330 deletions(-) create mode 100644 mallinkAdmin/src/main/resources/db/migration/V202405001.sql diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxContractBaseController.java b/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxContractBaseController.java index ac012701c..c9f7bf37d 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxContractBaseController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxContractBaseController.java @@ -13,6 +13,7 @@ import com.iformall.service.WxFlowService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RestController; +import java.math.BigDecimal; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -118,4 +119,5 @@ public class WxContractBaseController extends BaseController{ } return false; } + } diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxRentContractController.java b/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxRentContractController.java index 9e7fb5545..d526d29aa 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxRentContractController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxRentContractController.java @@ -93,68 +93,68 @@ public class WxRentContractController extends WxContractBaseController { } } wrc.setFlowHas(hasFlow); - String renInfo = wrc.getRentInfo(); - if (!StringUtils.isBlank(renInfo)) { - String floorName = ""; - String buildingName = ""; - String shopNumber = ""; - JSONArray arrays = JSONArray.parseArray(renInfo); - if ( null != arrays) { -// List floorIds = new ArrayList(); -// List buildIds = new ArrayList(); -// List shopIds = new ArrayList(); -// for (int i = 0 ; i < arrays.size(); i ++) { -// JSONObject o = arrays.getJSONObject(i); -// try { -// floorIds.add(Long.parseLong(o.getString("floor"))); -// }catch(Exception e) { -// floorName = floorName +","+o.getString("floor"); -// } -// try { -// buildIds.add(Long.parseLong(o.getString("building"))); -// }catch(Exception e) { -// buildingName = buildingName + ","+ o.getString("building"); -// } -// try { -// shopIds.add(Long.parseLong(o.getString("id"))); -// }catch(Exception e) { -// shopNumber = shopNumber +","+o.getString("id"); -// } -// } -// -// WxMallBuilding bq = new WxMallBuilding(); -// bq.setIds(buildIds); -// PageInfo bpage = buildingService.listAsPage(bq, 1, 1000); -// if (null != bpage && null != bpage.getList()) { -// for (WxMallBuilding wmb : bpage.getList()) { -// buildingName = buildingName +"," + wmb.getBuildingName(); -// } -// } +// String renInfo = wrc.getRentInfo(); +// if (!StringUtils.isBlank(renInfo)) { +// String floorName = ""; +// String buildingName = ""; +// String shopNumber = ""; +// JSONArray arrays = JSONArray.parseArray(renInfo); +// if ( null != arrays) { +//// List floorIds = new ArrayList(); +//// List buildIds = new ArrayList(); +//// List shopIds = new ArrayList(); +//// for (int i = 0 ; i < arrays.size(); i ++) { +//// JSONObject o = arrays.getJSONObject(i); +//// try { +//// floorIds.add(Long.parseLong(o.getString("floor"))); +//// }catch(Exception e) { +//// floorName = floorName +","+o.getString("floor"); +//// } +//// try { +//// buildIds.add(Long.parseLong(o.getString("building"))); +//// }catch(Exception e) { +//// buildingName = buildingName + ","+ o.getString("building"); +//// } +//// try { +//// shopIds.add(Long.parseLong(o.getString("id"))); +//// }catch(Exception e) { +//// shopNumber = shopNumber +","+o.getString("id"); +//// } +//// } +//// +//// WxMallBuilding bq = new WxMallBuilding(); +//// bq.setIds(buildIds); +//// PageInfo bpage = buildingService.listAsPage(bq, 1, 1000); +//// if (null != bpage && null != bpage.getList()) { +//// for (WxMallBuilding wmb : bpage.getList()) { +//// buildingName = buildingName +"," + wmb.getBuildingName(); +//// } +//// } +//// +//// WxMallFloor fq = new WxMallFloor(); +//// fq.setIds(floorIds); +//// PageInfo fpage = floorService.listAsPage(fq, 1, 1000); +//// if (null != fpage && null != fpage.getList()) { +//// for (WxMallFloor wmf : fpage.getList()) { +//// floorName = floorName +"," + wmf.getFloorName(); +//// } +//// } +//// +//// WxShop ws = new WxShop(); +//// ws.setIds(shopIds); +//// PageInfo spage = wxShopService.listAsPage(ws, 1, 1000); +//// if (null != spage && null != spage.getList()) { +//// for (WxShop shop : spage.getList()) { +//// shopNumber = shopNumber+","+shop.getShopNumber(); +//// } +//// } // -// WxMallFloor fq = new WxMallFloor(); -// fq.setIds(floorIds); -// PageInfo fpage = floorService.listAsPage(fq, 1, 1000); -// if (null != fpage && null != fpage.getList()) { -// for (WxMallFloor wmf : fpage.getList()) { -// floorName = floorName +"," + wmf.getFloorName(); -// } -// } -// -// WxShop ws = new WxShop(); -// ws.setIds(shopIds); -// PageInfo spage = wxShopService.listAsPage(ws, 1, 1000); -// if (null != spage && null != spage.getList()) { -// for (WxShop shop : spage.getList()) { -// shopNumber = shopNumber+","+shop.getShopNumber(); -// } -// } - - wrc.setFloorName(floorName); - wrc.setBuildingName(buildingName); - wrc.setShopNumber(shopNumber); - } - - } +// wrc.setFloorName(floorName); +// wrc.setBuildingName(buildingName); +// wrc.setShopNumber(shopNumber); +// } +// +// } } } diff --git a/mallinkAdmin/src/main/resources/db/migration/V202405001.sql b/mallinkAdmin/src/main/resources/db/migration/V202405001.sql new file mode 100644 index 000000000..529ac0513 --- /dev/null +++ b/mallinkAdmin/src/main/resources/db/migration/V202405001.sql @@ -0,0 +1,35 @@ +ALTER TABLE `wx_rent_contract` ADD COLUMN decimal_size INT(11) NOT NULL DEFAULT 2 COMMENT '金额小数点位数' AFTER `scope_metre`; +ALTER TABLE `wx_property_contract` ADD COLUMN decimal_size INT(11) NOT NULL DEFAULT 2 COMMENT '金额小数点位数' AFTER `merchant_id`; + +ALTER TABLE `wx_rent_contract` modify COLUMN price varchar(30); +ALTER TABLE `wx_rent_contract` MODIFY COLUMN `deposit` VARCHAR(30); +ALTER TABLE `wx_rent_contract` MODIFY COLUMN `revenue` VARCHAR(30); + + +ALTER TABLE wx_bill_rent MODIFY COLUMN `receive_pay` VARCHAR(30); +ALTER TABLE wx_bill_rent MODIFY COLUMN `pay` VARCHAR(30); +ALTER TABLE wx_bill_rent MODIFY COLUMN `owe` VARCHAR(30); +ALTER TABLE wx_bill_rent MODIFY COLUMN `need_pay` VARCHAR(30); +ALTER TABLE wx_bill_rent MODIFY COLUMN `bussiness_manage_fee_need_pay` VARCHAR(30); +ALTER TABLE wx_bill_rent MODIFY COLUMN `operating_manage_fee_need_pay` VARCHAR(30); +ALTER TABLE wx_bill_rent MODIFY COLUMN `revenue` VARCHAR(30); +ALTER TABLE wx_bill_rent MODIFY COLUMN `late_pay_price` VARCHAR(30); +ALTER TABLE wx_bill_rent MODIFY COLUMN `join_rent_price` VARCHAR(30); +ALTER TABLE wx_bill_rent MODIFY COLUMN `service_charge_pay` VARCHAR(30); +ALTER TABLE wx_bill_rent MODIFY COLUMN `service_charge_pay` VARCHAR(30); + + +ALTER TABLE wx_bill_rent_deposit MODIFY COLUMN `receive_pay` VARCHAR(30); +ALTER TABLE wx_bill_rent_deposit MODIFY COLUMN `pay` VARCHAR(30); +ALTER TABLE wx_bill_rent_deposit MODIFY COLUMN `owe` VARCHAR(30); +ALTER TABLE wx_bill_rent_deposit MODIFY COLUMN `need_pay` VARCHAR(30); +ALTER TABLE wx_bill_rent_deposit MODIFY COLUMN `return_price` VARCHAR(30); +ALTER TABLE wx_bill_rent_deposit MODIFY COLUMN `service_charge_pay` VARCHAR(30); + + +ALTER TABLE wx_bill_rent_manage MODIFY COLUMN `receive_pay` VARCHAR(30); +ALTER TABLE wx_bill_rent_manage MODIFY COLUMN `pay` VARCHAR(30); +ALTER TABLE wx_bill_rent_manage MODIFY COLUMN `owe` VARCHAR(30); +ALTER TABLE wx_bill_rent_manage MODIFY COLUMN `need_pay` VARCHAR(30); +ALTER TABLE wx_bill_rent_manage MODIFY COLUMN `late_pay_price` VARCHAR(30); +ALTER TABLE wx_bill_rent_manage MODIFY COLUMN `service_charge_pay` VARCHAR(30); \ No newline at end of file diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxBillDeposit.java b/mallinkService/src/main/java/com/iformall/domain/po/WxBillDeposit.java index 947c8959d..c57d6cd0c 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxBillDeposit.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxBillDeposit.java @@ -28,9 +28,9 @@ public class WxBillDeposit extends TenantEntity { @io.swagger.annotations.ApiModelProperty(value="租金合同ID",name="rentContractId") private Long rentContractId; @io.swagger.annotations.ApiModelProperty(value="实际应收金额",name="receivePay") - private Long receivePay; + private String receivePay; @io.swagger.annotations.ApiModelProperty(value="实收金额",name="pay") - private Long pay; + private String pay; @io.swagger.annotations.ApiModelProperty(value="收款日期",name="receiveDate") private Date receiveDate; @io.swagger.annotations.ApiModelProperty(value="到账日期",name="payDate") @@ -41,7 +41,7 @@ public class WxBillDeposit extends TenantEntity { private Long expiredDay; @io.swagger.annotations.ApiModelProperty(value="欠缴",name="owe") - private Long owe; + private String owe; @io.swagger.annotations.ApiModelProperty(value = "账单状态1欠缴2待缴3已结清4未到期5已退还", name = "status") private Integer status; @io.swagger.annotations.ApiModelProperty(value = "账单审核状态EnumBillRentApplyStatus", name = "applyStatus") @@ -53,7 +53,7 @@ public class WxBillDeposit extends TenantEntity { @io.swagger.annotations.ApiModelProperty(value="是否删除 是1否0 未到期不显示",name="isDel") private Integer isDel; @io.swagger.annotations.ApiModelProperty(value="应收金额",name="needPay") - private Long needPay; + private String needPay; @io.swagger.annotations.ApiModelProperty(value="商户ID",name="merchantId") private Long merchantId; @io.swagger.annotations.ApiModelProperty(value="账号ID",name="userId") @@ -73,7 +73,7 @@ public class WxBillDeposit extends TenantEntity { private Integer rentShopType; @io.swagger.annotations.ApiModelProperty(value = "退还金额", name = "returnPrice") - private Integer returnPrice; + private String returnPrice; @io.swagger.annotations.ApiModelProperty(value = "商铺信息", name = "shopInfo") private String shopInfo; @@ -85,11 +85,11 @@ public class WxBillDeposit extends TenantEntity { private Integer freeze; @io.swagger.annotations.ApiModelProperty(value = "手续费", name = "serviceChargePay") - private Integer serviceChargePay; + private String serviceChargePay; @io.swagger.annotations.ApiModelProperty(value="实际应收金额",name="realReceivePay") @TableField(exist = false) - private Long realReceivePay; + private String realReceivePay; @TableField(exist = false) private String serviceChargePayBefore; diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxBillRent.java b/mallinkService/src/main/java/com/iformall/domain/po/WxBillRent.java index daf4c5375..1997c84a0 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxBillRent.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxBillRent.java @@ -35,25 +35,25 @@ public class WxBillRent extends TenantEntity { private Long rentContractId; @io.swagger.annotations.ApiModelProperty(value="应收金额",name="receivePay") - private Long receivePay; + private String receivePay; - public String getReceivePayStr() { - return new BigDecimal(receivePay == null ? 0 : receivePay).divide(new BigDecimal(100)).toPlainString(); - } +// public String getReceivePayStr() { +// return new BigDecimal(receivePay == null ? 0 : receivePay).divide(new BigDecimal(100)).toPlainString(); +// } @TableField(exist = false) private String receivePayStr; - public String getPayStr() { - return new BigDecimal(pay == null ? 0 : pay).divide(new BigDecimal(100)).toPlainString(); - } +// public String getPayStr() { +// return new BigDecimal(pay == null ? 0 : pay).divide(new BigDecimal(100)).toPlainString(); +// } @Excel(name = "实收账款(元)", width = 20, orderNum = "9") @TableField(exist = false) private String payStr; @io.swagger.annotations.ApiModelProperty(value="实收金额",name="pay") - private Long pay; + private String pay; @Excel(name = "缴款截止日期", format = "yyyy-MM-dd", width = 20, orderNum = "13") @io.swagger.annotations.ApiModelProperty(value="收款日期",name="receiveDate") @@ -71,11 +71,11 @@ public class WxBillRent extends TenantEntity { private Long expiredDay; @io.swagger.annotations.ApiModelProperty(value="欠缴",name="owe") - private Long owe; + private String owe; - public String getOweStr() { - return new BigDecimal(owe == null ? 0 : owe).divide(new BigDecimal(100)).toPlainString(); - } +// public String getOweStr() { +// return new BigDecimal(owe == null ? 0 : owe).divide(new BigDecimal(100)).toPlainString(); +// } @Excel(name = "欠缴金额(元)", width = 20, orderNum = "11") @TableField(exist = false) @@ -102,9 +102,9 @@ public class WxBillRent extends TenantEntity { @TableField(exist = false) private String contractNeedPayStr; - public String getContractNeedPayStr() { - return new BigDecimal(contractNeedPay == null ? 0 : contractNeedPay).divide(new BigDecimal(100)).toPlainString(); - } +// public String getContractNeedPayStr() { +// return new BigDecimal(contractNeedPay == null ? 0 : contractNeedPay).divide(new BigDecimal(100)).toPlainString(); +// } @io.swagger.annotations.ApiModelProperty(value = "合同应收明细", name = "rentPriceInfo") private String rentPriceInfo; @@ -130,13 +130,13 @@ public class WxBillRent extends TenantEntity { } @io.swagger.annotations.ApiModelProperty(value="应收金额",name="needPay") - private Long needPay; + private String needPay; @io.swagger.annotations.ApiModelProperty(value="商业管理费应收金额",name="bussinessManageFeeNeedPay") - private Long bussinessManageFeeNeedPay; + private String bussinessManageFeeNeedPay; @io.swagger.annotations.ApiModelProperty(value="运营管理费应收金额",name="operatingManageFeeNeedPay") - private Long operatingManageFeeNeedPay; + private String operatingManageFeeNeedPay; @io.swagger.annotations.ApiModelProperty(value="商户ID",name="merchantId") private Long merchantId; @@ -166,7 +166,7 @@ public class WxBillRent extends TenantEntity { private Integer rentShopType; @io.swagger.annotations.ApiModelProperty(value = "营业额", name = "revenue") - private Long revenue; + private String revenue; @io.swagger.annotations.ApiModelProperty(value = "滞纳金费率", name = "latePayRatio") private Integer latePayRatio; @@ -175,11 +175,11 @@ public class WxBillRent extends TenantEntity { private Date latePayTime; @io.swagger.annotations.ApiModelProperty(value = "滞纳金总额", name = "latePayPrice") - private Long latePayPrice; + private String latePayPrice; - public String getLatePayPriceStr() { - return new BigDecimal(latePayPrice == null ? 0 : latePayPrice).divide(new BigDecimal(100)).toPlainString(); - } +// public String getLatePayPriceStr() { +// return new BigDecimal(latePayPrice == null ? 0 : latePayPrice).divide(new BigDecimal(100)).toPlainString(); +// } @Excel(name = "滞纳金(元)", width = 20, orderNum = "12") @TableField(exist = false) @@ -220,7 +220,7 @@ public class WxBillRent extends TenantEntity { private Integer rentType; @TableField(exist = false) - private Long deposit; + private String deposit; @io.swagger.annotations.ApiModelProperty(value = "联营费率", name = "payRatio") private Long payRatio; @@ -244,7 +244,7 @@ public class WxBillRent extends TenantEntity { private Integer freeze; @io.swagger.annotations.ApiModelProperty(value = "联营租金", name = "joinRentPrice") - private Long joinRentPrice; + private String joinRentPrice; @@ -254,19 +254,19 @@ public class WxBillRent extends TenantEntity { private String serviceChargePayUpdate; @io.swagger.annotations.ApiModelProperty(value = "手续费", name = "serviceChargePay") - private Integer serviceChargePay; + private String serviceChargePay; @io.swagger.annotations.ApiModelProperty(value="实际应收金额",name="realReceivePay") @TableField(exist = false) - private Long realReceivePay; + private String realReceivePay; @Excel(name = "实际应收总金额(元)", width = 20, orderNum = "8") @TableField(exist = false) private String realReceivePayStr; - public String getRealReceivePayStr() { - return new BigDecimal(realReceivePay == null ? 0 : realReceivePay).divide(new BigDecimal(100)).toPlainString(); - } +// public String getRealReceivePayStr() { +// return new BigDecimal(realReceivePay == null ? 0 : realReceivePay).divide(new BigDecimal(100)).toPlainString(); +// } @io.swagger.annotations.ApiModelProperty(value="楼座号",name="building") diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxBillRentManage.java b/mallinkService/src/main/java/com/iformall/domain/po/WxBillRentManage.java index 04b7e1ad9..c3eed4fd4 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxBillRentManage.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxBillRentManage.java @@ -36,25 +36,26 @@ public class WxBillRentManage extends TenantEntity { private Long rentContractId; @io.swagger.annotations.ApiModelProperty(value="应收金额",name="receivePay") - private Long receivePay; + private String receivePay; - public String getReceivePayStr() { - return new BigDecimal(receivePay == null ? 0 : receivePay).divide(new BigDecimal(100)).toPlainString(); - } +// public String getReceivePayStr() { +// return new BigDecimal(receivePay == null ? 0 : receivePay).divide(new BigDecimal(100)).toPlainString(); +// } - @TableField(exist = false) - private String receivePayStr; +// @TableField(exist = false) +// private String receivePayStr; - public String getPayStr() { - return new BigDecimal(pay == null ? 0 : pay).divide(new BigDecimal(100)).toPlainString(); - } - - @Excel(name = "实收账款(元)", width = 20, orderNum = "9") - @TableField(exist = false) - private String payStr; +// public String getPayStr() { +// return new BigDecimal(pay == null ? 0 : pay).divide(new BigDecimal(100)).toPlainString(); +// } +// +// @Excel(name = "实收账款(元)", width = 20, orderNum = "9") +// @TableField(exist = false) +// private String payStr; @io.swagger.annotations.ApiModelProperty(value="实收金额",name="pay") - private Long pay; + @Excel(name = "实收账款(元)", width = 20, orderNum = "9") + private String pay; @Excel(name = "缴款截止日期", format = "yyyy-MM-dd", width = 20, orderNum = "13") @io.swagger.annotations.ApiModelProperty(value="收款日期",name="receiveDate") @@ -72,15 +73,16 @@ public class WxBillRentManage extends TenantEntity { private Long expiredDay; @io.swagger.annotations.ApiModelProperty(value="欠缴",name="owe") - private Long owe; - - public String getOweStr() { - return new BigDecimal(owe == null ? 0 : owe).divide(new BigDecimal(100)).toPlainString(); - } - @Excel(name = "欠缴金额(元)", width = 20, orderNum = "11") - @TableField(exist = false) - private String oweStr; + private String owe; + +// public String getOweStr() { +// return new BigDecimal(owe == null ? 0 : owe).divide(new BigDecimal(100)).toPlainString(); +// } +// +// @Excel(name = "欠缴金额(元)", width = 20, orderNum = "11") +// @TableField(exist = false) +// private String oweStr; @Excel(name = "状态", replace = {"欠缴_1", "待缴_2", "已结清_3", "未到期_4", "已退还_5", "失效_6"}, width = 20, orderNum = "10") @io.swagger.annotations.ApiModelProperty(value = "账单状态1欠缴2待缴3已结清4未到期", name = "status") @@ -97,7 +99,7 @@ public class WxBillRentManage extends TenantEntity { private Integer isDel; @io.swagger.annotations.ApiModelProperty(value="应收金额",name="needPay") - private Long needPay; + private String needPay; @io.swagger.annotations.ApiModelProperty(value="商户ID",name="merchantId") private Long merchantId; @@ -129,15 +131,16 @@ public class WxBillRentManage extends TenantEntity { private Date latePayTime; @io.swagger.annotations.ApiModelProperty(value = "滞纳金总额", name = "latePayPrice") - private Long latePayPrice; - - public String getLatePayPriceStr() { - return new BigDecimal(latePayPrice == null ? 0 : latePayPrice).divide(new BigDecimal(100)).toPlainString(); - } - @Excel(name = "滞纳金(元)", width = 20, orderNum = "12") - @TableField(exist = false) - private String latePayPriceStr; + private String latePayPrice; + +// public String getLatePayPriceStr() { +// return new BigDecimal(latePayPrice == null ? 0 : latePayPrice).divide(new BigDecimal(100)).toPlainString(); +// } +// +// @Excel(name = "滞纳金(元)", width = 20, orderNum = "12") +// @TableField(exist = false) +// private String latePayPriceStr; @SortColumn(column = "period") @io.swagger.annotations.ApiModelProperty(value = "账期", name = "period") @@ -172,19 +175,20 @@ public class WxBillRentManage extends TenantEntity { private String serviceChargePayUpdate; @io.swagger.annotations.ApiModelProperty(value = "手续费", name = "serviceChargePay") - private Integer serviceChargePay; + private String serviceChargePay; @io.swagger.annotations.ApiModelProperty(value="实际应收金额",name="realReceivePay") - @TableField(exist = false) - private Long realReceivePay; - @Excel(name = "实际应收总金额(元)", width = 20, orderNum = "8") @TableField(exist = false) - private String realReceivePayStr; + private String realReceivePay; - public String getRealReceivePayStr() { - return new BigDecimal(realReceivePay == null ? 0 : realReceivePay).divide(new BigDecimal(100)).toPlainString(); - } +// @Excel(name = "实际应收总金额(元)", width = 20, orderNum = "8") +// @TableField(exist = false) +// private String realReceivePayStr; +// +// public String getRealReceivePayStr() { +// return new BigDecimal(realReceivePay == null ? 0 : realReceivePay).divide(new BigDecimal(100)).toPlainString(); +// } @io.swagger.annotations.ApiModelProperty(value="管理费类型,EnumRentContractManageFeeType",name="manageFeeType") private Integer manageFeeType; 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 3978f6f96..e10ca6b88 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxPropertyContract.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxPropertyContract.java @@ -39,6 +39,8 @@ public class WxPropertyContract extends TenantEntity { private String brandName; + @io.swagger.annotations.ApiModelProperty(value = "金额小数点位数", name = "decimalSize") + private Integer decimalSize; @io.swagger.annotations.ApiModelProperty(value="商户",name="merchantId") private Long merchantId; /*月租金/分成(分)**/ diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxRentContract.java b/mallinkService/src/main/java/com/iformall/domain/po/WxRentContract.java index 82eedeb03..91279f2be 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxRentContract.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxRentContract.java @@ -53,25 +53,25 @@ public class WxRentContract extends TenantEntity { @TableField(exist = false) private String buildArea; - @TableField(exist = false) - private String priceStr; - - public String getPriceStr() { - if(price!=null) { - priceStr = new BigDecimal(price).divide(new BigDecimal(100)).toString(); - } - return priceStr; - } - - @TableField(exist = false) - private String depositStr; - - public String getDepositStr() { - if(deposit!=null) { - depositStr = new BigDecimal(deposit).divide(new BigDecimal(100)).toString(); - } - return depositStr; - } +// @TableField(exist = false) +// private String priceStr; + +// public String getPriceStr() { +// if(price!=null) { +// priceStr = new BigDecimal(price).divide(new BigDecimal(100)).toString(); +// } +// return priceStr; +// } + +// @TableField(exist = false) +// private String depositStr; +// +// public String getDepositStr() { +// if(deposit!=null) { +// depositStr = new BigDecimal(deposit).divide(new BigDecimal(100)).toString(); +// } +// return depositStr; +// } @TableField(exist = false) @SortColumn(column = "allPeriod") @@ -216,11 +216,12 @@ public class WxRentContract extends TenantEntity { // // 乙方税务登记地址 // private String taxpayerAdress; - + @io.swagger.annotations.ApiModelProperty(value = "金额小数点位数", name = "decimalSize") + private Integer decimalSize = 2 ; @io.swagger.annotations.ApiModelProperty(value = "商户", name = "merchantId") private Long merchantId; - @io.swagger.annotations.ApiModelProperty(value = "月租金/分成(分)", name = "price") - private Long price; + @io.swagger.annotations.ApiModelProperty(value = "月租金/分成(元)", name = "price") + private String price; @io.swagger.annotations.ApiModelProperty(value = "起租开始时间", name = "rentalStartDate") private Date rentalStartDate; @io.swagger.annotations.ApiModelProperty(value = "", name = "rentalEndDate") @@ -237,7 +238,7 @@ public class WxRentContract extends TenantEntity { private List statuss; @io.swagger.annotations.ApiModelProperty(value = "押金", name = "deposit") - private Long deposit; + private String deposit; // @io.swagger.annotations.ApiModelProperty(value = "押金详细", name = "depositInfo") // private String depositInfo; @@ -298,7 +299,7 @@ public class WxRentContract extends TenantEntity { private Integer payRatio; @io.swagger.annotations.ApiModelProperty(value = "保底营业额", name = "revenue") - private Long revenue; + private String revenue; @io.swagger.annotations.ApiModelProperty(value = "是否设置保底营业额", name = "revenueRatio") private Integer revenueRatio; @@ -350,8 +351,8 @@ public class WxRentContract extends TenantEntity { @io.swagger.annotations.ApiModelProperty(value = "审批时带的物业合同编号,租金+物业时用", name = "propertyId") private Long propertyId; - @io.swagger.annotations.ApiModelProperty(value = "租金信息", name = "rentInfo") - private String rentInfo; +// @io.swagger.annotations.ApiModelProperty(value = "租金信息", name = "rentInfo") +// private String rentInfo; @io.swagger.annotations.ApiModelProperty(value = "上传文件名", name = "fileNames") private String fileNames; @@ -441,13 +442,11 @@ public class WxRentContract extends TenantEntity { } } - public void setRentPriceHandle() { - if(StringUtils.isNotBlank(rentPrice)) { - rentPrice = new BigDecimal(rentPrice).multiply(new BigDecimal(100)).toPlainString(); - } else { - rentPrice = "0"; - } - } +// public void setRentPriceHandle() { +// if(StringUtils.isBlank(rentPrice)) { +// rentPrice = "0"; +// } +// } @io.swagger.annotations.ApiModelProperty(value = "合同类型", name = "contractType") diff --git a/mallinkService/src/main/java/com/iformall/domain/vo/RatioVo.java b/mallinkService/src/main/java/com/iformall/domain/vo/RatioVo.java index 493e63c9e..ff3260c63 100644 --- a/mallinkService/src/main/java/com/iformall/domain/vo/RatioVo.java +++ b/mallinkService/src/main/java/com/iformall/domain/vo/RatioVo.java @@ -7,7 +7,7 @@ public class RatioVo { //扣点率 private Integer ratio = 0; //金额 - private Long price = 0l; + private String price = "0"; private String useRatio = ""; } 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 e16ae3360..eb6fa77bd 100644 --- a/mallinkService/src/main/java/com/iformall/service/helper/WxRentContractHelper.java +++ b/mallinkService/src/main/java/com/iformall/service/helper/WxRentContractHelper.java @@ -25,7 +25,7 @@ import java.util.List; public class WxRentContractHelper { //计算商业管理费 - public static long[] calcuteBussinessManagementFee(WxRentContract wxRentContract) { + public static String[] calcuteBussinessManagementFee(WxRentContract wxRentContract) { if ("[]".equals(StringUtils.trimToEmpty(wxRentContract.getBussinessManagementFeeRatio()))) { return null; } @@ -34,7 +34,7 @@ public class WxRentContractHelper { } //计算营业管理费 - public static long[] calcuteOperatingManagementFee(WxRentContract wxRentContract) { + public static String[] calcuteOperatingManagementFee(WxRentContract wxRentContract) { if ("[]".equals(StringUtils.trimToEmpty(wxRentContract.getOperatingManagementFeeRatio()))) { return null; } @@ -43,13 +43,13 @@ public class WxRentContractHelper { } //计算除租金外其他可调整费项(按面积计算) - private static long[] calcuteOtherCanAdjustFeeByArea(WxRentContract wxRentContract,String fee,Integer ratioWay,String ratio,String feeField,String feeRatioField) { + private static String[] calcuteOtherCanAdjustFeeByArea(WxRentContract wxRentContract,String fee,Integer ratioWay,String ratio,String feeField,String feeRatioField) { if (wxRentContract.getType().equals(EnumRentContractType.RENT_BY_AREA.getCode()) || wxRentContract.getType().equals(EnumRentContractType.RENT_BY_AREA_AND_JOINT.getCode())) { if (wxRentContract.getRentInputWay().equals(EnumRentContractRentInputWay.PART.getCode())) { //第一年,根据面积来计算 JSONArray rentInfoArray = JSONArray.parseArray(wxRentContract.getRentInfo()); - long[] priceArr = new long[rentInfoArray.size()]; + String[] priceArr = new String[rentInfoArray.size()]; for (int i = 0; i < rentInfoArray.size(); i++) { JSONObject rentInfoObject = rentInfoArray.getJSONObject(i); //商业管理费单价 @@ -62,9 +62,10 @@ public class WxRentContractHelper { if (rentArea == null || rentArea.equalsIgnoreCase("NaN")) { rentArea = "0"; } - priceArr[i] = new BigDecimal(priceStr).multiply(new BigDecimal(rentArea)).multiply(new BigDecimal(100)).longValue(); + priceArr[i] = new BigDecimal(priceStr).multiply(new BigDecimal(rentArea)).toPlainString(); } - List priceList = computeRatioByShop(rentInfoArray,wxRentContract.getBussinessManagementFeeRatioWay(),priceArr,feeRatioField); + + List priceList = computeRatioByShop(wxRentContract.getDecimalSize(),rentInfoArray,wxRentContract.getBussinessManagementFeeRatioWay(),priceArr,feeRatioField); if (null != priceList) { return calcuteRatioByPart(priceList, feeRatioField); }else { @@ -78,8 +79,8 @@ public class WxRentContractHelper { if (rentArea == null || rentArea.equalsIgnoreCase("NaN")) { rentArea = "0"; } - Long ratioFirstYearPrice = new BigDecimal(fee).multiply(new BigDecimal(100)).multiply(new BigDecimal(rentArea)).longValue(); - return calcuteRatioByJoin(ratioWay, ratio, ratioFirstYearPrice); + String ratioFirstYearPrice = new BigDecimal(fee).multiply(new BigDecimal(rentArea)).toPlainString(); + return calcuteRatioByJoin(wxRentContract.getDecimalSize(),ratioWay, ratio, ratioFirstYearPrice); } } return null; @@ -87,13 +88,13 @@ public class WxRentContractHelper { //计算年租金 - public static long[] calcuteRentPrice(WxRentContract wxRentContract) { + public static String[] calcuteRentPrice(WxRentContract wxRentContract) { if (wxRentContract.getType().equals(EnumRentContractType.RENT_BY_AREA.getCode()) || wxRentContract.getType().equals(EnumRentContractType.RENT_BY_AREA_AND_JOINT.getCode())) { if (wxRentContract.getRentInputWay().equals(EnumRentContractRentInputWay.PART.getCode())) { //计算每年租金基数(按面积,分铺录入) //第一年 - List priceList = computeRentPriceByShop(wxRentContract); + List priceList = computeRentPriceByShop(wxRentContract); return calcuteRatioByPart(priceList, "adjustRatio"); }else { return calcuteRentPriceByJoin(wxRentContract); @@ -103,27 +104,27 @@ public class WxRentContractHelper { } //计算单个店铺每年租金基数(分铺录入) - public static List computeRentPriceByShop(WxRentContract wxRentContract) { + public static List computeRentPriceByShop(WxRentContract wxRentContract) { JSONArray rentInfoArray = JSONArray.parseArray(wxRentContract.getRentInfo()); - long[] priceArr = new long[rentInfoArray.size()]; + String[] priceArr = new String[rentInfoArray.size()]; for (int i = 0; i < rentInfoArray.size(); i++) { JSONObject rentInfoObject = rentInfoArray.getJSONObject(i); String priceStr = rentInfoObject.getString("price"); if (priceStr == null || priceStr.equalsIgnoreCase("NaN")) { priceStr = "0"; } - priceArr[i] = new BigDecimal(priceStr).multiply(new BigDecimal(100)).longValue(); + priceArr[i] = priceStr; } - return computeRatioByShop(rentInfoArray,wxRentContract.getAdjustRatioWay(),priceArr,"adjustRatio"); + return computeRatioByShop(wxRentContract.getDecimalSize(),rentInfoArray,wxRentContract.getAdjustRatioWay(),priceArr,"adjustRatio"); } //计算每年租金基数(合铺录入) - private static long[] calcuteRentPriceByJoin(WxRentContract wxRentContract) { + private static String[] calcuteRentPriceByJoin(WxRentContract wxRentContract) { String adjustRatio = wxRentContract.getAdjustRatio(); List integers = JSONArray.parseArray(adjustRatio, Integer.class); integers.add(0, 0); int size = integers.size(); - long[] priceArrs = new long[size]; + String[] priceArrs = new String[size]; priceArrs[0] = wxRentContract.getPrice(); BigDecimal priceD = new BigDecimal(wxRentContract.getPrice()); @@ -138,32 +139,34 @@ public class WxRentContractHelper { revenueYears.add(0,0L); //联营扣点取高单独计算联营扣点调整。 - long[] revenuePriceArrs = calcuteRevenuePriceByRentAreaJoint(wxRentContract,revenueYears,size); + String[] revenuePriceArrs = calcuteRevenuePriceByRentAreaJoint(wxRentContract,revenueYears,size); if (wxRentContract.getAdjustRatioWay().equals(EnumRentContractAdjustRatioWay.RATIO.getCode())) { for (int i = 1; i < size; i++) { BigDecimal divide = priceD.multiply(new BigDecimal(integers.get(i))).divide(new BigDecimal(10000)); priceD = priceD.add(divide); - priceArrs[i] = priceD.setScale(0, RoundingMode.HALF_EVEN).longValue(); + priceArrs[i] = priceD.setScale(wxRentContract.getDecimalSize(), RoundingMode.HALF_EVEN).toPlainString(); } } else if (wxRentContract.getAdjustRatioWay().equals(EnumRentContractAdjustRatioWay.MONEY.getCode())) { for (int i = 1; i < size; i++) { priceD = priceD.add(new BigDecimal(integers.get(i))); - priceArrs[i] = priceD.setScale(0, RoundingMode.HALF_EVEN).longValue(); + priceArrs[i] = priceD.setScale(wxRentContract.getDecimalSize(), RoundingMode.HALF_EVEN).toPlainString(); } } else if (wxRentContract.getAdjustRatioWay().equals(EnumRentContractAdjustRatioWay.CUSTOM.getCode())){ for (int i = 1; i < size; i++) { if (wxRentContract.getType().equals(EnumRentContractType.RENT_BY_JOINT.getCode())) { if (EnumMissTimeType.YEAR.getCode().equals(wxRentContract.getBusDiscountTime())) { - priceArrs[i] = new BigDecimal(integers.get(i)).multiply(new BigDecimal(12)).setScale(0, RoundingMode.HALF_EVEN).longValue(); + priceArrs[i] = new BigDecimal(integers.get(i)).multiply(new BigDecimal(12)) + .setScale(wxRentContract.getDecimalSize(), RoundingMode.HALF_EVEN).toPlainString(); continue; } if (EnumMissTimeType.PERIOD.getCode().equals(wxRentContract.getBusDiscountTime())) { - priceArrs[i] = new BigDecimal(integers.get(i)).multiply(new BigDecimal(wxRentContract.getReceivePeriod())).setScale(0, RoundingMode.HALF_EVEN).longValue(); + priceArrs[i] = new BigDecimal(integers.get(i)).multiply(new BigDecimal(wxRentContract.getReceivePeriod())) + .setScale(wxRentContract.getDecimalSize(), RoundingMode.HALF_EVEN).toPlainString(); continue; } } - priceArrs[i] = new BigDecimal(integers.get(i)).setScale(0, RoundingMode.HALF_EVEN).longValue(); + priceArrs[i] = new BigDecimal(integers.get(i)).setScale(wxRentContract.getDecimalSize(), RoundingMode.HALF_EVEN).toPlainString(); } }else if (wxRentContract.getAdjustRatioWay().equals(EnumRentContractAdjustRatioWay.FIX_RATIO.getCode())){ for (int i = 1; i < size; i++) { @@ -176,22 +179,23 @@ public class WxRentContractHelper { } if (wxRentContract.getType().equals(EnumRentContractType.RENT_BY_JOINT.getCode())) { if (EnumMissTimeType.YEAR.getCode().equals(wxRentContract.getBusDiscountTime())) { - priceArrs[i] = _p.multiply(new BigDecimal(12)).setScale(0, RoundingMode.HALF_EVEN).longValue(); + priceArrs[i] = _p.multiply(new BigDecimal(12)).setScale(wxRentContract.getDecimalSize(), RoundingMode.HALF_EVEN).toPlainString(); continue; } if (EnumMissTimeType.PERIOD.getCode().equals(wxRentContract.getBusDiscountTime())) { - priceArrs[i] = _p.multiply(new BigDecimal(wxRentContract.getReceivePeriod())).setScale(0, RoundingMode.HALF_EVEN).longValue(); + priceArrs[i] = _p.multiply(new BigDecimal(wxRentContract.getReceivePeriod())) + .setScale(wxRentContract.getDecimalSize(), RoundingMode.HALF_EVEN).toPlainString(); continue; } } - priceArrs[i] = _p.setScale(0, RoundingMode.HALF_EVEN).longValue(); + priceArrs[i] = _p.setScale(wxRentContract.getDecimalSize(), RoundingMode.HALF_EVEN).toPlainString(); } } //租金和联营取高 if (wxRentContract.getType().equals(EnumRentContractType.RENT_BY_AREA_AND_JOINT.getCode())) { for (int i = 0 ; i < priceArrs.length; i ++) { - if (priceArrs[i] < revenuePriceArrs[i]) { + if (new BigDecimal(priceArrs[i]).compareTo(new BigDecimal(revenuePriceArrs[i])) < 0) { priceArrs[i] = revenuePriceArrs[i]; } } @@ -201,11 +205,12 @@ public class WxRentContractHelper { } //联营面积取高计算联营扣点调整。 - private static long[] calcuteRevenuePriceByRentAreaJoint(WxRentContract wxRentContract,List revenueYears,int size) { + private static String[] calcuteRevenuePriceByRentAreaJoint(WxRentContract wxRentContract,List revenueYears,int size) { //联营面积取高时,联营扣点调整比率设置 - long[] revenuePriceArrs = new long[size]; + String[] revenuePriceArrs = new String[size]; if (wxRentContract.getType().equals(EnumRentContractType.RENT_BY_AREA_AND_JOINT.getCode())) { - long _revenuePriceD = wxRentContract.getRevenue()*wxRentContract.getPayRatio()/10000; + String _revenuePriceD = new BigDecimal(wxRentContract.getRevenue()).multiply(new BigDecimal(wxRentContract.getPayRatio())) + .divide(new BigDecimal(100)).setScale(wxRentContract.getDecimalSize(), RoundingMode.HALF_EVEN).toPlainString(); revenuePriceArrs[0] = _revenuePriceD; BigDecimal revenuePriceD = new BigDecimal(_revenuePriceD); //联营扣点调整比率 @@ -225,28 +230,31 @@ public class WxRentContractHelper { BigDecimal _p = new BigDecimal(revenueYears.get(i)).multiply(new BigDecimal(revenueRationSets.get(i))).divide(new BigDecimal(10000)); revenuePriceD = revenuePriceD.add(_p); } - revenuePriceArrs[i] = revenuePriceD.setScale(0, RoundingMode.HALF_EVEN).longValue(); + revenuePriceArrs[i] = revenuePriceD.setScale(wxRentContract.getDecimalSize(), RoundingMode.HALF_EVEN).toPlainString(); } } else if (wxRentContract.getRevenueRatioWay().equals(EnumRentContractAdjustRatioWay.MONEY.getCode())) { for (int i = 1; i < size; i++) { if (revenueYears.size() == size && revenueRationSets.size() == size) { revenuePriceD = revenuePriceD.add(new BigDecimal(revenueRationSets.get(i))); } - revenuePriceArrs[i] = revenuePriceD.setScale(0, RoundingMode.HALF_EVEN).longValue(); + revenuePriceArrs[i] = revenuePriceD.setScale(wxRentContract.getDecimalSize(), RoundingMode.HALF_EVEN).toPlainString(); } } else if (wxRentContract.getRevenueRatioWay().equals(EnumRentContractAdjustRatioWay.CUSTOM.getCode())){ for (int i = 1; i < size; i++) { if (wxRentContract.getType().equals(EnumRentContractType.RENT_BY_JOINT.getCode())) { if (EnumMissTimeType.YEAR.getCode().equals(wxRentContract.getBusDiscountTime())) { - revenuePriceArrs[i] = new BigDecimal(revenueRationSets.get(i)).multiply(new BigDecimal(12)).setScale(0, RoundingMode.HALF_EVEN).longValue(); + revenuePriceArrs[i] = new BigDecimal(revenueRationSets.get(i)).multiply(new BigDecimal(12)) + .setScale(wxRentContract.getDecimalSize(), RoundingMode.HALF_EVEN).toPlainString(); continue; } if (EnumMissTimeType.PERIOD.getCode().equals(wxRentContract.getBusDiscountTime())) { - revenuePriceArrs[i] = new BigDecimal(revenueRationSets.get(i)).multiply(new BigDecimal(wxRentContract.getReceivePeriod())).setScale(0, RoundingMode.HALF_EVEN).longValue(); + revenuePriceArrs[i] = new BigDecimal(revenueRationSets.get(i)).multiply(new BigDecimal(wxRentContract.getReceivePeriod())) + .setScale(wxRentContract.getDecimalSize(), RoundingMode.HALF_EVEN).toPlainString(); continue; } } - revenuePriceArrs[i] = new BigDecimal(revenueRationSets.get(i)).setScale(0, RoundingMode.HALF_EVEN).longValue(); + revenuePriceArrs[i] = new BigDecimal(revenueRationSets.get(i)) + .setScale(wxRentContract.getDecimalSize(), RoundingMode.HALF_EVEN).toPlainString(); } }else if (wxRentContract.getRevenueRatioWay().equals(EnumRentContractAdjustRatioWay.FIX_RATIO.getCode())){ for (int i = 1; i < size; i++) { @@ -256,15 +264,17 @@ public class WxRentContractHelper { } if (wxRentContract.getType().equals(EnumRentContractType.RENT_BY_JOINT.getCode())) { if (EnumMissTimeType.YEAR.getCode().equals(wxRentContract.getBusDiscountTime())) { - revenuePriceArrs[i] = _p.multiply(new BigDecimal(12)).setScale(0, RoundingMode.HALF_EVEN).longValue(); + revenuePriceArrs[i] = _p.multiply(new BigDecimal(12)) + .setScale(wxRentContract.getDecimalSize(), RoundingMode.HALF_EVEN).toPlainString(); continue; } if (EnumMissTimeType.PERIOD.getCode().equals(wxRentContract.getBusDiscountTime())) { - revenuePriceArrs[i] = _p.multiply(new BigDecimal(wxRentContract.getReceivePeriod())).setScale(0, RoundingMode.HALF_EVEN).longValue(); + revenuePriceArrs[i] = _p.multiply(new BigDecimal(wxRentContract.getReceivePeriod())) + .setScale(wxRentContract.getDecimalSize(), RoundingMode.HALF_EVEN).toPlainString(); continue; } } - revenuePriceArrs[i] = _p.setScale(0, RoundingMode.HALF_EVEN).longValue(); + revenuePriceArrs[i] = _p.setScale(wxRentContract.getDecimalSize(), RoundingMode.HALF_EVEN).toPlainString(); } } } @@ -273,33 +283,33 @@ public class WxRentContractHelper { //合铺计算某项计费 - private static long[] calcuteRatioByJoin(Integer ratioWay,String ratio,Long ratioFirstYearPrice) { + private static String[] calcuteRatioByJoin(Integer decimalSize,Integer ratioWay,String ratio,String ratioFirstYearPrice) { List integers = JSONArray.parseArray(ratio, Integer.class); integers.add(0, 0); int size = integers.size(); - long[] priceArrs = new long[size]; + String[] priceArrs = new String[size]; priceArrs[0] = ratioFirstYearPrice; BigDecimal priceD = new BigDecimal(ratioFirstYearPrice); if (ratioWay.equals(EnumRentContractAdjustRatioWay.RATIO.getCode())) { for (int i = 1; i < size; i++) { - BigDecimal divide = priceD.multiply(new BigDecimal(integers.get(i))).divide(new BigDecimal(10000)); + BigDecimal divide = priceD.multiply(new BigDecimal(integers.get(i))).divide(new BigDecimal(100)); priceD = priceD.add(divide); - priceArrs[i] = priceD.setScale(0, RoundingMode.HALF_EVEN).longValue(); + priceArrs[i] = priceD.setScale(decimalSize, RoundingMode.HALF_EVEN).toPlainString(); } } else if (ratioWay.equals(EnumRentContractAdjustRatioWay.MONEY.getCode())) { for (int i = 1; i < size; i++) { priceD = priceD.add(new BigDecimal(integers.get(i))); - priceArrs[i] = priceD.setScale(0, RoundingMode.HALF_EVEN).longValue(); + priceArrs[i] = priceD.setScale(decimalSize, RoundingMode.HALF_EVEN).toPlainString(); } } else if (ratioWay.equals(EnumRentContractAdjustRatioWay.CUSTOM.getCode())){ for (int i = 1; i < size; i++) { - priceArrs[i] = new BigDecimal(integers.get(i)).setScale(0, RoundingMode.HALF_EVEN).longValue(); + priceArrs[i] = new BigDecimal(integers.get(i)).setScale(decimalSize, RoundingMode.HALF_EVEN).toPlainString(); } }else if (ratioWay.equals(EnumRentContractAdjustRatioWay.FIX_RATIO.getCode())){ for (int i = 1; i < size; i++) { - BigDecimal _p = priceD.multiply(new BigDecimal(integers.get(i))).divide(new BigDecimal(10000)); - priceArrs[i] = _p.setScale(0, RoundingMode.HALF_EVEN).longValue(); + BigDecimal _p = priceD.multiply(new BigDecimal(integers.get(i))).divide(new BigDecimal(100)); + priceArrs[i] = _p.setScale(decimalSize, RoundingMode.HALF_EVEN).toPlainString(); } } return priceArrs; @@ -307,38 +317,38 @@ public class WxRentContractHelper { //分铺汇总计算某项计费 - private static long[] calcuteRatioByPart(List priceList,String ratioKey){ + private static String[] calcuteRatioByPart(List priceList,String ratioKey){ //通过rentInfo里面分别计算各商铺的金额 - long[] priceArrs = new long[priceList.size()]; + String[] priceArrs = new String[priceList.size()]; for (int i = 0; i < priceList.size(); i++) { - long[] priceInt = priceList.get(i); - long sum = 0; - for (long p : priceInt) { - sum += p; + String[] priceInt = priceList.get(i); + BigDecimal sum = new BigDecimal(0); + for (String p : priceInt) { + sum = sum.add(new BigDecimal(p)); } - priceArrs[i] = sum; + priceArrs[i] = sum.toPlainString(); } return priceArrs; } //计算某项金额,每年-每个店铺金额 - public static List computeRatioByShop(JSONArray rentInfoArray, Integer ratioWayType,long[] firstYearPrces,String ratioKey) { - List priceList = new ArrayList<>(); + public static List computeRatioByShop(Integer decimalSize,JSONArray rentInfoArray, Integer ratioWayType,String[] firstYearPrces,String ratioKey) { + List priceList = new ArrayList<>(); priceList.add(firstYearPrces); //每个店铺每月租金 //大于一年 JSONObject rentInfoObject = rentInfoArray.getJSONObject(0); JSONArray adjustRatio = rentInfoObject.getJSONArray(ratioKey);//[100,200] if (null != adjustRatio) { - return computeRatioFromRentInfo(priceList, rentInfoArray, ratioWayType, adjustRatio.size(), ratioKey); + return computeRatioFromRentInfo(decimalSize,priceList, rentInfoArray, ratioWayType, adjustRatio.size(), ratioKey); } return null; } //计算年调整后的某项计费 - private static List computeRatioFromRentInfo(List priceList,JSONArray rentInfoArray, Integer ratioWayType,int ratioYears,String ratioKey ) { + private static List computeRatioFromRentInfo(Integer decimalSize,List priceList,JSONArray rentInfoArray, Integer ratioWayType,int ratioYears,String ratioKey ) { //循环多年的调整比例,如3年。[10,20,30] for (int i = 0; i < ratioYears; i++) { - long[] priceArrs = new long[rentInfoArray.size()]; + String[] priceArrs = new String[rentInfoArray.size()]; //按每个商铺循环 for (int j = 0; j < rentInfoArray.size(); j++) { JSONObject rentInfoObject = rentInfoArray.getJSONObject(j); @@ -346,16 +356,16 @@ public class WxRentContractHelper { if (ratioWayType.equals(EnumRentContractAdjustRatioWay.RATIO.getCode())) { BigDecimal multiply = new BigDecimal(priceList.get(i)[j]).multiply(new BigDecimal(adjustRatio.getString(i)).divide(new BigDecimal(100))); BigDecimal price = new BigDecimal(priceList.get(i)[j]).add(multiply); - priceArrs[j] = price.setScale(0, RoundingMode.HALF_EVEN).longValue(); + priceArrs[j] = price.setScale(decimalSize, RoundingMode.HALF_EVEN).toPlainString(); }else if (ratioWayType.equals(EnumRentContractAdjustRatioWay.MONEY.getCode())) { BigDecimal price = new BigDecimal(priceList.get(i)[j]).add(new BigDecimal(adjustRatio.getString(i)).multiply(new BigDecimal(100))); - priceArrs[j] = price.setScale(0, RoundingMode.HALF_EVEN).longValue(); + priceArrs[j] = price.setScale(decimalSize, RoundingMode.HALF_EVEN).toPlainString(); }else if (ratioWayType.equals(EnumRentContractAdjustRatioWay.CUSTOM.getCode())) { BigDecimal price = new BigDecimal(adjustRatio.getString(i)).multiply(new BigDecimal(100)); - priceArrs[j] = price.setScale(0, RoundingMode.HALF_EVEN).longValue(); + priceArrs[j] = price.setScale(decimalSize, RoundingMode.HALF_EVEN).toPlainString(); }else if (ratioWayType.equals(EnumRentContractAdjustRatioWay.FIX_RATIO.getCode())) { BigDecimal price = new BigDecimal(priceList.get(i)[j]).multiply(new BigDecimal(adjustRatio.getString(i)).divide(new BigDecimal(100))); - priceArrs[j] = price.setScale(0, RoundingMode.HALF_EVEN).longValue(); + priceArrs[j] = price.setScale(decimalSize, RoundingMode.HALF_EVEN).toPlainString(); } } priceList.add(priceArrs); 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 ca0052ad7..766b970f6 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java @@ -179,11 +179,11 @@ public class WxRentContractServiceImpl implements WxRentContractService { JSONObject rentInfoObject = rentInfoArray.getJSONObject(i); Double rentPrice = rentInfoObject.getDouble("rentPrice"); //wxRentContract.setShopId(rentInfoObject.getLong("shopId")); - Long price = wxRentContract.getPrice()/100; + String price = wxRentContract.getPrice(); if(rentPrice == null){ if(StringUtils.isNotBlank(wxRentContract.getRentArea()) && !"0".equals(wxRentContract.getRentArea()) && !"0.00".equals(wxRentContract.getRentArea()) && !"0.0".equals(wxRentContract.getRentArea()) ) { Double rentArea = Double.parseDouble(wxRentContract.getRentArea()); - rentPrice = new BigDecimal((float) price / rentArea).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); + rentPrice = new BigDecimal(price).divide(new BigDecimal(rentArea)).setScale(wxRentContract.getDecimalSize(), BigDecimal.ROUND_HALF_UP).doubleValue(); rentInfoObject.put("rentPrice", rentPrice); } } @@ -192,9 +192,9 @@ public class WxRentContractServiceImpl implements WxRentContractService { }else{ if(wxRentContract.getRentPrice() == null || "0".equals(wxRentContract.getRentPrice())){ if(StringUtils.isNotBlank(wxRentContract.getRentArea()) && !"0".equals(wxRentContract.getRentArea()) && !"0.00".equals(wxRentContract.getRentArea()) && !"0.0".equals(wxRentContract.getRentArea()) ) { - Long price = wxRentContract.getPrice()/100; + String price = wxRentContract.getPrice(); Double rentArea = Double.parseDouble(wxRentContract.getRentArea()); - Double rentPrice = new BigDecimal((float)price/rentArea).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); + Double rentPrice = new BigDecimal(price).divide(new BigDecimal(rentArea)).setScale(wxRentContract.getDecimalSize(), BigDecimal.ROUND_HALF_UP).doubleValue(); if(rentPrice > 0){ wxRentContract.setRentPrice(rentPrice.toString()); }else{ @@ -219,8 +219,8 @@ public class WxRentContractServiceImpl implements WxRentContractService { if (!mallList.isEmpty()) { result.put("mall", mallList.get(0)); } - wxRentContract.setPrice(wxRentContract.getPrice() != null ? wxRentContract.getPrice() : 0); - wxRentContract.setDeposit(wxRentContract.getDeposit() != null ? wxRentContract.getDeposit() : 0); + wxRentContract.setPrice(StringUtils.isNotBlank(wxRentContract.getPrice()) ? wxRentContract.getPrice() : "0"); + wxRentContract.setDeposit(StringUtils.isNotBlank(wxRentContract.getDeposit()) ? wxRentContract.getDeposit() : "0"); result.put("wxRentContract", wxRentContract); //关联的商户 @@ -285,26 +285,28 @@ public class WxRentContractServiceImpl implements WxRentContractService { * @param revenueLong * @return */ - public static Long countPrice(Integer ratio,Long revenueLong,int timeType,int period,int from){ - BigDecimal hundred = new BigDecimal(100); - BigDecimal revenue = new BigDecimal(revenueLong == null ? 0 : revenueLong).divide(hundred); + public static BigDecimal countPrice(Integer decimalSize,Integer ratio,String revenueLong,int timeType,int period,int from){ + if (StringUtils.isBlank(revenueLong)) { + revenueLong = "0"; + } + BigDecimal revenue = new BigDecimal(revenueLong); BigDecimal payRatio = new BigDecimal(ratio == null ? 0 : ratio).divide(new BigDecimal(10000)); BigDecimal price; if(EnumMissTimeType.YEAR.getCode().equals(timeType) && EnumGetRatioFrom.RENT.getCode().equals(from)){ - price = revenue.multiply(new BigDecimal(12)).multiply(payRatio).setScale(2, RoundingMode.HALF_EVEN);;; + price = revenue.multiply(new BigDecimal(12)).multiply(payRatio).setScale(decimalSize, RoundingMode.HALF_EVEN); }else if(EnumMissTimeType.PERIOD.getCode().equals(timeType) && EnumGetRatioFrom.RENT.getCode().equals(from)){ - price = revenue.multiply(new BigDecimal(period)).multiply(payRatio).setScale(2, RoundingMode.HALF_EVEN);; + price = revenue.multiply(new BigDecimal(period)).multiply(payRatio).setScale(decimalSize, RoundingMode.HALF_EVEN);; }else{ - price = revenue.multiply(payRatio).setScale(2, RoundingMode.HALF_EVEN); + price = revenue.multiply(payRatio).setScale(decimalSize, RoundingMode.HALF_EVEN); } - return price.multiply(hundred).longValue(); + return price; } /** * 获取设置的跳点率 * ["1000-1200:10",">3000:20"] */ - public static RatioVo getPayRatio(int from,Long revenueLong,String busDiscountRatio,int timeType,long dayCount,int period){ + public static RatioVo getPayRatio(Integer decimalSize,int from,String revenueLong,String busDiscountRatio,int timeType,long dayCount,int period){ RatioVo ratioVo = new RatioVo(); if(StringUtils.isBlank(busDiscountRatio)){ return ratioVo; @@ -313,7 +315,8 @@ public class WxRentContractServiceImpl implements WxRentContractService { ratioVo.setUseRatio(busDiscountRatio); for (int i = 0; i < ratioList.size(); i++) { - BigDecimal revenue = new BigDecimal(revenueLong).divide(new BigDecimal(1000000)).setScale(8, RoundingMode.HALF_EVEN); + //BigDecimal revenue = new BigDecimal(revenueLong).divide(new BigDecimal(1000000)).setScale(8, RoundingMode.HALF_EVEN); + BigDecimal revenue = new BigDecimal(revenueLong); String e = ratioList.get(i); String[] array = e.split(":"); Integer ratio = Integer.parseInt(array[1]); @@ -345,7 +348,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { if (revenue.compareTo(start) >= 0 && revenue.compareTo(end)<= 0){ ratioVo.setRatio(ratio); - ratioVo.setPrice(countPrice(ratioVo.getRatio(),revenueLong,timeType,period,from)); + ratioVo.setPrice(countPrice(decimalSize,ratioVo.getRatio(),revenueLong,timeType,period,from).toPlainString()); break; } }else if(e.indexOf(">") >= 0){ @@ -376,7 +379,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { //计算超出部分 BigDecimal payRatio = new BigDecimal(ratio).divide(new BigDecimal(10000)); BigDecimal balance = revenue.subtract(end).multiply(new BigDecimal(1000000)); - BigDecimal price = balance.multiply(payRatio).setScale(2, RoundingMode.HALF_EVEN); + BigDecimal price = balance.multiply(payRatio).setScale(decimalSize, RoundingMode.HALF_EVEN); array = ratioList.get(i-1).split(":"); Integer frontatio = Integer.parseInt(array[1]); @@ -396,16 +399,16 @@ public class WxRentContractServiceImpl implements WxRentContractService { } BigDecimal frontRatio = new BigDecimal(frontatio).divide(new BigDecimal(10000)); - BigDecimal frontPrice = frontEnd.multiply(new BigDecimal(1000000).multiply(frontRatio).setScale(2, RoundingMode.HALF_EVEN)); + BigDecimal frontPrice = frontEnd.multiply(new BigDecimal(1000000).multiply(frontRatio).setScale(decimalSize, RoundingMode.HALF_EVEN)); - ratioVo.setPrice(price.add(frontPrice).longValue()); + ratioVo.setPrice(price.add(frontPrice).toPlainString()); break; } } } return ratioVo; } - + @Transactional(rollbackFor = {Exception.class}) @Override public ResultData save(WxRentContract record,Long userId,String userName,Date oldRentStartDate) { @@ -429,29 +432,29 @@ public class WxRentContractServiceImpl implements WxRentContractService { } if (null != record.getType() && record.getType().equals(EnumRentContractType.RENT_BY_JOINT.getCode())) { - if(record.getRevenue() == null || record.getRevenue().longValue() <= 0){ - record.setPrice(0l); + if(StringUtils.isBlank(record.getRevenue())){ + record.setPrice("0"); }else{ if(record.getPayRatio()!=null && record.getPayRatio().intValue() > 0){ - record.setPrice(countPrice(record.getPayRatio(),record.getRevenue(),EnumMissTimeType.OTHER.getCode(),record.getAdjustPeriod(),EnumGetRatioFrom.RENT.getCode())); + record.setPrice(countPrice(record.getDecimalSize(),record.getPayRatio(),record.getRevenue(),EnumMissTimeType.OTHER.getCode(),record.getAdjustPeriod(),EnumGetRatioFrom.RENT.getCode()).toPlainString()); }else{ int dayCount = record.getReceivePeriod() * 30; - RatioVo ratioVo = getPayRatio(EnumGetRatioFrom.RENT.getCode(),record.getRevenue(),record.getBusDiscountRatio(),record.getBusDiscountTime(),dayCount,record.getReceivePeriod()); + RatioVo ratioVo = getPayRatio(record.getDecimalSize(),EnumGetRatioFrom.RENT.getCode(),record.getRevenue(),record.getBusDiscountRatio(),record.getBusDiscountTime(),dayCount,record.getReceivePeriod()); //record.setPayRatio(ratioVo.getRatio()); record.setPrice(ratioVo.getPrice()); } } } else { - if (StringUtils.isNotEmpty(record.getPriceStr())) { - record.setPrice(new BigDecimal(record.getPriceStr()).multiply(new BigDecimal(100)).longValue()); + if (StringUtils.isNotEmpty(record.getPrice())) { + //record.setPrice(new BigDecimal(record.getPriceStr()).multiply(new BigDecimal(100)).longValue()); } else { - record.setPrice(0L); + record.setPrice("0"); } } - if (StringUtils.isNotEmpty(record.getDepositStr())) { - record.setDeposit(new BigDecimal(record.getDepositStr()).multiply(new BigDecimal(100)).longValue()); + if (StringUtils.isNotEmpty(record.getDeposit())) { + //record.setDeposit(new BigDecimal(record.getDepositStr()).multiply(new BigDecimal(100)).longValue()); } else { - record.setDeposit(0L); + record.setDeposit("0"); } Date date = new Date(); @@ -663,9 +666,9 @@ public class WxRentContractServiceImpl implements WxRentContractService { bill.setPeriod(count); bill.setIsPreview(EnumIsPreview.YES.getCode()); bill.setShopInfo(getShopInfoStr(record)); - bill.setRevenue(0L); + bill.setRevenue("0"); bill.setLatePayRatio(0); - bill.setPay(0L); + bill.setPay("0"); bill.setIsDel(EnumDelStatus.NOT_DEL.getCode()); bill.setMerchantId(record.getMerchantId()); if (null != shopIds && shopIds.size() == 1) { @@ -677,8 +680,8 @@ public class WxRentContractServiceImpl implements WxRentContractService { bill.setPayDate(date); } //计算手续费 - BigDecimal servicePay = new BigDecimal(bill.getReceivePay()).multiply(new BigDecimal(wxPayAccountBill.getServiceChargeRate())).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP); - bill.setServiceChargePay(servicePay.intValue()); + BigDecimal servicePay = new BigDecimal(bill.getReceivePay()).multiply(new BigDecimal(wxPayAccountBill.getServiceChargeRate())).divide(new BigDecimal(10000), record.getDecimalSize(), BigDecimal.ROUND_HALF_UP); + bill.setServiceChargePay(servicePay.toPlainString()); bill.setOwe(bill.getReceivePay() + bill.getServiceChargePay()); count++; } @@ -702,17 +705,17 @@ public class WxRentContractServiceImpl implements WxRentContractService { List shopIds = record.shopIdsByRentInfo(); List billList = new ArrayList(); for (WxBillRent _bi:record.getPreviewBillRentList()) { - Long needPay = 0L; + BigDecimal needPay = new BigDecimal("0"); if (feeType.getCode() == EnumRentContractManageFeeType.RENT_BUSSINESS_MANAGE_FEE.getCode()) { if (null != _bi.getBussinessManageFeeNeedPay()) { - needPay = _bi.getBussinessManageFeeNeedPay(); + needPay = new BigDecimal(_bi.getBussinessManageFeeNeedPay()); } }else if (feeType.getCode() == EnumRentContractManageFeeType.RENT_OPERATING_MANAGE_FEE.getCode()) { if (null != _bi.getOperatingManageFeeNeedPay()) { - needPay = _bi.getOperatingManageFeeNeedPay(); + needPay = new BigDecimal(_bi.getOperatingManageFeeNeedPay()); } } - if (needPay <= 0) { + if (needPay.compareTo(new BigDecimal(0)) <= 0) { continue; } WxBillRentManage bill = new WxBillRentManage(); @@ -723,14 +726,14 @@ public class WxRentContractServiceImpl implements WxRentContractService { bill.setCreatetime(date); bill.updateTenantInfo(record); bill.setManageFeeType(feeType.getCode()); - bill.setNeedPay(needPay); - bill.setReceivePay(needPay); + bill.setNeedPay(needPay.toPlainString()); + bill.setReceivePay(needPay.toPlainString()); bill.setUpdatetime(date); bill.setRentShopType(record.getRentShopType()); bill.setPeriod(count); bill.setShopInfo(getShopInfoStr(record)); bill.setLatePayRatio(0); - bill.setPay(0L); + bill.setPay("0"); bill.setIsDel(EnumDelStatus.NOT_DEL.getCode()); bill.setMerchantId(record.getMerchantId()); if (null != shopIds && shopIds.size() == 1) { @@ -742,8 +745,8 @@ public class WxRentContractServiceImpl implements WxRentContractService { bill.setPayDate(date); } //计算手续费 - BigDecimal servicePay = new BigDecimal(bill.getReceivePay()).multiply(new BigDecimal(wxPayAccountBill.getServiceChargeRate())).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP); - bill.setServiceChargePay(servicePay.intValue()); + BigDecimal servicePay = new BigDecimal(bill.getReceivePay()).multiply(new BigDecimal(wxPayAccountBill.getServiceChargeRate())).divide(new BigDecimal(10000), record.getDecimalSize(), BigDecimal.ROUND_HALF_UP); + bill.setServiceChargePay(servicePay.toPlainString()); bill.setOwe(bill.getReceivePay() + bill.getServiceChargePay()); count++; billList.add(bill); @@ -773,26 +776,26 @@ public class WxRentContractServiceImpl implements WxRentContractService { if(!EnumFromType.SWITCH.getCode().equals(from)){ if (record.getType() != null && record.getType().equals(EnumRentContractType.RENT_BY_JOINT.getCode())) { if(record.getPayRatio()!=null && record.getPayRatio().intValue() > 0){ - record.setPrice(countPrice(record.getPayRatio(),record.getRevenue(),EnumMissTimeType.OTHER.getCode(),record.getAdjustPeriod(),from)); + record.setPrice(countPrice(record.getDecimalSize(),record.getPayRatio(),record.getRevenue(),EnumMissTimeType.OTHER.getCode(),record.getAdjustPeriod(),from).toPlainString()); }else{ int dayCount = record.getReceivePeriod() * 30; - RatioVo ratioVo = getPayRatio(EnumGetRatioFrom.RENT.getCode(),record.getRevenue(),record.getBusDiscountRatio(),record.getBusDiscountTime(),dayCount,record.getReceivePeriod()); + RatioVo ratioVo = getPayRatio(record.getDecimalSize(),EnumGetRatioFrom.RENT.getCode(),record.getRevenue(),record.getBusDiscountRatio(),record.getBusDiscountTime(),dayCount,record.getReceivePeriod()); //record.setPayRatio(ratioVo.getRatio()); record.setPrice(ratioVo.getPrice()); } } else { - if (StringUtils.isNotEmpty(record.getPriceStr())) { - record.setPrice(new BigDecimal(record.getPriceStr()).multiply(new BigDecimal(100)).longValue()); + if (StringUtils.isNotEmpty(record.getPrice())) { + //record.setPrice(new BigDecimal(record.getPriceStr()).multiply(new BigDecimal(100)).longValue()); } else { - record.setPrice(0L); + record.setPrice("0"); } } } - if (StringUtils.isNotEmpty(record.getDepositStr())) { - record.setDeposit(new BigDecimal(record.getDepositStr()).multiply(new BigDecimal(100)).longValue()); + if (StringUtils.isNotEmpty(record.getDeposit())) { + //record.setDeposit(new BigDecimal(record.getDepositStr()).multiply(new BigDecimal(100)).longValue()); } else { - record.setDeposit(0L); + record.setDeposit("0"); } List shopList = Lists.newArrayList(); record.setUpdatetime(new Date()); @@ -891,13 +894,14 @@ public class WxRentContractServiceImpl implements WxRentContractService { @Override public void buildDeposit( Long userId,Long rentContractId) { WxRentContract wxRentContract = wxRentContractMapper.selectById(rentContractId); - if (wxRentContract != null && wxRentContract.getDeposit() > 0) { + if (wxRentContract != null && StringUtils.isNotBlank(wxRentContract.getDeposit()) + && new BigDecimal(wxRentContract.getDeposit()).compareTo(new BigDecimal(0)) > 0 ) { final IdWorker idWorker = IdWorker.get(); WxBillDeposit wxBillDeposit = new WxBillDeposit(); wxBillDeposit.setId(idWorker.nextId()); wxBillDeposit.setRentContractId(wxRentContract.getId()); - wxBillDeposit.setPay(0L); - long needpay = wxRentContract.getDeposit(); + wxBillDeposit.setPay("0"); + String needpay = wxRentContract.getDeposit(); wxBillDeposit.setReceivePay(needpay); wxBillDeposit.setNeedPay(needpay); wxBillDeposit.setOwe(needpay); @@ -1108,7 +1112,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { int receivePeriod = wxRentContract.getReceivePeriod().intValue(); Integer lease = wxRentContract.getLease(); Date rentalStartDate = wxRentContract.getRentalStartDate(); - Long price = wxRentContract.getPrice(); + String price = wxRentContract.getPrice(); if(EnumContractOperationType.JINMAO.getCode().equals(wxRentContract.getOperationType())){ Date startDate = wxRentContract.getStartDate(); rentList = buildRentJinmao(userId, wxRentContract, receivePeriod, lease, startDate, price, isPreview,saveDb); @@ -1135,14 +1139,14 @@ public class WxRentContractServiceImpl implements WxRentContractService { - public List buildRentMonth(Long userId, WxRentContract wxRentContract, int receivePeriod, Integer lease, Date rentalStartDate, Long price, Integer isPreview, boolean saveDb) { + public List buildRentMonth(Long userId, WxRentContract wxRentContract, int receivePeriod, Integer lease, Date rentalStartDate, String price, Integer isPreview, boolean saveDb) { int years = 0; //计算租金每年的计费基数 - long[] priceArrs = WxRentContractHelper.calcuteRentPrice(wxRentContract); + String[] priceArrs = WxRentContractHelper.calcuteRentPrice(wxRentContract); //计算商业管理费 - long[] bussinessManagerPriceArrs = WxRentContractHelper.calcuteBussinessManagementFee(wxRentContract); + String[] bussinessManagerPriceArrs = WxRentContractHelper.calcuteBussinessManagementFee(wxRentContract); //计算运营管理费 - long[] operationManagerPriceArrs = WxRentContractHelper.calcuteOperatingManagementFee(wxRentContract); + String[] operationManagerPriceArrs = WxRentContractHelper.calcuteOperatingManagementFee(wxRentContract); int month = 12; int billcount = 0; List resultList = new ArrayList<>(); @@ -1175,9 +1179,9 @@ public class WxRentContractServiceImpl implements WxRentContractService { return resultList; } - public List buildRentJinmao(Long userId, WxRentContract wxRentContract, int receivePeriod, Integer lease, Date rentalStartDate, Long price, Integer isPreview, boolean saveDb) { + public List buildRentJinmao(Long userId, WxRentContract wxRentContract, int receivePeriod, Integer lease, Date rentalStartDate, String price, Integer isPreview, boolean saveDb) { int size = 0; - long[] priceArrs = null; + String[] priceArrs = null; if (wxRentContract.getType().equals(EnumRentContractType.RENT_BY_AREA.getCode())){ String adjustRatio = wxRentContract.getAdjustRatio(); @@ -1197,37 +1201,37 @@ public class WxRentContractServiceImpl implements WxRentContractService { } integers.add(0, 0); size = integers.size(); - priceArrs = new long[size]; + priceArrs = new String[size]; priceArrs[0] = price; BigDecimal priceD = new BigDecimal(price); if (wxRentContract.getAdjustRatioWay().equals(EnumRentContractAdjustRatioWay.RATIO.getCode())) { for (int i = 1; i < size; i++) { - BigDecimal divide = priceD.multiply(new BigDecimal(integers.get(i))).divide(new BigDecimal(10000)); + BigDecimal divide = priceD.multiply(new BigDecimal(integers.get(i))).divide(new BigDecimal(100)); logger.info("价格算法------递增前价格:"+priceD.doubleValue()+" 递增率:"+integers.get(i)+" 递增价格:"+divide.doubleValue()); priceD = priceD.add(divide); - priceArrs[i] = priceD.setScale(0, RoundingMode.HALF_EVEN).longValue(); + priceArrs[i] = priceD.setScale(wxRentContract.getDecimalSize(), RoundingMode.HALF_EVEN).toPlainString(); } } }else if (wxRentContract.getType().equals(EnumRentContractType.RENT_BY_CUSTOMIZE.getCode())) { String adjustRatio = wxRentContract.getAdjustRatio(); JSONArray array = JSONArray.parseArray(adjustRatio); if(array != null && array.size() > 0){ - priceArrs = new long[array.size()]; + priceArrs = new String[array.size()]; size = array.size(); for (int i=0;i(); @@ -1413,7 +1417,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { return calendar.getTime(); } - public Map buildRent(int receivePeriod, long[] priceArrs,long[] bussinessManagerPriceArrs,long[] operationManagerPriceArrs, List yearList, int dayType, WxRentContract wxRentContract, Long userId, int billcount, Integer isPreview, String shopInfoStr,boolean saveDb) { + public Map buildRent(int receivePeriod, String[] priceArrs,String[] bussinessManagerPriceArrs,String[] operationManagerPriceArrs, List yearList, int dayType, WxRentContract wxRentContract, Long userId, int billcount, Integer isPreview, String shopInfoStr,boolean saveDb) { WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantInfo(wxRentContract); SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd"); Map resultMap = new HashedMap(); @@ -1444,11 +1448,11 @@ public class WxRentContractServiceImpl implements WxRentContractService { for (int i = 0; i < billTimeVoList.size(); i++) { BillTimeVo billTimeVo = billTimeVoList.get(i); //计算金额 - long needpay = 0; + BigDecimal needpay = new BigDecimal(0); //商业管理费 - long bussinessManageFeeNeedpay = 0; + BigDecimal bussinessManageFeeNeedpay = new BigDecimal(0); //营业管理费 - long operatingManageFeeNeedpay = 0; + BigDecimal operatingManageFeeNeedpay = new BigDecimal(0); boolean flag = false; //此处逻辑处理这一年和下一年交接那一期账单。 diff --git a/mallinkService/src/main/java/com/iformall/utils/PriceUtilV2.java b/mallinkService/src/main/java/com/iformall/utils/PriceUtilV2.java index dafa34afb..2fc93ad77 100644 --- a/mallinkService/src/main/java/com/iformall/utils/PriceUtilV2.java +++ b/mallinkService/src/main/java/com/iformall/utils/PriceUtilV2.java @@ -157,5 +157,16 @@ public class PriceUtilV2 { BigDecimal numberOfMoney = new BigDecimal(22200000020.109); System.out.println(numberOfMoney.toString()); System.out.println(number2CNMontrayUnit(numberOfMoney)); + + BigDecimal a = new BigDecimal(10); + a = a.add(new BigDecimal(10)); + System.out.println(a); } + + + public static double getPowerNumber(Integer decimalSize) { + return Math.pow(10, decimalSize); + } + + } \ No newline at end of file diff --git a/mallinkService/src/main/resources/mapper/WxBillDepositMapper.xml b/mallinkService/src/main/resources/mapper/WxBillDepositMapper.xml index 961915af1..cee30332e 100644 --- a/mallinkService/src/main/resources/mapper/WxBillDepositMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxBillDepositMapper.xml @@ -6,25 +6,25 @@ - - + + - + - + - + diff --git a/mallinkService/src/main/resources/mapper/WxBillRentManageMapper.xml b/mallinkService/src/main/resources/mapper/WxBillRentManageMapper.xml index 1ca905043..9fd50bd79 100644 --- a/mallinkService/src/main/resources/mapper/WxBillRentManageMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxBillRentManageMapper.xml @@ -6,19 +6,19 @@ - - + + - + - + @@ -26,7 +26,7 @@ - + diff --git a/mallinkService/src/main/resources/mapper/WxBillRentMapper.xml b/mallinkService/src/main/resources/mapper/WxBillRentMapper.xml index aa231cc48..d49a8b4d7 100644 --- a/mallinkService/src/main/resources/mapper/WxBillRentMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxBillRentMapper.xml @@ -6,13 +6,13 @@ - - + + - + @@ -20,18 +20,18 @@ - - - + + + - + - + diff --git a/mallinkService/src/main/resources/mapper/WxPropertyContractMapper.xml b/mallinkService/src/main/resources/mapper/WxPropertyContractMapper.xml index b2da73fe1..16ac03f39 100644 --- a/mallinkService/src/main/resources/mapper/WxPropertyContractMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxPropertyContractMapper.xml @@ -4,6 +4,7 @@ + @@ -56,7 +57,7 @@ - `id`,`merchant_id`,`price`,`rental_start_date`,`rental_end_date`, + `id`,`merchant_id`,`decimal_size`,`price`,`rental_start_date`,`rental_end_date`, `sign_date`,`receive_period`,`tenant_id`,`parent_tenant_id`,`filepath`,`status`,`contract_number`, `deposit`,`pay_date`,`is_del`,`merchant_name`,`brand`,`business_id`, `shop_type`,`updatetime`,`createtime`,`rent_area`,`rent_shop_type`, diff --git a/mallinkService/src/main/resources/mapper/WxRentContractMapper.xml b/mallinkService/src/main/resources/mapper/WxRentContractMapper.xml index c183e7944..011153fcc 100644 --- a/mallinkService/src/main/resources/mapper/WxRentContractMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxRentContractMapper.xml @@ -13,8 +13,8 @@ - - + + @@ -35,7 +35,7 @@ - + @@ -59,7 +59,7 @@ - + @@ -133,7 +133,7 @@ `id`,`merchant_id`, `shop_type_sub`,`lease_purpose`,`contractual_rules`,`delivery_date`,`delivery_grace_period`,`opening_date`,`business_hours`,`scope_metre`, - `price`,`rental_start_date`,`rental_end_date`,`sign_date`,`receive_period`, + `decimal_size`,`price`,`rental_start_date`,`rental_end_date`,`sign_date`,`receive_period`, `tenant_id`,`parent_tenant_id`,`filepath`,`status`,`contract_number`, `first_party_bank_info`,`second_party_bank_info`,`second_party_tax_info`, `property_name`,`property_fee`,`fee_cycle`,`water_fee`,`electricity_fees`,