diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/rent/WxBillDepositController.java b/mallinkAdmin/src/main/java/com/iformall/controller/rent/WxBillDepositController.java index a302e319b..f5e0cde93 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/rent/WxBillDepositController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/rent/WxBillDepositController.java @@ -6,6 +6,7 @@ import com.iformall.common.Result; import com.iformall.common.ResultData; import com.iformall.controller.base.BaseController; import com.iformall.domain.po.WxBillDeposit; +import com.iformall.domain.po.WxUserDataRule; import com.iformall.service.WxBillDepositService; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; @@ -36,6 +37,11 @@ public class WxBillDepositController extends BaseController { wxBillDeposit = new WxBillDeposit(); } wxBillDeposit.updateTenantInfo(getTenantInfo()); + WxUserDataRule dataRule = this.getCurrentDataFloors(); + if (null != dataRule) { + wxBillDeposit.setFloorForRule(dataRule.getFloorIds()); + wxBillDeposit.setBusinessForRule(dataRule.getBussinessIds()); + } final PageInfo page = wxBillDepositService.listAsPage(wxBillDeposit, pageNum, pageSize); return new ResultData(page); } diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/rent/WxBillPropertyDepositController.java b/mallinkAdmin/src/main/java/com/iformall/controller/rent/WxBillPropertyDepositController.java index c825d3c10..2a0ba52d2 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/rent/WxBillPropertyDepositController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/rent/WxBillPropertyDepositController.java @@ -6,6 +6,7 @@ import com.iformall.common.Result; import com.iformall.common.ResultData; import com.iformall.controller.base.BaseController; import com.iformall.domain.po.WxBillPropertyDeposit; +import com.iformall.domain.po.WxUserDataRule; import com.iformall.service.WxBillPropertyDepositService; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; @@ -36,6 +37,11 @@ public class WxBillPropertyDepositController extends BaseController { wxBillPropertyDeposit = new WxBillPropertyDeposit(); } wxBillPropertyDeposit.updateTenantInfo(getTenantInfo()); + WxUserDataRule dataRule = this.getCurrentDataFloors(); + if (null != dataRule) { + wxBillPropertyDeposit.setFloorForRule(dataRule.getFloorIds()); + wxBillPropertyDeposit.setBusinessForRule(dataRule.getBussinessIds()); + } PageInfo result = wxBillPropertyDepositService.listAsPage(wxBillPropertyDeposit, pageNum, pageSize); return new ResultData(result); } diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxBillDeposit.java b/mallinkService/src/main/java/com/iformall/domain/po/WxBillDeposit.java index c57d6cd0c..174993ba8 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxBillDeposit.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxBillDeposit.java @@ -97,4 +97,6 @@ public class WxBillDeposit extends TenantEntity { private String serviceChargePayUpdate; @TableField(exist = false) private List rentContractIdList; + @TableField(exist = false) + private List merchantIds; } diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxBillPropertyDeposit.java b/mallinkService/src/main/java/com/iformall/domain/po/WxBillPropertyDeposit.java index 43eeb46b6..a99d0dc14 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxBillPropertyDeposit.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxBillPropertyDeposit.java @@ -96,4 +96,6 @@ public class WxBillPropertyDeposit extends TenantEntity { private String serviceChargePayUpdate; @TableField(exist = false) private List propertyContractIdList; + @TableField(exist = false) + private List merchantIds; } diff --git a/mallinkService/src/main/java/com/iformall/service/WxBillDepositService.java b/mallinkService/src/main/java/com/iformall/service/WxBillDepositService.java index 2d4145550..eb5f2515d 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxBillDepositService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxBillDepositService.java @@ -50,6 +50,6 @@ public interface WxBillDepositService { ResultData adjustDeposit(WxBillDeposit wxBillDeposit); - void computeTotalMoney(WxPayAccountBill wxPayAccountBill, WxBillDeposit deposit); + void computeTotalMoney(Integer decimalSize,WxPayAccountBill wxPayAccountBill, WxBillDeposit deposit); } diff --git a/mallinkService/src/main/java/com/iformall/service/WxBillRentManageService.java b/mallinkService/src/main/java/com/iformall/service/WxBillRentManageService.java index 25c08d17a..3104c239e 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxBillRentManageService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxBillRentManageService.java @@ -60,7 +60,7 @@ public interface WxBillRentManageService { ResultData updatePaid(Long id); - void computeTotalMoney(WxPayAccountBill wxPayAccountBill, WxBillRentManage deposit); + void computeTotalMoney(Integer decimalSize,WxPayAccountBill wxPayAccountBill, WxBillRentManage deposit); ResultData updateLatePayStatus(WxBillRentManage wxBillRent); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxBillDepositServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxBillDepositServiceImpl.java index 57d3848a8..0a192541b 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxBillDepositServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxBillDepositServiceImpl.java @@ -10,7 +10,10 @@ import com.iformall.common.ResultData; import com.iformall.domain.po.MallUserInfo; import com.iformall.domain.po.WxBillAction; import com.iformall.domain.po.WxBillDeposit; +import com.iformall.domain.po.WxBillOtherDeposit; +import com.iformall.domain.po.WxMerchant; import com.iformall.domain.po.WxPayAccountBill; +import com.iformall.domain.po.WxShop; import com.iformall.enums.EnumBillAction; import com.iformall.enums.EnumBillPayWay; import com.iformall.enums.EnumBillRentStatus; @@ -19,11 +22,17 @@ import com.iformall.exception.MallinkException; import com.iformall.mapper.WxBillDepositMapper; import com.iformall.service.WxBillActionService; import com.iformall.service.WxBillDepositService; +import com.iformall.service.WxMerchantService; import com.iformall.service.WxPayAccountBillService; +import com.iformall.service.WxShopService; +import com.iformall.utils.Constant; import com.iformall.utils.DateUtils; + +import org.apache.commons.collections.CollectionUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -48,29 +57,99 @@ public class WxBillDepositServiceImpl implements WxBillDepositService { @Autowired WxPayAccountBillService wxPayAccountBillService; + + @Lazy + @Autowired + WxMerchantService wxMerchantService; + + @Lazy + @Autowired + WxShopService wxShopService; @Override public PageInfo listAsPage(WxBillDeposit record, Integer pageIndex, Integer pageSize) { WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantInfo(record); - PageHelper.startPage(pageIndex, pageSize); - List billDepositList = wxBillDepositMapper.queryBillDepositList(record); - billDepositList.stream().forEach(e->{ - //手续费 = 合同应收+手续费+滞纳金 - computeTotalMoney(wxPayAccountBill, e); - }); - PageInfo pageInfo = new PageInfo<>(billDepositList); - return pageInfo; + return getBillDepositPropertyList(wxPayAccountBill, record, pageIndex, pageSize); + } + + private PageInfo getBillDepositPropertyList(WxPayAccountBill wxPayAccountBill,WxBillDeposit record, Integer pageIndex, Integer pageSize) { + if (null != record.getFloorForRule()) { + List merchantIds = wxMerchantService.getFloorBuildMerchantIds(record, record.getFloorForRule(), null, null, 0, 0); + if (null != merchantIds) { + record.setMerchantIds(merchantIds); + }else { + record.setId(-1L); + } + } + + if (StringUtils.isNotBlank(record.getMerchantName())) { + WxMerchant mq = new WxMerchant(); + mq.updateTenantInfo(record); + mq.setName(StringUtils.trimToNull(record.getMerchantName())); + List mids = wxMerchantService.findIdList(mq); + if (null != mids && mids.size() > 0 ) { + if (null != record.getMerchantIds()) { + List _mids = (List) CollectionUtils.intersection(mids, record.getMerchantIds()); + if (null == _mids || _mids.size() <= 0) { + record.setId(-1L); + }else { + record.setMerchantIds(_mids); + } + }else { + record.setMerchantIds(mids); + } + }else { + record.setId(-1L); + } + } + + PageInfo page = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxBillDepositMapper.queryBillDepositList(record)); + if (null == page) { + return null; + } + + WxMerchant wq = new WxMerchant(); + wq.updateTenantInfo(record); + Map merchantMap = wxMerchantService.findMerchantMap(wq); + + WxShop sq = new WxShop(); + sq.updateTenantInfo(record); + Map shopMap = wxShopService.findShopMap(sq); + + if (null != page.getList()) { + for (int i = 0 ; i < page.getList().size() ; i ++) { + WxBillDeposit e = page.getList().get(i); + //手续费 = 合同应收+手续费+滞纳金 + computeTotalMoney(Constant.default_long_decimal_size,wxPayAccountBill, e); + + if (null != e.getMerchantId()) { + WxMerchant m = merchantMap.get(e.getMerchantId()); + if (null != m ) { + e.setMerchantName(m.getName()); + } + } + + if (null != e.getShopId()) { + WxShop shop = shopMap.get(e.getShopId()); + if (null != shop) { + e.setShopNumber(shop.getShopNumber()); + } + } + + } + } + return page; } @Override - public void computeTotalMoney(WxPayAccountBill wxPayAccountBill, WxBillDeposit deposit) { + public void computeTotalMoney(Integer decimalSize,WxPayAccountBill wxPayAccountBill, WxBillDeposit deposit) { if (deposit.getReceivePay() != null) { String receivePayB = deposit.getReceivePay(); BigDecimal servicePay; if (deposit.getServiceChargePay() != null) { servicePay = new BigDecimal(deposit.getServiceChargePay()); } else { - servicePay = new BigDecimal(receivePayB).multiply(new BigDecimal(wxPayAccountBill.getServiceChargeRate())).divide(new BigDecimal(10000), 10, BigDecimal.ROUND_HALF_UP); + servicePay = new BigDecimal(receivePayB).multiply(new BigDecimal(wxPayAccountBill.getServiceChargeRate())).divide(new BigDecimal(10000), decimalSize, BigDecimal.ROUND_HALF_UP); } BigDecimal realReceivePay = servicePay.add(new BigDecimal(receivePayB)); deposit.setRealReceivePay(realReceivePay.toPlainString()); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxBillPropertyDepositServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxBillPropertyDepositServiceImpl.java index c58dc6462..54ed3d233 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxBillPropertyDepositServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxBillPropertyDepositServiceImpl.java @@ -1,5 +1,6 @@ package com.iformall.service.impl; +import com.aliyun.openservices.shade.org.apache.commons.lang3.StringUtils; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.iformall.common.ErrorCode; @@ -8,8 +9,11 @@ import com.iformall.common.Result; import com.iformall.common.ResultData; import com.iformall.domain.po.MallUserInfo; import com.iformall.domain.po.WxBillAction; +import com.iformall.domain.po.WxBillDeposit; import com.iformall.domain.po.WxBillPropertyDeposit; +import com.iformall.domain.po.WxMerchant; import com.iformall.domain.po.WxPayAccountBill; +import com.iformall.domain.po.WxShop; import com.iformall.enums.EnumBillAction; import com.iformall.enums.EnumBillPayWay; import com.iformall.enums.EnumBillRentStatus; @@ -18,11 +22,17 @@ import com.iformall.exception.MallinkException; import com.iformall.mapper.WxBillPropertyDepositMapper; import com.iformall.service.WxBillActionService; import com.iformall.service.WxBillPropertyDepositService; +import com.iformall.service.WxMerchantService; import com.iformall.service.WxPayAccountBillService; +import com.iformall.service.WxShopService; +import com.iformall.utils.Constant; import com.iformall.utils.DateUtils; + +import org.apache.commons.collections.CollectionUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -45,18 +55,88 @@ public class WxBillPropertyDepositServiceImpl implements WxBillPropertyDepositSe WxBillActionService wxBillActionService; @Autowired WxPayAccountBillService wxPayAccountBillService; + + @Lazy + @Autowired + WxMerchantService wxMerchantService; + + @Lazy + @Autowired + WxShopService wxShopService; @Override public PageInfo listAsPage(WxBillPropertyDeposit record, Integer pageIndex, Integer pageSize) { WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantInfo(record); - PageHelper.startPage(pageIndex, pageSize); - List billDepositList = wxBillPropertyDepositMapper.queryBillDepositList(record); - /*billDepositList.stream().forEach(e->{ - //手续费 = 合同应收+手续费+滞纳金 - computeTotalMoney(wxPayAccountBill, e); - });*/ - PageInfo pageInfo = new PageInfo<>(billDepositList); - return pageInfo; + return getBillDepositPropertyList(wxPayAccountBill, record, pageIndex, pageSize); + } + + private PageInfo getBillDepositPropertyList(WxPayAccountBill wxPayAccountBill,WxBillPropertyDeposit record, Integer pageIndex, Integer pageSize) { + if (null != record.getFloorForRule()) { + List merchantIds = wxMerchantService.getFloorBuildMerchantIds(record, record.getFloorForRule(), null, null, 0, 0); + if (null != merchantIds) { + record.setMerchantIds(merchantIds); + }else { + record.setId(-1L); + } + } + + if (StringUtils.isNotBlank(record.getMerchantName())) { + WxMerchant mq = new WxMerchant(); + mq.updateTenantInfo(record); + mq.setName(StringUtils.trimToNull(record.getMerchantName())); + List mids = wxMerchantService.findIdList(mq); + if (null != mids && mids.size() > 0 ) { + if (null != record.getMerchantIds()) { + List _mids = (List) CollectionUtils.intersection(mids, record.getMerchantIds()); + if (null == _mids || _mids.size() <= 0) { + record.setId(-1L); + }else { + record.setMerchantIds(_mids); + } + }else { + record.setMerchantIds(mids); + } + }else { + record.setId(-1L); + } + } + + PageInfo page = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxBillPropertyDepositMapper.queryBillDepositList(record)); + if (null == page) { + return null; + } + + WxMerchant wq = new WxMerchant(); + wq.updateTenantInfo(record); + Map merchantMap = wxMerchantService.findMerchantMap(wq); + + WxShop sq = new WxShop(); + sq.updateTenantInfo(record); + Map shopMap = wxShopService.findShopMap(sq); + + if (null != page.getList()) { + for (int i = 0 ; i < page.getList().size() ; i ++) { + WxBillPropertyDeposit e = page.getList().get(i); + //手续费 = 合同应收+手续费+滞纳金 + //computeTotalMoney(Constant.default_long_decimal_size,wxPayAccountBill, e); + + if (null != e.getMerchantId()) { + WxMerchant m = merchantMap.get(e.getMerchantId()); + if (null != m ) { + e.setMerchantName(m.getName()); + } + } + + if (null != e.getShopId()) { + WxShop shop = shopMap.get(e.getShopId()); + if (null != shop) { + e.setShopNumber(shop.getShopNumber()); + } + } + + } + } + return page; } @Override diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxBillRentManageServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxBillRentManageServiceImpl.java index a3e971b3a..10a16ece2 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxBillRentManageServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxBillRentManageServiceImpl.java @@ -26,6 +26,7 @@ import com.iformall.service.WxBillActionService; import com.iformall.service.WxBillRentManageService; 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; @@ -130,10 +131,10 @@ public class WxBillRentManageServiceImpl implements WxBillRentManageService { if (null != billRentList.getList()) { for (int i = 0 ; i < billRentList.getList().size() ; i ++) { WxBillRentManage e = billRentList.getList().get(i); - //手续费 = 合同应收+手续费+滞纳金 - computeTotalMoney(wxPayAccountBill, e); + Integer decimalSize = Constant.default_long_decimal_size; WxRentContract rent = rentContractMap.get(e.getRentContractId()); if (null != rent) { + decimalSize = rent.getDecimalSize(); e.setMerchantName(rent.getMerchantName()); //e.setRentType(rent.getType()); //if (null != rent.getPayRatio()) { @@ -146,6 +147,9 @@ public class WxBillRentManageServiceImpl implements WxBillRentManageService { // } //e.setLatePayDay(rent.getLatePayDay()); } + + //手续费 = 合同应收+手续费+滞纳金 + computeTotalMoney(decimalSize,wxPayAccountBill, e); } } return billRentList; @@ -262,7 +266,7 @@ public class WxBillRentManageServiceImpl implements WxBillRentManageService { } @Override - public void computeTotalMoney(WxPayAccountBill wxPayAccountBill, WxBillRentManage rent) { + public void computeTotalMoney(Integer decimalSize, WxPayAccountBill wxPayAccountBill, WxBillRentManage rent) { if (rent.getReceivePay() != null) { if (rent.getLatePayPrice() == null) { rent.setLatePayPrice("0"); @@ -271,7 +275,7 @@ public class WxBillRentManageServiceImpl implements WxBillRentManageService { if (rent.getServiceChargePay() != null) { servicePay = new BigDecimal(rent.getServiceChargePay()); } else { - servicePay = new BigDecimal(rent.getReceivePay()).multiply(new BigDecimal(wxPayAccountBill.getServiceChargeRate())).divide(new BigDecimal(10000), 10, BigDecimal.ROUND_HALF_UP); + servicePay = new BigDecimal(rent.getReceivePay()).multiply(new BigDecimal(wxPayAccountBill.getServiceChargeRate())).divide(new BigDecimal(10000), decimalSize, BigDecimal.ROUND_HALF_UP); } BigDecimal realReceivePay = servicePay.add(new BigDecimal(rent.getLatePayPrice()).add(new BigDecimal(rent.getReceivePay()))); rent.setRealReceivePay(realReceivePay.toPlainString()); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxBillRentServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxBillRentServiceImpl.java index 7f170403e..63b0fb525 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxBillRentServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxBillRentServiceImpl.java @@ -14,6 +14,7 @@ import com.iformall.enums.*; import com.iformall.exception.MallinkException; import com.iformall.mapper.*; import com.iformall.service.*; +import com.iformall.utils.Constant; import com.iformall.utils.DateUtils; import org.apache.commons.lang3.StringUtils; import org.joda.time.DateTime; @@ -73,7 +74,7 @@ public class WxBillRentServiceImpl implements WxBillRentService { return getBillRentPropertyList(pageIndex,pageSize,record,wxPayAccountBill); } - public void computeTotalMoney(WxPayAccountBill wxPayAccountBill, WxBillRent rent) { + public void computeTotalMoney(Integer decimalSize,WxPayAccountBill wxPayAccountBill, WxBillRent rent) { if (rent.getReceivePay() != null) { if (rent.getLatePayPrice() == null) { rent.setLatePayPrice("0"); @@ -82,15 +83,15 @@ public class WxBillRentServiceImpl implements WxBillRentService { if (rent.getServiceChargePay() != null) { servicePay = new BigDecimal(rent.getServiceChargePay()); } else { - servicePay = new BigDecimal(rent.getReceivePay()).multiply(new BigDecimal(wxPayAccountBill.getServiceChargeRate())).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP); + servicePay = new BigDecimal(rent.getReceivePay()).multiply(new BigDecimal(wxPayAccountBill.getServiceChargeRate())).divide(new BigDecimal(10000), decimalSize, BigDecimal.ROUND_HALF_UP); } - Long realReceivePay = servicePay.longValue() + rent.getLatePayPrice() + rent.getReceivePay(); - rent.setRealReceivePay(realReceivePay); - rent.setServiceChargePay(servicePay.intValue()); + BigDecimal realReceivePay = servicePay.add(new BigDecimal(rent.getLatePayPrice())).add(new BigDecimal(rent.getReceivePay())); + rent.setRealReceivePay(realReceivePay.toPlainString()); + rent.setServiceChargePay(servicePay.toPlainString()); if (!rent.getStatus().equals(EnumBillRentStatus.NOT_PAID.getCode())) { - rent.setOwe(0L); + rent.setOwe("0"); } else { - rent.setOwe(realReceivePay - rent.getPay()); + rent.setOwe(realReceivePay.subtract(new BigDecimal(rent.getPay())).toPlainString()); } } } @@ -145,15 +146,15 @@ public class WxBillRentServiceImpl implements WxBillRentService { WxBillRent rent = rp.getList().get(0); //手续费 = 合同应收+手续费+滞纳金 //computeTotalMoney(wxPayAccountBill, rent); - rent.setOwe(rent.getRealReceivePay() - rent.getPay()); + rent.setOwe(new BigDecimal(rent.getRealReceivePay()).subtract(new BigDecimal(rent.getPay())).toPlainString()); return rent; } @Override public ResultData saveOrUpdate(WxBillRent 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(); @@ -163,7 +164,7 @@ public class WxBillRentServiceImpl implements WxBillRentService { record.setId(idWorker.nextId()); record.setCreatetime(date); record.setUpdatetime(date); - record.setOwe(record.getReceivePay()-record.getPay()); + record.setOwe(new BigDecimal(receivepay).subtract(new BigDecimal(pay)).toPlainString()); record.setIsDel(EnumDelStatus.NOT_DEL.getCode()); try { wxBillRentMapper.insert(record); @@ -182,19 +183,19 @@ public class WxBillRentServiceImpl implements WxBillRentService { String price = ""; String message =""; if(record.getServiceChargePayUpdate() != null){ - Double l = Double.valueOf(record.getServiceChargePayUpdate())*100; - wxBillRent.setServiceChargePay(l.intValue()); - long latePayPrice = wxBillRent.getLatePayPrice() == null ? 0 : wxBillRent.getLatePayPrice(); - wxBillRent.setOwe(wxBillRent.getReceivePay() + latePayPrice + wxBillRent.getServiceChargePay() - wxBillRent.getPay()); + wxBillRent.setServiceChargePay(record.getServiceChargePayUpdate()); + String latePayPrice = StringUtils.isBlank(wxBillRent.getLatePayPrice()) ? "0" : wxBillRent.getLatePayPrice(); + wxBillRent.setOwe(new BigDecimal(wxBillRent.getReceivePay()).add(new BigDecimal(latePayPrice)) + .add(new BigDecimal(wxBillRent.getServiceChargePay())).subtract(new BigDecimal(wxBillRent.getPay())).toPlainString()); }else{ - Long addpay = wxBillRent.getPay(); + String addpay = wxBillRent.getPay(); wxBillRent.setRevenue(record.getRevenue()); wxBillRent.setLatePayRatio(record.getLatePayRatio()); wxBillRent.setLatePayTime(record.getLatePayTime()); wxBillRent.setLatePayStatus(record.getLatePayStatus()); wxBillRent.setPay(record.getPay()); wxBillRent.setReceivePay(record.getReceivePay()); - wxBillRent.setOwe(record.getRealReceivePay() - record.getPay()); + wxBillRent.setOwe(new BigDecimal(record.getRealReceivePay()).subtract(new BigDecimal(record.getPay())).toPlainString()); if (record.getPay().equals(record.getRealReceivePay())) { wxBillRent.setStatus(EnumBillRentStatus.PAID.getCode()); Date payDate = record.getPayDate(); @@ -208,7 +209,7 @@ public class WxBillRentServiceImpl implements WxBillRentService { wxBillRent.setPayDate(record.getPayDate()); wxBillRent.setUpdatetime(date); wxBillRent.setPayWay(record.getPayWay()); - price = new BigDecimal(record.getPay() - addpay).divide(new BigDecimal(100)).toPlainString(); + price = new BigDecimal(record.getPay()).subtract(new BigDecimal(addpay)).toPlainString(); } try { @@ -345,24 +346,24 @@ public class WxBillRentServiceImpl implements WxBillRentService { if(EnumBusRatioTime.YEAR.getCode().equals(wxRentContract.getBusDiscountTime())){ if(startInt == endInt && months == 12){ //刚好1年 - ratioVo = WxRentContractServiceImpl.getPayRatio(EnumGetRatioFrom.BILL.getCode(),wxBillRent.getRevenue(),wxRentContract.getBusDiscountRatio(),EnumMissTimeType.OTHER.getCode(),dayCount,0); + ratioVo = WxRentContractServiceImpl.getPayRatio(wxRentContract.getDecimalSize(),EnumGetRatioFrom.BILL.getCode(),wxBillRent.getRevenue(),wxRentContract.getBusDiscountRatio(),EnumMissTimeType.OTHER.getCode(),dayCount,0); }else{ - ratioVo = WxRentContractServiceImpl.getPayRatio(EnumGetRatioFrom.BILL.getCode(),wxBillRent.getRevenue(),wxRentContract.getBusDiscountRatio(),EnumMissTimeType.YEAR.getCode(),dayCount,0); + ratioVo = WxRentContractServiceImpl.getPayRatio(wxRentContract.getDecimalSize(),EnumGetRatioFrom.BILL.getCode(),wxBillRent.getRevenue(),wxRentContract.getBusDiscountRatio(),EnumMissTimeType.YEAR.getCode(),dayCount,0); } }else if(EnumBusRatioTime.MONTH.getCode().equals(wxRentContract.getBusDiscountTime())){ if(startInt == endInt && months == 1){ //刚好1个月 - ratioVo = WxRentContractServiceImpl.getPayRatio(EnumGetRatioFrom.BILL.getCode(),wxBillRent.getRevenue(),wxRentContract.getBusDiscountRatio(),EnumMissTimeType.OTHER.getCode(),dayCount,0); + ratioVo = WxRentContractServiceImpl.getPayRatio(wxRentContract.getDecimalSize(),EnumGetRatioFrom.BILL.getCode(),wxBillRent.getRevenue(),wxRentContract.getBusDiscountRatio(),EnumMissTimeType.OTHER.getCode(),dayCount,0); }else{ - ratioVo = WxRentContractServiceImpl.getPayRatio(EnumGetRatioFrom.BILL.getCode(),wxBillRent.getRevenue(),wxRentContract.getBusDiscountRatio(),EnumMissTimeType.MONTH.getCode(),dayCount,0); + ratioVo = WxRentContractServiceImpl.getPayRatio(wxRentContract.getDecimalSize(),EnumGetRatioFrom.BILL.getCode(),wxBillRent.getRevenue(),wxRentContract.getBusDiscountRatio(),EnumMissTimeType.MONTH.getCode(),dayCount,0); } }else if(EnumBusRatioTime.PERIOD.getCode().equals(wxRentContract.getBusDiscountTime())){ - ratioVo = WxRentContractServiceImpl.getPayRatio(EnumGetRatioFrom.BILL.getCode(),wxBillRent.getRevenue(),wxRentContract.getBusDiscountRatio(),EnumMissTimeType.PERIOD.getCode(),dayCount,wxRentContract.getReceivePeriod()); + ratioVo = WxRentContractServiceImpl.getPayRatio(wxRentContract.getDecimalSize(),EnumGetRatioFrom.BILL.getCode(),wxBillRent.getRevenue(),wxRentContract.getBusDiscountRatio(),EnumMissTimeType.PERIOD.getCode(),dayCount,wxRentContract.getReceivePeriod()); } } } - long newReceivePay; + String newReceivePay; if(ratioVo != null){ newReceivePay = ratioVo.getPrice(); //wxBillRent.setPayRatio(ratioVo.getRatio().longValue()); @@ -371,22 +372,21 @@ public class WxBillRentServiceImpl implements WxBillRentService { wxBillRent.setBusDiscountRatio(ratioVo.getUseRatio()); } }else{ - BigDecimal hundred = new BigDecimal(100); - BigDecimal revenue = new BigDecimal(record.getRevenue() == null ? 0 : record.getRevenue()).divide(hundred); + BigDecimal revenue = new BigDecimal(StringUtils.isBlank(record.getRevenue()) ? "0" : record.getRevenue()); BigDecimal payRatio = new BigDecimal(ratio).divide(new BigDecimal(10000)); - BigDecimal price = revenue.multiply(payRatio).setScale(2, RoundingMode.HALF_EVEN); - newReceivePay = price.multiply(hundred).longValue(); + BigDecimal price = revenue.multiply(payRatio).setScale(wxRentContract.getDecimalSize(), RoundingMode.HALF_EVEN); + newReceivePay = price.toPlainString(); } wxBillRent.setJoinRentPrice(newReceivePay); - if(newReceivePay > wxBillRent.getReceivePay()){ + if(new BigDecimal(newReceivePay).compareTo(new BigDecimal(wxBillRent.getReceivePay())) > 0){ wxBillRent.setReceivePay(newReceivePay); } - Long oldPrice = wxBillRent.getReceivePay(); - Long newPrice = newReceivePay; + String oldPrice = wxBillRent.getReceivePay(); + String newPrice = newReceivePay; wxBillRent.setUpdatetime(new Date()); - long latePayPrice = wxBillRent.getLatePayPrice() == null ? 0 : wxBillRent.getLatePayPrice(); - wxBillRent.setOwe(newPrice + wxBillRent.getServiceChargePay() + latePayPrice - wxBillRent.getPay()); + String latePayPrice = StringUtils.isBlank(wxBillRent.getLatePayPrice()) ? "0" : wxBillRent.getLatePayPrice(); + wxBillRent.setOwe(new BigDecimal(newPrice).add(new BigDecimal(wxBillRent.getServiceChargePay())).add(new BigDecimal(latePayPrice)).subtract(new BigDecimal(wxBillRent.getPay())).toPlainString()); wxBillRentMapper.updateById(wxBillRent); if (!oldPrice.equals(newPrice)) { @@ -517,10 +517,10 @@ public class WxBillRentServiceImpl implements WxBillRentService { if (null != billRentList.getList()) { for (int i = 0 ; i < billRentList.getList().size() ; i ++) { WxBillRent e = billRentList.getList().get(i); - //手续费 = 合同应收+手续费+滞纳金 - computeTotalMoney(wxPayAccountBill, e); + Integer decimalSize = Constant.default_long_decimal_size; WxRentContract rent = rentContractMap.get(e.getRentContractId()); if (null != rent) { + decimalSize = rent.getDecimalSize(); e.setMerchantName(rent.getMerchantName()); e.setRentType(rent.getType()); if (null != rent.getPayRatio()) { @@ -534,6 +534,9 @@ public class WxBillRentServiceImpl implements WxBillRentService { e.setLatePayDay(rent.getLatePayDay()); } + //手续费 = 合同应收+手续费+滞纳金 + computeTotalMoney(decimalSize,wxPayAccountBill, e); + WxBillDeposit bd = billDepositMap.get(e.getRentContractId()); if (null != bd) { e.setDeposit(bd.getReceivePay()); @@ -550,8 +553,8 @@ public class WxBillRentServiceImpl implements WxBillRentService { public ResultData updateLatePayMoney(WxBillRent record, MallUserInfo user) { WxBillRent rent = wxBillRentMapper.selectById(record.getId()); if(record.getLatePayMoneyUpdate() != null) { - rent.setLatePayPrice(Long.parseLong(record.getLatePayMoneyUpdate()) * 100); - rent.setOwe(rent.getReceivePay() + rent.getLatePayPrice() + rent.getServiceChargePay() - rent.getPay()); + rent.setLatePayPrice(record.getLatePayMoneyUpdate()); + rent.setOwe(new BigDecimal(rent.getReceivePay()).add(new BigDecimal(rent.getLatePayPrice())).add(new BigDecimal(rent.getServiceChargePay())).subtract(new BigDecimal(rent.getPay())).toPlainString()); final IdWorker idWorker = IdWorker.get(); WxBillAction billAction = new WxBillAction(); billAction.setId(idWorker.nextId()); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxBillSettleServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxBillSettleServiceImpl.java index 7bc93c4d0..ee661a5a1 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxBillSettleServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxBillSettleServiceImpl.java @@ -148,7 +148,7 @@ public class WxBillSettleServiceImpl implements WxBillSettleService { return billSettle; } - public void addBillAction(Long billId,Long money){ + public void addBillAction(Long billId,String money){ final IdWorker idWorker = IdWorker.get(); WxBillAction billAction = new WxBillAction(); billAction.setId(idWorker.nextId()); @@ -185,9 +185,9 @@ public class WxBillSettleServiceImpl implements WxBillSettleService { wxBillRent.setPayDate(new Date()); WxBillRent dbBill = wxBillRentMapper.selectById(wxBillRent.getId()); if(dbBill!=null) { - if(dbBill.getPay() == null) dbBill.setPay(0l); - if(dbBill.getOwe() == null) dbBill.setOwe(0l); - wxBillRent.setPay(dbBill.getPay()+ dbBill.getOwe()); + if(StringUtils.isBlank(dbBill.getPay())) dbBill.setPay("0"); + if(StringUtils.isBlank(dbBill.getOwe())) dbBill.setOwe("0"); + wxBillRent.setPay(new BigDecimal(dbBill.getPay()).add(new BigDecimal(dbBill.getOwe())).toPlainString()); wxBillRent.setPayDate(new Date()); addBillAction(bill.getBillId(), dbBill.getOwe()); } @@ -211,9 +211,9 @@ public class WxBillSettleServiceImpl implements WxBillSettleService { wxBillRent.setPayDate(new Date()); WxBillDeposit dbBill = wxBillDepositMapper.selectById(wxBillRent.getId()); if(dbBill!=null) { - if(dbBill.getPay() == null) dbBill.setPay(0l); - if(dbBill.getReceivePay() == null) dbBill.setReceivePay(0l); - wxBillRent.setPay(dbBill.getPay()+dbBill.getReceivePay() ); //押金是ReceivePay + if(StringUtils.isBlank(dbBill.getPay())) dbBill.setPay("0"); + if(StringUtils.isBlank(dbBill.getReceivePay())) dbBill.setReceivePay("0"); + wxBillRent.setPay(new BigDecimal(dbBill.getPay()).add(new BigDecimal(dbBill.getReceivePay())).toPlainString()); //押金是ReceivePay wxBillRent.setPayDate(new Date()); if(EnumSettleBillType.R.getCode().equals(bill.getType())){ wxBillRent.setStatus(EnumBillRentStatus.PAID.getCode()); @@ -251,7 +251,7 @@ public class WxBillSettleServiceImpl implements WxBillSettleService { }else{ wxBillOtherDeposit.setStatus(EnumBillRentStatus.RETURN.getCode()); } - addBillAction(bill.getBillId(), dbBill.getOwe()); + addBillAction(bill.getBillId(), String.valueOf(dbBill.getOwe())); } } wxBillOtherDepositMapper.updateById(wxBillOtherDeposit); @@ -282,7 +282,7 @@ public class WxBillSettleServiceImpl implements WxBillSettleService { }else{ propertyDeposit.setStatus(EnumBillRentStatus.RETURN.getCode()); } - addBillAction(bill.getBillId(), dbBill.getOwe()); + addBillAction(bill.getBillId(), String.valueOf(dbBill.getOwe())); } } wxBillPropertyDepositMapper.updateById(propertyDeposit); @@ -309,7 +309,7 @@ public class WxBillSettleServiceImpl implements WxBillSettleService { if(dbBill.getOwe() == null) dbBill.setOwe(0l); wxBillRent.setPay(dbBill.getPay()+dbBill.getOwe()); wxBillRent.setPayDate(new Date()); - addBillAction(bill.getBillId(), dbBill.getOwe()); + addBillAction(bill.getBillId(), String.valueOf(dbBill.getOwe())); } } wxBillPropertyMapper.updateById(wxBillRent); @@ -340,7 +340,7 @@ public class WxBillSettleServiceImpl implements WxBillSettleService { }else{ propertyDeposit.setStatus(EnumBillRentStatus.RETURN.getCode()); } - addBillAction(bill.getBillId(), dbBill.getOwe()); + addBillAction(bill.getBillId(), String.valueOf(dbBill.getOwe())); } } wxBillPropertyDepositMapper.updateById(propertyDeposit); @@ -366,7 +366,7 @@ public class WxBillSettleServiceImpl implements WxBillSettleService { if(dbBill.getOwe() == null) dbBill.setOwe(0l); wxBillRent.setPay(dbBill.getPay()+dbBill.getOwe()); wxBillRent.setPayDate(new Date()); - addBillAction(bill.getBillId(), dbBill.getOwe()); + addBillAction(bill.getBillId(), String.valueOf(dbBill.getOwe())); } } wxBillOtherMapper.updateById(wxBillRent); @@ -397,7 +397,7 @@ public class WxBillSettleServiceImpl implements WxBillSettleService { }else{ wxBillRent.setStatus(EnumBillRentStatus.RETURN.getCode()); } - addBillAction(bill.getBillId(), dbBill.getOwe()); + addBillAction(bill.getBillId(), String.valueOf(dbBill.getOwe())); } } wxBillOtherDepositMapper.updateById(wxBillRent); @@ -436,7 +436,7 @@ public class WxBillSettleServiceImpl implements WxBillSettleService { }else{ wxBillRent.setStatus(EnumBillRentStatus.RETURN.getCode()); } - addBillAction(bill.getBillId(), dbBill.getOwe()); + addBillAction(bill.getBillId(), String.valueOf(dbBill.getOwe())); } } wxBillOtherDepositMapper.updateById(wxBillRent); @@ -462,7 +462,7 @@ public class WxBillSettleServiceImpl implements WxBillSettleService { if(dbBill.getOwe() == null) dbBill.setOwe(0l); wxBillDaily.setPay(dbBill.getPay()+dbBill.getOwe()); wxBillDaily.setPayDate(new Date()); - addBillAction(bill.getBillId(), dbBill.getOwe()); + addBillAction(bill.getBillId(), String.valueOf(dbBill.getOwe())); } } wxBillDailyMapper.updateById(wxBillDaily); @@ -488,7 +488,7 @@ public class WxBillSettleServiceImpl implements WxBillSettleService { if(dbBill.getOwe() == null) dbBill.setOwe(0l); wxBillRent.setPay(dbBill.getPay()+dbBill.getOwe()); wxBillRent.setPayDate(new Date()); - addBillAction(bill.getBillId(), dbBill.getOwe()); + addBillAction(bill.getBillId(), String.valueOf(dbBill.getOwe())); } } wxBillOtherMapper.updateById(wxBillRent); @@ -517,7 +517,7 @@ public class WxBillSettleServiceImpl implements WxBillSettleService { }else{ propertyDeposit.setStatus(EnumBillRentStatus.RETURN.getCode()); } - addBillAction(bill.getBillId(), dbBill.getOwe()); + addBillAction(bill.getBillId(), String.valueOf(dbBill.getOwe())); } } wxBillPropertyDepositMapper.updateById(propertyDeposit); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxBusinessServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxBusinessServiceImpl.java index d1dcde456..d3a0441cf 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxBusinessServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxBusinessServiceImpl.java @@ -135,12 +135,12 @@ public class WxBusinessServiceImpl implements WxBusinessService { logger.warn("rent rentInfo is null-1: " + dbRent.getId()); continue; } - Long price = dbRent.getPrice(); + String price = dbRent.getPrice(); Integer priceUnit = dbRent.getPriceUnit(); Integer type = dbRent.getType(); Integer period = dbRent.getReceivePeriod(); Integer busDiscountTime = dbRent.getBusDiscountTime(); - BigDecimal priceDecimal = getPriceDecimal(day, price, priceUnit, type, period, busDiscountTime); + BigDecimal priceDecimal = getPriceDecimal(dbRent.getDecimalSize(),day, price, priceUnit, type, period, busDiscountTime); businessSumMoney = businessSumMoney.add(priceDecimal); } @@ -164,7 +164,7 @@ public class WxBusinessServiceImpl implements WxBusinessService { logger.info("业态分析>>>>>>>>>>>>>>>>>>物业合同ID:" + dbRent.getId()); Long price = dbRent.getPrice(); Integer priceUnit = dbRent.getPriceUnit(); - BigDecimal priceDecimal = getPriceDecimal(day, price, priceUnit, EnumRentContractType.RENT_BY_AREA.getCode(), null, null); + BigDecimal priceDecimal = getPriceDecimal(dbRent.getDecimalSize(),day, String.valueOf(price), priceUnit, EnumRentContractType.RENT_BY_AREA.getCode(), null, null); businessSumMoney = businessSumMoney.add(priceDecimal); } logger.info("业态分析>>>>>>>>>>>>>>>>>>商铺面积:" + e.get("area").toString()); @@ -188,23 +188,23 @@ public class WxBusinessServiceImpl implements WxBusinessService { * 2联营 1年(price/365*day) 2月(price/31*day) 3周期 (price/period/31*day) * 3取其高 与按面积 相同 */ - public BigDecimal getPriceDecimal(int day, Long price, Integer priceUnit, Integer type, Integer period, Integer busDiscountTime) { + public BigDecimal getPriceDecimal(Integer decimalSize,int day, String price, Integer priceUnit, Integer type, Integer period, Integer busDiscountTime) { if (EnumRentContractType.RENT_BY_JOINT.getCode().equals(type)) { if (EnumBusRatioTime.YEAR.getCode().equals(busDiscountTime)) { - return new BigDecimal(price).divide(new BigDecimal(365), 0, RoundingMode.HALF_UP).multiply(new BigDecimal(day)); + return new BigDecimal(price).divide(new BigDecimal(365), decimalSize, RoundingMode.HALF_UP).multiply(new BigDecimal(day)); } if (EnumBusRatioTime.MONTH.getCode().equals(busDiscountTime)) { - return new BigDecimal(price).divide(new BigDecimal(31), 0, RoundingMode.HALF_UP).multiply(new BigDecimal(day)); + return new BigDecimal(price).divide(new BigDecimal(31), decimalSize, RoundingMode.HALF_UP).multiply(new BigDecimal(day)); } - return new BigDecimal(price).divide(new BigDecimal(31).multiply(new BigDecimal(period)), 0, RoundingMode.HALF_UP).multiply(new BigDecimal(day)); + return new BigDecimal(price).divide(new BigDecimal(31).multiply(new BigDecimal(period)), decimalSize, RoundingMode.HALF_UP).multiply(new BigDecimal(day)); } else { if (EnumPriceUnit.D.getCode().equals(priceUnit)) { return new BigDecimal(price).multiply(new BigDecimal(day)); } if (EnumPriceUnit.M.getCode().equals(priceUnit)) { - return new BigDecimal(price).divide(new BigDecimal(31), 0, RoundingMode.HALF_UP).multiply(new BigDecimal(day)); + return new BigDecimal(price).divide(new BigDecimal(31), decimalSize, RoundingMode.HALF_UP).multiply(new BigDecimal(day)); } - return new BigDecimal(price).divide(new BigDecimal(365), 0, RoundingMode.HALF_UP).multiply(new BigDecimal(day)); + return new BigDecimal(price).divide(new BigDecimal(365), decimalSize, RoundingMode.HALF_UP).multiply(new BigDecimal(day)); } } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java index 32ccee427..94d1f1195 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java @@ -752,19 +752,19 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService long needpay; //按日 if (wxRentContract.getPriceUnit().equals(EnumPriceUnit.D.getCode())){ - Double priceD = new Double(price); - double needpayD = WxRentContractHelper.getNeedPay(0,priceD,startDate,endDate); + BigDecimal priceD = new BigDecimal(price); + String needpayD = WxRentContractHelper.getNeedPay(wxRentContract.getDecimalSize(),new BigDecimal(0),priceD,startDate,endDate); needpay = new Double(needpayD).longValue(); }else{ //年 需要除12 - Double priceD = new Double(price); + BigDecimal priceD = new BigDecimal(price); if(EnumPriceUnit.Y.getCode().equals(wxRentContract.getPriceUnit())){ - priceD = new Double(price)/12; + priceD = new BigDecimal(price).divide(new BigDecimal(12),wxRentContract.getDecimalSize(),BigDecimal.ROUND_HALF_UP); } //生成金额直接计算 if(!saveDb){ - needpay = new Double(WxRentContractHelper.getMonthNeedPay(priceD, startDate, endDate,dayType,receivePeriod,false)).longValue(); + needpay = new Double(WxRentContractHelper.getMonthNeedPay(wxRentContract.getDecimalSize(),priceD, startDate, endDate,dayType,receivePeriod,false)).longValue(); return needpay; } @@ -777,18 +777,18 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService if(sdMR.format(startDate).equals(sdMR.format(wxRentContract.getStartDate())) && sdMR.format(endDate).equals(sdMR.format(wxRentContract.getEndDate())) ){ int months = WxRentContractHelper.getMonths(sdM.format(startDate)+"-01",sdM.format(endDate)+"-01"); months++; - needpay = new Double(months * priceD).longValue(); + needpay = new BigDecimal(months).multiply(priceD).longValue(); }else { - needpay = new Double(WxRentContractHelper.getMonthNeedPay(priceD, startDate, endDate,dayType,receivePeriod,false)).longValue(); + needpay = new Double(WxRentContractHelper.getMonthNeedPay(wxRentContract.getDecimalSize(),priceD, startDate, endDate,dayType,receivePeriod,false)).longValue(); } }else if(i == 0){//第一期 if(wxRentContract.getAdjustPeriod().equals(EnumRentContractAdjustPeriod.ADJUST_PERIOD_NAR_MONTH.getCode())){ if(isFirstDay(startDate)){ int months = WxRentContractHelper.getMonths(sdM.format(startDate)+"-01",sdM.format(endDate)+"-01"); months++; - needpay = new Double(months * priceD).longValue(); + needpay = new BigDecimal(months).multiply(priceD).longValue(); }else{ - needpay = new Double(WxRentContractHelper.getMonthNeedPay(priceD, startDate, endDate,dayType,receivePeriod,false)).longValue(); + needpay = new Double(WxRentContractHelper.getMonthNeedPay(wxRentContract.getDecimalSize(),priceD, startDate, endDate,dayType,receivePeriod,false)).longValue(); } }else{ if(isFirstDay(startDate)){ @@ -796,9 +796,9 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService if(isFirstDay(startDate)){ months++; } - needpay = new Double(months * priceD).longValue(); + needpay = new BigDecimal(months).multiply(priceD).longValue(); }else{ - needpay = new Double(WxRentContractHelper.getMonthNeedPay(priceD, startDate, endDate,dayType,receivePeriod,false)).longValue(); + needpay = new Double(WxRentContractHelper.getMonthNeedPay(wxRentContract.getDecimalSize(),priceD, startDate, endDate,dayType,receivePeriod,false)).longValue(); } } }else{//中间 @@ -806,7 +806,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService if(isFirstDay(startDate)){ months++; } - needpay = new Double(months * priceD).longValue(); + needpay = new BigDecimal(months).multiply(priceD).longValue(); } } return needpay; diff --git a/mallinkService/src/main/java/com/iformall/utils/Constant.java b/mallinkService/src/main/java/com/iformall/utils/Constant.java index 304f6e6fd..2f3fcafa8 100644 --- a/mallinkService/src/main/java/com/iformall/utils/Constant.java +++ b/mallinkService/src/main/java/com/iformall/utils/Constant.java @@ -134,5 +134,7 @@ public class Constant { public static final Integer dy_business = 2; public static final String cache_aliyun_msg ="aliyunMsg:"; + + public static final Integer default_long_decimal_size = 10; } diff --git a/mallinkService/src/main/resources/mapper/WxBillDepositMapper.xml b/mallinkService/src/main/resources/mapper/WxBillDepositMapper.xml index cee30332e..981c899a1 100644 --- a/mallinkService/src/main/resources/mapper/WxBillDepositMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxBillDepositMapper.xml @@ -94,16 +94,13 @@ diff --git a/mallinkService/src/main/resources/mapper/WxBillPropertyDepositMapper.xml b/mallinkService/src/main/resources/mapper/WxBillPropertyDepositMapper.xml index 127277c59..4155b0841 100644 --- a/mallinkService/src/main/resources/mapper/WxBillPropertyDepositMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxBillPropertyDepositMapper.xml @@ -92,15 +92,11 @@ - + select br.`id`,br.`receive_pay`,br.`pay`,br.`receive_date`,br.`pay_date`,br.`createtime`,br.`expired_day`,br.`owe`,br.`status`, + br.`need_pay`,br.`updatetime`,br.`merchant_id`,br.`rent_shop_type`,br.`return_price`,br.`shop_info`,br.pay_way, br.freeze,br.service_charge_pay,br.`apply_status`,br.`apply_pay_img`,br.`apply_update_time` - from wx_bill_property_deposit br left join wx_merchant m on br.merchant_id=m.id - left join wx_shop s on br.shop_id=s.id + from wx_bill_property_deposit br and br.`id` = #{id} @@ -110,14 +106,18 @@ and br.`parent_tenant_id` = #{parentTenantId} and br.`merchant_id` = #{merchantId} - and m.`name` like concat('%',#{merchantName},'%') and br.`status` = #{status} and br.`apply_status` = #{applyStatus} and br.`is_del` = #{isDel} and br.`rent_shop_type` = #{rentShopType} and br.`property_contract_id` = #{propertyContractId} and br.`pay_way` = #{payWay} - + + and br.`merchant_id` in + + #{midItem} + + order by id desc