From 646e71c49486ba6074183a18db09b77dc8065a75 Mon Sep 17 00:00:00 2001 From: winter Date: Wed, 24 Apr 2024 05:36:13 +0800 Subject: [PATCH] fix contact and bill --- .../controller/mem/BillDailyAsyncTask.java | 14 +- .../resources/db/migration/V202405001.sql | 26 +- .../schedule/PowerBillAutoBuildSchedule.java | 10 +- .../com/iformall/domain/po/WxBillDaily.java | 14 +- .../iformall/domain/po/WxBillProperty.java | 77 +-- .../domain/po/WxBillPropertyDeposit.java | 14 +- .../domain/po/WxPropertyContract.java | 4 +- .../domain/vo/WxBillDailyExportVo.java | 15 +- .../service/impl/WxBillAllServiceImpl.java | 462 +++++++++--------- .../service/impl/WxBillDailyServiceImpl.java | 44 +- .../service/impl/WxBillSettleServiceImpl.java | 6 +- .../resources/mapper/WxBillDailyMapper.xml | 6 +- .../mapper/WxBillPropertyDepositMapper.xml | 10 +- .../resources/mapper/WxBillPropertyMapper.xml | 10 +- .../mapper/WxPropertyContractMapper.xml | 4 +- 15 files changed, 375 insertions(+), 341 deletions(-) diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/mem/BillDailyAsyncTask.java b/mallinkAdmin/src/main/java/com/iformall/controller/mem/BillDailyAsyncTask.java index d8a92d28e..93637420c 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/mem/BillDailyAsyncTask.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/mem/BillDailyAsyncTask.java @@ -113,26 +113,26 @@ public class BillDailyAsyncTask { } String receivePayStr = vo.getReceivePayStr(); - long receivePay = new BigDecimal(receivePayStr).multiply(new BigDecimal(100)).longValue(); - if (receivePay <= 0) { + BigDecimal receivePay = new BigDecimal(receivePayStr); + if (receivePay.compareTo(new BigDecimal(0)) <= 0) { logger.error("实际应收金额小于等于0", vo.toString()); fail++; continue; } String payStr = vo.getPayStr(); - long pay = new BigDecimal(payStr).multiply(new BigDecimal(100)).longValue(); - if (pay < 0) { + BigDecimal pay = new BigDecimal(payStr); + if (pay.compareTo(new BigDecimal(0)) < 0) { logger.error("实收金额小于0", vo.toString()); fail++; continue; } - if (receivePay < pay) { + if (receivePay.compareTo(pay) < 0) { logger.error("实际应收金额小于实收金额", vo.toString()); fail++; continue; } - vo.setReceivePay(receivePay); - vo.setPay(pay); + vo.setReceivePay(receivePay.toPlainString()); + vo.setPay(pay.toPlainString()); vo.updateTenantInfo(user); vo.setShopId(wxShop.getId()); vo.setRentShopType(wxShop.getType()); diff --git a/mallinkAdmin/src/main/resources/db/migration/V202405001.sql b/mallinkAdmin/src/main/resources/db/migration/V202405001.sql index d8bed36b2..272398ac8 100644 --- a/mallinkAdmin/src/main/resources/db/migration/V202405001.sql +++ b/mallinkAdmin/src/main/resources/db/migration/V202405001.sql @@ -32,4 +32,28 @@ 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 +ALTER TABLE wx_bill_rent_manage MODIFY COLUMN `service_charge_pay` VARCHAR(30); + +ALTER TABLE wx_bill_daily MODIFY COLUMN `receive_pay` VARCHAR(30); +ALTER TABLE wx_bill_daily MODIFY COLUMN `pay` VARCHAR(30); +ALTER TABLE wx_bill_daily MODIFY COLUMN `owe` VARCHAR(30); +ALTER TABLE wx_bill_daily MODIFY COLUMN `service_charge_pay` VARCHAR(30); + + +ALTER TABLE wx_property_contract MODIFY COLUMN `price` VARCHAR(30); +ALTER TABLE wx_property_contract MODIFY COLUMN `deposit` VARCHAR(30); + +ALTER TABLE wx_bill_property MODIFY COLUMN `receive_pay` VARCHAR(30); +ALTER TABLE wx_bill_property MODIFY COLUMN `pay` VARCHAR(30); +ALTER TABLE wx_bill_property MODIFY COLUMN `owe` VARCHAR(30); +ALTER TABLE wx_bill_property MODIFY COLUMN `need_pay` VARCHAR(30); +ALTER TABLE wx_bill_property MODIFY COLUMN `revenue` VARCHAR(30); +ALTER TABLE wx_bill_property MODIFY COLUMN `late_pay_price` VARCHAR(30); +ALTER TABLE wx_bill_property MODIFY COLUMN `service_charge_pay` VARCHAR(30); + +ALTER TABLE wx_bill_property_deposit MODIFY COLUMN `receive_pay` VARCHAR(30); +ALTER TABLE wx_bill_property_deposit MODIFY COLUMN `pay` VARCHAR(30); +ALTER TABLE wx_bill_property_deposit MODIFY COLUMN `owe` VARCHAR(30); +ALTER TABLE wx_bill_property_deposit MODIFY COLUMN `need_pay` VARCHAR(30); +ALTER TABLE wx_bill_property_deposit MODIFY COLUMN `return_price` VARCHAR(30); +ALTER TABLE wx_bill_property_deposit MODIFY COLUMN `service_charge_pay` VARCHAR(30); diff --git a/mallinkSchedule/src/main/java/com/iformall/schedule/PowerBillAutoBuildSchedule.java b/mallinkSchedule/src/main/java/com/iformall/schedule/PowerBillAutoBuildSchedule.java index 552a49a0c..eb8552504 100644 --- a/mallinkSchedule/src/main/java/com/iformall/schedule/PowerBillAutoBuildSchedule.java +++ b/mallinkSchedule/src/main/java/com/iformall/schedule/PowerBillAutoBuildSchedule.java @@ -13,6 +13,8 @@ import com.iformall.mapper.WxMerchantShopMapper; import com.iformall.mapper.WxPowerBillAutoConfigMapper; import com.iformall.service.WxBillDailyService; import com.iformall.service.kw.KwMeterDataService; +import com.iformall.utils.Constant; + import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -100,7 +102,7 @@ public class PowerBillAutoBuildSchedule { MallUserInfo mallUserInfo = getMallUserInfo(); WxBillDaily wxBillDaily = getBillDaily(wxMerchantPowerBillConfig); Date receiveDate = getReceiveDate(Integer.parseInt(wxPowerBillAutoConfig.getReceiveDay())); - long receivePay; + String receivePay; String unitPrice; long usedPower = 0L; Long merchantId = wxMerchantPowerBillConfig.getMerchantId(); @@ -114,12 +116,12 @@ public class PowerBillAutoBuildSchedule { //按电表 单价从商户配置表中取 因为会修改 unitPrice = wxMerchantPowerBillConfig.getPrice(); receivePay = new BigDecimal(unitPrice).multiply(new BigDecimal(usedPower)) - .setScale(0, RoundingMode.HALF_EVEN).longValue(); + .setScale(Constant.default_long_decimal_size, RoundingMode.HALF_EVEN).toPlainString(); } else { //按固定金额 单位从统一配置表中取 unitPrice = wxPowerBillAutoConfig.getUnitPrice(); String price = wxMerchantPowerBillConfig.getPrice(); - receivePay = new BigDecimal(price).multiply(new BigDecimal(100)).longValue(); + receivePay = new BigDecimal(price).toPlainString(); } JSONArray priceDetals = new JSONArray(); @@ -178,7 +180,7 @@ public class PowerBillAutoBuildSchedule { wxBillDaily.setMerchantName(wxMerchantPowerBillConfig.getMerchantName()); wxBillDaily.setType(EnumBillDailyType.POWER.getCode()); wxBillDaily.setRentShopType(wxMerchantPowerBillConfig.getMerchantType()); - wxBillDaily.setPay(0L); + wxBillDaily.setPay("0"); wxBillDaily.setPayWay(EnumBillPayWay.OTHER.getCode()); return wxBillDaily; } diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxBillDaily.java b/mallinkService/src/main/java/com/iformall/domain/po/WxBillDaily.java index 3c22e0701..6c9ec8a8b 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxBillDaily.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxBillDaily.java @@ -39,10 +39,10 @@ public class WxBillDaily extends TenantEntity { private Integer type; @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; @Excel(name = "缴款截止日期*", orderNum = "5", width = 20, format = "yyyy-MM-dd") @NotNull @@ -59,7 +59,7 @@ public class WxBillDaily 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未到期", name = "status") private Integer status; @io.swagger.annotations.ApiModelProperty(value = "账单审核状态EnumBillRentApplyStatus", name = "applyStatus") @@ -95,10 +95,10 @@ public class WxBillDaily extends TenantEntity { private Integer allPeriod; @TableField(exist = false) - private Long needPay; + private String needPay; @TableField(exist = false) - private Long latePayPrice; + private String latePayPrice; @TableField(exist = false) @SortColumn(column = "period") @@ -119,11 +119,11 @@ public class WxBillDaily extends TenantEntity { private Integer buildWay; @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/WxBillProperty.java b/mallinkService/src/main/java/com/iformall/domain/po/WxBillProperty.java index c22c10a34..47b5b7c6d 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxBillProperty.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxBillProperty.java @@ -38,26 +38,27 @@ public class WxBillProperty extends TenantEntity { @SortColumn(column = "receivePay") @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(); - } +// public String getPayStr() { +// return new BigDecimal(pay == null ? 0 : pay).divide(new BigDecimal(100)).toPlainString(); +// } +// +// @Excel(name = "实收账款(元)", width = 20, orderNum = "7") +// @TableField(exist = false) +// private String payStr; @Excel(name = "实收账款(元)", width = 20, orderNum = "7") - @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 = "10") @io.swagger.annotations.ApiModelProperty(value="收款日期",name="receiveDate") @@ -73,17 +74,17 @@ public class WxBillProperty extends TenantEntity { @io.swagger.annotations.ApiModelProperty(value="逾期天数",name="expiredDay") private Long expiredDay; - + @Excel(name = "欠缴金额(元)", width = 20, orderNum = "9") @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(); - } - - @Excel(name = "欠缴金额(元)", width = 20, orderNum = "9") - @TableField(exist = false) - private String oweStr; +// public String getOweStr() { +// return new BigDecimal(owe == null ? 0 : owe).divide(new BigDecimal(100)).toPlainString(); +// } +// +// @Excel(name = "欠缴金额(元)", width = 20, orderNum = "9") +// @TableField(exist = false) +// private String oweStr; @Excel(name = "状态", replace = {"欠缴_1", "待缴_2", "已结清_3", "未到期_4", "已退还_5", "失效_6"}, width = 20, orderNum = "8") @io.swagger.annotations.ApiModelProperty(value = "账单状态1欠缴2待缴3已结清4未到期", name = "status") @@ -98,7 +99,7 @@ public class WxBillProperty 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; @@ -124,7 +125,7 @@ public class WxBillProperty 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; @@ -132,16 +133,17 @@ public class WxBillProperty extends TenantEntity { @io.swagger.annotations.ApiModelProperty(value = "滞纳金时间", name = "latePayTime") private Date latePayTime; + @Excel(name = "滞纳金(元)", width = 20, orderNum = "12") @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(); - } - - @Excel(name = "滞纳金(元)", width = 20, orderNum = "12") - @TableField(exist = false) - private String latePayPriceStr; +// 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; @io.swagger.annotations.ApiModelProperty(value = "账期", name = "period") private Integer period; @@ -173,7 +175,7 @@ public class WxBillProperty extends TenantEntity { private Integer depositStatus; @TableField(exist = false) - private Long deposit; + private String deposit; @TableField(exist = false) private Integer limitStart; @@ -194,11 +196,11 @@ public class WxBillProperty 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; @@ -210,7 +212,8 @@ public class WxBillProperty extends TenantEntity { private String realReceivePayStr; public String getRealReceivePayStr() { - return new BigDecimal(realReceivePay == null ? 0 : realReceivePay).divide(new BigDecimal(100)).toPlainString(); + //return new BigDecimal(realReceivePay == null ? 0 : realReceivePay).divide(new BigDecimal(100)).toPlainString(); + return realReceivePay; } diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxBillPropertyDeposit.java b/mallinkService/src/main/java/com/iformall/domain/po/WxBillPropertyDeposit.java index a99d0dc14..7a290148c 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxBillPropertyDeposit.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxBillPropertyDeposit.java @@ -28,9 +28,9 @@ public class WxBillPropertyDeposit extends TenantEntity { @io.swagger.annotations.ApiModelProperty(value="物业合同ID",name="propertyContractId") private Long propertyContractId; @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") @@ -40,7 +40,7 @@ public class WxBillPropertyDeposit extends TenantEntity { @io.swagger.annotations.ApiModelProperty(value="逾期天数",name="expiredDay") 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") @@ -52,7 +52,7 @@ public class WxBillPropertyDeposit 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") @@ -72,7 +72,7 @@ public class WxBillPropertyDeposit extends TenantEntity { private Integer rentShopType; @io.swagger.annotations.ApiModelProperty(value = "退还金额", name = "returnPrice") - private Long returnPrice; + private String returnPrice; @io.swagger.annotations.ApiModelProperty(value = "商铺信息", name = "shopInfo") private String shopInfo; @@ -84,11 +84,11 @@ public class WxBillPropertyDeposit 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/WxPropertyContract.java b/mallinkService/src/main/java/com/iformall/domain/po/WxPropertyContract.java index e10ca6b88..8b943dd6b 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxPropertyContract.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxPropertyContract.java @@ -45,7 +45,7 @@ public class WxPropertyContract extends TenantEntity { private Long merchantId; /*月租金/分成(分)**/ @io.swagger.annotations.ApiModelProperty(value="物业费(分)",name="price") - private Long price; + private String price; @io.swagger.annotations.ApiModelProperty(value="计租开始时间",name="rentalStartDate") private Date rentalStartDate; @@ -74,7 +74,7 @@ public class WxPropertyContract extends TenantEntity { private String contractNumber; @io.swagger.annotations.ApiModelProperty(value="押金",name="deposit") - private Long deposit; + private String deposit; @io.swagger.annotations.ApiModelProperty(value="交租日 计租开始时间减去交租日的天数为基数 提前多少日交租",name="payDate") private Integer payDate; diff --git a/mallinkService/src/main/java/com/iformall/domain/vo/WxBillDailyExportVo.java b/mallinkService/src/main/java/com/iformall/domain/vo/WxBillDailyExportVo.java index 8ce0b33df..26ea6faae 100644 --- a/mallinkService/src/main/java/com/iformall/domain/vo/WxBillDailyExportVo.java +++ b/mallinkService/src/main/java/com/iformall/domain/vo/WxBillDailyExportVo.java @@ -34,19 +34,22 @@ public class WxBillDailyExportVo { @Excel(name = "逾期(天)", orderNum = "10", width = 20) private Long expiredDay; - private Long receivePay; - private Long pay; - private Long owe; + private String receivePay; + private String pay; + private String owe; public String getReceivePayStr() { - return new BigDecimal(receivePay == null ? 0 : receivePay).divide(new BigDecimal(100)).toPlainString(); + //return new BigDecimal(receivePay == null ? 0 : receivePay).divide(new BigDecimal(100)).toPlainString(); + return receivePay; } public String getPayStr() { - return new BigDecimal(pay == null ? 0 : pay).divide(new BigDecimal(100)).toPlainString(); + //return new BigDecimal(pay == null ? 0 : pay).divide(new BigDecimal(100)).toPlainString(); + return pay; } public String getOweStr() { - return new BigDecimal(owe == null ? 0 : owe).divide(new BigDecimal(100)).toPlainString(); + //return new BigDecimal(owe == null ? 0 : owe).divide(new BigDecimal(100)).toPlainString(); + return owe; } } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxBillAllServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxBillAllServiceImpl.java index aa4c168d3..796da697b 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxBillAllServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxBillAllServiceImpl.java @@ -645,7 +645,7 @@ public class WxBillAllServiceImpl implements WxBillAllService { wxBillDaily.setPayDate(date); Long owe = (Long) bill.get("owe"); wxBillDaily.setPay(wxBillDaily.getPay() + owe); - wxBillDaily.setOwe(0L); + wxBillDaily.setOwe("0"); wxBillDaily.setStatus(EnumBillDailyStatus.PAID.getCode()); wxBillDaily.setPayDate(date); wxBillDaily.setUpdatetime(date); @@ -1510,233 +1510,233 @@ public class WxBillAllServiceImpl implements WxBillAllService { @Override public void importBillOther(String importKey, WxBillExcelTemplateOther bill, MallUserInfo user) { - Integer billType = bill.getBillType(); - long receivePay = new BigDecimal(bill.getReceivePayStr()).multiply(new BigDecimal(100)).longValueExact(); - long pay = new BigDecimal(bill.getPayStr()).multiply(new BigDecimal(100)).longValueExact(); - if (billType.equals(EnumBillExcelTemplate.DAILY.getCode())) { - WxBillDaily dailyQuery = new WxBillDaily(); - String billAttrStr = StringUtils.trim(bill.getBillAttr()); - if (billAttrStr.equals(EnumBillExcelTemplateDaily.WATER.getMessage())) { - dailyQuery.setType(EnumBillDailyType.WATER.getCode()); - } - if (billAttrStr.equals(EnumBillExcelTemplateDaily.POWER.getMessage())) { - dailyQuery.setType(EnumBillDailyType.POWER.getCode()); - } - if (billAttrStr.equals(EnumBillExcelTemplateDaily.AIR_CONDITIONING.getMessage())) { - dailyQuery.setType(EnumBillDailyType.AIR_CONDITIONING.getCode()); - } - dailyQuery.updateTenantInfo(user); - dailyQuery.setMerchantId(bill.getMerchantId()); - dailyQuery.setReceiveDate(bill.getReceiveDate()); - dailyQuery.setIsDel(EnumDelStatus.NOT_DEL.getCode()); - WxBillDaily daily = wxBillDailyMapper.selectOne(new QueryWrapper(dailyQuery)); - if (daily != null && pay > 0) { - if (!daily.getStatus().equals(EnumBillRentStatus.PAID.getCode())) { - long allPay = new BigDecimal(daily.getPay()).add(new BigDecimal(pay)).longValueExact(); - WxBillRent expiredDayAndStatus = getExpiredDayAndStatus(bill.getReceiveDate(), bill.getPayDate(), receivePay, allPay, false); - daily.setExpiredDay(expiredDayAndStatus.getExpiredDay()); - daily.setStatus(expiredDayAndStatus.getStatus()); - daily.setReceivePay(receivePay); - daily.setPay(allPay); - daily.setOwe(0L); - long owe = daily.getReceivePay() - daily.getPay(); - if (owe > 0) { - daily.setOwe(owe); - } - daily.setPayDate(bill.getPayDate()); - daily.setReceiveDate(bill.getReceiveDate()); - wxBillDailyMapper.updateById(daily); - addActionImport(daily.getId(), bill.getPayWay(), bill.getPayDate(), user, bill.getPayStr()); - } - } else { - WxMerchantShop wxMerchantShop = new WxMerchantShop(); - wxMerchantShop.updateTenantInfo(user); - wxMerchantShop.setMerchantId(bill.getMerchantId()); - wxMerchantShop.setIsDel(EnumDelStatus.NOT_DEL.getCode()); - List select = wxMerchantShopMapper.selectList(new QueryWrapper<>(wxMerchantShop)); - if (!select.isEmpty()) { - daily = new WxBillDaily(); - final IdWorker idWorker = IdWorker.get(); - daily.setId(idWorker.nextId()); - daily.setReceivePay(receivePay); - daily.setReceiveDate(bill.getReceiveDate()); - daily.setPay(pay); - daily.setType(dailyQuery.getType()); - daily.updateTenantInfo(user); - daily.setMerchantId(bill.getMerchantId()); - daily.setShopId(select.get(0).getShopId()); - daily.setRentShopType(bill.getMerchantType()); - daily.setPayDate(bill.getPayDate()); - Date date = new Date(); - daily.setCreatetime(date); - daily.setUpdatetime(date); - daily.setOwe(receivePay - pay); - daily.setIsDel(EnumDelStatus.NOT_DEL.getCode()); - daily.setStarttime(bill.getStarttime()); - daily.setEndtime(bill.getEndtime()); - WxBillRent expiredDayAndStatus = getExpiredDayAndStatus(bill.getReceiveDate(), bill.getPayDate(), receivePay, pay, false); - daily.setExpiredDay(expiredDayAndStatus.getExpiredDay()); - daily.setStatus(expiredDayAndStatus.getStatus()); - daily.setBuildWay(EnumBillDailyBuildWay.IMPORT.getCode()); - JSONArray priceDetals = new JSONArray(); - JSONObject priceDetal = new JSONObject(); - priceDetal.put("key", "price"); - priceDetal.put("value", 1); - priceDetals.add(priceDetal); - priceDetal = new JSONObject(); - priceDetal.put("key", "way"); - priceDetal.put("value", 1); - priceDetals.add(priceDetal); - priceDetal = new JSONObject(); - priceDetal.put("key", "unit"); - priceDetal.put("value", 1); - priceDetals.add(priceDetal); - daily.setPriceDetail(JSONArray.toJSONString(priceDetals)); - wxBillDailyMapper.insert(daily); - if (pay > 0) { - addActionImport(daily.getId(), bill.getPayWay(), bill.getPayDate(), user, bill.getPayStr()); - } - } - } - } else if (billType.equals(EnumBillExcelTemplate.OTHER.getCode())) { - WxBillOther otherQuery = new WxBillOther(); - otherQuery.updateTenantInfo(user); - otherQuery.setMerchantId(bill.getMerchantId()); - otherQuery.setReceiveDate(bill.getReceiveDate()); - otherQuery.setName(bill.getBillAttr()); - otherQuery.setIsDel(EnumDelStatus.NOT_DEL.getCode()); - WxBillOther other = wxBillOtherMapper.selectOne(new QueryWrapper(otherQuery)); - if (other != null && pay > 0) { - if (!other.getStatus().equals(EnumBillRentStatus.PAID.getCode())) { - long allPay = new BigDecimal(other.getPay()).add(new BigDecimal(pay)).longValueExact(); - WxBillRent expiredDayAndStatus = getExpiredDayAndStatus(bill.getReceiveDate(), bill.getPayDate(), receivePay, allPay, false); - other.setExpiredDay(expiredDayAndStatus.getExpiredDay()); - other.setStatus(expiredDayAndStatus.getStatus()); - other.setReceivePay(receivePay); - other.setName(bill.getBillAttr()); - other.setComments(bill.getBillAttr()); - other.setPay(allPay); - other.setOwe(0L); - long owe = other.getReceivePay() - other.getPay(); - if (owe > 0) { - other.setOwe(owe); - } - other.setPayDate(bill.getPayDate()); - other.setReceiveDate(bill.getReceiveDate()); - wxBillOtherMapper.updateById(other); - addActionImport(other.getId(), bill.getPayWay(), bill.getPayDate(), user, bill.getPayStr()); - } - } else { - WxMerchantShop wxMerchantShop = new WxMerchantShop(); - wxMerchantShop.updateTenantInfo(user); - wxMerchantShop.setMerchantId(bill.getMerchantId()); - wxMerchantShop.setIsDel(EnumDelStatus.NOT_DEL.getCode()); - List select = wxMerchantShopMapper.selectList(new QueryWrapper(wxMerchantShop)); - if (!select.isEmpty()) { - other = new WxBillOther(); - final IdWorker idWorker = IdWorker.get(); - other.setId(idWorker.nextId()); - other.setName(bill.getBillAttr()); - other.setComments(bill.getBillAttr()); - other.setReceivePay(receivePay); - other.setReceiveDate(bill.getReceiveDate()); - other.setPay(pay); - other.updateTenantInfo(user); - other.setMerchantId(bill.getMerchantId()); - other.setShopId(select.get(0).getShopId()); - other.setRentShopType(bill.getMerchantType()); - other.setPayDate(bill.getPayDate()); - Date date = new Date(); - other.setCreatetime(date); - other.setUpdatetime(date); - other.setOwe(receivePay - pay); - other.setIsDel(EnumDelStatus.NOT_DEL.getCode()); - other.setStarttime(bill.getStarttime()); - other.setEndtime(bill.getEndtime()); - WxBillRent expiredDayAndStatus = getExpiredDayAndStatus(bill.getReceiveDate(), bill.getPayDate(), receivePay, pay, false); - other.setExpiredDay(expiredDayAndStatus.getExpiredDay()); - other.setStatus(expiredDayAndStatus.getStatus()); - wxBillOtherMapper.insert(other); - if (pay > 0) { - addActionImport(other.getId(), bill.getPayWay(), bill.getPayDate(), user, bill.getPayStr()); - } - } - } - } else if (billType.equals(EnumBillExcelTemplate.OTHER_DEPOSIT.getCode())) { - WxBillOtherDeposit otherDepositQuery = new WxBillOtherDeposit(); - otherDepositQuery.updateTenantInfo(user); - otherDepositQuery.setMerchantId(bill.getMerchantId()); - otherDepositQuery.setReceiveDate(bill.getReceiveDate()); - otherDepositQuery.setComments(bill.getBillAttr()); - otherDepositQuery.setIsDel(EnumDelStatus.NOT_DEL.getCode()); - WxBillOtherDeposit otherDeposit = wxBillOtherDepositMapper.selectOne(new QueryWrapper(otherDepositQuery)); - if (otherDeposit != null && pay > 0) { - if (!otherDeposit.getStatus().equals(EnumBillRentStatus.PAID.getCode()) && !otherDeposit.getStatus().equals(EnumBillRentStatus.RETURN.getCode())) { - long allPay = new BigDecimal(otherDeposit.getPay()).add(new BigDecimal(pay)).longValueExact(); - otherDeposit.setExpiredDay(0L); - if (allPay >= receivePay) { - otherDeposit.setStatus(EnumBillRentStatus.PAID.getCode()); - } else { - otherDeposit.setStatus(EnumBillRentStatus.WAIT_PAY.getCode()); - } - otherDeposit.setReceivePay(receivePay); - otherDeposit.setPay(allPay); - otherDeposit.setOwe(0L); - long owe = otherDeposit.getReceivePay() - otherDeposit.getPay(); - if (owe > 0) { - otherDeposit.setOwe(owe); - } - otherDeposit.setPayDate(bill.getPayDate()); - otherDeposit.setReceiveDate(bill.getReceiveDate()); - wxBillOtherDepositMapper.updateById(otherDeposit); - addActionImport(otherDeposit.getId(), bill.getPayWay(), bill.getPayDate(), user, bill.getPayStr()); - } - } else { - WxMerchantShop wxMerchantShop = new WxMerchantShop(); - wxMerchantShop.updateTenantInfo(user); - wxMerchantShop.setMerchantId(bill.getMerchantId()); - otherDepositQuery.setReceiveDate(bill.getReceiveDate()); - wxMerchantShop.setIsDel(EnumDelStatus.NOT_DEL.getCode()); - List select = wxMerchantShopMapper.selectList(new QueryWrapper(wxMerchantShop)); - if (!select.isEmpty()) { - otherDeposit = new WxBillOtherDeposit(); - final IdWorker idWorker = IdWorker.get(); - otherDeposit.setId(idWorker.nextId()); - otherDeposit.setName(bill.getBillAttr()); - otherDeposit.setComments(bill.getBillAttr()); - otherDeposit.setReceivePay(receivePay); - otherDeposit.setReceiveDate(bill.getReceiveDate()); - otherDeposit.setPay(pay); - otherDeposit.updateTenantInfo(user); - otherDeposit.setMerchantId(bill.getMerchantId()); - otherDeposit.setShopId(select.get(0).getShopId()); - otherDeposit.setRentShopType(bill.getMerchantType()); - otherDeposit.setPayDate(bill.getPayDate()); - Date date = new Date(); - otherDeposit.setCreatetime(date); - otherDeposit.setUpdatetime(date); - otherDeposit.setExpiredDay(0L); - otherDeposit.setOwe(receivePay - pay); - otherDeposit.setIsDel(EnumDelStatus.NOT_DEL.getCode()); - otherDeposit.setStarttime(bill.getStarttime()); - otherDeposit.setEndtime(bill.getEndtime()); - if (receivePay <= pay) { - otherDeposit.setStatus(EnumBillRentStatus.PAID.getCode()); - } else { - otherDeposit.setStatus(EnumBillRentStatus.WAIT_PAY.getCode()); - } - wxBillOtherDepositMapper.insert(otherDeposit); - if (pay > 0) { - addActionImport(otherDeposit.getId(), bill.getPayWay(), bill.getPayDate(), user, bill.getPayStr()); - } - } - } - } else { - logger.error("账单导入失败"); - } - //记数 - stringRedisTemplate.opsForHash().increment(importKey, "processCount", 1); - stringRedisTemplate.expire(importKey, 10, TimeUnit.SECONDS); +// Integer billType = bill.getBillType(); +// long receivePay = new BigDecimal(bill.getReceivePayStr()).multiply(new BigDecimal(100)).longValueExact(); +// long pay = new BigDecimal(bill.getPayStr()).multiply(new BigDecimal(100)).longValueExact(); +// if (billType.equals(EnumBillExcelTemplate.DAILY.getCode())) { +// WxBillDaily dailyQuery = new WxBillDaily(); +// String billAttrStr = StringUtils.trim(bill.getBillAttr()); +// if (billAttrStr.equals(EnumBillExcelTemplateDaily.WATER.getMessage())) { +// dailyQuery.setType(EnumBillDailyType.WATER.getCode()); +// } +// if (billAttrStr.equals(EnumBillExcelTemplateDaily.POWER.getMessage())) { +// dailyQuery.setType(EnumBillDailyType.POWER.getCode()); +// } +// if (billAttrStr.equals(EnumBillExcelTemplateDaily.AIR_CONDITIONING.getMessage())) { +// dailyQuery.setType(EnumBillDailyType.AIR_CONDITIONING.getCode()); +// } +// dailyQuery.updateTenantInfo(user); +// dailyQuery.setMerchantId(bill.getMerchantId()); +// dailyQuery.setReceiveDate(bill.getReceiveDate()); +// dailyQuery.setIsDel(EnumDelStatus.NOT_DEL.getCode()); +// WxBillDaily daily = wxBillDailyMapper.selectOne(new QueryWrapper(dailyQuery)); +// if (daily != null && pay > 0) { +// if (!daily.getStatus().equals(EnumBillRentStatus.PAID.getCode())) { +// long allPay = new BigDecimal(daily.getPay()).add(new BigDecimal(pay)).longValueExact(); +// WxBillRent expiredDayAndStatus = getExpiredDayAndStatus(bill.getReceiveDate(), bill.getPayDate(), receivePay, allPay, false); +// daily.setExpiredDay(expiredDayAndStatus.getExpiredDay()); +// daily.setStatus(expiredDayAndStatus.getStatus()); +// daily.setReceivePay(receivePay); +// daily.setPay(allPay); +// daily.setOwe(0L); +// long owe = daily.getReceivePay() - daily.getPay(); +// if (owe > 0) { +// daily.setOwe(owe); +// } +// daily.setPayDate(bill.getPayDate()); +// daily.setReceiveDate(bill.getReceiveDate()); +// wxBillDailyMapper.updateById(daily); +// addActionImport(daily.getId(), bill.getPayWay(), bill.getPayDate(), user, bill.getPayStr()); +// } +// } else { +// WxMerchantShop wxMerchantShop = new WxMerchantShop(); +// wxMerchantShop.updateTenantInfo(user); +// wxMerchantShop.setMerchantId(bill.getMerchantId()); +// wxMerchantShop.setIsDel(EnumDelStatus.NOT_DEL.getCode()); +// List select = wxMerchantShopMapper.selectList(new QueryWrapper<>(wxMerchantShop)); +// if (!select.isEmpty()) { +// daily = new WxBillDaily(); +// final IdWorker idWorker = IdWorker.get(); +// daily.setId(idWorker.nextId()); +// daily.setReceivePay(receivePay); +// daily.setReceiveDate(bill.getReceiveDate()); +// daily.setPay(pay); +// daily.setType(dailyQuery.getType()); +// daily.updateTenantInfo(user); +// daily.setMerchantId(bill.getMerchantId()); +// daily.setShopId(select.get(0).getShopId()); +// daily.setRentShopType(bill.getMerchantType()); +// daily.setPayDate(bill.getPayDate()); +// Date date = new Date(); +// daily.setCreatetime(date); +// daily.setUpdatetime(date); +// daily.setOwe(receivePay - pay); +// daily.setIsDel(EnumDelStatus.NOT_DEL.getCode()); +// daily.setStarttime(bill.getStarttime()); +// daily.setEndtime(bill.getEndtime()); +// WxBillRent expiredDayAndStatus = getExpiredDayAndStatus(bill.getReceiveDate(), bill.getPayDate(), receivePay, pay, false); +// daily.setExpiredDay(expiredDayAndStatus.getExpiredDay()); +// daily.setStatus(expiredDayAndStatus.getStatus()); +// daily.setBuildWay(EnumBillDailyBuildWay.IMPORT.getCode()); +// JSONArray priceDetals = new JSONArray(); +// JSONObject priceDetal = new JSONObject(); +// priceDetal.put("key", "price"); +// priceDetal.put("value", 1); +// priceDetals.add(priceDetal); +// priceDetal = new JSONObject(); +// priceDetal.put("key", "way"); +// priceDetal.put("value", 1); +// priceDetals.add(priceDetal); +// priceDetal = new JSONObject(); +// priceDetal.put("key", "unit"); +// priceDetal.put("value", 1); +// priceDetals.add(priceDetal); +// daily.setPriceDetail(JSONArray.toJSONString(priceDetals)); +// wxBillDailyMapper.insert(daily); +// if (pay > 0) { +// addActionImport(daily.getId(), bill.getPayWay(), bill.getPayDate(), user, bill.getPayStr()); +// } +// } +// } +// } else if (billType.equals(EnumBillExcelTemplate.OTHER.getCode())) { +// WxBillOther otherQuery = new WxBillOther(); +// otherQuery.updateTenantInfo(user); +// otherQuery.setMerchantId(bill.getMerchantId()); +// otherQuery.setReceiveDate(bill.getReceiveDate()); +// otherQuery.setName(bill.getBillAttr()); +// otherQuery.setIsDel(EnumDelStatus.NOT_DEL.getCode()); +// WxBillOther other = wxBillOtherMapper.selectOne(new QueryWrapper(otherQuery)); +// if (other != null && pay > 0) { +// if (!other.getStatus().equals(EnumBillRentStatus.PAID.getCode())) { +// long allPay = new BigDecimal(other.getPay()).add(new BigDecimal(pay)).longValueExact(); +// WxBillRent expiredDayAndStatus = getExpiredDayAndStatus(bill.getReceiveDate(), bill.getPayDate(), receivePay, allPay, false); +// other.setExpiredDay(expiredDayAndStatus.getExpiredDay()); +// other.setStatus(expiredDayAndStatus.getStatus()); +// other.setReceivePay(receivePay); +// other.setName(bill.getBillAttr()); +// other.setComments(bill.getBillAttr()); +// other.setPay(allPay); +// other.setOwe(0L); +// long owe = other.getReceivePay() - other.getPay(); +// if (owe > 0) { +// other.setOwe(owe); +// } +// other.setPayDate(bill.getPayDate()); +// other.setReceiveDate(bill.getReceiveDate()); +// wxBillOtherMapper.updateById(other); +// addActionImport(other.getId(), bill.getPayWay(), bill.getPayDate(), user, bill.getPayStr()); +// } +// } else { +// WxMerchantShop wxMerchantShop = new WxMerchantShop(); +// wxMerchantShop.updateTenantInfo(user); +// wxMerchantShop.setMerchantId(bill.getMerchantId()); +// wxMerchantShop.setIsDel(EnumDelStatus.NOT_DEL.getCode()); +// List select = wxMerchantShopMapper.selectList(new QueryWrapper(wxMerchantShop)); +// if (!select.isEmpty()) { +// other = new WxBillOther(); +// final IdWorker idWorker = IdWorker.get(); +// other.setId(idWorker.nextId()); +// other.setName(bill.getBillAttr()); +// other.setComments(bill.getBillAttr()); +// other.setReceivePay(receivePay); +// other.setReceiveDate(bill.getReceiveDate()); +// other.setPay(pay); +// other.updateTenantInfo(user); +// other.setMerchantId(bill.getMerchantId()); +// other.setShopId(select.get(0).getShopId()); +// other.setRentShopType(bill.getMerchantType()); +// other.setPayDate(bill.getPayDate()); +// Date date = new Date(); +// other.setCreatetime(date); +// other.setUpdatetime(date); +// other.setOwe(receivePay - pay); +// other.setIsDel(EnumDelStatus.NOT_DEL.getCode()); +// other.setStarttime(bill.getStarttime()); +// other.setEndtime(bill.getEndtime()); +// WxBillRent expiredDayAndStatus = getExpiredDayAndStatus(bill.getReceiveDate(), bill.getPayDate(), receivePay, pay, false); +// other.setExpiredDay(expiredDayAndStatus.getExpiredDay()); +// other.setStatus(expiredDayAndStatus.getStatus()); +// wxBillOtherMapper.insert(other); +// if (pay > 0) { +// addActionImport(other.getId(), bill.getPayWay(), bill.getPayDate(), user, bill.getPayStr()); +// } +// } +// } +// } else if (billType.equals(EnumBillExcelTemplate.OTHER_DEPOSIT.getCode())) { +// WxBillOtherDeposit otherDepositQuery = new WxBillOtherDeposit(); +// otherDepositQuery.updateTenantInfo(user); +// otherDepositQuery.setMerchantId(bill.getMerchantId()); +// otherDepositQuery.setReceiveDate(bill.getReceiveDate()); +// otherDepositQuery.setComments(bill.getBillAttr()); +// otherDepositQuery.setIsDel(EnumDelStatus.NOT_DEL.getCode()); +// WxBillOtherDeposit otherDeposit = wxBillOtherDepositMapper.selectOne(new QueryWrapper(otherDepositQuery)); +// if (otherDeposit != null && pay > 0) { +// if (!otherDeposit.getStatus().equals(EnumBillRentStatus.PAID.getCode()) && !otherDeposit.getStatus().equals(EnumBillRentStatus.RETURN.getCode())) { +// long allPay = new BigDecimal(otherDeposit.getPay()).add(new BigDecimal(pay)).longValueExact(); +// otherDeposit.setExpiredDay(0L); +// if (allPay >= receivePay) { +// otherDeposit.setStatus(EnumBillRentStatus.PAID.getCode()); +// } else { +// otherDeposit.setStatus(EnumBillRentStatus.WAIT_PAY.getCode()); +// } +// otherDeposit.setReceivePay(receivePay); +// otherDeposit.setPay(allPay); +// otherDeposit.setOwe(0L); +// long owe = otherDeposit.getReceivePay() - otherDeposit.getPay(); +// if (owe > 0) { +// otherDeposit.setOwe(owe); +// } +// otherDeposit.setPayDate(bill.getPayDate()); +// otherDeposit.setReceiveDate(bill.getReceiveDate()); +// wxBillOtherDepositMapper.updateById(otherDeposit); +// addActionImport(otherDeposit.getId(), bill.getPayWay(), bill.getPayDate(), user, bill.getPayStr()); +// } +// } else { +// WxMerchantShop wxMerchantShop = new WxMerchantShop(); +// wxMerchantShop.updateTenantInfo(user); +// wxMerchantShop.setMerchantId(bill.getMerchantId()); +// otherDepositQuery.setReceiveDate(bill.getReceiveDate()); +// wxMerchantShop.setIsDel(EnumDelStatus.NOT_DEL.getCode()); +// List select = wxMerchantShopMapper.selectList(new QueryWrapper(wxMerchantShop)); +// if (!select.isEmpty()) { +// otherDeposit = new WxBillOtherDeposit(); +// final IdWorker idWorker = IdWorker.get(); +// otherDeposit.setId(idWorker.nextId()); +// otherDeposit.setName(bill.getBillAttr()); +// otherDeposit.setComments(bill.getBillAttr()); +// otherDeposit.setReceivePay(receivePay); +// otherDeposit.setReceiveDate(bill.getReceiveDate()); +// otherDeposit.setPay(pay); +// otherDeposit.updateTenantInfo(user); +// otherDeposit.setMerchantId(bill.getMerchantId()); +// otherDeposit.setShopId(select.get(0).getShopId()); +// otherDeposit.setRentShopType(bill.getMerchantType()); +// otherDeposit.setPayDate(bill.getPayDate()); +// Date date = new Date(); +// otherDeposit.setCreatetime(date); +// otherDeposit.setUpdatetime(date); +// otherDeposit.setExpiredDay(0L); +// otherDeposit.setOwe(receivePay - pay); +// otherDeposit.setIsDel(EnumDelStatus.NOT_DEL.getCode()); +// otherDeposit.setStarttime(bill.getStarttime()); +// otherDeposit.setEndtime(bill.getEndtime()); +// if (receivePay <= pay) { +// otherDeposit.setStatus(EnumBillRentStatus.PAID.getCode()); +// } else { +// otherDeposit.setStatus(EnumBillRentStatus.WAIT_PAY.getCode()); +// } +// wxBillOtherDepositMapper.insert(otherDeposit); +// if (pay > 0) { +// addActionImport(otherDeposit.getId(), bill.getPayWay(), bill.getPayDate(), user, bill.getPayStr()); +// } +// } +// } +// } else { +// logger.error("账单导入失败"); +// } +// //记数 +// stringRedisTemplate.opsForHash().increment(importKey, "processCount", 1); +// stringRedisTemplate.expire(importKey, 10, TimeUnit.SECONDS); } public WxBillRent getExpiredDayAndStatus(Date startDate, Date endDate, Long owe, Long pay, boolean flag) { @@ -1849,17 +1849,17 @@ public class WxBillAllServiceImpl implements WxBillAllService { wxBillActionService.modifyBill(wxBillAction, user); } - public void updateDailyBill(Long businessId, Long newPrice, Date updateDate,boolean forcePaid) { + public void updateDailyBill(Long businessId, String newPrice, Date updateDate,boolean forcePaid) { WxBillDaily dbBill = wxBillDailyMapper.selectById(businessId); WxBillDaily wxBillDaily = new WxBillDaily(); wxBillDaily.setId(businessId); if (forcePaid) { wxBillDaily.setReceivePay(dbBill.getPay()); wxBillDaily.setStatus(EnumBillRentStatus.PAID.getCode()); - wxBillDaily.setOwe(0L); + wxBillDaily.setOwe("0"); }else { wxBillDaily.setReceivePay(newPrice); - wxBillDaily.setOwe(newPrice + dbBill.getServiceChargePay() - dbBill.getPay()); + wxBillDaily.setOwe(new BigDecimal(newPrice).add(new BigDecimal(dbBill.getServiceChargePay())).subtract(new BigDecimal(dbBill.getPay())).toPlainString()); if (newPrice.equals(dbBill.getPay())) { wxBillDaily.setStatus(EnumBillRentStatus.PAID.getCode()); } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxBillDailyServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxBillDailyServiceImpl.java index e20081c09..b1432edde 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxBillDailyServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxBillDailyServiceImpl.java @@ -1,5 +1,6 @@ package com.iformall.service.impl; +import com.alibaba.druid.Constants; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; @@ -22,6 +23,7 @@ import com.iformall.service.WxBillActionService; import com.iformall.service.WxBillDailyService; import com.iformall.service.WxMerchantService; import com.iformall.service.WxPayAccountBillService; +import com.iformall.utils.Constant; import com.iformall.utils.DateUtils; import org.apache.commons.collections.CollectionUtils; @@ -139,15 +141,15 @@ public class WxBillDailyServiceImpl implements WxBillDailyService { if (e.getServiceChargePay() != null) { servicePay = new BigDecimal(e.getServiceChargePay()); } else { - servicePay = new BigDecimal(e.getReceivePay()).multiply(new BigDecimal(wxPayAccountBill.getServiceChargeRate())).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP); + servicePay = new BigDecimal(e.getReceivePay()).multiply(new BigDecimal(wxPayAccountBill.getServiceChargeRate())).divide(new BigDecimal(100), Constant.default_long_decimal_size, BigDecimal.ROUND_HALF_UP); } - Long realReceivePay = servicePay.longValue() + e.getReceivePay(); - e.setRealReceivePay(realReceivePay); - e.setServiceChargePay(servicePay.intValue()); + BigDecimal realReceivePay = servicePay.add(new BigDecimal(e.getReceivePay())); + e.setRealReceivePay(realReceivePay.toPlainString()); + e.setServiceChargePay(servicePay.toPlainString()); if (!e.getStatus().equals(EnumBillRentStatus.NOT_PAID.getCode())) { - e.setOwe(0L); + e.setOwe("0"); } else { - e.setOwe(realReceivePay - e.getPay()); + e.setOwe(realReceivePay.subtract(new BigDecimal(e.getPay())).toPlainString()); } } } @@ -204,7 +206,7 @@ public class WxBillDailyServiceImpl implements WxBillDailyService { record.setId(id); record.updateTenantInfo(tenantEntity); WxBillDaily wxBillDaily = getBillRentPropertyList(1, 1, record, wxPayAccountBill).getList().get(0); - wxBillDaily.setOwe(wxBillDaily.getRealReceivePay() - wxBillDaily.getPay()); + wxBillDaily.setOwe(new BigDecimal(wxBillDaily.getRealReceivePay()).subtract(new BigDecimal(wxBillDaily.getPay())).toPlainString()); wxBillDaily.setMerchant(wxMerchantMapper.selectById(wxBillDaily.getMerchantId())); // if (wxBillDaily.getShopId() != null) { // WxShop shop = new WxShop(); @@ -219,9 +221,9 @@ public class WxBillDailyServiceImpl implements WxBillDailyService { @Override public ResultData saveOrUpdate(WxBillDaily record, MallUserInfo user) { - int receivepay = record.getRealReceivePay() == null ? 0 : record.getRealReceivePay().intValue(); - int pay = record.getPay()==null?0:record.getPay().intValue(); - if(pay>receivepay){ + String receivepay = StringUtils.isBlank(record.getRealReceivePay()) ? "0" : record.getRealReceivePay(); + String pay = StringUtils.isBlank(record.getPay()) ? "0" : record.getPay(); + if(new BigDecimal(pay).compareTo(new BigDecimal(receivepay)) > 0 ){ return new ResultData(ErrorCode.BILL_PAY_ERROR.getCode(), "实收金额不能大于实际应收总金额"); } Date date = new Date(); @@ -243,7 +245,7 @@ public class WxBillDailyServiceImpl implements WxBillDailyService { record.setCreatetime(date); record.setUpdatetime(date); record.setExpiredDay(0L); - record.setOwe(record.getRealReceivePay() - record.getPay()); + record.setOwe(new BigDecimal(record.getRealReceivePay()).subtract(new BigDecimal(record.getPay())).toPlainString()); record.setIsDel(EnumDelStatus.NOT_DEL.getCode()); try { wxBillDailyMapper.insert(record); @@ -262,15 +264,15 @@ public class WxBillDailyServiceImpl implements WxBillDailyService { String price = ""; String message = ""; if(record.getServiceChargePayUpdate() != null){ - Double l = Double.valueOf(record.getServiceChargePayUpdate())*100; - wxBillDaily.setServiceChargePay(l.intValue()); - wxBillDaily.setOwe(wxBillDaily.getReceivePay() + wxBillDaily.getServiceChargePay() - wxBillDaily.getPay()); + wxBillDaily.setServiceChargePay(record.getServiceChargePayUpdate()); + wxBillDaily.setOwe(new BigDecimal(wxBillDaily.getReceivePay()).add(new BigDecimal(wxBillDaily.getServiceChargePay())) + .subtract(new BigDecimal(wxBillDaily.getPay())).toPlainString()); }else{ - Long addpay = wxBillDaily.getPay(); + String addpay = wxBillDaily.getPay(); wxBillDaily.setPayDate(record.getPayDate()); wxBillDaily.setPay(record.getPay()); wxBillDaily.setReceivePay(record.getReceivePay()); - wxBillDaily.setOwe(record.getRealReceivePay() - record.getPay()); + wxBillDaily.setOwe(new BigDecimal(record.getRealReceivePay()).subtract(new BigDecimal(record.getPay())).toPlainString()); if (record.getPay().equals(record.getRealReceivePay())) { wxBillDaily.setStatus(EnumBillRentStatus.PAID.getCode()); Date payDate = record.getPayDate(); @@ -286,7 +288,7 @@ public class WxBillDailyServiceImpl implements WxBillDailyService { wxBillDaily.setPayWay(record.getPayWay()); wxBillDaily.setPriceDetail(record.getPriceDetail()); message = EnumBillPayWay.getEnum(record.getPayWay()).getMessage(); - price = new BigDecimal(record.getPay() - addpay).divide(new BigDecimal(100)).toPlainString(); + price = new BigDecimal(record.getPay()).subtract(new BigDecimal(addpay)).toPlainString(); } try { wxBillDailyMapper.updateById(wxBillDaily); @@ -377,16 +379,16 @@ public class WxBillDailyServiceImpl implements WxBillDailyService { Integer type = billDaily.getType(); WxBillDaily wxBillDaily = new WxBillDaily(); - Long receivePay = billDaily.getReceivePay(); + String receivePay = billDaily.getReceivePay(); wxBillDaily.setReceivePay(receivePay); - Long pay = billDaily.getPay(); + String pay = billDaily.getPay(); wxBillDaily.setPay(pay); - wxBillDaily.setOwe(receivePay - pay); + wxBillDaily.setOwe(new BigDecimal(receivePay).subtract(new BigDecimal(pay)).toPlainString()); wxBillDaily.setType(type); Date receiveDate = billDaily.getReceiveDate(); wxBillDaily.setReceiveDate(receiveDate); Date date = new Date(); - if (pay > 0) { + if (new BigDecimal(pay).compareTo(new BigDecimal(0)) > 0) { wxBillDaily.setPayDate(date); } int expiredDay = DateUtils.daysBetween(receiveDate, date); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxBillSettleServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxBillSettleServiceImpl.java index ee661a5a1..b3facdca5 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxBillSettleServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxBillSettleServiceImpl.java @@ -458,9 +458,9 @@ public class WxBillSettleServiceImpl implements WxBillSettleService { wxBillDaily.setPayDate(new Date()); WxBillDaily dbBill = wxBillDailyMapper.selectById(wxBillDaily.getId()); if(dbBill!=null) { - if(dbBill.getPay() == null) dbBill.setPay(0l); - if(dbBill.getOwe() == null) dbBill.setOwe(0l); - wxBillDaily.setPay(dbBill.getPay()+dbBill.getOwe()); + if(StringUtils.isBlank(dbBill.getPay())) dbBill.setPay("0"); + if(StringUtils.isBlank(dbBill.getOwe())) dbBill.setOwe("0"); + wxBillDaily.setPay(new BigDecimal(dbBill.getPay()).add(new BigDecimal(dbBill.getOwe())).toPlainString()); wxBillDaily.setPayDate(new Date()); addBillAction(bill.getBillId(), String.valueOf(dbBill.getOwe())); } diff --git a/mallinkService/src/main/resources/mapper/WxBillDailyMapper.xml b/mallinkService/src/main/resources/mapper/WxBillDailyMapper.xml index 8f1def20d..5cde0653d 100644 --- a/mallinkService/src/main/resources/mapper/WxBillDailyMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxBillDailyMapper.xml @@ -3,15 +3,15 @@ - - + + - + diff --git a/mallinkService/src/main/resources/mapper/WxBillPropertyDepositMapper.xml b/mallinkService/src/main/resources/mapper/WxBillPropertyDepositMapper.xml index 4155b0841..9706386c2 100644 --- a/mallinkService/src/main/resources/mapper/WxBillPropertyDepositMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxBillPropertyDepositMapper.xml @@ -6,25 +6,25 @@ - - + + - + - + - + diff --git a/mallinkService/src/main/resources/mapper/WxBillPropertyMapper.xml b/mallinkService/src/main/resources/mapper/WxBillPropertyMapper.xml index 8393d901c..c2d077e08 100644 --- a/mallinkService/src/main/resources/mapper/WxBillPropertyMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxBillPropertyMapper.xml @@ -6,19 +6,19 @@ - - + + - + - + @@ -27,7 +27,7 @@ - + diff --git a/mallinkService/src/main/resources/mapper/WxPropertyContractMapper.xml b/mallinkService/src/main/resources/mapper/WxPropertyContractMapper.xml index 16ac03f39..4733af3cf 100644 --- a/mallinkService/src/main/resources/mapper/WxPropertyContractMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxPropertyContractMapper.xml @@ -5,7 +5,7 @@ - + @@ -15,7 +15,7 @@ - +