From 08f8241eebe530aeb2dca369ea8b44a2d0f3ec60 Mon Sep 17 00:00:00 2001 From: winter Date: Mon, 29 Jul 2024 20:32:21 +0800 Subject: [PATCH] fix --- .../domain/po/base/WxBillBaseEntity.java | 5 ++- .../service/helper/WxBillAllHelper.java | 39 ++++++++----------- .../service/impl/WxMerchantServiceImpl.java | 8 +++- 3 files changed, 27 insertions(+), 25 deletions(-) diff --git a/mallinkService/src/main/java/com/iformall/domain/po/base/WxBillBaseEntity.java b/mallinkService/src/main/java/com/iformall/domain/po/base/WxBillBaseEntity.java index 5a2df3dc8..972fcdb35 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/base/WxBillBaseEntity.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/base/WxBillBaseEntity.java @@ -104,8 +104,11 @@ public class WxBillBaseEntity extends TenantEntity { if (StringUtils.isBlank(setOff)) { setOff = "0"; } + if (StringUtils.isBlank(returnPay)) { + returnPay = "0"; + } if (StringUtils.isNotBlank(receivePay) && StringUtils.isNotBlank(pay)) { - return new BigDecimal(receivePay).subtract(new BigDecimal(pay)).subtract(new BigDecimal(setOff)).toPlainString(); + return new BigDecimal(receivePay).subtract(new BigDecimal(pay)).subtract(new BigDecimal(returnPay)).subtract(new BigDecimal(setOff)).toPlainString(); } return "0"; } diff --git a/mallinkService/src/main/java/com/iformall/service/helper/WxBillAllHelper.java b/mallinkService/src/main/java/com/iformall/service/helper/WxBillAllHelper.java index 45d97814a..7ef99d940 100644 --- a/mallinkService/src/main/java/com/iformall/service/helper/WxBillAllHelper.java +++ b/mallinkService/src/main/java/com/iformall/service/helper/WxBillAllHelper.java @@ -1122,9 +1122,9 @@ public class WxBillAllHelper { action.setBillId(bill.getId()); action.setBillType(bill.getBillType()); String oldReceivePay = bill.getReceivePay(); + //如果账单的开始时间在结束时间之后,已经支付了的要退回。 if (!bill.getStarttime().before(endTime)) { - if (bill.getStatus().intValue() == EnumBillStatus.WAIT_PAY.getCode().intValue() || - bill.getStatus().intValue() == EnumBillStatus.BAD.getCode().intValue()) { + if (bill.getStatus().intValue() == EnumBillStatus.WAIT_PAY.getCode().intValue()) { EnumBillStatus realBillStatus = EnumBillStatus.INVALID; String newReceivePay = bill.getReceivePay(); if (isPaid) { @@ -1139,7 +1139,7 @@ public class WxBillAllHelper { action.setDetails(EnumBillAction.STATUS_CHANGE.getDescription(null, null, null,null,EnumBillStatus.getEnum(bill.getStatus()),realBillStatus)); action.setRemark("商户停用,停用日期["+endTimeStr+"]"+"系统自动变更状态,应收金额变为0"); isUpdate = true; - //如果是已支付,则需退回全部费用 + //如果是已结清,则需退回全部费用 }else if (bill.getStatus().intValue() == EnumBillStatus.PAID.getCode().intValue()) { bill.setReceivePay("0"); bill.setStatus(EnumBillStatus.STOP_TO_SETTLE.getCode()); @@ -1150,8 +1150,10 @@ public class WxBillAllHelper { action.setRemark("商户停用,停用日期["+endTimeStr+"],系统自动由["+EnumBillStatus.getEnum(bill.getStatus()).getMessage()+"]变更为["+EnumBillStatus.STOP_TO_SETTLE.getMessage()+"]"); isUpdate = true; }else { - //do nothing + //其他状态的账单无需处理 } + + //如果结束时间在中间,则按天计算差额退回 }else if (bill.getStarttime().before(endTime) && bill.getEndtime().after(endTime)){ int realDays = DateUtils.daysBetween(bill.getStarttime(),endTime); int billDays = DateUtils.daysBetween(bill.getStarttime(),bill.getEndtime()); @@ -1161,8 +1163,8 @@ public class WxBillAllHelper { } action.setOldMoney(oldReceivePay); action.setNewMoney(newReceivePay); - if (bill.getStatus().intValue() == EnumBillStatus.WAIT_PAY.getCode().intValue() - || bill.getStatus().intValue() == EnumBillStatus.BAD.getCode().intValue()) { + //账单有欠费 + if (bill.getStatus().intValue() == EnumBillStatus.WAIT_PAY.getCode().intValue()) { bill.setReceivePay(newReceivePay); bill.setStatus(EnumBillStatus.STOP_TO_SETTLE.getCode()); action.setAction(EnumBillAction.UPDATE_BILL.getCode()); @@ -1180,25 +1182,16 @@ public class WxBillAllHelper { //do nothing } }else { + //如果账单属于结束时间之前的,欠缴费的也需要结算 if (bill.getStatus().intValue() == EnumBillStatus.WAIT_PAY.getCode().intValue()) { if (isAllReturn) { - if (isPaid) { - bill.setReceivePay("0"); - bill.setStatus(EnumBillStatus.STOP_TO_SETTLE.getCode()); - action.setOldMoney(oldReceivePay); - action.setNewMoney("0"); - action.setAction(EnumBillAction.UPDATE_BILL.getCode()); - action.setDetails(EnumBillAction.UPDATE_BILL.getDescription(oldReceivePay, "0", null,null,null,null)); - action.setRemark("商户停用,停用日期["+endTimeStr+"],系统自动由["+EnumBillStatus.getEnum(bill.getStatus()).getMessage()+"]变更为["+EnumBillStatus.STOP_TO_SETTLE.getMessage()+"]"); - }else { - bill.setReceivePay("0"); - bill.setStatus(EnumBillStatus.INVALID.getCode()); - action.setOldMoney(oldReceivePay); - action.setNewMoney("0"); - action.setAction(EnumBillAction.STATUS_CHANGE.getCode()); - action.setDetails(EnumBillAction.STATUS_CHANGE.getDescription(null, null, null,null,EnumBillStatus.getEnum(bill.getStatus()),EnumBillStatus.INVALID)); - action.setRemark("商户停用,停用日期["+endTimeStr+"]"+"系统自动变更状态,应收金额变为0"); - } + bill.setReceivePay("0"); + bill.setStatus(EnumBillStatus.STOP_TO_SETTLE.getCode()); + action.setOldMoney(oldReceivePay); + action.setNewMoney("0"); + action.setAction(EnumBillAction.UPDATE_BILL.getCode()); + action.setDetails(EnumBillAction.UPDATE_BILL.getDescription(oldReceivePay, "0", null,null,null,null)); + action.setRemark("商户停用,停用日期["+endTimeStr+"],系统自动由["+EnumBillStatus.getEnum(bill.getStatus()).getMessage()+"]变更为["+EnumBillStatus.STOP_TO_SETTLE.getMessage()+"]"); }else { bill.setStatus(EnumBillStatus.STOP_TO_SETTLE.getCode()); action.setOldMoney(oldReceivePay); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java index bb59e4c81..bf061e7ad 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java @@ -1273,7 +1273,13 @@ public class WxMerchantServiceImpl implements WxMerchantService { shop.updateTenantInfo(record); shop.setShopNumber(record.getShopNumber()); shop.setId(record.getShopId()); - wxShopService.getMerchantIds(shop); + List shopMerchantIds = wxShopService.getMerchantIds(shop); + if (null == shopMerchantIds || shopMerchantIds.size() <= 0 ) { + record.setId(-999L); + return; + }else { + merchantIds.addAll(shopMerchantIds); + } } if (merchantIds.size() > 0 ) {