refactor(Property): 重构收费计算逻辑并优化工单和计量记录功能
This commit is contained in:
@@ -6,6 +6,7 @@ import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.dubbo.config.annotation.DubboReference;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
@@ -20,9 +21,14 @@ import org.dromara.property.api.model.LoginResidentPerson;
|
||||
import org.dromara.property.domain.bo.residentBo.ResidentPersonBo;
|
||||
import org.dromara.property.domain.vo.residentVo.ResidentPersonVo;
|
||||
import org.dromara.property.service.residentService.IResidentPersonService;
|
||||
import org.dromara.resource.api.RemoteFileService;
|
||||
import org.dromara.resource.api.domain.RemoteFile;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -41,6 +47,9 @@ public class XResidentPersonController extends BaseController {
|
||||
|
||||
private final IResidentPersonService residentPersonService;
|
||||
|
||||
@DubboReference
|
||||
private RemoteFileService remoteFileService;
|
||||
|
||||
/**
|
||||
* 获取登录员工信息
|
||||
*/
|
||||
@@ -125,4 +134,16 @@ public class XResidentPersonController extends BaseController {
|
||||
return toAjax(residentPersonService.deleteWithValidByIds(List.of(ids), true));
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传图片
|
||||
*
|
||||
* @param file 图片文件
|
||||
*/
|
||||
@PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
||||
public R<RemoteFile> upload(@RequestPart("file") MultipartFile file) throws IOException {
|
||||
byte[] imgByte = file.getBytes();
|
||||
RemoteFile remoteFile = remoteFileService.uploadImg(imgByte);
|
||||
return R.ok(remoteFile);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -197,44 +197,50 @@ public class CostHouseChargeServiceImpl implements ICostHouseChargeService {
|
||||
BigDecimal area = BigDecimal.valueOf(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("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)));
|
||||
}
|
||||
//类型为2、7、9,则为停车费用、租金、押金,设置收费为固定收费
|
||||
if (Objects.equals(remoteDictDataVo.getDictValue(), "2") || Objects.equals(remoteDictDataVo.getDictValue(), "7") || Objects.equals(remoteDictDataVo.getDictValue(), "9")) {
|
||||
add.setAmountReceivable(costItemsVo.getSurcharge());
|
||||
}
|
||||
//类型为5,则为水费
|
||||
if (Objects.equals(remoteDictDataVo.getDictValue(), "5")) {
|
||||
add.setAmountReceivable(meterCharge(residentUnitVo.getLocation(), area, 2L, bo));
|
||||
}
|
||||
//类型为6,则为电费
|
||||
if (Objects.equals(remoteDictDataVo.getDictValue(), "6")) {
|
||||
add.setAmountReceivable(meterCharge(residentUnitVo.getLocation(), area, 1L, bo));
|
||||
}
|
||||
//类型为8,则为气费
|
||||
if (Objects.equals(remoteDictDataVo.getDictValue(), "8")) {
|
||||
// for (RemoteDictDataVo remoteDictDataVo : proExpenseType) {
|
||||
// //类型为0,则为物业管理费用,设置收费为建筑面积*单价+附加费
|
||||
// if (Objects.equals(remoteDictDataVo.getDictValue(), bo.getCostType())) {
|
||||
// add.setAmountReceivable(area.multiply(unitPrice).add(costItemsVo.getSurcharge().setScale(Integer.parseInt(costItemsVo.getCurrencyDecimals()), BigDecimal.ROUND_HALF_UP)));
|
||||
// }
|
||||
// //类型为2、7、9,则为停车费用、租金、押金,设置收费为固定收费
|
||||
// if (Objects.equals(remoteDictDataVo.getDictValue(), bo.getCostType()) || Objects.equals(remoteDictDataVo.getDictValue(), "7") || Objects.equals(remoteDictDataVo.getDictValue(), "9")) {
|
||||
// add.setAmountReceivable(costItemsVo.getSurcharge());
|
||||
// }
|
||||
// //类型为5,则为水费
|
||||
// if (Objects.equals(remoteDictDataVo.getDictValue(), bo.getCostType())) {
|
||||
// add.setAmountReceivable(meterCharge(residentUnitVo.getLocation(), area, 2L, bo));
|
||||
// }
|
||||
// //类型为6,则为电费
|
||||
// if (Objects.equals(remoteDictDataVo.getDictValue(), bo.getCostType())) {
|
||||
// add.setAmountReceivable(meterCharge(residentUnitVo.getLocation(), area, 1L, bo));
|
||||
// }
|
||||
// //类型为8,则为气费
|
||||
// if (Objects.equals(remoteDictDataVo.getDictValue(), bo.getCostType())) {
|
||||
//
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
//类型为0,则为物业管理费用,设置收费为建筑面积*单价+附加费
|
||||
if (Objects.equals("0", bo.getCostType())) {
|
||||
add.setAmountReceivable(area.multiply(unitPrice).add(costItemsVo.getSurcharge().setScale(Integer.parseInt(costItemsVo.getCurrencyDecimals()), BigDecimal.ROUND_HALF_UP)));
|
||||
}
|
||||
//类型为2、7、9,则为停车费用、租金、押金,设置收费为固定收费
|
||||
if (Objects.equals("2", bo.getCostType()) || Objects.equals("7", bo.getCostType()) || Objects.equals("9", bo.getCostType())) {
|
||||
add.setAmountReceivable(costItemsVo.getSurcharge());
|
||||
}
|
||||
//类型为5,则为水费
|
||||
if (Objects.equals("5", bo.getCostType())) {
|
||||
add.setAmountReceivable(meterCharge(residentUnitVo.getLocation(), area, 2L, bo));
|
||||
}
|
||||
//类型为6,则为电费
|
||||
if (Objects.equals("6", bo.getCostType())) {
|
||||
add.setAmountReceivable(meterCharge(residentUnitVo.getLocation(), area, 1L, bo));
|
||||
}
|
||||
|
||||
|
||||
add.setChargeStatus(ChargeStatusEnum.PAYMENT_IS_SUBJECT_TO_REVIEW.getValue());
|
||||
//area
|
||||
@@ -284,8 +290,10 @@ public class CostHouseChargeServiceImpl implements ICostHouseChargeService {
|
||||
for (Map.Entry<Long, TbFloorVo> entry : floorData.entrySet()) {
|
||||
floorArea += entry.getValue().getArea();
|
||||
Map<String, Object> meterRecord = tbMeterRecordService.getEnergyTrend(entry.getKey().toString(), null, meterType, null, bo.getChargeTime(), null);
|
||||
Map<String, Object> dayMap = Convert.convert(new TypeReference<>() {
|
||||
}, meterRecord.get("day"));
|
||||
Map<String, Object> resultMap = Convert.convert(new TypeReference<>() {
|
||||
}, meterRecord.get("nowMonth"));
|
||||
}, dayMap.get("nowMonth"));
|
||||
meterEnergy += Convert.convert(Float.class, resultMap.get("total"));
|
||||
}
|
||||
|
||||
|
@@ -235,7 +235,7 @@ public class ServiceWorkOrdersServiceImpl implements IServiceWorkOrdersService {
|
||||
assert user != null;
|
||||
add.setInitiatorPeople(user.getNickname());
|
||||
}
|
||||
|
||||
add.setInitiatorPeople(bo.getInitiatorName());
|
||||
Date originalDate = new Date(); // 当前时间
|
||||
Date newDate = DateUtil.offsetHour(originalDate, serviceWorkOrdersType.getCompletionNumber());
|
||||
add.setPlanCompleTime(newDate);
|
||||
|
@@ -276,6 +276,9 @@ public class TbMeterRecordServiceImpl implements ITbMeterRecordService {
|
||||
}
|
||||
ordersBo.setOrderName(orderName);
|
||||
ordersBo.setType(orderType);
|
||||
ordersBo.setLocation(info.getInstallLocation());
|
||||
ordersBo.setReportingType("3"); // 系统上报
|
||||
ordersBo.setProcessingWeight("2"); // 紧急
|
||||
boolean orderFlag = serviceWorkOrdersService.insertByBo(ordersBo);
|
||||
Assert.isTrue(orderFlag, "自动上报工单失败");
|
||||
}
|
||||
|
Reference in New Issue
Block a user