Bläddra i källkod

feat: 一房产局址一表接口添加默认返回

weijianghai 10 månader sedan
förälder
incheckning
72405f49f3

+ 5 - 0
src/main/java/com/example/common/exception/BizException.java

@@ -7,4 +7,9 @@ public class BizException extends RuntimeException{
     public BizException(String message) {
         super(message);
     }
+
+    @Override
+    public synchronized Throwable fillInStackTrace() {
+        return this;
+    }
 }

+ 5 - 0
src/main/java/com/example/common/exception/MyRuntimeException.java

@@ -19,4 +19,9 @@ public class MyRuntimeException extends RuntimeException{
     public MyRuntimeException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
         super(message, cause, enableSuppression, writableStackTrace);
     }
+
+    @Override
+    public synchronized Throwable fillInStackTrace() {
+        return this;
+    }
 }

+ 1 - 1
src/main/java/com/example/dao/WzOtnAreaDao.java

@@ -95,7 +95,7 @@ select
 from
     house.site_month
 where
-    year_month = #{bo.yearMonth}
+    year_month = (select max(year_month) from house.site_month)
 <if test="bo.areaNo != null and bo.areaNo != ''">
   and area_no = #{bo.areaNo}
 </if>

+ 5 - 3
src/main/java/com/example/dao/house/HouseSiteStatDao.java

