|
@@ -3,6 +3,7 @@ package com.skyversation.xjcy.computer;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.skyversation.xjcy.util.JSONDataTool;
|
|
import com.skyversation.xjcy.util.JSONDataTool;
|
|
|
import lombok.AllArgsConstructor;
|
|
import lombok.AllArgsConstructor;
|
|
|
|
|
+import lombok.Getter;
|
|
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
|
import java.time.Instant;
|
|
import java.time.Instant;
|
|
@@ -86,6 +87,15 @@ public class ParkPreCounter {
|
|
|
private final List<JSONObject> allRoom;
|
|
private final List<JSONObject> allRoom;
|
|
|
private final List<JSONObject> allLease;
|
|
private final List<JSONObject> allLease;
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * -- GETTER --
|
|
|
|
|
+ * 获取当前是否启用强制更新模式
|
|
|
|
|
+ *
|
|
|
|
|
+ * @return true-强制更新模式;false-差异对比模式
|
|
|
|
|
+ */
|
|
|
|
|
+ @Getter
|
|
|
|
|
+ private boolean forceUpdate = false;
|
|
|
|
|
+
|
|
|
|
|
|
|
|
private final LocalDate now;
|
|
private final LocalDate now;
|
|
|
|
|
|
|
@@ -127,6 +137,17 @@ public class ParkPreCounter {
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 设置是否强制更新所有房间(跳过差异检查,直接执行计算)
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param forceUpdate true-强制更新所有房间;false-仅更新有变化的房间(默认)
|
|
|
|
|
+ * @return 当前对象,支持链式调用
|
|
|
|
|
+ */
|
|
|
|
|
+ public ParkPreCounter setForceUpdate(boolean forceUpdate) {
|
|
|
|
|
+ this.forceUpdate = forceUpdate;
|
|
|
|
|
+ return this;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
public Set<JSONObject> getRoomsWithCode(Collection<String> roomCodes, List<JSONObject> range) {
|
|
public Set<JSONObject> getRoomsWithCode(Collection<String> roomCodes, List<JSONObject> range) {
|
|
|
if (roomCodes == null || roomCodes.isEmpty() || range == null || range.isEmpty()) {
|
|
if (roomCodes == null || roomCodes.isEmpty() || range == null || range.isEmpty()) {
|
|
|
return Collections.emptySet();
|
|
return Collections.emptySet();
|
|
@@ -230,7 +251,7 @@ public class ParkPreCounter {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//评估房间是否需要更新
|
|
//评估房间是否需要更新
|
|
|
- boolean shouldRoomUpdateFlag = shouldRoomUpdate(room, newWorkingLease);
|
|
|
|
|
|
|
+ boolean shouldRoomUpdateFlag = forceUpdate || shouldRoomUpdate(room, newWorkingLease);
|
|
|
if (shouldRoomUpdateFlag) {
|
|
if (shouldRoomUpdateFlag) {
|
|
|
updateRoomLease(room, newWorkingLease);
|
|
updateRoomLease(room, newWorkingLease);
|
|
|
return true;
|
|
return true;
|
|
@@ -447,8 +468,11 @@ public class ParkPreCounter {
|
|
|
JSONDataTool.updateDoubleValue(father, String.valueOf(ParkKey.c_sold_area), countResult.soldArea.doubleValue(), parkNeedUploadId);
|
|
JSONDataTool.updateDoubleValue(father, String.valueOf(ParkKey.c_sold_area), countResult.soldArea.doubleValue(), parkNeedUploadId);
|
|
|
JSONDataTool.updateDoubleValue(father, String.valueOf(ParkKey.c_rented_area), countResult.rentedArea.doubleValue(), parkNeedUploadId);
|
|
JSONDataTool.updateDoubleValue(father, String.valueOf(ParkKey.c_rented_area), countResult.rentedArea.doubleValue(), parkNeedUploadId);
|
|
|
JSONDataTool.updateDoubleValue(father, String.valueOf(ParkKey.c_self_used_area), countResult.selfUseArea.doubleValue(), parkNeedUploadId);
|
|
JSONDataTool.updateDoubleValue(father, String.valueOf(ParkKey.c_self_used_area), countResult.selfUseArea.doubleValue(), parkNeedUploadId);
|
|
|
- BigDecimal vacant_area = countResult.buildArea.subtract(countResult.rentedArea).subtract(countResult.selfUseArea).subtract(countResult.soldArea);
|
|
|
|
|
- JSONDataTool.updateDoubleValue(father, String.valueOf(ParkKey.c_vacant_area), vacant_area.doubleValue(), parkNeedUploadId);
|
|
|
|
|
|
|
+ BigDecimal building_area = father.getBigDecimal(String.valueOf(ParkKey.c_building_area));
|
|
|
|
|
+ if (building_area!=null){
|
|
|
|
|
+ BigDecimal vacant_area = building_area.subtract(countResult.rentedArea).subtract(countResult.selfUseArea).subtract(countResult.soldArea);
|
|
|
|
|
+ JSONDataTool.updateDoubleValue(father, String.valueOf(ParkKey.c_vacant_area), vacant_area.doubleValue(), parkNeedUploadId);
|
|
|
|
|
+ }
|
|
|
}else {
|
|
}else {
|
|
|
BigDecimal undergroundArea = nullToZero(father.getBigDecimal(String.valueOf(ParkKey.c_underground_area)));
|
|
BigDecimal undergroundArea = nullToZero(father.getBigDecimal(String.valueOf(ParkKey.c_underground_area)));
|
|
|
JSONDataTool.updateDoubleValue(father, String.valueOf(ParkKey.c_building_area), countResult.buildArea.add(undergroundArea).doubleValue(), parkNeedUploadId);
|
|
JSONDataTool.updateDoubleValue(father, String.valueOf(ParkKey.c_building_area), countResult.buildArea.add(undergroundArea).doubleValue(), parkNeedUploadId);
|