单位收费业务逻辑修改
This commit is contained in:
@@ -102,6 +102,8 @@ public class Clean extends TenantEntity {
|
||||
*/
|
||||
private String searchValue;
|
||||
|
||||
private Double area;
|
||||
|
||||
@TableField(exist = false)
|
||||
private CleanRelation cleanRelation;
|
||||
|
||||
|
@@ -29,7 +29,7 @@ public class CostItems extends TenantEntity {
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 费用类型
|
||||
* 费用类型(0物业费1押金2停车费3维修费4.服务费5水费6电费7租金8其他)
|
||||
*/
|
||||
private String costType;
|
||||
/**
|
||||
|
@@ -75,13 +75,13 @@ public class CostItemsBo extends BaseEntity {
|
||||
/**
|
||||
* 进位方式
|
||||
*/
|
||||
@NotBlank(message = "进位方式不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
// @NotBlank(message = "进位方式不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String roundingMode;
|
||||
|
||||
/**
|
||||
* 保留小数
|
||||
*/
|
||||
@NotBlank(message = "保留小数不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
// @NotBlank(message = "保留小数不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String currencyDecimals;
|
||||
|
||||
/**
|
||||
@@ -92,13 +92,13 @@ public class CostItemsBo extends BaseEntity {
|
||||
/**
|
||||
* 计算公式
|
||||
*/
|
||||
@NotBlank(message = "计算公式不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
// @NotBlank(message = "计算公式不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String formula;
|
||||
|
||||
/**
|
||||
* 计费单价
|
||||
*/
|
||||
@NotNull(message = "计费单价不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
// @NotNull(message = "计费单价不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
@DecimalMin(value = "0.00", inclusive = false, message = "计费单价必须大于0")
|
||||
@ExcelProperty("计费单价")
|
||||
private BigDecimal unitPrice;
|
||||
|
@@ -151,5 +151,4 @@ public class CleanOrderBo extends BaseEntity {
|
||||
|
||||
private CleanOrderRecordBo cleanOrderRecord;
|
||||
|
||||
|
||||
}
|
||||
|
@@ -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;
|
||||
|
||||
/**
|
||||
* 查询房屋收费
|
||||
*
|
||||
@@ -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);
|
||||
|
@@ -228,7 +228,7 @@ public class CleanOrderServiceImpl implements ICleanOrderService {
|
||||
cleanRelation.setCleanserverOrderId(cleanserverOrderIds.get(i));
|
||||
cleanRelation.setCleanId(clean.getId());
|
||||
// cleanRelation.setAreas(clean.getArea());
|
||||
cleanRelation.setSumPrice(bo.getSumPeices());
|
||||
cleanRelation.setSumPrice(bo.getCleanList().get(i).getArea() * bo.getCleanList().get(i).getPeices());
|
||||
cleanRelationMapper.insert(cleanRelation);
|
||||
i++;
|
||||
}
|
||||
|
Reference in New Issue
Block a user