| @@ -131,7 +131,7 @@ public class WxBillAllController extends BaseController { | |||
| WxBillSum rentDepositSum = billAllHelper.getBillDeposit(wxMerchant, starttime, enttime); | |||
| WxBillSum propertySum = billAllHelper.getBillProperty(wxMerchant, starttime, enttime); | |||
| WxBillSum propertyDepositSum = billAllHelper.getBillPropertyDeposit(wxMerchant, starttime, enttime); | |||
| WxBillSum dailySum = billAllHelper.getBillDaily(wxMerchant, starttime, enttime); | |||
| WxBillSum dailySum = billAllHelper.getBillDaily(wxMerchant, starttime, enttime,null); | |||
| WxBillSum otherSum = billAllHelper.getBillOther(wxMerchant, starttime, enttime); | |||
| WxBillSum otherDepositSum = billAllHelper.getBillOtherDeposit(wxMerchant, starttime, enttime); | |||
| @@ -195,7 +195,7 @@ public class WxBillAllController extends BaseController { | |||
| WxBillSum rentDepositSum = billAllHelper.getBillDeposit(wxMerchant, starttime, enttime); | |||
| WxBillSum propertySum = billAllHelper.getBillProperty(wxMerchant, starttime, enttime); | |||
| WxBillSum propertyDepositSum = billAllHelper.getBillPropertyDeposit(wxMerchant, starttime, enttime); | |||
| WxBillSum dailySum = billAllHelper.getBillDaily(wxMerchant, starttime, enttime); | |||
| WxBillSum dailySum = billAllHelper.getBillDaily(wxMerchant, starttime, enttime,null); | |||
| WxBillSum otherSum = billAllHelper.getBillOther(wxMerchant, starttime, enttime); | |||
| WxBillSum otherDepositSum = billAllHelper.getBillOtherDeposit(wxMerchant, starttime, enttime); | |||
| @@ -35,7 +35,7 @@ public class WxBillDaily extends TenantEntity { | |||
| @Excel(name = "费用类型*", replace = {"水费_1", "电费_2"}, width = 20, orderNum = "2") | |||
| @NotNull | |||
| @io.swagger.annotations.ApiModelProperty(value="账单类型",name="type") | |||
| @io.swagger.annotations.ApiModelProperty(value="账单类型EnumBillDailyType",name="type") | |||
| private Integer type; | |||
| @io.swagger.annotations.ApiModelProperty(value="实际应收金额",name="receivePay") | |||
| @@ -42,9 +42,11 @@ public class WxBillOther extends TenantEntity { | |||
| private String comments; | |||
| @io.swagger.annotations.ApiModelProperty(value="实际应收金额",name="receivePay") | |||
| private Long receivePay; | |||
| private String receivePay; | |||
| @Excel(name = "实收金额(元)", orderNum = "5", width = 20) | |||
| @io.swagger.annotations.ApiModelProperty(value="实收金额",name="pay") | |||
| private Long pay; | |||
| private String pay; | |||
| @Excel(name = "缴款截止日期", orderNum = "7", width = 20, format = "yyyy-MM-dd") | |||
| @io.swagger.annotations.ApiModelProperty(value="截止收款日期",name="receiveDate") | |||
| @@ -61,8 +63,9 @@ public class WxBillOther extends TenantEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value="逾期天数",name="expiredDay") | |||
| private Long expiredDay; | |||
| @Excel(name = "欠缴金额(元)", orderNum = "6", width = 20) | |||
| @io.swagger.annotations.ApiModelProperty(value="欠缴",name="owe") | |||
| private Long owe; | |||
| private String owe; | |||
| @Excel(name = "状态", replace = {"欠缴_1", "待缴_2", "已结清_3", "未到期_4", "已退还_5", "失效_6"}, width = 20, orderNum = "9") | |||
| @io.swagger.annotations.ApiModelProperty(value = "账单状态1欠缴2待缴3已结清4未到期", name = "status") | |||
| private Integer status; | |||
| @@ -105,34 +108,12 @@ public class WxBillOther extends TenantEntity { | |||
| @Excel(name = "商铺号", width = 20, orderNum = "1") | |||
| private String shopName; | |||
| @TableField(exist = false) | |||
| private String receivePayStr; | |||
| @TableField(exist = false) | |||
| @Excel(name = "实收金额(元)", orderNum = "5", width = 20) | |||
| private String payStr; | |||
| @TableField(exist = false) | |||
| @Excel(name = "欠缴金额(元)", orderNum = "6", width = 20) | |||
| private String oweStr; | |||
| @io.swagger.annotations.ApiModelProperty(value = "开始时间", name = "starttime") | |||
| private Date starttime; | |||
| @io.swagger.annotations.ApiModelProperty(value = "结束时间", name = "endtime") | |||
| private Date endtime; | |||
| public String getReceivePayStr() { | |||
| return new BigDecimal(receivePay == null ? 0 : receivePay).divide(new BigDecimal(100)).toPlainString(); | |||
| } | |||
| public String getPayStr() { | |||
| return new BigDecimal(pay == null ? 0 : pay).divide(new BigDecimal(100)).toPlainString(); | |||
| } | |||
| public String getOweStr() { | |||
| return new BigDecimal(owe == null ? 0 : owe).divide(new BigDecimal(100)).toPlainString(); | |||
| } | |||
| @TableField(exist = false) | |||
| private WxMerchant merchant; | |||
| @@ -141,26 +122,17 @@ public class WxBillOther extends TenantEntity { | |||
| private Integer freeze; | |||
| @io.swagger.annotations.ApiModelProperty(value = "手续费", name = "serviceChargePay") | |||
| private Integer serviceChargePay; | |||
| @io.swagger.annotations.ApiModelProperty(value="实际应收金额",name="realReceivePay") | |||
| private String serviceChargePay; | |||
| @Excel(name = "实际应收总金额(元)", width = 20, orderNum = "4") | |||
| @TableField(exist = false) | |||
| private Long realReceivePay; | |||
| private String realReceivePay; | |||
| @TableField(exist = false) | |||
| private String serviceChargePayBefore; | |||
| @TableField(exist = false) | |||
| private String serviceChargePayUpdate; | |||
| @Excel(name = "实际应收总金额(元)", width = 20, orderNum = "4") | |||
| @TableField(exist = false) | |||
| private String realReceivePayStr; | |||
| public String getRealReceivePayStr() { | |||
| return new BigDecimal(realReceivePay == null ? 0 : realReceivePay).divide(new BigDecimal(100)).toPlainString(); | |||
| } | |||
| @io.swagger.annotations.ApiModelProperty(value="账单类型名称",name="billTypeName") | |||
| private String billTypeName; | |||
| @@ -37,10 +37,11 @@ public class WxBillOtherDeposit extends TenantEntity { | |||
| private String comments; | |||
| @io.swagger.annotations.ApiModelProperty(value = "实际应收金额", name = "receivePay") | |||
| private Long receivePay; | |||
| private String receivePay; | |||
| @Excel(name = "实收金额(元)", orderNum = "5", width = 20) | |||
| @io.swagger.annotations.ApiModelProperty(value = "实收金额", name = "pay") | |||
| private Long pay; | |||
| private String pay; | |||
| @io.swagger.annotations.ApiModelProperty(value = "截止收款日期", name = "receiveDate") | |||
| private Date receiveDate; | |||
| @@ -56,7 +57,7 @@ public class WxBillOtherDeposit extends TenantEntity { | |||
| private Long expiredDay; | |||
| @io.swagger.annotations.ApiModelProperty(value = "欠缴", name = "owe") | |||
| private Long owe; | |||
| private String owe; | |||
| @Excel(name = "状态", replace = {"欠缴_1", "待缴_2", "已结清_3", "未到期_4", "已退还_5", "失效_6"}, width = 20, orderNum = "8") | |||
| @io.swagger.annotations.ApiModelProperty(value = "账单状态1欠缴2待缴3已结清4未到期5已退还", name = "status") | |||
| @@ -103,22 +104,6 @@ public class WxBillOtherDeposit extends TenantEntity { | |||
| @Excel(name = "商铺号", width = 20, orderNum = "1") | |||
| private String shopName; | |||
| @TableField(exist = false) | |||
| private String receivePayStr; | |||
| @TableField(exist = false) | |||
| @Excel(name = "实收金额(元)", orderNum = "5", width = 20) | |||
| private String payStr; | |||
| public String getReceivePayStr() { | |||
| return new BigDecimal(receivePay == null ? 0 : receivePay).divide(new BigDecimal(100)).toPlainString(); | |||
| } | |||
| public String getPayStr() { | |||
| return new BigDecimal(pay == null ? 0 : pay).divide(new BigDecimal(100)).toPlainString(); | |||
| } | |||
| public Date getReturnDate() { | |||
| if (status == null) { | |||
| return null; | |||
| @@ -145,25 +130,17 @@ public class WxBillOtherDeposit 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") | |||
| @Excel(name = "实际应收总金额(元)", width = 20, orderNum = "4") | |||
| @TableField(exist = false) | |||
| private Long realReceivePay; | |||
| private String realReceivePay; | |||
| @TableField(exist = false) | |||
| private String serviceChargePayBefore; | |||
| @TableField(exist = false) | |||
| private String serviceChargePayUpdate; | |||
| @Excel(name = "实际应收总金额(元)", width = 20, orderNum = "4") | |||
| @TableField(exist = false) | |||
| private String realReceivePayStr; | |||
| public String getRealReceivePayStr() { | |||
| return new BigDecimal(realReceivePay == null ? 0 : realReceivePay).divide(new BigDecimal(100)).toPlainString(); | |||
| } | |||
| @io.swagger.annotations.ApiModelProperty(value="账单类型名称",name="billTypeName") | |||
| private String billTypeName; | |||
| @@ -26,6 +26,7 @@ import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.vo.WxBillSum; | |||
| import com.iformall.domain.vo.WxShopVo; | |||
| import com.iformall.enums.EnumBillAllType; | |||
| import com.iformall.enums.EnumBillDailyType; | |||
| import com.iformall.enums.EnumBillType; | |||
| import com.iformall.enums.EnumRentContractManageFeeType; | |||
| import com.iformall.enums.EnumYesOrNo; | |||
| @@ -116,13 +117,15 @@ public class WxBillAllHelper { | |||
| return rentManageSum; | |||
| } | |||
| public List<Long> getBillRentManageMerchantIds(WxMerchant wxMerchant,Date starttime, Date enttime,Integer manageFeeType) { | |||
| public List<Long> getBillRentManageMerchantIds(WxMerchant wxMerchant,Date starttime, Date enttime,EnumRentContractManageFeeType manageFeeType) { | |||
| WxBillRentManage brm = new WxBillRentManage(); | |||
| brm.updateTenantInfo(wxMerchant); | |||
| brm.setStarttime(starttime); | |||
| brm.setEndtime(enttime); | |||
| brm.setOnlyOwe(wxMerchant.getOnlyOwe()); | |||
| brm.setManageFeeType(manageFeeType); | |||
| if (null != manageFeeType) { | |||
| brm.setManageFeeType(manageFeeType.getCode()); | |||
| } | |||
| brm.setMerchantId(wxMerchant.getId()); | |||
| return wxBillRentManageService.getMerchantIds(brm); | |||
| } | |||
| @@ -202,28 +205,38 @@ public class WxBillAllHelper { | |||
| return wxBillPropertyDepositService.getMerchantIds(pd); | |||
| } | |||
| public WxBillSum getBillDaily(WxMerchant wxMerchant,Date starttime, Date enttime) { | |||
| public WxBillSum getBillDaily(WxMerchant wxMerchant,Date starttime, Date enttime,EnumBillDailyType dailyType) { | |||
| WxBillDaily bdd = new WxBillDaily(); | |||
| bdd.updateTenantInfo(wxMerchant); | |||
| bdd.setStarttime(starttime); | |||
| bdd.setEndtime(enttime); | |||
| bdd.setOnlyOwe(wxMerchant.getOnlyOwe()); | |||
| bdd.setMerchantId(wxMerchant.getId()); | |||
| if (null != dailyType) { | |||
| bdd.setType(dailyType.getCode()); | |||
| } | |||
| WxBillSum dailySum = wxBillDailyService.getBillMonthSum(bdd); | |||
| if (null == dailySum) { | |||
| dailySum = new WxBillSum(); | |||
| } | |||
| dailySum.setBillName("日藏水电空调费用"); | |||
| if (null != dailyType) { | |||
| dailySum.setBillName(dailyType.getMessage()); | |||
| }else { | |||
| dailySum.setBillName("日藏水电空调费用"); | |||
| } | |||
| return dailySum; | |||
| } | |||
| public List<Long> getBillDailyMerchantIds(WxMerchant wxMerchant,Date starttime, Date enttime) { | |||
| public List<Long> getBillDailyMerchantIds(WxMerchant wxMerchant,Date starttime, Date enttime,EnumBillDailyType dailyType) { | |||
| WxBillDaily bdd = new WxBillDaily(); | |||
| bdd.updateTenantInfo(wxMerchant); | |||
| bdd.setStarttime(starttime); | |||
| bdd.setEndtime(enttime); | |||
| bdd.setOnlyOwe(wxMerchant.getOnlyOwe()); | |||
| bdd.setMerchantId(wxMerchant.getId()); | |||
| if (null != dailyType) { | |||
| bdd.setType(dailyType.getCode()); | |||
| } | |||
| return wxBillDailyService.getMerchantIds(bdd); | |||
| } | |||
| @@ -311,7 +324,7 @@ public class WxBillAllHelper { | |||
| List<Long> rentDepositMids = this.getBillDepositMerchantIds(wxMerchant, starttime, enttime); | |||
| List<Long> propertyMids = this.getBillPropertyMerchantIds(wxMerchant, starttime, enttime); | |||
| List<Long> propertyDepositMids = this.getBillPropertyDepositMerchantIds(wxMerchant, starttime, enttime); | |||
| List<Long> dailyMids = this.getBillDailyMerchantIds(wxMerchant, starttime, enttime); | |||
| List<Long> dailyMids = this.getBillDailyMerchantIds(wxMerchant, starttime, enttime,null); | |||
| List<Long> otherMids = this.getBillOtherMerchantIds(wxMerchant, starttime, enttime); | |||
| List<Long> otherDepositMids = this.getBillOtherDepositMerchantIds(wxMerchant, starttime, enttime); | |||
| return getUnionIds(rentMids,rentManageMids,rentDepositMids,propertyMids,propertyDepositMids,dailyMids,otherMids,otherDepositMids); | |||
| @@ -558,7 +558,7 @@ public class WxBillAllServiceImpl implements WxBillAllService { | |||
| wxBillOtherDeposit.setPayDate(date); | |||
| Long owe = (Long) bill.get("owe"); | |||
| wxBillOtherDeposit.setPay(wxBillOtherDeposit.getPay() + owe); | |||
| wxBillOtherDeposit.setOwe(0L); | |||
| wxBillOtherDeposit.setOwe("0"); | |||
| wxBillOtherDeposit.setStatus(EnumBillDailyStatus.PAID.getCode()); | |||
| wxBillOtherDeposit.setPayDate(date); | |||
| wxBillOtherDeposit.setUpdatetime(date); | |||
| @@ -602,7 +602,7 @@ public class WxBillAllServiceImpl implements WxBillAllService { | |||
| wxBillOther.setPayDate(date); | |||
| Long owe = (Long) bill.get("owe"); | |||
| wxBillOther.setPay(wxBillOther.getPay() + owe); | |||
| wxBillOther.setOwe(0L); | |||
| wxBillOther.setOwe("0"); | |||
| wxBillOther.setStatus(EnumBillDailyStatus.PAID.getCode()); | |||
| wxBillOther.setPayDate(date); | |||
| wxBillOther.setUpdatetime(date); | |||
| @@ -151,13 +151,12 @@ public class WxBillOtherDepositServiceImpl implements WxBillOtherDepositService | |||
| } else { | |||
| servicePay = new BigDecimal(e.getReceivePay()).multiply(new BigDecimal(wxPayAccountBill.getServiceChargeRate())).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP); | |||
| } | |||
| Long realReceivePay = servicePay.longValue() + e.getReceivePay(); | |||
| e.setRealReceivePay(realReceivePay); | |||
| e.setServiceChargePay(servicePay.intValue()); | |||
| e.setRealReceivePay(servicePay.add(new BigDecimal(e.getReceivePay())).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(servicePay.add(new BigDecimal(e.getReceivePay())).subtract(new BigDecimal(e.getPay())).toPlainString()); | |||
| } | |||
| } | |||
| } | |||
| @@ -208,7 +207,7 @@ public class WxBillOtherDepositServiceImpl implements WxBillOtherDepositService | |||
| record.setId(id); | |||
| record.updateTenantInfo(tenantEntity); | |||
| WxBillOtherDeposit wxBillOther = getBillRentPropertyList(1, 10000, record, wxPayAccountBill).getList().get(0); | |||
| wxBillOther.setOwe(wxBillOther.getRealReceivePay() - wxBillOther.getPay()); | |||
| wxBillOther.setOwe(new BigDecimal(wxBillOther.getRealReceivePay()).subtract(new BigDecimal(wxBillOther.getPay())).toPlainString()); | |||
| wxBillOther.setMerchant(wxMerchantMapper.selectById(wxBillOther.getMerchantId())); | |||
| // if (wxBillOther.getShopId() != null) { | |||
| // WxShop shop = new WxShop(); | |||
| @@ -223,9 +222,15 @@ public class WxBillOtherDepositServiceImpl implements WxBillOtherDepositService | |||
| @Override | |||
| public ResultData saveOrUpdate(WxBillOtherDeposit 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 = "0"; | |||
| if (StringUtils.isNotBlank(record.getRealReceivePay())) { | |||
| receivepay = record.getRealReceivePay(); | |||
| } | |||
| String pay = "0"; | |||
| if (StringUtils.isNotBlank(record.getPay())) { | |||
| pay = record.getPay(); | |||
| } | |||
| if (new BigDecimal(pay).compareTo(new BigDecimal(receivepay)) > 0 ) { | |||
| return new ResultData(ErrorCode.BILL_PAY_ERROR.getCode(), "实收金额不能大于实际应收总金额"); | |||
| } | |||
| Date date = new Date(); | |||
| @@ -249,7 +254,7 @@ public class WxBillOtherDepositServiceImpl implements WxBillOtherDepositService | |||
| 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 { | |||
| wxBillOtherDepositMapper.insert(record); | |||
| @@ -267,15 +272,14 @@ public class WxBillOtherDepositServiceImpl implements WxBillOtherDepositService | |||
| String message = ""; | |||
| String price = ""; | |||
| if(record.getServiceChargePayUpdate() != null){ | |||
| Double l = Double.valueOf(record.getServiceChargePayUpdate())*100; | |||
| wxBillOtherDeposit.setServiceChargePay(l.intValue()); | |||
| wxBillOtherDeposit.setOwe(wxBillOtherDeposit.getReceivePay() + wxBillOtherDeposit.getServiceChargePay() - wxBillOtherDeposit.getPay()); | |||
| wxBillOtherDeposit.setServiceChargePay(record.getServiceChargePayUpdate()); | |||
| wxBillOtherDeposit.setOwe(new BigDecimal(wxBillOtherDeposit.getReceivePay()).add(new BigDecimal(wxBillOtherDeposit.getServiceChargePay())).subtract(new BigDecimal(wxBillOtherDeposit.getPay())).toPlainString()); | |||
| }else{ | |||
| Long addpay = wxBillOtherDeposit.getPay(); | |||
| String addpay = wxBillOtherDeposit.getPay(); | |||
| wxBillOtherDeposit.setPayDate(record.getPayDate()); | |||
| wxBillOtherDeposit.setPay(record.getPay()); | |||
| wxBillOtherDeposit.setReceivePay(record.getReceivePay()); | |||
| wxBillOtherDeposit.setOwe(record.getRealReceivePay() - record.getPay()); | |||
| wxBillOtherDeposit.setOwe(new BigDecimal(record.getRealReceivePay()).subtract(new BigDecimal(record.getPay())).toPlainString()); | |||
| if (record.getPay().equals(record.getRealReceivePay())) { | |||
| wxBillOtherDeposit.setStatus(EnumBillRentStatus.PAID.getCode()); | |||
| Date payDate = record.getPayDate(); | |||
| @@ -291,7 +295,7 @@ public class WxBillOtherDepositServiceImpl implements WxBillOtherDepositService | |||
| wxBillOtherDeposit.setPayWay(record.getPayWay()); | |||
| wxBillOtherDeposit.setComments(record.getComments()); | |||
| 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 { | |||
| @@ -397,7 +401,7 @@ public class WxBillOtherDepositServiceImpl implements WxBillOtherDepositService | |||
| return new ResultData(ErrorCode.BILL_OTHER_DEPOSIT_IS_NOT_FOUND); | |||
| } | |||
| wxBillDeposit.setReceivePay(record.getReceivePay()); | |||
| wxBillDeposit.setOwe(record.getReceivePay() - record.getPay()); | |||
| wxBillDeposit.setOwe(new BigDecimal(record.getReceivePay()).subtract(new BigDecimal(record.getPay())).toPlainString()); | |||
| wxBillDeposit.setUpdatetime(new Date()); | |||
| try { | |||
| wxBillOtherDepositMapper.updateById(wxBillDeposit); | |||
| @@ -151,13 +151,12 @@ public class WxBillOtherServiceImpl implements WxBillOtherService { | |||
| } else { | |||
| servicePay = new BigDecimal(e.getReceivePay()).multiply(new BigDecimal(wxPayAccountBill.getServiceChargeRate())).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP); | |||
| } | |||
| Long realReceivePay = servicePay.longValue() + e.getReceivePay(); | |||
| e.setRealReceivePay(realReceivePay); | |||
| e.setServiceChargePay(servicePay.intValue()); | |||
| e.setRealReceivePay(servicePay.add(new BigDecimal(e.getReceivePay())).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(servicePay.add(new BigDecimal(e.getReceivePay())).subtract(new BigDecimal(e.getPay())).toPlainString()); | |||
| } | |||
| } | |||
| } | |||
| @@ -208,7 +207,7 @@ public class WxBillOtherServiceImpl implements WxBillOtherService { | |||
| record.setId(id); | |||
| record.updateTenantInfo(tenantEntity); | |||
| WxBillOther wxBillOther = getBillOtherPropertyList(1, 1, record, wxPayAccountBill).getList().get(0); | |||
| wxBillOther.setOwe(wxBillOther.getRealReceivePay() - wxBillOther.getPay()); | |||
| wxBillOther.setOwe(new BigDecimal(wxBillOther.getRealReceivePay()).subtract(new BigDecimal(wxBillOther.getPay())).toPlainString()); | |||
| wxBillOther.setMerchant(wxMerchantMapper.selectById(wxBillOther.getMerchantId())); | |||
| // if (wxBillOther.getShopId() != null) { | |||
| // WxShop shop = new WxShop(); | |||
| @@ -224,9 +223,15 @@ public class WxBillOtherServiceImpl implements WxBillOtherService { | |||
| @Override | |||
| public ResultData saveOrUpdate(WxBillOther 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 = "0"; | |||
| if (StringUtils.isNotBlank(record.getRealReceivePay())) { | |||
| receivepay = record.getRealReceivePay(); | |||
| } | |||
| String pay = "0"; | |||
| if (StringUtils.isNotBlank(record.getPay())) { | |||
| pay = record.getPay(); | |||
| } | |||
| if(new BigDecimal(pay).compareTo(new BigDecimal(receivepay)) > 0){ | |||
| return new ResultData(ErrorCode.BILL_PAY_ERROR.getCode(), "实收金额不能大于实际应收总金额"); | |||
| } | |||
| Date date = new Date(); | |||
| @@ -248,7 +253,7 @@ public class WxBillOtherServiceImpl implements WxBillOtherService { | |||
| 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 { | |||
| wxBillOtherMapper.insert(record); | |||
| @@ -267,15 +272,14 @@ public class WxBillOtherServiceImpl implements WxBillOtherService { | |||
| String message = ""; | |||
| String price = ""; | |||
| if(record.getServiceChargePayUpdate() != null){ | |||
| Double l = Double.valueOf(record.getServiceChargePayUpdate())*100; | |||
| wxBillOther.setServiceChargePay(l.intValue()); | |||
| wxBillOther.setOwe(wxBillOther.getReceivePay() + wxBillOther.getServiceChargePay() - wxBillOther.getPay()); | |||
| wxBillOther.setServiceChargePay(record.getServiceChargePayUpdate()); | |||
| wxBillOther.setOwe(new BigDecimal(wxBillOther.getReceivePay()).add(new BigDecimal(wxBillOther.getServiceChargePay())).subtract(new BigDecimal(wxBillOther.getPay())).toPlainString()); | |||
| }else{ | |||
| Long addpay = wxBillOther.getPay(); | |||
| String addpay = wxBillOther.getPay(); | |||
| wxBillOther.setPayDate(record.getPayDate()); | |||
| wxBillOther.setPay(record.getPay()); | |||
| wxBillOther.setReceivePay(record.getReceivePay()); | |||
| wxBillOther.setOwe(record.getRealReceivePay() - record.getPay()); | |||
| wxBillOther.setOwe(new BigDecimal(record.getRealReceivePay()).subtract(new BigDecimal(record.getPay())).toPlainString()); | |||
| if (record.getPay().equals(record.getRealReceivePay())) { | |||
| wxBillOther.setStatus(EnumBillRentStatus.PAID.getCode()); | |||
| Date payDate = record.getPayDate(); | |||
| @@ -292,7 +296,7 @@ public class WxBillOtherServiceImpl implements WxBillOtherService { | |||
| wxBillOther.setComments(record.getComments()); | |||
| wxBillOther.setName(record.getName()); | |||
| 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 { | |||
| @@ -242,8 +242,8 @@ public class WxBillSettleServiceImpl implements WxBillSettleService { | |||
| wxBillOtherDeposit.setPayDate(new Date()); | |||
| WxBillOtherDeposit dbBill = wxBillOtherDepositMapper.selectById(wxBillRent.getId()); | |||
| if(dbBill!=null) { | |||
| if(dbBill.getPay() == null) dbBill.setPay(0l); | |||
| if(dbBill.getReceivePay() == null) dbBill.setReceivePay(0l); | |||
| if(StringUtils.isBlank(dbBill.getPay())) dbBill.setPay("0"); | |||
| if(StringUtils.isBlank(dbBill.getReceivePay())) dbBill.setReceivePay("0"); | |||
| wxBillOtherDeposit.setPay(dbBill.getPay()+ dbBill.getReceivePay()); | |||
| wxBillOtherDeposit.setPayDate(new Date()); | |||
| if(EnumSettleBillType.R.getCode().equals(bill.getType())){ | |||
| @@ -362,8 +362,8 @@ public class WxBillSettleServiceImpl implements WxBillSettleService { | |||
| wxBillRent.setPayDate(new Date()); | |||
| WxBillOther dbBill = wxBillOtherMapper.selectById(wxBillRent.getId()); | |||
| if(dbBill!=null) { | |||
| if(dbBill.getPay() == null) dbBill.setPay(0l); | |||
| if(dbBill.getOwe() == null) dbBill.setOwe(0l); | |||
| if(StringUtils.isBlank(dbBill.getPay())) dbBill.setPay("0"); | |||
| if(StringUtils.isBlank(dbBill.getOwe())) dbBill.setOwe("0"); | |||
| wxBillRent.setPay(dbBill.getPay()+dbBill.getOwe()); | |||
| wxBillRent.setPayDate(new Date()); | |||
| addBillAction(bill.getBillId(), String.valueOf(dbBill.getOwe())); | |||
| @@ -388,8 +388,8 @@ public class WxBillSettleServiceImpl implements WxBillSettleService { | |||
| wxBillRent.setPayDate(new Date()); | |||
| WxBillOtherDeposit dbBill = wxBillOtherDepositMapper.selectById(wxBillRent.getId()); | |||
| if(dbBill!=null) { | |||
| if(dbBill.getPay() == null) dbBill.setPay(0l); | |||
| if(dbBill.getReceivePay() == null) dbBill.setReceivePay(0l); | |||
| if(StringUtils.isBlank(dbBill.getPay())) dbBill.setPay("0"); | |||
| if(StringUtils.isBlank(dbBill.getReceivePay())) dbBill.setReceivePay("0"); | |||
| wxBillRent.setPay(dbBill.getPay()+dbBill.getReceivePay()); | |||
| wxBillRent.setPayDate(new Date()); | |||
| if(EnumSettleBillType.R.getCode().equals(bill.getType())){ | |||
| @@ -427,8 +427,8 @@ public class WxBillSettleServiceImpl implements WxBillSettleService { | |||
| wxBillRent.setPayDate(new Date()); | |||
| WxBillOtherDeposit dbBill = wxBillOtherDepositMapper.selectById(wxBillRent.getId()); | |||
| if(dbBill!=null) { | |||
| if(dbBill.getPay() == null) dbBill.setPay(0l); | |||
| if(dbBill.getReceivePay() == null) dbBill.setReceivePay(0l); | |||
| if(StringUtils.isBlank(dbBill.getPay())) dbBill.setPay("0"); | |||
| if(StringUtils.isBlank(dbBill.getReceivePay())) dbBill.setReceivePay("0"); | |||
| wxBillRent.setPay(dbBill.getPay()+dbBill.getReceivePay()); | |||
| wxBillRent.setPayDate(new Date()); | |||
| if(EnumSettleBillType.R.getCode().equals(bill.getType())){ | |||
| @@ -484,8 +484,8 @@ public class WxBillSettleServiceImpl implements WxBillSettleService { | |||
| wxBillRent.setPayDate(new Date()); | |||
| WxBillOther dbBill = wxBillOtherMapper.selectById(wxBillRent.getId()); | |||
| if(dbBill!=null) { | |||
| if(dbBill.getPay() == null) dbBill.setPay(0l); | |||
| if(dbBill.getOwe() == null) dbBill.setOwe(0l); | |||
| if(StringUtils.isBlank(dbBill.getPay())) dbBill.setPay("0"); | |||
| if(StringUtils.isBlank(dbBill.getOwe())) dbBill.setOwe("0"); | |||
| wxBillRent.setPay(dbBill.getPay()+dbBill.getOwe()); | |||
| wxBillRent.setPayDate(new Date()); | |||
| addBillAction(bill.getBillId(), String.valueOf(dbBill.getOwe())); | |||
| @@ -38,7 +38,8 @@ | |||
| <sql id="allColumns"> | |||
| `id`,`receive_pay`,`pay`,`receive_date`,`pay_date`,`createtime`,`expired_day`,`apply_status`,`apply_pay_img`,`apply_update_time`, | |||
| `tenant_id`,`parent_tenant_id`,`owe`,`status`,`is_del`,`merchant_id`,`user_id`,`shop_id`,`shop_name`,`updatetime`,`type`, | |||
| `rent_shop_type`,`pay_way`,`price_detail`,`starttime`,`endtime`,freeze,build_way,service_charge_pay,'日常费用' bill_type_name | |||
| `rent_shop_type`,`pay_way`,`price_detail`,`starttime`,`endtime`,freeze,build_way,service_charge_pay, | |||
| case type when 1 then '水费' when 2 then '电费' when 3 then '空调费' else '日常费用' end bill_type_name | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| @@ -118,7 +119,8 @@ | |||
| select br.`id`,br.`receive_pay`,br.`pay`,br.`receive_date`,br.`pay_date`,br.`createtime`,br.`expired_day` , | |||
| case when br.status=1 then br.owe else 0 end owe,br.`status`,br.`updatetime`,br.`merchant_id`,br.shop_id, | |||
| br.shop_name,br.type,br.`rent_shop_type`,br.pay_way,br.price_detail,br.`starttime`,br.`endtime`,br.`build_way`, | |||
| br.freeze,br.service_charge_pay,br.`apply_status`,br.`apply_pay_img`,br.`apply_update_time`,'日常费用' bill_type_name | |||
| br.freeze,br.service_charge_pay,br.`apply_status`,br.`apply_pay_img`,br.`apply_update_time`, | |||
| case type when 1 then '水费' when 2 then '电费' when 3 then '空调费' else '日常费用' end bill_type_name | |||
| from wx_bill_daily br | |||
| <include refid="queryBillDailyListConditions" /> | |||
| <if test=" null != sortColumns"> order by ${sortColumns} </if> | |||
| @@ -5,13 +5,13 @@ | |||
| <id column="id" jdbcType="BIGINT" property="id"/> | |||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/> | |||
| <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" /> | |||
| <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"/> | |||
| @@ -5,13 +5,13 @@ | |||
| <id column="id" jdbcType="BIGINT" property="id" /> | |||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" /> | |||
| <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" /> | |||
| <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"/> | |||