@@ -6,6 +6,7 @@ import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.ObjectUtil ;
import cn.hutool.core.util.RandomUtil ;
import org.apache.dubbo.config.annotation.DubboReference ;
import org.dromara.common.core.utils.DictUtils ;
import org.dromara.common.core.utils.MapstructUtils ;
import org.dromara.common.core.utils.StringUtils ;
import org.dromara.common.mybatis.core.page.TableDataInfo ;
@@ -24,7 +25,9 @@ import org.dromara.property.domain.vo.*;
import org.dromara.property.domain.vo.residentVo.ResidentPersonVo ;
import org.dromara.property.domain.vo.residentVo.ResidentUnitVo ;
import org.dromara.property.mapper.* ;
import org.dromara.system.api.RemoteDictService ;
import org.dromara.system.api.RemoteUserService ;
import org.dromara.system.api.domain.vo.RemoteDictDataVo ;
import org.springframework.stereotype.Service ;
import org.dromara.property.domain.bo.CostHouseChargeBo ;
import org.dromara.property.service.ICostHouseChargeService ;
@@ -32,10 +35,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal ;
import java.math.RoundingMode ;
import java.util.ArrayList ;
import java.util.List ;
import java.util.Map ;
import java.util.Collection ;
import java.util.* ;
import java.util.stream.Collectors ;
/**
@@ -59,6 +59,9 @@ public class CostHouseChargeServiceImpl implements ICostHouseChargeService {
@DubboReference
private RemoteUserService remoteUserService ;
@DubboReference
private RemoteDictService remoteDictService ;
/**
* 查询房屋收费
*
@@ -147,7 +150,7 @@ public class CostHouseChargeServiceImpl implements ICostHouseChargeService {
lqw . orderByDesc ( CostHouseCharge : : getCreateTime )
. orderByDesc ( CostHouseCharge : : getUpdateTime ) ;
List < Long > itemIdList = new ArrayList < > ( ) ;
if ( ObjectUtil . isNotEmpty ( bo . getCostType ( ) ) ) {
if ( ObjectUtil . isNotEmpty ( bo . getCostType ( ) ) ) {
List < CostItemsVo > costItemsVos = costItemsMapper . selectVoList (
new LambdaQueryWrapper < CostItems > ( )
. eq ( CostItems : : getCostType , bo . getCostType ( ) )
@@ -155,10 +158,10 @@ public class CostHouseChargeServiceImpl implements ICostHouseChargeService {
//收集项目id
itemIdList = costItemsVos . stream ( ) . map ( vo - > vo . getId ( ) ) . distinct ( ) . collect ( Collectors . toList ( ) ) ;
}
lqw . in ( CollUtil . isNotEmpty ( itemIdList ) , CostHouseCharge : : getCostItemsId , itemIdList ) ;
lqw . in ( CollUtil . isNotEmpty ( itemIdList ) , CostHouseCharge : : getCostItemsId , itemIdList ) ;
lqw . eq ( bo . getResidentUnitId ( ) ! = null , CostHouseCharge : : getResidentUnitId , bo . getResidentUnitId ( ) ) ;
lqw . eq ( bo . getCostItemsId ( ) ! = null , CostHouseCharge : : getCostItemsId , bo . getCostItemsId ( ) ) ;
lqw . eq ( bo . getType ( ) ! = null , CostHouseCharge : : getType , bo . getType ( ) ) ;
lqw . eq ( bo . getType ( ) ! = null , CostHouseCharge : : getType , bo . getType ( ) ) ;
lqw . eq ( StringUtils . isNotBlank ( bo . getChargeCycle ( ) ) , CostHouseCharge : : getChargeCycle , bo . getChargeCycle ( ) ) ;
lqw . eq ( bo . getAmountReceivable ( ) ! = null , CostHouseCharge : : getAmountReceivable , bo . getAmountReceivable ( ) ) ;
lqw . eq ( bo . getStartTime ( ) ! = null , CostHouseCharge : : getStartTime , bo . getStartTime ( ) ) ;
@@ -185,18 +188,43 @@ public class CostHouseChargeServiceImpl implements ICostHouseChargeService {
BigDecimal area = new BigDecimal ( add . getArea ( ) ) ;
CostItemsVo costItemsVo = costItemsMapper . selectVoById ( add . getCostItemsId ( ) ) ;
BigDecimal unitPrice = costItemsVo . getUnitPrice ( ) ;
//向上取整
if ( costItemsVo. getRoundingMode( ) . equals ( " 1 " ) ) {
add. setAmountReceivable( area . multiply( unitPrice) . add ( costItemsVo. getSurcharge( ) ) . setScale( Integer. valueOf( costItemsVo. getCurrencyDecimals( ) ) , BigDecimal. ROUND_UP) ) ;
// //向上取整
// if ( costItemsVo. getRoundingMode().equals("1")) {
// add. setAmountReceivable(area. multiply( unitPrice).add( costItemsVo. getSurcharge()). setScale( Integer. valueOf( costItemsVo. getCurrencyDecimals()), BigDecimal. ROUND_UP)) ;
// }
// //向下取整
// if (costItemsVo.getRoundingMode().equals("2")) {
// add.setAmountReceivable(area.multiply(unitPrice).add(costItemsVo.getSurcharge()).setScale(Integer.valueOf(costItemsVo.getCurrencyDecimals()), BigDecimal.ROUND_DOWN));
// }
// //四舍五入
// if (costItemsVo.getRoundingMode().equals("0")) {
// add.setAmountReceivable(area.multiply(unitPrice).add(costItemsVo.getSurcharge()).setScale(Integer.valueOf(costItemsVo.getCurrencyDecimals()), RoundingMode.HALF_UP));
// }
List < RemoteDictDataVo > proExpenseType = remoteDictService . selectDictDataByType ( " pro_expense_type " ) ;
//循环proExpenseType
for ( RemoteDictDataVo remoteDictDataVo : proExpenseType ) {
//类型为0, 则为物业管理费用, 设置收费为建筑面积*单价+附加费
if ( Objects . equals ( remoteDictDataVo . getDictValue ( ) , " 0 " ) ) {
add . setAmountReceivable ( area . multiply ( unitPrice ) . add ( costItemsVo . getSurcharge ( ) . setScale ( Integer . parseInt ( costItemsVo . getCurrencyDecimals ( ) ) , BigDecimal . ROUND_HALF_UP ) ) ) ;
}
//向下取整
if ( costItemsVo . getRoundingMode ( ) . equals ( " 2 " ) ) {
add . setAmountReceivable ( area . multiply ( unitPrice ) . add ( costItemsVo . getSurcharge ( ) ) . setScale ( Integer . valueOf ( costItemsVo . getCurrencyDecimals ( ) ) , BigDecimal . ROUND_DOWN ) ) ;
//类型为2、7、9, 则为停车费用、租金、押金, 设置收费为固定收费
if ( Objects . equals ( remoteDictDataVo . getDictValue ( ) , " 2 " ) | | Objects . equals ( remoteDictDataVo . getDictValue ( ) , " 7 " ) | | Objects . equals ( remoteDictDataVo . getDictValue ( ) , " 9 " ) ) {
add . setAmountReceivable ( costItemsVo . getSurcharge ( ) ) ;
}
//四舍五入
if ( costItemsVo . getRoundingMode ( ) . equals ( " 0 " ) ) {
add . setAmountReceivable ( area . multiply ( unitPrice ) . add ( costItemsVo . getSurcharge ( ) ) . setScale ( Integer . valueOf ( costItemsVo . getCurrencyDecimals ( ) ) , RoundingMode . HALF_UP ) ) ;
//类型为5, 则为水费
if ( Objects . equals ( remoteDictDataVo . getDictValue ( ) , " 5 " ) ) {
}
//类型为6, 则为电费
if ( Objects . equals ( remoteDictDataVo . getDictValue ( ) , " 6 " ) ) {
}
//类型为8, 则为气费
if ( Objects . equals ( remoteDictDataVo . getDictValue ( ) , " 8 " ) ) {
}
}
add . setChargeStatus ( ChargeStatusEnum . PAYMENT_IS_SUBJECT_TO_REVIEW . getValue ( ) ) ;
//area
validEntityBeforeSave ( add ) ;
@@ -297,7 +325,7 @@ public class CostHouseChargeServiceImpl implements ICostHouseChargeService {
. setEndTime ( bo . getEndTime ( ) )
. setReceivableAmount ( bo . getAmountReceivable ( ) )
. setState ( " 0 " ) ;
return costPayFeeAuditMapper . insert ( CostPayFeeAudit ) > 0 ;
return costPayFeeAuditMapper . insert ( CostPayFeeAudit ) > 0 ;
}
return flag ;
}