@@ -20,7 +20,7 @@ public interface HouseSiteStatDao {
      * @param siteId 局址id
      */
     @Select("""
-select * from house.site_month where year_month = #{yearMonth} and site_id = #{siteId}
+select * from house.site_month where year_month <= #{yearMonth} and site_id = #{siteId} order by year_month desc limit 1
 """)
     HouseSitePo getHouseSiteBySiteIdAndYearMonth(@Param("yearMonth") Integer yearMonth, @Param("siteId") String siteId);
 
@@ -30,7 +30,9 @@ select * from house.site_month where year_month = #{yearMonth} and site_id = #{s
      * @param siteId 局址id
      */
     @Select("""
-select * from house.building_month where year_month = #{yearMonth} and site_id = #{siteId}
+select * from house.building_month
+where year_month = (select max(year_month) from house.building_month where year_month <= #{yearMonth})
+and site_id = #{siteId}
 """)
     List<HouseBuildingPo> allBuildingBySiteIdAndYearMonth(@Param("yearMonth") Integer yearMonth,
                                                           @Param("siteId") String siteId);
@@ -46,7 +48,7 @@ select
 from
     house.land_month
 where
-    year_month = #{yearMonth}
+    year_month = (select max(year_month) from house.land_month where year_month <= #{yearMonth})
     and site_id = #{siteId}
 """)
     BigDecimal getLandAreaBySiteIdAndYearMonth(@Param("yearMonth") Integer yearMonth, @Param("siteId") String siteId);

+ 0 - 4
src/main/java/com/example/pojo/bo/ListHouseSiteBo.java

@@ -4,10 +4,6 @@ import lombok.Data;
 
 @Data
 public class ListHouseSiteBo {
-    /**
-     * 账期
-     */
-    private Integer yearMonth;
     /**
      * 二级组织机构编码
      */

+ 0 - 3
src/main/java/com/example/pojo/dto/ListSiteNameDto.java

@@ -21,9 +21,6 @@ public class ListSiteNameDto {
     @NoArgsConstructor
     @Data
     public static class ListSiteNameMapDTO {
-        @Schema(description = "账期", example = "202312")
-        @NotNull
-        private Integer statisticalMonth;
         @Schema(description = "二级组织机构id")
         private String city;
         @Schema(description = "三级级组织机构id")

+ 7 - 3
src/main/java/com/example/service/house/HouseSiteStatService.java

@@ -20,6 +20,7 @@ import java.time.format.DateTimeFormatter;
 import java.util.ArrayList;
 import java.util.LinkedHashMap;
 import java.util.List;
+import java.util.Objects;
 
 @Slf4j
 @Service
@@ -127,9 +128,12 @@ public class HouseSiteStatService {
             vo.setBuildingAreaIdleRateNow(BigDecimal.ZERO);
             vo.setBuildingAreaIdleRateDiff(BigDecimal.ZERO);
         } else {
-            vo.setBuildingAreaIdleRatePast(houseSiteBuildingAreaIdleDiffPo.getBuildingAreaIdleRatePast());
-            vo.setBuildingAreaIdleRateNow(houseSiteBuildingAreaIdleDiffPo.getBuildingAreaIdleRateNow());
-            vo.setBuildingAreaIdleRateDiff(houseSiteBuildingAreaIdleDiffPo.getBuildingAreaIdleRateDiff());
+            vo.setBuildingAreaIdleRatePast(Objects.requireNonNullElse(
+                    houseSiteBuildingAreaIdleDiffPo.getBuildingAreaIdleRatePast(), BigDecimal.ZERO));
+            vo.setBuildingAreaIdleRateNow(Objects.requireNonNullElse(
+                    houseSiteBuildingAreaIdleDiffPo.getBuildingAreaIdleRateNow(), BigDecimal.ZERO));
+            vo.setBuildingAreaIdleRateDiff(Objects.requireNonNullElse(
+                    houseSiteBuildingAreaIdleDiffPo.getBuildingAreaIdleRateDiff(), BigDecimal.ZERO));
         }
         return vo;
     }

+ 0 - 13
src/main/java/com/example/service/house/HouseWzBuildManageDetailsService.java

@@ -32,7 +32,6 @@ import org.springframework.web.context.request.RequestContextHolder;
 import org.springframework.web.context.request.ServletRequestAttributes;
 
 import javax.servlet.http.HttpServletResponse;
-import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
 import java.util.ArrayList;
@@ -381,17 +380,11 @@ public class HouseWzBuildManageDetailsService {
     }
 
     public Rsp<PageVo<String>> listSiteName(ListSiteNameDto dto) {
-        Integer yearMonth = dto.getMap().getStatisticalMonth();
-        if (yearMonth == null) {
-            yearMonth = Integer.valueOf(LocalDate.now().minusDays(40)
-                    .format(DateTimeFormatter.ofPattern("yyyyMM")));
-        }
         if ("全省".equals(dto.getMap().getCity())) {
             dto.getMap().setCity(null);
             dto.getMap().setCounty(null);
         }
         ListHouseSiteBo bo = new ListHouseSiteBo();
-        bo.setYearMonth(yearMonth);
         bo.setAreaNo(dto.getMap().getCity());
         bo.setCityNo(dto.getMap().getCounty());
         bo.setSiteName(dto.getMap().getAlias());
@@ -403,17 +396,11 @@ public class HouseWzBuildManageDetailsService {
     }
 
     public Rsp<PageVo<String>> listSiteNum(ListSiteNumDto dto) {
-        Integer yearMonth = dto.getMap().getStatisticalMonth();
-        if (yearMonth == null) {
-            yearMonth = Integer.valueOf(LocalDate.now().minusDays(40)
-                    .format(DateTimeFormatter.ofPattern("yyyyMM")));
-        }
         if ("全省".equals(dto.getMap().getCity())) {
             dto.getMap().setCity(null);
             dto.getMap().setCounty(null);
         }
         ListHouseSiteBo bo = new ListHouseSiteBo();
-        bo.setYearMonth(yearMonth);
         bo.setAreaNo(dto.getMap().getCity());
         bo.setCityNo(dto.getMap().getCounty());
         bo.setSiteNum(dto.getMap().getCode());

+ 0 - 13
src/main/java/com/example/service/house/HouseWzHouseMaintenaCostService.java

@@ -42,7 +42,6 @@ import org.springframework.web.context.request.RequestContextHolder;
 import org.springframework.web.context.request.ServletRequestAttributes;
 
 import javax.servlet.http.HttpServletResponse;
-import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
 import java.util.ArrayList;
@@ -557,17 +556,11 @@ public class HouseWzHouseMaintenaCostService {
     }
 
     public Rsp<PageVo<String>> listSiteName(ListSiteNameDto dto) {
-        Integer yearMonth = dto.getMap().getStatisticalMonth();
-        if (yearMonth == null) {
-            yearMonth = Integer.valueOf(LocalDate.now().minusDays(40)
-                    .format(DateTimeFormatter.ofPattern("yyyyMM")));
-        }
         if ("全省".equals(dto.getMap().getCity())) {
             dto.getMap().setCity(null);
             dto.getMap().setCounty(null);
         }
         ListHouseSiteBo bo = new ListHouseSiteBo();
-        bo.setYearMonth(yearMonth);
         bo.setAreaNo(dto.getMap().getCity());
         bo.setCityNo(dto.getMap().getCounty());
         bo.setSiteName(dto.getMap().getAlias());
@@ -579,17 +572,11 @@ public class HouseWzHouseMaintenaCostService {
     }
 
     public Rsp<PageVo<String>> listSiteNum(ListSiteNumDto dto) {
-        Integer yearMonth = dto.getMap().getStatisticalMonth();
-        if (yearMonth == null) {
-            yearMonth = Integer.valueOf(LocalDate.now().minusDays(40)
-                    .format(DateTimeFormatter.ofPattern("yyyyMM")));
-        }
         if ("全省".equals(dto.getMap().getCity())) {
             dto.getMap().setCity(null);
             dto.getMap().setCounty(null);
         }
         ListHouseSiteBo bo = new ListHouseSiteBo();
-        bo.setYearMonth(yearMonth);
         bo.setAreaNo(dto.getMap().getCity());
         bo.setCityNo(dto.getMap().getCounty());
         bo.setSiteNum(dto.getMap().getCode());

+ 0 - 14
src/main/java/com/example/service/house/HouseWzLandManageDetailsService.java

@@ -11,8 +11,6 @@ import com.example.pojo.dto.ListSiteNumDto;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
 
-import java.time.LocalDate;
-import java.time.format.DateTimeFormatter;
 import java.util.List;
 
 @Slf4j
@@ -25,17 +23,11 @@ public class HouseWzLandManageDetailsService {
     }
 
     public Rsp<PageVo<String>> listSiteName(ListSiteNameDto dto) {
-        Integer yearMonth = dto.getMap().getStatisticalMonth();
-        if (yearMonth == null) {
-            yearMonth = Integer.valueOf(LocalDate.now().minusDays(40)
-                    .format(DateTimeFormatter.ofPattern("yyyyMM")));
-        }
         if ("全省".equals(dto.getMap().getCity())) {
             dto.getMap().setCity(null);
             dto.getMap().setCounty(null);
         }
         ListHouseSiteBo bo = new ListHouseSiteBo();
-        bo.setYearMonth(yearMonth);
         bo.setAreaNo(dto.getMap().getCity());
         bo.setCityNo(dto.getMap().getCounty());
         bo.setSiteName(dto.getMap().getAlias());
@@ -47,17 +39,11 @@ public class HouseWzLandManageDetailsService {
     }
 
     public Rsp<PageVo<String>> listSiteNum(ListSiteNumDto dto) {
-        Integer yearMonth = dto.getMap().getStatisticalMonth();
-        if (yearMonth == null) {
-            yearMonth = Integer.valueOf(LocalDate.now().minusDays(40)
-                    .format(DateTimeFormatter.ofPattern("yyyyMM")));
-        }
         if ("全省".equals(dto.getMap().getCity())) {
             dto.getMap().setCity(null);
             dto.getMap().setCounty(null);
         }
         ListHouseSiteBo bo = new ListHouseSiteBo();
-        bo.setYearMonth(yearMonth);
         bo.setAreaNo(dto.getMap().getCity());
         bo.setCityNo(dto.getMap().getCounty());
         bo.setSiteNum(dto.getMap().getCode());

+ 0 - 2
src/main/java/com/example/service/house/HouseWzOtnAreaService.java

@@ -46,7 +46,6 @@ public class HouseWzOtnAreaService {
             dto.getMap().setCounty(null);
         }
         ListHouseSiteBo bo = new ListHouseSiteBo();
-        bo.setYearMonth(dto.getMap().getStatisticalMonth());
         bo.setAreaNo(dto.getMap().getCity());
         bo.setCityNo(dto.getMap().getCounty());
         bo.setSiteName(dto.getMap().getAlias());
@@ -63,7 +62,6 @@ public class HouseWzOtnAreaService {
             dto.getMap().setCounty(null);
         }
         ListHouseSiteBo bo = new ListHouseSiteBo();
-        bo.setYearMonth(dto.getMap().getStatisticalMonth());
         bo.setAreaNo(dto.getMap().getCity());
         bo.setCityNo(dto.getMap().getCounty());
         bo.setSiteNum(dto.getMap().getCode());