mirror of
https://codeup.aliyun.com/64f7d6b8ce01efaafef1e678/coal/coal.git
synced 2026-07-26 07:28:58 +08:00
refactor(coal): 优化代码结构和精度处理
- 重构了 SmartCamCarLicenseSnapshotDataService 中的条件判断逻辑,减少了代码重复 - 在 WarehouseReceiptService 中将价格精度从 2 位小数调整为 4 位小数,提高精度
This commit is contained in:
@@ -319,25 +319,20 @@ public class SmartCamCarLicenseSnapshotDataService
|
||||
boolean entry = StringUtils.equals(entity.getSmartCam().getDirection(), "0");
|
||||
if (byNumber == null) {
|
||||
|
||||
SmartCamCarDataEntity smartCamCarDataEntity = new SmartCamCarDataEntity();
|
||||
smartCamCarDataEntity.setNumber(entity.getNumber());
|
||||
if (entry) {
|
||||
|
||||
SmartCamCarDataEntity smartCamCarDataEntity = new SmartCamCarDataEntity();
|
||||
smartCamCarDataEntity.setNumber(entity.getNumber());
|
||||
smartCamCarDataEntity.setEntry(entity);
|
||||
smartCamCarDataEntity.setEntryTime(entity.getInfoTimeObj());
|
||||
|
||||
smartCamCarDataEntity.setOrganizationId(entity.getOrganizationId());
|
||||
smartCamCarDataRepository.save(smartCamCarDataEntity);
|
||||
|
||||
} else {
|
||||
|
||||
SmartCamCarDataEntity smartCamCarDataEntity = new SmartCamCarDataEntity();
|
||||
smartCamCarDataEntity.setNumber(entity.getNumber());
|
||||
smartCamCarDataEntity.setExit(entity);
|
||||
smartCamCarDataEntity.setExitTime(entity.getInfoTimeObj());
|
||||
smartCamCarDataEntity.setOrganizationId(entity.getOrganizationId());
|
||||
smartCamCarDataRepository.save(smartCamCarDataEntity);
|
||||
}
|
||||
smartCamCarDataEntity.setOrganizationId(entity.getOrganizationId());
|
||||
smartCamCarDataRepository.save(smartCamCarDataEntity);
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
@@ -253,7 +253,7 @@ public class WarehouseReceiptService
|
||||
BigDecimal.valueOf(
|
||||
ObjectUtils.defaultIfNull(
|
||||
warehouseReceiptDetailEntity.getPrice(), 0.0))
|
||||
.setScale(2, RoundingMode.HALF_UP)
|
||||
.setScale(4, RoundingMode.HALF_UP)
|
||||
.doubleValue());
|
||||
|
||||
warehouseReceiptDetailEntity.setNumber(
|
||||
|
||||
Reference in New Issue
Block a user