浏览代码

房产土地接口修改

zhanghao 2 天之前
父节点
当前提交
417ab39042

+ 11 - 32
project-zcustom/src/main/java/com/project/zcustom/domain/addional/LargeHousingLand.java

@@ -31,24 +31,28 @@ public class LargeHousingLand extends CustomBaseEntity {
     private Long id;
 
     /**
-     * 房产名称
+     * 房产数量
      */
-
-
-    private String housing;
+    private Long houseNum;
 
     /**
      * 房产面积
      */
+    private BigDecimal houseAcreage;
 
+    /**
+     * 土地数量
+     */
+    private Long landNum;
 
-    private BigDecimal acreage;
+    /**
+     * 土地面积
+     */
+    private BigDecimal landAcreage;
 
     /**
      * 房产类型
      */
-
-
     private Long type;
 
     /**
@@ -58,29 +62,4 @@ public class LargeHousingLand extends CustomBaseEntity {
 
     @TableField(exist = false)
     private String typeName;
-
-    /**
-     * 施工时间
-     */
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-
-
-    private Date constructionTime;
-
-    /**
-     * 是否拥有所有权(0否;1是)
-     */
-
-
-    private Integer ownershipFlag;
-
-    /**
-     * 是否为投资计划(0否;1是)
-     */
-
-
-    private Integer investmentPlanFlag;
-
-    @TableField(exist = false)
-    private Long num;
 }

+ 1 - 2
project-zcustom/src/main/java/com/project/zcustom/mapper/logistics/PlatHousingLandMapper.java

@@ -2,7 +2,6 @@ package com.project.zcustom.mapper.logistics;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.project.zcustom.domain.addional.LargeHousingLand;
-import org.springframework.web.multipart.MultipartFile;
 
 import java.util.List;
 import java.util.Map;
