| @@ -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()); | |||
| @@ -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); | |||
| 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); | |||
| @@ -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; | |||
| } | |||
| @@ -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; | |||
| @@ -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; | |||
| } | |||
| @@ -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; | |||
| @@ -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; | |||
| @@ -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; | |||
| } | |||
| } | |||
| @@ -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<WxMerchantShop> 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<WxMerchantShop> 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<WxMerchantShop> 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<WxMerchantShop> 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<WxMerchantShop> 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<WxMerchantShop> 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()); | |||
| } | |||
| @@ -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); | |||
| @@ -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())); | |||
| } | |||
| @@ -3,15 +3,15 @@ | |||
| <mapper namespace="com.iformall.mapper.WxBillDailyMapper"> | |||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxBillDaily"> | |||
| <id column="id" jdbcType="BIGINT" property="id" /> | |||
| <result column="receive_pay" jdbcType="BIGINT" property="receivePay"/> | |||
| <result column="pay" jdbcType="BIGINT" property="pay"/> | |||
| <result column="receive_pay" jdbcType="VARCHAR" property="receivePay"/> | |||
| <result column="pay" jdbcType="VARCHAR" property="pay"/> | |||
| <result column="receive_date" jdbcType="TIMESTAMP" property="receiveDate" /> | |||
| <result column="pay_date" jdbcType="TIMESTAMP" property="payDate" /> | |||
| <result column="createtime" jdbcType="TIMESTAMP" property="createtime" /> | |||
| <result column="expired_day" jdbcType="INTEGER" property="expiredDay" /> | |||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" /> | |||
| <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" /> | |||
| <result column="owe" jdbcType="BIGINT" property="owe"/> | |||
| <result column="owe" jdbcType="VARCHAR" property="owe"/> | |||
| <result column="status" jdbcType="INTEGER" property="status" /> | |||
| <result column="apply_status" jdbcType="INTEGER" property="applyStatus"/> | |||
| <result column="apply_pay_img" jdbcType="INTEGER" property="applyPayImg"/> | |||
| @@ -6,25 +6,25 @@ | |||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" /> | |||
| <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" /> | |||
| <result column="property_contract_id" jdbcType="BIGINT" property="propertyContractId"/> | |||
| <result column="receive_pay" jdbcType="BIGINT" property="receivePay"/> | |||
| <result column="pay" jdbcType="BIGINT" property="pay"/> | |||
| <result column="receive_pay" jdbcType="VARCHAR" property="receivePay"/> | |||
| <result column="pay" jdbcType="VARCHAR" property="pay"/> | |||
| <result column="receive_date" jdbcType="TIMESTAMP" property="receiveDate" /> | |||
| <result column="pay_date" jdbcType="TIMESTAMP" property="payDate" /> | |||
| <result column="createtime" jdbcType="TIMESTAMP" property="createtime" /> | |||
| <result column="expired_day" jdbcType="INTEGER" property="expiredDay" /> | |||
| <result column="owe" jdbcType="BIGINT" property="owe"/> | |||
| <result column="owe" jdbcType="VARCHAR" property="owe"/> | |||
| <result column="status" jdbcType="INTEGER" property="status" /> | |||
| <result column="apply_status" jdbcType="INTEGER" property="applyStatus"/> | |||
| <result column="apply_pay_img" jdbcType="INTEGER" property="applyPayImg"/> | |||
| <result column="apply_update_time" jdbcType="INTEGER" property="applyUpdateTime"/> | |||
| <result column="is_del" jdbcType="INTEGER" property="isDel" /> | |||
| <result column="need_pay" jdbcType="INTEGER" property="needPay" /> | |||
| <result column="need_pay" jdbcType="VARCHAR" property="needPay" /> | |||
| <result column="merchant_id" jdbcType="INTEGER" property="merchantId" /> | |||
| <result column="user_id" jdbcType="INTEGER" property="userId" /> | |||
| <result column="shop_id" jdbcType="INTEGER" property="shopId" /> | |||
| <result column="updatetime" jdbcType="TIMESTAMP" property="updatetime" /> | |||
| <result column="rent_shop_type" jdbcType="INTEGER" property="rentShopType"/> | |||
| <result column="return_price" jdbcType="BIGINT" property="returnPrice"/> | |||
| <result column="return_price" jdbcType="VARCHAR" property="returnPrice"/> | |||
| <result column="shop_info" jdbcType="VARCHAR" property="shopInfo"/> | |||
| <result column="pay_way" jdbcType="INTEGER" property="payWay"/> | |||
| <result column="freeze" property="freeze"/> | |||
| @@ -6,19 +6,19 @@ | |||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/> | |||
| <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId"/> | |||
| <result column="property_contract_id" jdbcType="INTEGER" property="propertyContractId"/> | |||
| <result column="receive_pay" jdbcType="BIGINT" property="receivePay"/> | |||
| <result column="pay" jdbcType="BIGINT" property="pay"/> | |||
| <result column="receive_pay" jdbcType="VARCHAR" property="receivePay"/> | |||
| <result column="pay" jdbcType="VARCHAR" property="pay"/> | |||
| <result column="receive_date" jdbcType="TIMESTAMP" property="receiveDate"/> | |||
| <result column="pay_date" jdbcType="TIMESTAMP" property="payDate"/> | |||
| <result column="createtime" jdbcType="TIMESTAMP" property="createtime"/> | |||
| <result column="expired_day" jdbcType="INTEGER" property="expiredDay"/> | |||
| <result column="owe" jdbcType="BIGINT" property="owe"/> | |||
| <result column="owe" jdbcType="VARCHAR" property="owe"/> | |||
| <result column="status" jdbcType="INTEGER" property="status"/> | |||
| <result column="apply_status" jdbcType="INTEGER" property="applyStatus"/> | |||
| <result column="apply_pay_img" jdbcType="INTEGER" property="applyPayImg"/> | |||
| <result column="apply_update_time" jdbcType="INTEGER" property="applyUpdateTime"/> | |||
| <result column="is_del" jdbcType="INTEGER" property="isDel"/> | |||
| <result column="need_pay" jdbcType="BIGINT" property="needPay"/> | |||
| <result column="need_pay" jdbcType="VARCHAR" property="needPay"/> | |||
| <result column="merchant_id" jdbcType="INTEGER" property="merchantId"/> | |||
| <result column="user_id" jdbcType="INTEGER" property="userId"/> | |||
| <result column="shop_id" jdbcType="INTEGER" property="shopId"/> | |||
| @@ -27,7 +27,7 @@ | |||
| <result column="revenue" jdbcType="BIGINT" property="revenue"/> | |||
| <result column="late_pay_ratio" jdbcType="INTEGER" property="latePayRatio"/> | |||
| <result column="late_pay_time" jdbcType="TIMESTAMP" property="latePayTime"/> | |||
| <result column="late_pay_price" jdbcType="BIGINT" property="latePayPrice"/> | |||
| <result column="late_pay_price" jdbcType="VARCHAR" property="latePayPrice"/> | |||
| <result column="period" jdbcType="INTEGER" property="period"/> | |||
| <result column="is_preview" property="isPreview"/> | |||
| <result column="shop_info" jdbcType="VARCHAR" property="shopInfo"/> | |||
| @@ -5,7 +5,7 @@ | |||
| <id column="id" jdbcType="BIGINT" property="id"/> | |||
| <result column="merchant_id" jdbcType="BIGINT" property="merchantId"/> | |||
| <result column="decimal_size" jdbcType="INTEGER" property="decimalSize"/> | |||
| <result column="price" jdbcType="INTEGER" property="price"/> | |||
| <result column="price" jdbcType="VARCHAR" property="price"/> | |||
| <result column="rental_start_date" jdbcType="TIMESTAMP" property="rentalStartDate"/> | |||
| <result column="rental_end_date" jdbcType="TIMESTAMP" property="rentalEndDate"/> | |||
| <result column="sign_date" jdbcType="TIMESTAMP" property="signDate"/> | |||
| @@ -15,7 +15,7 @@ | |||
| <result column="filepath" jdbcType="VARCHAR" property="filepath"/> | |||
| <result column="status" jdbcType="INTEGER" property="status"/> | |||
| <result column="contract_number" jdbcType="VARCHAR" property="contractNumber"/> | |||
| <result column="deposit" jdbcType="INTEGER" property="deposit"/> | |||
| <result column="deposit" jdbcType="VARCHAR" property="deposit"/> | |||
| <result column="pay_date" jdbcType="INTEGER" property="payDate"/> | |||
| <result column="is_del" jdbcType="INTEGER" property="isDel"/> | |||
| <result column="merchant_name" jdbcType="VARCHAR" property="merchantName"/> | |||