@@ -10,7 +9,7 @@ import java.util.Map;
 public interface PlatHousingLandMapper extends BaseMapper<LargeHousingLand> {
     List<LargeHousingLand> getStockOfEstateResources(String appOrg);
 
-    Map<String, Object> getStockOfLandResources(String appOrg);
+    List<LargeHousingLand> getStockOfLandResources(String appOrg);
 
     Map<String, Object> getInvestFinishState(String appOrg);
 

+ 46 - 40
project-zcustom/src/main/java/com/project/zcustom/service/logistics/impl/LargeHousingLandServiceImpl.java

@@ -8,7 +8,6 @@ import com.project.common.utils.StringUtils;
 import com.project.zcustom.domain.addional.LargeHousingLand;
 import com.project.zcustom.mapper.logistics.PlatHousingLandMapper;
 import com.project.zcustom.service.logistics.ILargeHousingLandService;
-import com.project.zcustom.service.logistics.ILargePlatAssetService;
 import org.apache.poi.ss.usermodel.*;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -28,12 +27,12 @@ public class LargeHousingLandServiceImpl extends ServiceImpl<PlatHousingLandMapp
 
 
     public Map<String, Object> getStockOfEstateResources(String appOrg){
-        String[] strArr = {"办公用房", "周转用房", "生产管理", "教育培训用房", "交流干部住房", "单身公寓/单身宿舍"};
+        String[] strArr = {"供电所用房", "物资仓储用房", "办公用房", "周转用房"};
         List<LargeHousingLand> arr = new ArrayList<>();
-        for (int i = 0; i < 6; i++){
+        for (int i = 0; i < 4; i++){
             LargeHousingLand land = new LargeHousingLand();
-            land.setNum(0L);
-            land.setAcreage(BigDecimal.valueOf(0));
+            land.setHouseNum(0L);
+            land.setHouseAcreage(BigDecimal.valueOf(0));
             land.setType((long) i);
             land.setTypeName(strArr[i]);
             arr.add(land);
@@ -43,10 +42,10 @@ public class LargeHousingLandServiceImpl extends ServiceImpl<PlatHousingLandMapp
         BigDecimal housingAcreage = new BigDecimal(0);
         Long housingNum = 0L;
         for (LargeHousingLand it : list){
-            housingAcreage = housingAcreage.add(it.getAcreage());
-            housingNum += it.getNum();
-            arr.get(it.getType().intValue()).setAcreage(it.getAcreage());
-            arr.get(it.getType().intValue()).setNum(it.getNum());
+            housingAcreage = housingAcreage.add(it.getHouseAcreage());
+            housingNum += it.getHouseNum();
+            arr.get(it.getType().intValue()).setHouseAcreage(it.getHouseAcreage());
+            arr.get(it.getType().intValue()).setHouseNum(it.getHouseNum());
         }
         map.put("pieChart", arr);
         map.put("housingNum", housingNum);
@@ -55,7 +54,30 @@ public class LargeHousingLandServiceImpl extends ServiceImpl<PlatHousingLandMapp
     }
 
     public Map<String, Object> getStockOfLandResources(String appOrg){
-        return platHousingLandMapper.getStockOfLandResources(appOrg);
+        String[] strArr = {"供电所土地", "物资仓储土地", "办公土地", "周转土地"};
+        List<LargeHousingLand> arr = new ArrayList<>();
+        for (int i = 0; i < 4; i++){
+            LargeHousingLand land = new LargeHousingLand();
+            land.setLandNum(0L);
+            land.setLandAcreage(BigDecimal.valueOf(0));
+            land.setType((long) i);
+            land.setTypeName(strArr[i]);
+            arr.add(land);
+        }
+        List<LargeHousingLand> list = platHousingLandMapper.getStockOfLandResources(appOrg);
+        Map<String, Object> map = new HashMap<>();
+        BigDecimal landAcreage = new BigDecimal(0);
+        Long landNum = 0L;
+        for (LargeHousingLand it : list){
+            landAcreage = landAcreage.add(it.getLandAcreage());
+            landNum += it.getLandNum();
+            arr.get(it.getType().intValue()).setLandAcreage(it.getLandAcreage());
+            arr.get(it.getType().intValue()).setLandNum(it.getLandNum());
+        }
+        map.put("chart", arr);
+        map.put("landNum", landNum);
+        map.put("landAcreage", landAcreage);
+        return map;
     }
 
     public Map<String, Object> getInvestFinishState(String appOrg){
@@ -97,12 +119,10 @@ public class LargeHousingLandServiceImpl extends ServiceImpl<PlatHousingLandMapp
         List<LargeHousingLand> data = new ArrayList<>();
 
         Map<String, Long> mapType = new HashMap<>();
-        mapType.put("办公用房", 0L);
-        mapType.put("周转用房", 1L);
-        mapType.put("生产管理", 2L);
-        mapType.put("教育培训用房", 3L);
-        mapType.put("交流干部住房", 4L);
-        mapType.put("单身公寓/单身宿舍", 5L);
+        mapType.put("供电所", 0L);
+        mapType.put("物资仓储", 1L);
+        mapType.put("办公", 2L);
+        mapType.put("周转", 3L);
 
         // 跳过表头
         if (rowIterator.hasNext()) {
@@ -120,34 +140,32 @@ public class LargeHousingLandServiceImpl extends ServiceImpl<PlatHousingLandMapp
                 switch (i) {
                     case 0:
                         if (cell != null && cell.getCellType() == CellType.STRING) {
-                            a.setHousing(cell.getStringCellValue());
+                            a.setAppOrg(cell.getStringCellValue());
                         }
                         break;
                     case 1:
                         if (cell != null && cell.getCellType() == CellType.NUMERIC) {
-                            a.setAcreage(BigDecimal.valueOf(cell.getNumericCellValue()));
+                            a.setHouseNum((long) cell.getNumericCellValue());
                         }
                         break;
                     case 2:
-                        if (cell != null && cell.getCellType() == CellType.STRING) {
-                            a.setType(mapType.get(cell.getStringCellValue()));
+                        if (cell != null && cell.getCellType() == CellType.NUMERIC) {
+                            a.setHouseAcreage(BigDecimal.valueOf(cell.getNumericCellValue()));
                         }
                         break;
                     case 3:
                         if (cell != null && cell.getCellType() == CellType.NUMERIC) {
-                            a.setOwnershipFlag((int) cell.getNumericCellValue());
+                            a.setLandNum((long) cell.getNumericCellValue());
                         }
                         break;
                     case 4:
                         if (cell != null && cell.getCellType() == CellType.NUMERIC) {
-                            a.setInvestmentPlanFlag((int) cell.getNumericCellValue());
+                            a.setLandAcreage(BigDecimal.valueOf(cell.getNumericCellValue()));
                         }
                         break;
                     case 5:
-                        if (cell != null && cell.getCellType() == CellType.NUMERIC) {
-                            if (DateUtil.isCellDateFormatted(cell)) {
-                                a.setConstructionTime(cell.getDateCellValue());
-                            }
+                        if (cell != null && cell.getCellType() == CellType.STRING) {
+                            a.setType(mapType.get(cell.getStringCellValue()));
                         }
                         break;
                     default:
@@ -167,24 +185,12 @@ public class LargeHousingLandServiceImpl extends ServiceImpl<PlatHousingLandMapp
      */
     private LambdaQueryWrapper<LargeHousingLand> getLambdaQueryWrapper(LargeHousingLand largePlatHousingLand) {
         LambdaQueryWrapper<LargeHousingLand> lqw = new LambdaQueryWrapper<LargeHousingLand>();
-        if (StringUtils.isNotBlank(largePlatHousingLand.getHousing())){
-            lqw.eq(LargeHousingLand::getHousing ,largePlatHousingLand.getHousing());
-        }
-        if (StringUtils.isNotNull(largePlatHousingLand.getAcreage())){
-            lqw.eq(LargeHousingLand::getAcreage ,largePlatHousingLand.getAcreage());
+        if (StringUtils.isNotNull(largePlatHousingLand.getAppOrg())){
+            lqw.eq(LargeHousingLand::getAppOrg ,largePlatHousingLand.getAppOrg());
         }
         if (StringUtils.isNotNull(largePlatHousingLand.getType())){
             lqw.eq(LargeHousingLand::getType ,largePlatHousingLand.getType());
         }
-        if (StringUtils.isNotNull(largePlatHousingLand.getConstructionTime())){
-            lqw.eq(LargeHousingLand::getConstructionTime ,largePlatHousingLand.getConstructionTime());
-        }
-        if (StringUtils.isNotNull(largePlatHousingLand.getOwnershipFlag())){
-            lqw.eq(LargeHousingLand::getOwnershipFlag ,largePlatHousingLand.getOwnershipFlag());
-        }
-        if (StringUtils.isNotNull(largePlatHousingLand.getInvestmentPlanFlag())){
-            lqw.eq(LargeHousingLand::getInvestmentPlanFlag ,largePlatHousingLand.getInvestmentPlanFlag());
-        }
         return lqw;
     }
 }

+ 28 - 23
project-zcustom/src/main/resources/mapper/zcustom/logistics/PlatHousingLandMapper.xml

@@ -5,34 +5,39 @@
 <mapper namespace="com.project.zcustom.mapper.logistics.PlatHousingLandMapper">
     <resultMap type="com.project.zcustom.domain.addional.LargeHousingLand" id="LargeHousingLandResult">
         <result property="id"    column="id"    />
-        <result property="housing"    column="housing"    />
-        <result property="investmentPlanFlag"    column="investment_plan_flag"    />
-        <result property="ownershipFlag"    column="ownership_flag"    />
-        <result property="constructionTime"    column="construction_time"    />
+        <result property="houseNum"    column="house_num"    />
+        <result property="houseAcreage"    column="house_acreage"    />
+        <result property="landNum"    column="land_num"    />
+        <result property="landAcreage"    column="land_acreage"    />
+        <result property="type"    column="type"    />
+        <result property="appOrg"    column="app_org"    />
     </resultMap>
 
+
     <select id="getStockOfEstateResources" parameterType="String" resultMap="LargeHousingLandResult">
         SELECT
-            count( 1 ) AS num,
-            sum( acreage ) AS acreage,
+            sum( house_num ) AS house_num,
+            sum( house_acreage ) AS house_acreage,
             type
         FROM
             large_plat_housing_land
         WHERE del_flag = '0'
         <if test="appOrg != '0000'"> AND app_org = #{appOrg} </if>
         GROUP BY
-            type
+        type
     </select>
 
-    <select id="getStockOfLandResources" parameterType="String" resultType="map">
+    <select id="getStockOfLandResources" parameterType="String" resultMap="LargeHousingLandResult">
         SELECT
-            count( 1 ) AS num,
-            COUNT( CASE WHEN YEAR ( construction_time ) >= YEAR ( CURDATE()) THEN 1 END ) AS new,
-            COUNT( CASE WHEN ownership_flag = 1 THEN 1 END ) AS own
+        sum( land_num ) AS land_num,
+        sum( land_acreage ) AS land_acreage,
+        type
         FROM
-            large_plat_housing_land
+        large_plat_housing_land
         WHERE del_flag = '0'
         <if test="appOrg != '0000'"> AND app_org = #{appOrg} </if>
+        GROUP BY
+        type
     </select>
 
     <select id="getInvestFinishState" parameterType="String" resultType="map">
@@ -46,23 +51,23 @@
     </select>
 
     <insert id="upload" parameterType="com.project.zcustom.domain.addional.LargeHousingLand">
-        insert into large_plat_housing_land (housing,
-                                          acreage,
-                                          type,
-                                          ownership_flag,
-                                          investment_plan_flag,
-                                          construction_time,
+        insert into large_plat_housing_land (house_num,
+                                            house_acreage,
+                                            land_num,
+                                            land_acreage,
+                                            type,
+                                            app_org,
                                           del_flag,
                                           create_time)
         values
         <foreach collection="list" item="item" separator="," close=";">
             <trim prefix="(" suffix=")" suffixOverrides=",">
-                #{item.housing},
-                #{item.acreage},
+                #{item.houseNum},
+                #{item.houseAcreage},
+                #{item.landNum},
+                #{item.landAcreage},
                 #{item.type},
-                #{item.ownershipFlag},
-                #{item.investmentPlanFlag},
-                #{item.constructionTime},
+                #{item.appOrg},
             '0', sysdate()
             </trim>
         </foreach>